|
@@ -55,7 +55,7 @@ int lua_MaterialParameter__gc(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 1:
|
|
case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
void* userdata = luaL_checkudata(state, 1, "MaterialParameter");
|
|
void* userdata = luaL_checkudata(state, 1, "MaterialParameter");
|
|
|
luaL_argcheck(state, userdata != NULL, 1, "'MaterialParameter' expected.");
|
|
luaL_argcheck(state, userdata != NULL, 1, "'MaterialParameter' expected.");
|
|
@@ -95,7 +95,7 @@ int lua_MaterialParameter_addRef(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 1:
|
|
case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->addRef();
|
|
instance->addRef();
|
|
@@ -129,47 +129,57 @@ int lua_MaterialParameter_createAnimation(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 3:
|
|
case 3:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING &&
|
|
|
|
|
- lua_type(state, 3) == LUA_TSTRING)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (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.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
- const char* param2 = luaL_checkstring(state, 3);
|
|
|
|
|
|
|
+ const char* param2 = ScriptController::getInstance()->getString(3, false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->createAnimation(param1, param2);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->createAnimation(param1, param2);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING &&
|
|
|
|
|
- lua_type(state, 3) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
- void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Properties");
|
|
|
|
|
- if (!userdata3)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Properties' for parameter 3.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Properties* param2 = (Properties*)((ScriptController::LuaObject*)userdata3)->instance;
|
|
|
|
|
|
|
+ Properties* param2 = ScriptController::getInstance()->getObjectPointer<Properties>(3, "Properties", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->createAnimation(param1, param2);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->createAnimation(param1, param2);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -182,16 +192,16 @@ int lua_MaterialParameter_createAnimation(lua_State* state)
|
|
|
}
|
|
}
|
|
|
case 7:
|
|
case 7:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
lua_type(state, 4) == LUA_TNUMBER &&
|
|
lua_type(state, 4) == LUA_TNUMBER &&
|
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
|
(lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
|
|
|
- lua_type(state, 7) == LUA_TSTRING)
|
|
|
|
|
|
|
+ (lua_type(state, 7) == LUA_TSTRING || lua_type(state, 7) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
@@ -209,11 +219,19 @@ int lua_MaterialParameter_createAnimation(lua_State* state)
|
|
|
Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
|
|
Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -226,18 +244,18 @@ int lua_MaterialParameter_createAnimation(lua_State* state)
|
|
|
}
|
|
}
|
|
|
case 9:
|
|
case 9:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
lua_type(state, 4) == LUA_TNUMBER &&
|
|
lua_type(state, 4) == LUA_TNUMBER &&
|
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
|
(lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
|
|
|
(lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
|
|
|
(lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
|
|
|
- lua_type(state, 9) == LUA_TSTRING)
|
|
|
|
|
|
|
+ (lua_type(state, 9) == LUA_TSTRING || lua_type(state, 9) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
@@ -261,11 +279,19 @@ int lua_MaterialParameter_createAnimation(lua_State* state)
|
|
|
Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
|
|
Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -296,16 +322,16 @@ int lua_MaterialParameter_createAnimationFromBy(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 7:
|
|
case 7:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
(lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
|
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
|
- lua_type(state, 6) == LUA_TSTRING &&
|
|
|
|
|
|
|
+ (lua_type(state, 6) == LUA_TSTRING || lua_type(state, 6) == LUA_TNIL) &&
|
|
|
lua_type(state, 7) == LUA_TNUMBER)
|
|
lua_type(state, 7) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
@@ -323,11 +349,19 @@ int lua_MaterialParameter_createAnimationFromBy(lua_State* state)
|
|
|
unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
|
|
unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->createAnimationFromBy(param1, param2, param3, param4, param5, param6);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->createAnimationFromBy(param1, param2, param3, param4, param5, param6);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -358,16 +392,16 @@ int lua_MaterialParameter_createAnimationFromTo(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 7:
|
|
case 7:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
(lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
|
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
|
|
|
- lua_type(state, 6) == LUA_TSTRING &&
|
|
|
|
|
|
|
+ (lua_type(state, 6) == LUA_TSTRING || lua_type(state, 6) == LUA_TNIL) &&
|
|
|
lua_type(state, 7) == LUA_TNUMBER)
|
|
lua_type(state, 7) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
int param2 = (int)luaL_checkint(state, 3);
|
|
@@ -385,11 +419,19 @@ int lua_MaterialParameter_createAnimationFromTo(lua_State* state)
|
|
|
unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
|
|
unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->createAnimationFromTo(param1, param2, param3, param4, param5, param6);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->createAnimationFromTo(param1, param2, param3, param4, param5, param6);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -420,7 +462,7 @@ int lua_MaterialParameter_destroyAnimation(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 1:
|
|
case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->destroyAnimation();
|
|
instance->destroyAnimation();
|
|
@@ -436,11 +478,11 @@ int lua_MaterialParameter_destroyAnimation(lua_State* state)
|
|
|
}
|
|
}
|
|
|
case 2:
|
|
case 2:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->destroyAnimation(param1);
|
|
instance->destroyAnimation(param1);
|
|
@@ -474,14 +516,22 @@ int lua_MaterialParameter_getAnimation(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 1:
|
|
case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->getAnimation();
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->getAnimation();
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -494,18 +544,26 @@ int lua_MaterialParameter_getAnimation(lua_State* state)
|
|
|
}
|
|
}
|
|
|
case 2:
|
|
case 2:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->getAnimation(param1);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "Animation");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->getAnimation(param1);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "Animation");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -536,7 +594,7 @@ int lua_MaterialParameter_getAnimationPropertyComponentCount(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 2:
|
|
case 2:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
lua_type(state, 2) == LUA_TNUMBER)
|
|
lua_type(state, 2) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
@@ -577,21 +635,15 @@ int lua_MaterialParameter_getAnimationPropertyValue(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 3:
|
|
case 3:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
lua_type(state, 2) == LUA_TNUMBER &&
|
|
lua_type(state, 2) == LUA_TNUMBER &&
|
|
|
- lua_type(state, 3) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
int param1 = (int)luaL_checkint(state, 2);
|
|
int param1 = (int)luaL_checkint(state, 2);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
- void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
|
|
|
|
|
- if (!userdata3)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
|
|
|
|
|
|
|
+ AnimationValue* param2 = ScriptController::getInstance()->getObjectPointer<AnimationValue>(3, "AnimationValue", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->getAnimationPropertyValue(param1, param2);
|
|
instance->getAnimationPropertyValue(param1, param2);
|
|
@@ -625,7 +677,7 @@ int lua_MaterialParameter_getName(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 1:
|
|
case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
const char* result = instance->getName();
|
|
const char* result = instance->getName();
|
|
@@ -662,7 +714,7 @@ int lua_MaterialParameter_getRefCount(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 1:
|
|
case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
unsigned int result = instance->getRefCount();
|
|
unsigned int result = instance->getRefCount();
|
|
@@ -699,7 +751,7 @@ int lua_MaterialParameter_release(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 1:
|
|
case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->release();
|
|
instance->release();
|
|
@@ -733,21 +785,15 @@ int lua_MaterialParameter_setAnimationPropertyValue(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 3:
|
|
case 3:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
lua_type(state, 2) == LUA_TNUMBER &&
|
|
lua_type(state, 2) == LUA_TNUMBER &&
|
|
|
- lua_type(state, 3) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
int param1 = (int)luaL_checkint(state, 2);
|
|
int param1 = (int)luaL_checkint(state, 2);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
- void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
|
|
|
|
|
- if (!userdata3)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
|
|
|
|
|
|
|
+ AnimationValue* param2 = ScriptController::getInstance()->getObjectPointer<AnimationValue>(3, "AnimationValue", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setAnimationPropertyValue(param1, param2);
|
|
instance->setAnimationPropertyValue(param1, param2);
|
|
@@ -763,22 +809,16 @@ int lua_MaterialParameter_setAnimationPropertyValue(lua_State* state)
|
|
|
}
|
|
}
|
|
|
case 4:
|
|
case 4:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
lua_type(state, 2) == LUA_TNUMBER &&
|
|
lua_type(state, 2) == LUA_TNUMBER &&
|
|
|
- lua_type(state, 3) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
|
|
|
lua_type(state, 4) == LUA_TNUMBER)
|
|
lua_type(state, 4) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
int param1 = (int)luaL_checkint(state, 2);
|
|
int param1 = (int)luaL_checkint(state, 2);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
- void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
|
|
|
|
|
- if (!userdata3)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
|
|
|
|
|
|
|
+ AnimationValue* param2 = ScriptController::getInstance()->getObjectPointer<AnimationValue>(3, "AnimationValue", false);
|
|
|
|
|
|
|
|
// Get parameter 3 off the stack.
|
|
// Get parameter 3 off the stack.
|
|
|
float param3 = (float)luaL_checknumber(state, 4);
|
|
float param3 = (float)luaL_checknumber(state, 4);
|
|
@@ -815,7 +855,7 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
{
|
|
{
|
|
|
case 2:
|
|
case 2:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
lua_type(state, 2) == LUA_TNUMBER)
|
|
lua_type(state, 2) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
@@ -826,7 +866,7 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
lua_type(state, 2) == LUA_TNUMBER)
|
|
lua_type(state, 2) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
@@ -837,7 +877,7 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
@@ -848,7 +888,7 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
@@ -859,153 +899,99 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector2");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector2' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector2* param1 = (Vector2*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector2* param1 = ScriptController::getInstance()->getObjectPointer<Vector2>(2, "Vector2", true);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(*param1);
|
|
instance->setValue(*param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector2");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector2' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector2* param1 = (Vector2*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector2* param1 = ScriptController::getInstance()->getObjectPointer<Vector2>(2, "Vector2", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(param1);
|
|
instance->setValue(param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector3* param1 = ScriptController::getInstance()->getObjectPointer<Vector3>(2, "Vector3", true);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(*param1);
|
|
instance->setValue(*param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector3* param1 = ScriptController::getInstance()->getObjectPointer<Vector3>(2, "Vector3", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(param1);
|
|
instance->setValue(param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector4* param1 = ScriptController::getInstance()->getObjectPointer<Vector4>(2, "Vector4", true);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(*param1);
|
|
instance->setValue(*param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector4* param1 = ScriptController::getInstance()->getObjectPointer<Vector4>(2, "Vector4", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(param1);
|
|
instance->setValue(param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Matrix");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Matrix' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Matrix* param1 = (Matrix*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Matrix* param1 = ScriptController::getInstance()->getObjectPointer<Matrix>(2, "Matrix", true);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(*param1);
|
|
instance->setValue(*param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Matrix");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Matrix' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Matrix* param1 = (Matrix*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Matrix* param1 = ScriptController::getInstance()->getObjectPointer<Matrix>(2, "Matrix", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(param1);
|
|
instance->setValue(param1);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA)
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "TextureSampler");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Texture::Sampler' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Texture::Sampler* param1 = (Texture::Sampler*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Texture::Sampler* param1 = ScriptController::getInstance()->getObjectPointer<Texture::Sampler>(2, "TextureSampler", false);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
instance->setValue(param1);
|
|
instance->setValue(param1);
|
|
@@ -1021,7 +1007,7 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
}
|
|
}
|
|
|
case 3:
|
|
case 3:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
@@ -1036,7 +1022,7 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
(lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
@@ -1051,18 +1037,12 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector2");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector2' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector2* param1 = (Vector2*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector2* param1 = ScriptController::getInstance()->getObjectPointer<Vector2>(2, "Vector2", false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
@@ -1072,18 +1052,12 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector3* param1 = ScriptController::getInstance()->getObjectPointer<Vector3>(2, "Vector3", false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
@@ -1093,18 +1067,12 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Vector4* param1 = ScriptController::getInstance()->getObjectPointer<Vector4>(2, "Vector4", false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
@@ -1114,18 +1082,12 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TUSERDATA &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Matrix");
|
|
|
|
|
- if (!userdata2)
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Matrix' for parameter 2.");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- }
|
|
|
|
|
- Matrix* param1 = (Matrix*)((ScriptController::LuaObject*)userdata2)->instance;
|
|
|
|
|
|
|
+ Matrix* param1 = ScriptController::getInstance()->getObjectPointer<Matrix>(2, "Matrix", false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
@@ -1135,22 +1097,30 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- else if (lua_type(state, 1) == LUA_TUSERDATA &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TSTRING &&
|
|
|
|
|
|
|
+ else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
|
|
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
lua_type(state, 3) == LUA_TBOOLEAN)
|
|
lua_type(state, 3) == LUA_TBOOLEAN)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
- const char* param1 = luaL_checkstring(state, 2);
|
|
|
|
|
|
|
+ const char* param1 = ScriptController::getInstance()->getString(2, false);
|
|
|
|
|
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
bool param2 = (luaL_checkint(state, 3) != 0);
|
|
bool param2 = (luaL_checkint(state, 3) != 0);
|
|
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
- object->instance = (void*)instance->setValue(param1, param2);
|
|
|
|
|
- object->owns = false;
|
|
|
|
|
- luaL_getmetatable(state, "TextureSampler");
|
|
|
|
|
- lua_setmetatable(state, -2);
|
|
|
|
|
|
|
+ void* returnPtr = (void*)instance->setValue(param1, param2);
|
|
|
|
|
+ if (returnPtr)
|
|
|
|
|
+ {
|
|
|
|
|
+ ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
|
|
|
|
|
+ object->instance = returnPtr;
|
|
|
|
|
+ object->owns = false;
|
|
|
|
|
+ luaL_getmetatable(state, "TextureSampler");
|
|
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lua_pushnil(state);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|