Przeglądaj źródła

Merge pull request #1378 from sgrenier/next

Variables support for Properties files
Steve Grenier 12 lat temu
rodzic
commit
7cecca999f

+ 10 - 7
gameplay/src/Bundle.cpp

@@ -1007,14 +1007,17 @@ Model* Bundle::readModel(const char* nodeId)
                 {
                 {
                     std::string materialName = readString(_stream);
                     std::string materialName = readString(_stream);
                     std::string materialPath = getMaterialPath();
                     std::string materialPath = getMaterialPath();
-                    materialPath.append("#");
-                    materialPath.append(materialName);
-                    Material* material = Material::create(materialPath.c_str());
-                    if (material)
+                    if (materialPath.length() > 0)
                     {
                     {
-                        int partIndex = model->getMesh()->getPartCount() > 0 ? i : -1;
-                        model->setMaterial(material, partIndex);
-                        SAFE_RELEASE(material);
+                        materialPath.append("#");
+                        materialPath.append(materialName);
+                        Material* material = Material::create(materialPath.c_str());
+                        if (material)
+                        {
+                            int partIndex = model->getMesh()->getPartCount() > 0 ? i : -1;
+                            model->setMaterial(material, partIndex);
+                            SAFE_RELEASE(material);
+                        }
                     }
                     }
                 }
                 }
             }
             }

+ 1 - 1
gameplay/src/Material.cpp

@@ -36,7 +36,7 @@ Material* Material::create(const char* url, PassCallback callback, void* cookie)
     Properties* properties = Properties::create(url);
     Properties* properties = Properties::create(url);
     if (properties == NULL)
     if (properties == NULL)
     {
     {
-        GP_WARN("Failed to create material from file.");
+        GP_WARN("Failed to create material from file: %s", url);
         return NULL;
         return NULL;
     }
     }
 
 

+ 114 - 15
gameplay/src/Properties.cpp

@@ -26,12 +26,12 @@ void calculateNamespacePath(const std::string& urlString, std::string& fileStrin
 Properties* getPropertiesFromNamespacePath(Properties* properties, const std::vector<std::string>& namespacePath);
 Properties* getPropertiesFromNamespacePath(Properties* properties, const std::vector<std::string>& namespacePath);
 
 
 Properties::Properties()
 Properties::Properties()
-    : _dirPath(NULL), _parent(NULL)
+    : _variables(NULL), _dirPath(NULL), _parent(NULL)
 {
 {
 }
 }
 
 
 Properties::Properties(const Properties& copy)
 Properties::Properties(const Properties& copy)
-    : _namespace(copy._namespace), _id(copy._id), _parentID(copy._parentID), _properties(copy._properties), _dirPath(NULL), _parent(copy._parent)
+    : _namespace(copy._namespace), _id(copy._id), _parentID(copy._parentID), _properties(copy._properties), _variables(NULL), _dirPath(NULL), _parent(copy._parent)
 {
 {
     setDirectoryPath(copy._dirPath);
     setDirectoryPath(copy._dirPath);
     _namespaces = std::vector<Properties*>();
     _namespaces = std::vector<Properties*>();
@@ -45,14 +45,14 @@ Properties::Properties(const Properties& copy)
 }
 }
 
 
 Properties::Properties(Stream* stream)
 Properties::Properties(Stream* stream)
-    : _dirPath(NULL), _parent(NULL)
+    : _variables(NULL), _dirPath(NULL), _parent(NULL)
 {
 {
     readProperties(stream);
     readProperties(stream);
     rewind();
     rewind();
 }
 }
 
 
 Properties::Properties(Stream* stream, const char* name, const char* id, const char* parentID, Properties* parent)
 Properties::Properties(Stream* stream, const char* name, const char* id, const char* parentID, Properties* parent)
-    : _namespace(name), _dirPath(NULL), _parent(parent)
+    : _namespace(name), _variables(NULL), _dirPath(NULL), _parent(parent)
 {
 {
     if (id)
     if (id)
     {
     {
@@ -112,11 +112,28 @@ Properties* Properties::create(const char* url)
     return p;
     return p;
 }
 }
 
 
+static bool isVariable(const char* str, char* outName, size_t outSize)
+{
+    size_t len = strlen(str);
+    if (len > 3 && str[0] == '$' && str[1] == '{' && str[len - 1] == '}')
+    {
+        size_t size = len - 3;
+        if (size > (outSize - 1))
+            size = outSize - 1;
+        strncpy(outName, str + 2, len - 3);
+        outName[len - 3] = 0;
+        return true;
+    }
+
+    return false;
+}
+
 void Properties::readProperties(Stream* stream)
 void Properties::readProperties(Stream* stream)
 {
 {
     GP_ASSERT(stream);
     GP_ASSERT(stream);
 
 
     char line[2048];
     char line[2048];
+    char variable[256];
     int c;
     int c;
     char* name;
     char* name;
     char* value;
     char* value;
@@ -169,9 +186,6 @@ void Properties::readProperties(Stream* stream)
             rc = strchr(line, '=');
             rc = strchr(line, '=');
             if (rc != NULL)
             if (rc != NULL)
             {
             {
-                // There could be a '}' at the end of the line, ending a namespace.
-                rc = strchr(line, '}');
-
                 // First token should be the property name.
                 // First token should be the property name.
                 name = strtok(line, "=");
                 name = strtok(line, "=");
                 if (name == NULL)
                 if (name == NULL)
@@ -194,13 +208,15 @@ void Properties::readProperties(Stream* stream)
                 // Remove white-space from value.
                 // Remove white-space from value.
                 value = trimWhiteSpace(value);
                 value = trimWhiteSpace(value);
 
 
-                // Store name/value pair.
-                _properties.push_back(Property(name, value));
-
-                if (rc != NULL)
+                // Is this a variable assignment?
+                if (isVariable(name, variable, 256))
                 {
                 {
-                    // End of namespace.
-                    return;
+                    setVariable(variable, value);
+                }
+                else
+                {
+                    // Normal name/value pair
+                    _properties.push_back(Property(name, value));
                 }
                 }
             }
             }
             else
             else
@@ -369,6 +385,8 @@ Properties::~Properties()
     {
     {
         SAFE_DELETE(_namespaces[i]);
         SAFE_DELETE(_namespaces[i]);
     }
     }
+
+    SAFE_DELETE(_variables);
 }
 }
 
 
 void Properties::skipWhiteSpace(Stream* stream)
 void Properties::skipWhiteSpace(Stream* stream)
@@ -695,22 +713,44 @@ Properties::Type Properties::getType(const char* name) const
 
 
 const char* Properties::getString(const char* name, const char* defaultValue) const
 const char* Properties::getString(const char* name, const char* defaultValue) const
 {
 {
+    char variable[256];
+    const char* value = NULL;
+
     if (name)
     if (name)
     {
     {
+        // If 'name' is a variable, return the variable value
+        if (isVariable(name, variable, 256))
+        {
+            return getVariable(variable, defaultValue);
+        }
+
         for (std::list<Property>::const_iterator itr = _properties.begin(); itr != _properties.end(); ++itr)
         for (std::list<Property>::const_iterator itr = _properties.begin(); itr != _properties.end(); ++itr)
         {
         {
             if (itr->name == name)
             if (itr->name == name)
-                return itr->value.c_str();
+            {
+                value = itr->value.c_str();
+                break;
+            }
         }
         }
     }
     }
     else
     else
     {
     {
+        // No name provided - get the value at the current iterator position
         if (_propertiesItr != _properties.end())
         if (_propertiesItr != _properties.end())
         {
         {
-            return _propertiesItr->value.c_str();
+            value = _propertiesItr->value.c_str();
         }
         }
     }
     }
 
 
+    if (value)
+    {
+        // If the value references a variable, return the variable value
+        if (isVariable(value, variable, 256))
+            return getVariable(variable, defaultValue);
+
+        return value;
+    }
+
     return defaultValue;
     return defaultValue;
 }
 }
 
 
@@ -904,6 +944,65 @@ bool Properties::getPath(const char* name, std::string* path) const
     return false;
     return false;
 }
 }
 
 
+const char* Properties::getVariable(const char* name, const char* defaultValue) const
+{
+    if (name == NULL)
+        return defaultValue;
+
+    // Search for variable in this Properties object
+    if (_variables)
+    {
+        for (size_t i = 0, count = _variables->size(); i < count; ++i)
+        {
+            Property& prop = (*_variables)[i];
+            if (prop.name == name)
+                return prop.value.c_str();
+        }
+    }
+
+    // Search for variable in parent Properties
+    return _parent ? _parent->getVariable(name, defaultValue) : defaultValue;
+}
+
+void Properties::setVariable(const char* name, const char* value)
+{
+    GP_ASSERT(name);
+
+    Property* prop = NULL;
+
+    // Search for variable in this Properties object and parents
+    Properties* current = const_cast<Properties*>(this);
+    while (current)
+    {
+        if (current->_variables)
+        {
+            for (size_t i = 0, count = current->_variables->size(); i < count; ++i)
+            {
+                Property* p = &(*current->_variables)[i];
+                if (p->name == name)
+                {
+                    prop = p;
+                    break;
+                }
+            }
+        }
+        current = current->_parent;
+    }
+
+    if (prop)
+    {
+        // Found an existing property, set it
+        prop->value = value ? value : "";
+    }
+    else
+    {
+        // Add a new variable with this name
+        if (!_variables)
+            _variables = new std::vector<Property>();
+        _variables->push_back(Property(name, value ? value : ""));
+    }
+}
+
 Properties* Properties::clone()
 Properties* Properties::clone()
 {
 {
     Properties* p = new Properties();
     Properties* p = new Properties();

+ 21 - 0
gameplay/src/Properties.h

@@ -414,6 +414,26 @@ public:
      */
      */
     bool getPath(const char* name, std::string* path) const;
     bool getPath(const char* name, std::string* path) const;
 
 
+    /**
+     * Returns the value of a variable that is set in this Properties object.
+     *
+     * Variables take on the format ${name} and are inherited from parent Property objects.
+     *
+     * @param name Name of the variable to get.
+     * @param defaultValue Value to return if the variable is not found.
+     *
+     * @return The value of the specified variable, or defaultValue if not found.
+     */
+    const char* getVariable(const char* name, const char* defaultValue = NULL) const;
+
+    /**
+     * Sets the value of the specified variable.
+     *
+     * @param name Name of the variable to set.
+     * @param value The value to set.
+     */
+    void setVariable(const char* name, const char* value);
+
     /**
     /**
      * Attempts to parse the specified string as a Vector2 value.
      * Attempts to parse the specified string as a Vector2 value.
      *
      *
@@ -541,6 +561,7 @@ private:
     std::list<Property>::iterator _propertiesItr;
     std::list<Property>::iterator _propertiesItr;
     std::vector<Properties*> _namespaces;
     std::vector<Properties*> _namespaces;
     std::vector<Properties*>::const_iterator _namespacesItr;
     std::vector<Properties*>::const_iterator _namespacesItr;
+    std::vector<Property>* _variables;
     std::string* _dirPath;
     std::string* _dirPath;
     Properties* _parent;
     Properties* _parent;
 };
 };

+ 449 - 0
gameplay/src/lua/lua_Properties.cpp

@@ -24,18 +24,27 @@ void luaRegister_Properties()
         {"getMatrix", lua_Properties_getMatrix},
         {"getMatrix", lua_Properties_getMatrix},
         {"getNamespace", lua_Properties_getNamespace},
         {"getNamespace", lua_Properties_getNamespace},
         {"getNextNamespace", lua_Properties_getNextNamespace},
         {"getNextNamespace", lua_Properties_getNextNamespace},
+        {"getNextProperty", lua_Properties_getNextProperty},
         {"getQuaternionFromAxisAngle", lua_Properties_getQuaternionFromAxisAngle},
         {"getQuaternionFromAxisAngle", lua_Properties_getQuaternionFromAxisAngle},
         {"getString", lua_Properties_getString},
         {"getString", lua_Properties_getString},
         {"getType", lua_Properties_getType},
         {"getType", lua_Properties_getType},
+        {"getVariable", lua_Properties_getVariable},
         {"getVector2", lua_Properties_getVector2},
         {"getVector2", lua_Properties_getVector2},
         {"getVector3", lua_Properties_getVector3},
         {"getVector3", lua_Properties_getVector3},
         {"getVector4", lua_Properties_getVector4},
         {"getVector4", lua_Properties_getVector4},
         {"rewind", lua_Properties_rewind},
         {"rewind", lua_Properties_rewind},
+        {"setString", lua_Properties_setString},
+        {"setVariable", lua_Properties_setVariable},
         {NULL, NULL}
         {NULL, NULL}
     };
     };
     const luaL_Reg lua_statics[] = 
     const luaL_Reg lua_statics[] = 
     {
     {
         {"create", lua_Properties_static_create},
         {"create", lua_Properties_static_create},
+        {"parseAxisAngle", lua_Properties_static_parseAxisAngle},
+        {"parseColor", lua_Properties_static_parseColor},
+        {"parseVector2", lua_Properties_static_parseVector2},
+        {"parseVector3", lua_Properties_static_parseVector3},
+        {"parseVector4", lua_Properties_static_parseVector4},
         {NULL, NULL}
         {NULL, NULL}
     };
     };
     std::vector<std::string> scopePath;
     std::vector<std::string> scopePath;
@@ -727,6 +736,41 @@ int lua_Properties_getNextNamespace(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
+int lua_Properties_getNextProperty(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 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Properties* instance = getInstance(state);
+                const char* result = instance->getNextProperty();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_getNextProperty - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Properties_getQuaternionFromAxisAngle(lua_State* state)
 int lua_Properties_getQuaternionFromAxisAngle(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
@@ -913,6 +957,70 @@ int lua_Properties_getType(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
+int lua_Properties_getVariable(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_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Properties* instance = getInstance(state);
+                const char* result = instance->getVariable(param1);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_getVariable - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        case 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = gameplay::ScriptUtil::getString(3, false);
+
+                Properties* instance = getInstance(state);
+                const char* result = instance->getVariable(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_getVariable - 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 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Properties_getVector2(lua_State* state)
 int lua_Properties_getVector2(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
@@ -1092,6 +1200,89 @@ int lua_Properties_rewind(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
+int lua_Properties_setString(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 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = gameplay::ScriptUtil::getString(3, false);
+
+                Properties* instance = getInstance(state);
+                bool result = instance->setString(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_setString - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Properties_setVariable(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 3:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = gameplay::ScriptUtil::getString(3, false);
+
+                Properties* instance = getInstance(state);
+                instance->setVariable(param1, param2);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Properties_setVariable - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Properties_static_create(lua_State* state)
 int lua_Properties_static_create(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
@@ -1138,4 +1329,262 @@ int lua_Properties_static_create(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
+int lua_Properties_static_parseAxisAngle(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_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(1, false);
+
+                // Get parameter 2 off the stack.
+                bool param2Valid;
+                gameplay::ScriptUtil::LuaArray<Quaternion> param2 = gameplay::ScriptUtil::getObjectPointer<Quaternion>(2, "Quaternion", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Quaternion'.");
+                    lua_error(state);
+                }
+
+                bool result = Properties::parseAxisAngle(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_static_parseAxisAngle - 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_Properties_static_parseColor(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:
+        {
+            do
+            {
+                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    const char* param1 = gameplay::ScriptUtil::getString(1, false);
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    bool result = Properties::parseColor(param1, param2);
+
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
+
+                    return 1;
+                }
+            } while (0);
+
+            do
+            {
+                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    const char* param1 = gameplay::ScriptUtil::getString(1, false);
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    bool result = Properties::parseColor(param1, param2);
+
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
+
+                    return 1;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Properties_static_parseColor - 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_Properties_static_parseVector2(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_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(1, false);
+
+                // Get parameter 2 off the stack.
+                bool param2Valid;
+                gameplay::ScriptUtil::LuaArray<Vector2> param2 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector2'.");
+                    lua_error(state);
+                }
+
+                bool result = Properties::parseVector2(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_static_parseVector2 - 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_Properties_static_parseVector3(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_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(1, false);
+
+                // Get parameter 2 off the stack.
+                bool param2Valid;
+                gameplay::ScriptUtil::LuaArray<Vector3> param2 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
+                    lua_error(state);
+                }
+
+                bool result = Properties::parseVector3(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_static_parseVector3 - 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_Properties_static_parseVector4(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_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(1, false);
+
+                // Get parameter 2 off the stack.
+                bool param2Valid;
+                gameplay::ScriptUtil::LuaArray<Vector4> param2 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector4'.");
+                    lua_error(state);
+                }
+
+                bool result = Properties::parseVector4(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Properties_static_parseVector4 - 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;
+}
+
 }
 }

+ 9 - 0
gameplay/src/lua/lua_Properties.h

@@ -16,14 +16,23 @@ int lua_Properties_getLong(lua_State* state);
 int lua_Properties_getMatrix(lua_State* state);
 int lua_Properties_getMatrix(lua_State* state);
 int lua_Properties_getNamespace(lua_State* state);
 int lua_Properties_getNamespace(lua_State* state);
 int lua_Properties_getNextNamespace(lua_State* state);
 int lua_Properties_getNextNamespace(lua_State* state);
+int lua_Properties_getNextProperty(lua_State* state);
 int lua_Properties_getQuaternionFromAxisAngle(lua_State* state);
 int lua_Properties_getQuaternionFromAxisAngle(lua_State* state);
 int lua_Properties_getString(lua_State* state);
 int lua_Properties_getString(lua_State* state);
 int lua_Properties_getType(lua_State* state);
 int lua_Properties_getType(lua_State* state);
+int lua_Properties_getVariable(lua_State* state);
 int lua_Properties_getVector2(lua_State* state);
 int lua_Properties_getVector2(lua_State* state);
 int lua_Properties_getVector3(lua_State* state);
 int lua_Properties_getVector3(lua_State* state);
 int lua_Properties_getVector4(lua_State* state);
 int lua_Properties_getVector4(lua_State* state);
 int lua_Properties_rewind(lua_State* state);
 int lua_Properties_rewind(lua_State* state);
+int lua_Properties_setString(lua_State* state);
+int lua_Properties_setVariable(lua_State* state);
 int lua_Properties_static_create(lua_State* state);
 int lua_Properties_static_create(lua_State* state);
+int lua_Properties_static_parseAxisAngle(lua_State* state);
+int lua_Properties_static_parseColor(lua_State* state);
+int lua_Properties_static_parseVector2(lua_State* state);
+int lua_Properties_static_parseVector3(lua_State* state);
+int lua_Properties_static_parseVector4(lua_State* state);
 
 
 void luaRegister_Properties();
 void luaRegister_Properties();