Jelajahi Sumber

Changing Node active to enabled for consistency

setaylor 11 tahun lalu
induk
melakukan
c178bbc78d

+ 10 - 10
gameplay/src/Node.cpp

@@ -20,7 +20,7 @@ namespace gameplay
 {
 
 Node::Node(const char* id)
-    : _scene(NULL), _firstChild(NULL), _nextSibling(NULL), _prevSibling(NULL), _parent(NULL), _childCount(0), _active(true),
+    : _scene(NULL), _firstChild(NULL), _nextSibling(NULL), _prevSibling(NULL), _parent(NULL), _childCount(0), _enabled(true),
     _tags(NULL), _camera(NULL), _light(NULL), _model(NULL), _terrain(NULL), _form(NULL), _audioSource(NULL), _particleEmitter(NULL),
     _collisionObject(NULL), _agent(NULL), _dirtyBits(NODE_DIRTY_ALL), _notifyHierarchyChanged(true), _userData(NULL)
 {
@@ -292,30 +292,30 @@ void Node::setUserPointer(void* pointer, void (*cleanupCallback)(void*))
     }
 }
 
-void Node::setActive(bool active)
+void Node::setEnabled(bool enabled)
 {
-    if (_active != active)
+    if (_enabled != enabled)
     {
         if (_collisionObject)
-            _collisionObject->setEnabled(active);
+            _collisionObject->setEnabled(enabled);
 
-        _active = active;
+        _enabled = enabled;
     }
 }
 
-bool Node::isActive() const
+bool Node::isEnabled() const
 {
-    return _active;
+    return _enabled;
 }
 
-bool Node::isActiveInHierarchy() const
+bool Node::isEnabledInHierarchy() const
 {
-    if (!_active)
+    if (!_enabled)
        return false;
    Node* node = _parent;
    while (node)
    {
-       if (!node->_active)
+       if (!node->_enabled)
            return false;
        node = node->_parent;
    }

+ 11 - 11
gameplay/src/Node.h

@@ -187,25 +187,25 @@ public:
     void setUserPointer(void* pointer, void (*cleanupCallback)(void*) = NULL);
 
     /**
-     * Sets if the node is active in the scene.
+     * Sets if the node is enabled in the scene.
      *
-     * @param active if the node is active in the scene.
+     * @param enabled if the node is enabled in the scene.
      */
-    void setActive(bool active);
+    void setEnabled(bool enabled);
 
     /**
-     * Gets if the node is active in the scene.
+     * Gets if the node is enabled in the scene.
      *
-     * @return if the node is active in the scene.
+     * @return if the node is enabled in the scene.
      */
-    bool isActive() const;
+    bool isEnabled() const;
 
     /**
-     * Gets if the node  either inherited active.
+     * Gets if the node either inherently enabled.
      *
-     * @return if visual components attached on this node should be drawn.
+     * @return if components attached on this node should be running.
      */
-    bool isActiveInHierarchy() const;
+    bool isEnabledInHierarchy() const;
 
     /**
      * Returns the number of direct children of this item.
@@ -771,9 +771,9 @@ protected:
     unsigned int _childCount;
 
     /**
-     * If this node is active in the scrne. This may not be active in hierarchy if its parents are not active.
+     * If this node is enabled in the scene. This may not be enabled in hierarchy if its parents are not enabled.
      */
-    bool _active;
+    bool _enabled;
 
     /**
      * List of custom tags for a node.

+ 1 - 1
gameplay/src/Scene.cpp

@@ -434,7 +434,7 @@ Node* Scene::findNextVisibleSibling(Node* node)
 
 bool Scene::isNodeVisible(Node* node)
 {
-    if (!node->isActive())
+    if (!node->isEnabled())
         return false;
 
     if (node->getForm() || node->getParticleEmitter() || node->getTerrain() || node->getLight() || node->getCamera())

+ 45 - 45
gameplay/src/lua/lua_Joint.cpp

@@ -101,8 +101,8 @@ void luaRegister_Joint()
         {"getWorldViewMatrix", lua_Joint_getWorldViewMatrix},
         {"getWorldViewProjectionMatrix", lua_Joint_getWorldViewProjectionMatrix},
         {"hasTag", lua_Joint_hasTag},
-        {"isActive", lua_Joint_isActive},
-        {"isActiveInHierarchy", lua_Joint_isActiveInHierarchy},
+        {"isEnabled", lua_Joint_isEnabled},
+        {"isEnabledInHierarchy", lua_Joint_isEnabledInHierarchy},
         {"isStatic", lua_Joint_isStatic},
         {"release", lua_Joint_release},
         {"removeAllChildren", lua_Joint_removeAllChildren},
@@ -118,12 +118,12 @@ void luaRegister_Joint()
         {"scaleY", lua_Joint_scaleY},
         {"scaleZ", lua_Joint_scaleZ},
         {"set", lua_Joint_set},
-        {"setActive", lua_Joint_setActive},
         {"setAgent", lua_Joint_setAgent},
         {"setAnimationPropertyValue", lua_Joint_setAnimationPropertyValue},
         {"setAudioSource", lua_Joint_setAudioSource},
         {"setCamera", lua_Joint_setCamera},
         {"setCollisionObject", lua_Joint_setCollisionObject},
+        {"setEnabled", lua_Joint_setEnabled},
         {"setForm", lua_Joint_setForm},
         {"setId", lua_Joint_setId},
         {"setIdentity", lua_Joint_setIdentity},
@@ -3810,7 +3810,7 @@ int lua_Joint_hasTag(lua_State* state)
     return 0;
 }
 
-int lua_Joint_isActive(lua_State* state)
+int lua_Joint_isEnabled(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -3823,7 +3823,7 @@ int lua_Joint_isActive(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 Joint* instance = getInstance(state);
-                bool result = instance->isActive();
+                bool result = instance->isEnabled();
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3831,7 +3831,7 @@ int lua_Joint_isActive(lua_State* state)
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Joint_isActive - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Joint_isEnabled - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -3845,7 +3845,7 @@ int lua_Joint_isActive(lua_State* state)
     return 0;
 }
 
-int lua_Joint_isActiveInHierarchy(lua_State* state)
+int lua_Joint_isEnabledInHierarchy(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -3858,7 +3858,7 @@ int lua_Joint_isActiveInHierarchy(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 Joint* instance = getInstance(state);
-                bool result = instance->isActiveInHierarchy();
+                bool result = instance->isEnabledInHierarchy();
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3866,7 +3866,7 @@ int lua_Joint_isActiveInHierarchy(lua_State* state)
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Joint_isActiveInHierarchy - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Joint_isEnabledInHierarchy - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -4680,42 +4680,6 @@ int lua_Joint_set(lua_State* state)
     return 0;
 }
 
-int lua_Joint_setActive(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                Joint* instance = getInstance(state);
-                instance->setActive(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Joint_setActive - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Joint_setAgent(lua_State* state)
 {
     // Get the number of parameters.
@@ -5221,6 +5185,42 @@ int lua_Joint_setCollisionObject(lua_State* state)
     return 0;
 }
 
+int lua_Joint_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
+
+                Joint* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Joint_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joint_setForm(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 3
gameplay/src/lua/lua_Joint.h

@@ -76,8 +76,8 @@ int lua_Joint_getWorldMatrix(lua_State* state);
 int lua_Joint_getWorldViewMatrix(lua_State* state);
 int lua_Joint_getWorldViewProjectionMatrix(lua_State* state);
 int lua_Joint_hasTag(lua_State* state);
-int lua_Joint_isActive(lua_State* state);
-int lua_Joint_isActiveInHierarchy(lua_State* state);
+int lua_Joint_isEnabled(lua_State* state);
+int lua_Joint_isEnabledInHierarchy(lua_State* state);
 int lua_Joint_isStatic(lua_State* state);
 int lua_Joint_release(lua_State* state);
 int lua_Joint_removeAllChildren(lua_State* state);
@@ -93,12 +93,12 @@ int lua_Joint_scaleX(lua_State* state);
 int lua_Joint_scaleY(lua_State* state);
 int lua_Joint_scaleZ(lua_State* state);
 int lua_Joint_set(lua_State* state);
-int lua_Joint_setActive(lua_State* state);
 int lua_Joint_setAgent(lua_State* state);
 int lua_Joint_setAnimationPropertyValue(lua_State* state);
 int lua_Joint_setAudioSource(lua_State* state);
 int lua_Joint_setCamera(lua_State* state);
 int lua_Joint_setCollisionObject(lua_State* state);
+int lua_Joint_setEnabled(lua_State* state);
 int lua_Joint_setForm(lua_State* state);
 int lua_Joint_setId(lua_State* state);
 int lua_Joint_setIdentity(lua_State* state);

+ 45 - 45
gameplay/src/lua/lua_Node.cpp

@@ -99,8 +99,8 @@ void luaRegister_Node()
         {"getWorldViewMatrix", lua_Node_getWorldViewMatrix},
         {"getWorldViewProjectionMatrix", lua_Node_getWorldViewProjectionMatrix},
         {"hasTag", lua_Node_hasTag},
-        {"isActive", lua_Node_isActive},
-        {"isActiveInHierarchy", lua_Node_isActiveInHierarchy},
+        {"isEnabled", lua_Node_isEnabled},
+        {"isEnabledInHierarchy", lua_Node_isEnabledInHierarchy},
         {"isStatic", lua_Node_isStatic},
         {"release", lua_Node_release},
         {"removeAllChildren", lua_Node_removeAllChildren},
@@ -116,12 +116,12 @@ void luaRegister_Node()
         {"scaleY", lua_Node_scaleY},
         {"scaleZ", lua_Node_scaleZ},
         {"set", lua_Node_set},
-        {"setActive", lua_Node_setActive},
         {"setAgent", lua_Node_setAgent},
         {"setAnimationPropertyValue", lua_Node_setAnimationPropertyValue},
         {"setAudioSource", lua_Node_setAudioSource},
         {"setCamera", lua_Node_setCamera},
         {"setCollisionObject", lua_Node_setCollisionObject},
+        {"setEnabled", lua_Node_setEnabled},
         {"setForm", lua_Node_setForm},
         {"setId", lua_Node_setId},
         {"setIdentity", lua_Node_setIdentity},
@@ -3765,7 +3765,7 @@ int lua_Node_hasTag(lua_State* state)
     return 0;
 }
 
-int lua_Node_isActive(lua_State* state)
+int lua_Node_isEnabled(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -3778,7 +3778,7 @@ int lua_Node_isActive(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 Node* instance = getInstance(state);
-                bool result = instance->isActive();
+                bool result = instance->isEnabled();
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3786,7 +3786,7 @@ int lua_Node_isActive(lua_State* state)
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Node_isActive - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Node_isEnabled - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -3800,7 +3800,7 @@ int lua_Node_isActive(lua_State* state)
     return 0;
 }
 
-int lua_Node_isActiveInHierarchy(lua_State* state)
+int lua_Node_isEnabledInHierarchy(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -3813,7 +3813,7 @@ int lua_Node_isActiveInHierarchy(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 Node* instance = getInstance(state);
-                bool result = instance->isActiveInHierarchy();
+                bool result = instance->isEnabledInHierarchy();
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3821,7 +3821,7 @@ int lua_Node_isActiveInHierarchy(lua_State* state)
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Node_isActiveInHierarchy - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Node_isEnabledInHierarchy - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -4635,42 +4635,6 @@ int lua_Node_set(lua_State* state)
     return 0;
 }
 
-int lua_Node_setActive(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                Node* instance = getInstance(state);
-                instance->setActive(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Node_setActive - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Node_setAgent(lua_State* state)
 {
     // Get the number of parameters.
@@ -5176,6 +5140,42 @@ int lua_Node_setCollisionObject(lua_State* state)
     return 0;
 }
 
+int lua_Node_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
+
+                Node* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Node_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Node_setForm(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 3
gameplay/src/lua/lua_Node.h

@@ -75,8 +75,8 @@ int lua_Node_getWorldMatrix(lua_State* state);
 int lua_Node_getWorldViewMatrix(lua_State* state);
 int lua_Node_getWorldViewProjectionMatrix(lua_State* state);
 int lua_Node_hasTag(lua_State* state);
-int lua_Node_isActive(lua_State* state);
-int lua_Node_isActiveInHierarchy(lua_State* state);
+int lua_Node_isEnabled(lua_State* state);
+int lua_Node_isEnabledInHierarchy(lua_State* state);
 int lua_Node_isStatic(lua_State* state);
 int lua_Node_release(lua_State* state);
 int lua_Node_removeAllChildren(lua_State* state);
@@ -92,12 +92,12 @@ int lua_Node_scaleX(lua_State* state);
 int lua_Node_scaleY(lua_State* state);
 int lua_Node_scaleZ(lua_State* state);
 int lua_Node_set(lua_State* state);
-int lua_Node_setActive(lua_State* state);
 int lua_Node_setAgent(lua_State* state);
 int lua_Node_setAnimationPropertyValue(lua_State* state);
 int lua_Node_setAudioSource(lua_State* state);
 int lua_Node_setCamera(lua_State* state);
 int lua_Node_setCollisionObject(lua_State* state);
+int lua_Node_setEnabled(lua_State* state);
 int lua_Node_setForm(lua_State* state);
 int lua_Node_setId(lua_State* state);
 int lua_Node_setIdentity(lua_State* state);