mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Added 2 new variants of Mesh:attachAttribute (resolves issue #1233). Thanks xenthral!
- Added Mesh:attachAttribute(name, mesh, nameInMesh) which retargets the attribute name in the specified Mesh (3rd argument) to a new name for this mesh (1st argument). - Added Mesh:attachAttribute(name) which detaches any attached attributes from other meshes for that attribute name. --HG-- branch : minor
This commit is contained in:
@@ -337,8 +337,14 @@ int w_Mesh_attachAttribute(lua_State *L)
|
||||
{
|
||||
Mesh *t = luax_checkmesh(L, 1);
|
||||
const char *name = luaL_checkstring(L, 2);
|
||||
Mesh *mesh = luax_checkmesh(L, 3);
|
||||
luax_catchexcept(L, [&](){ t->attachAttribute(name, mesh); });
|
||||
const char *attachname = name;
|
||||
Mesh *mesh = nullptr;
|
||||
if (lua_isnoneornil(L, 3))
|
||||
{
|
||||
mesh = luax_checkmesh(L, 3);
|
||||
attachname = luaL_optstring(L, 4, attachname);
|
||||
}
|
||||
luax_catchexcept(L, [&](){ t->attachAttribute(name, mesh, attachname); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user