Fix interpolating to identity bone overrides (#16609)

The previous code immediately dropped identity overrides, even if there still was an interpolation to be done.
Also a little bit of cleanup, and setting an appropriate identity default for the scale property when interpolating.

For modders: As a workaround, you can add a tiny offset so that overrides aren't identity overrides.
This commit is contained in:
Lars Müller
2025-10-29 10:25:50 +01:00
committed by GitHub
parent 93ccb4b355
commit 7331156650
5 changed files with 49 additions and 41 deletions

View File

@@ -668,7 +668,7 @@ int ObjectRef::l_set_bone_override(lua_State *L)
lua_getfield(L, -1, "interpolation");
if (lua_isnumber(L, -1))
prop.interp_timer = lua_tonumber(L, -1);
prop.interp_duration = lua_tonumber(L, -1);
lua_pop(L, 1);
};
@@ -718,7 +718,7 @@ static void push_bone_override(lua_State *L, const BoneOverride &props)
lua_newtable(L);
push_v3f(L, vec);
lua_setfield(L, -2, "vec");
lua_pushnumber(L, prop.interp_timer);
lua_pushnumber(L, prop.interp_duration);
lua_setfield(L, -2, "interpolation");
lua_pushboolean(L, prop.absolute);
lua_setfield(L, -2, "absolute");