@@ -130,6 +130,13 @@ void draw_model_viewer_panel(MapRenderer* mapRenderer, std::map<int, std::unique
130130 auto & options = state.options ;
131131 auto & vis = g_animationState.visualization ;
132132
133+ // Keep newly created animation controllers aligned with persisted model viewer settings.
134+ if (g_animationState.controller &&
135+ g_animationState.controller ->IsRootPositionLocked () != vis.lockRootPosition )
136+ {
137+ g_animationState.controller ->SetLockRootPosition (vis.lockRootPosition );
138+ }
139+
133140 // Sync bone info from animation state
134141 if (g_animationState.clip && g_animationState.clip ->boneTracks .size () != state.bones .size ())
135142 {
@@ -1042,7 +1049,10 @@ void draw_model_viewer_panel(MapRenderer* mapRenderer, std::map<int, std::unique
10421049
10431050 // Mesh alpha
10441051 ImGui::SetNextItemWidth (ImGui::GetContentRegionAvail ().x );
1045- ImGui::SliderFloat (" ##MeshAlpha" , &vis.meshAlpha , 0 .0f , 1 .0f , " Mesh Alpha: %.2f" );
1052+ if (ImGui::SliderFloat (" ##MeshAlpha" , &vis.meshAlpha , 0 .0f , 1 .0f , " Mesh Alpha: %.2f" ))
1053+ {
1054+ options.meshAlpha = vis.meshAlpha ;
1055+ }
10461056
10471057 // Lock root position option
10481058 if (g_animationState.hasAnimation && g_animationState.controller )
@@ -1051,6 +1061,7 @@ void draw_model_viewer_panel(MapRenderer* mapRenderer, std::map<int, std::unique
10511061 if (ImGui::Checkbox (" Lock Root Position" , &lockRoot))
10521062 {
10531063 vis.lockRootPosition = lockRoot;
1064+ options.lockRootPosition = lockRoot;
10541065 g_animationState.controller ->SetLockRootPosition (lockRoot);
10551066 }
10561067 if (ImGui::IsItemHovered ())
@@ -1064,7 +1075,10 @@ void draw_model_viewer_panel(MapRenderer* mapRenderer, std::map<int, std::unique
10641075 ImGui::Spacing ();
10651076
10661077 // Debug: color by bone index
1067- ImGui::Checkbox (" Color by Bone Index" , &vis.colorByBoneIndex );
1078+ if (ImGui::Checkbox (" Color by Bone Index" , &vis.colorByBoneIndex ))
1079+ {
1080+ options.colorByBoneIndex = vis.colorByBoneIndex ;
1081+ }
10681082 if (ImGui::IsItemHovered ())
10691083 {
10701084 ImGui::SetTooltip (" Color vertices by bone index.\n Useful for debugging bone assignments." );
@@ -1075,7 +1089,7 @@ void draw_model_viewer_panel(MapRenderer* mapRenderer, std::map<int, std::unique
10751089 ImGui::SameLine ();
10761090 if (ImGui::Checkbox (" Raw" , &vis.showRawBoneIndex ))
10771091 {
1078- // No rebuild needed, just changes shader mode
1092+ options. showRawBoneIndex = vis. showRawBoneIndex ;
10791093 }
10801094 if (ImGui::IsItemHovered ())
10811095 {
0 commit comments