From 82a923e06c4dcf13a4690809de4bca2ad024bad3 Mon Sep 17 00:00:00 2001
From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com>
Date: Thu, 10 Oct 2024 22:27:26 -0400
Subject: [PATCH] Add "Grab And Equip" section

Add "Grab And Equip" section for the grabbale and Equipable groups of properties.
---
 .../html/js/entityProperties.js               | 145 +++++++++++++++---
 1 file changed, 121 insertions(+), 24 deletions(-)

diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js
index ab7c7ba54a..0d26df29c4 100644
--- a/scripts/system/create/entityProperties/html/js/entityProperties.js
+++ b/scripts/system/create/entityProperties/html/js/entityProperties.js
@@ -1512,11 +1512,6 @@ const GROUPS = [
         id: "behavior",
         label: "BEHAVIOR",
         properties: [
-            {
-                label: "Grabbable",
-                type: "bool",
-                propertyID: "grab.grabbable",
-            },
             {
                 label: "Cloneable",
                 type: "bool",
@@ -1554,11 +1549,6 @@ const GROUPS = [
                 type: "bool",
                 propertyID: "grab.triggerable",
             },
-            {
-                label: "Follow Controller",
-                type: "bool",
-                propertyID: "grab.grabFollowsController",
-            },
             {
                 label: "Cast Shadows",
                 type: "bool",
@@ -1583,6 +1573,113 @@ const GROUPS = [
             }
         ]
     },
+    {
+        id: "grabAndEquip",
+        label: "GRAB AND EQUIP",
+        properties: [
+            {
+                label: "Grabbable",
+                type: "bool",
+                propertyID: "grab.grabbable",
+            },
+            {
+                label: "Follow Controller",
+                type: "bool",
+                propertyID: "grab.grabFollowsController",
+                showPropertyRule: { "grab.grabbable": "true" },
+            },
+            {
+                label: "Kinematic Grab",
+                type: "bool",
+                propertyID: "grab.grabKinematic",
+                showPropertyRule: { "grab.grabbable": "true" },
+            },
+            {
+                label: "Delegate To Parent",
+                type: "bool",
+                propertyID: "grab.grabDelegateToParent",
+                showPropertyRule: { "grab.grabbable": "true" },
+            },
+            {
+                label: "Equippable",
+                type: "bool",
+                propertyID: "grab.equippable",
+            },
+            {
+                label: "Left Position",
+                type: "vec3",
+                vec3Type: "xyz",
+                subLabels: [ "x", "y", "z" ],
+                step: 0.0025,
+                decimals: 4,
+                unit: "m",
+                propertyID: "grab.equippableLeftPosition",
+                showPropertyRule: { "grab.equippable": "true" },
+            },
+            {
+                label: "Left Rotation",
+                type: "vec3",
+                vec3Type: "pyr",
+                step: 0.1,
+                decimals: 4,
+                subLabels: [ "x", "y", "z" ],
+                unit: "deg",
+                propertyID: "grab.equippableLeftRotation",
+                showPropertyRule: { "grab.equippable": "true" },
+            },
+            {
+                label: "Right Position",
+                type: "vec3",
+                vec3Type: "xyz",
+                subLabels: [ "x", "y", "z" ],
+                step: 0.0025,
+                decimals: 4,
+                unit: "m",
+                propertyID: "grab.equippableRightPosition",
+                showPropertyRule: { "grab.equippable": "true" },
+            },
+            {
+                label: "Right Rotation",
+                type: "vec3",
+                vec3Type: "pyr",
+                step: 0.1,
+                decimals: 4,
+                subLabels: [ "x", "y", "z" ],
+                unit: "deg",
+                propertyID: "grab.equippableRightRotation",
+                showPropertyRule: { "grab.equippable": "true" },
+            },
+            {
+                label: "Indicator Model URL",
+                type: "string",
+                propertyID: "grab.equippableIndicatorURL",
+                placeholder: "URL",
+                showPropertyRule: { "grab.equippable": "true" },
+            },
+            {
+                label: "Indicator Scale",
+                type: "vec3",
+                vec3Type: "xyz",
+                subLabels: [ "x", "y", "z" ],
+                step: 0.0025,
+                decimals: 4,
+                unit: "scale",
+                propertyID: "grab.equippableIndicatorScale",
+                showPropertyRule: { "grab.equippable": "true" },
+            },
+            {
+                label: "Indicator Offset",
+                type: "vec3",
+                vec3Type: "xyz",
+                subLabels: [ "x", "y", "z" ],
+                step: 0.005,
+                decimals: 4,
+                unit: "m",
+                propertyID: "grab.equippableIndicatorOffset",
+                showPropertyRule: { "grab.equippable": "true" },
+            },
+        ]
+    },
     {
         id: "scripts",
         label: "SCRIPTS",
@@ -1761,22 +1858,22 @@ const GROUPS = [
 ];
 
 const GROUPS_PER_TYPE = {
-  None: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  Shape: [ 'base', 'shape', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  Text: [ 'base', 'text', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
+  None: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  Shape: [ 'base', 'shape', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  Text: [ 'base', 'text', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
   Zone: [ 'base', 'zone', 'zone_key_light', 'zone_skybox', 'zone_ambient_light', 'zone_haze', 
-            'zone_bloom', 'zone_avatar_priority', 'spatial', 'behavior', 'scripts', 'physics' ],
-  Model: [ 'base', 'model', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  Image: [ 'base', 'image', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  Web: [ 'base', 'web', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  Light: [ 'base', 'light', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  Material: [ 'base', 'material', 'spatial', 'behavior', 'scripts', 'physics' ],
+            'zone_bloom', 'zone_avatar_priority', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
+  Model: [ 'base', 'model', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  Image: [ 'base', 'image', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  Web: [ 'base', 'web', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  Light: [ 'base', 'light', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  Material: [ 'base', 'material', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
   ParticleEffect: [ 'base', 'particles', 'particles_emit', 'particles_size', 'particles_color', 
-                    'particles_behavior', 'particles_constraints', 'spatial', 'behavior', 'scripts', 'physics' ],
-  PolyLine: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  PolyVox: [ 'base', 'polyvox', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
-  Grid: [ 'base', 'grid', 'spatial', 'behavior', 'scripts', 'physics' ],
-  Multiple: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ],
+                    'particles_behavior', 'particles_constraints', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
+  PolyLine: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  PolyVox: [ 'base', 'polyvox', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
+  Grid: [ 'base', 'grid', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'physics' ],
+  Multiple: [ 'base', 'spatial', 'behavior', 'grabAndEquip', 'scripts', 'collision', 'physics' ],
 };
 
 const EDITOR_TIMEOUT_DURATION = 1500;