1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 03:32:36 +00:00

Merge branch 'getactivegroup' into 'master'

Throw on invalid bone group indices in getActiveGroup

See merge request OpenMW/openmw!4171
This commit is contained in:
psi29a 2024-06-14 07:20:55 +00:00
commit a1cacbe164

View File

@ -218,6 +218,8 @@ namespace MWLua
getMutableAnimationOrThrow(ObjectVariant(object))->adjustSpeedMult(groupname, speed);
};
api["getActiveGroup"] = [](const sol::object& object, MWRender::BoneGroup boneGroup) -> std::string_view {
if (boneGroup < 0 || boneGroup >= BoneGroup::Num_BoneGroups)
throw std::runtime_error("Invalid bonegroup: " + std::to_string(boneGroup));
return getConstAnimationOrThrow(ObjectVariant(object))->getActiveGroup(boneGroup);
};