make entity skeleton optional

This commit is contained in:
MihailRis 2026-08-19 20:51:40 +03:00
parent 1186011dcf
commit 9fff79f8e2
3 changed files with 26 additions and 17 deletions

View file

@ -116,6 +116,10 @@ static int l_set_skeleton(lua::State* L) {
return 0;
}
if (auto entity = get_entity(L, 1)) {
if (lua::isnil(L, 2)) {
entity->setRig(nullptr);
return 0;
}
std::string skeletonName = lua::require_string(L, 2);
auto rigConfig = assets->getShared<rigging::SkeletonConfig>(skeletonName);
if (rigConfig == nullptr) {