Split Mesh:attachAttribute(name, nil) out into Mesh:detachAttribute. Fix attachAttribute.

Don’t let me push commits on a friday night…

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-11-26 01:50:36 -04:00
parent 100404c917
commit cbba8c40a6
4 changed files with 40 additions and 26 deletions
+13 -7
View File
@@ -337,17 +337,22 @@ int w_Mesh_attachAttribute(lua_State *L)
{
Mesh *t = luax_checkmesh(L, 1);
const char *name = luaL_checkstring(L, 2);
const char *attachname = name;
Mesh *mesh = nullptr;
if (lua_isnoneornil(L, 3))
{
mesh = luax_checkmesh(L, 3);
attachname = luaL_optstring(L, 4, attachname);
}
Mesh *mesh = luax_checkmesh(L, 3);
const char *attachname = luaL_optstring(L, 4, name);
luax_catchexcept(L, [&](){ t->attachAttribute(name, mesh, attachname); });
return 0;
}
int w_Mesh_detachAttribute(lua_State *L)
{
Mesh *t = luax_checkmesh(L, 1);
const char *name = luaL_checkstring(L, 2);
bool success = false;
luax_catchexcept(L, [&](){ success = t->detachAttribute(name); });
luax_pushboolean(L, success);
return 1;
}
int w_Mesh_flush(lua_State *L)
{
Mesh *t = luax_checkmesh(L, 1);
@@ -520,6 +525,7 @@ static const luaL_Reg w_Mesh_functions[] =
{ "setAttributeEnabled", w_Mesh_setAttributeEnabled },
{ "isAttributeEnabled", w_Mesh_isAttributeEnabled },
{ "attachAttribute", w_Mesh_attachAttribute },
{ "detachAttribute", w_Mesh_detachAttribute },
{ "flush", w_Mesh_flush },
{ "setVertexMap", w_Mesh_setVertexMap },
{ "getVertexMap", w_Mesh_getVertexMap },