LUA : Add curves to inputs

This commit is contained in:
3djc
2018-10-12 07:34:56 +02:00
parent 577eb6224f
commit 04c95d2fdb
+12 -2
View File
@@ -333,8 +333,10 @@ Return input data for given input and line number
* `weight` (number) input weight
* `offset` (number) input offset
* `switch` (number) input switch index
* `curveType` (number) curve type (function, expo, custom curve)
* `curveValue` (number) curve index
@status current Introduced in 2.0.0, `switch` added in TODO
@status current Introduced in 2.0.0, curveType/curveValue added in 2.3
*/
static int luaModelGetInput(lua_State *L)
{
@@ -350,6 +352,8 @@ static int luaModelGetInput(lua_State *L)
lua_pushtableinteger(L, "weight", expo->weight);
lua_pushtableinteger(L, "offset", expo->offset);
lua_pushtableinteger(L, "switch", expo->swtch);
lua_pushtableinteger(L, "curveType", expo->curve.type);
lua_pushtableinteger(L, "curveValue", expo->curve.value);
}
else {
lua_pushnil(L);
@@ -368,7 +372,7 @@ Insert an Input at specified line
@param value (table) input data, see model.getInput()
@status current Introduced in 2.0.0, `switch` added in TODO
@status current Introduced in 2.0.0, curveType/curveValue added in 2.3
*/
static int luaModelInsertInput(lua_State *L)
{
@@ -403,6 +407,12 @@ static int luaModelInsertInput(lua_State *L)
else if (!strcmp(key, "switch")) {
expo->swtch = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "curveType")) {
expo->curve.type = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "curveValue")) {
expo->curve.value = luaL_checkinteger(L, -1);
}
}
}