@@ -20,7 +20,7 @@ TransformationGizmo::TransformationGizmo(std::string name_, glm::mat4* externalT
2020 allowTranslation(name + " #allowTranslation" , true ),
2121 allowRotation(name + " #allowRotation" , true ),
2222 allowScaling(name + " #allowScaling" , false ),
23- // uniformScaling (name + "#uniformScaling ", true ),
23+ allowNonUniformScaling (name + " #allowNonUniformScaling " , false ),
2424 interactInLocalSpace(name + " #interactInLocalSpace" , false ),
2525 showUIWindow(name + " #showUIWindow" , false ),
2626 gizmoSize(name + " #gizmoSize" , 1.0 )
@@ -62,12 +62,8 @@ void TransformationGizmo::draw() {
6262 if (allowRotation.get ()) gizmoOpModeInt |= ImGuizmo::ROTATE;
6363 if (allowScaling.get ()) {
6464 gizmoOpModeInt |= ImGuizmo::SCALEU;
65- // if(uniformScaling.get()) {
66- // gizmoOpModeInt |= ImGuizmo::SCALEU;
67- // } else {
68- // gizmoOpModeInt |= ImGuizmo::SCALE;
69- // }
7065 }
66+ ImGuizmo::SetAllowNonUniformScaling (allowNonUniformScaling.get ());
7167 ImGuizmo::OPERATION gizmoOpMode = static_cast <ImGuizmo::OPERATION>(gizmoOpModeInt);
7268
7369 ImGuizmo::MODE gizmoCoordSpace = interactInLocalSpace.get () ? ImGuizmo::LOCAL : ImGuizmo::WORLD;
@@ -94,7 +90,7 @@ void TransformationGizmo::buildMenuItems() {
9490 ImGui::MenuItem (" Allow Translation" , NULL , &allowTranslation.get ());
9591 ImGui::MenuItem (" Allow Rotation" , NULL , &allowRotation.get ());
9692 ImGui::MenuItem (" Allow Scaling" , NULL , &allowScaling.get ());
97- // ImGui::MenuItem("Uniform Scaling", NULL, &uniformScaling .get());
93+ ImGui::MenuItem (" Allow Non- Uniform Scaling" , NULL , &allowNonUniformScaling .get ());
9894}
9995
10096bool TransformationGizmo::interact () {
@@ -134,27 +130,17 @@ void TransformationGizmo::buildInlineTransformUI() {
134130 ImGui::SameLine ();
135131 ImGui::Checkbox (" Scaling" , &allowScaling.get ());
136132
137- // if (allowScaling.get()) {
138- // ImGui::Checkbox("Uniform Scaling", &uniformScaling .get());
139- // }
133+ if (allowScaling.get ()) {
134+ ImGui::Checkbox (" Allow Non- Uniform Scaling" , &allowNonUniformScaling .get ());
135+ }
140136
141- static ImGuizmo::OPERATION mCurrentGizmoOperation (ImGuizmo::ROTATE);
142- static ImGuizmo::MODE mCurrentGizmoMode (ImGuizmo::WORLD);
143- if (ImGui::RadioButton (" Translate" , mCurrentGizmoOperation == ImGuizmo::TRANSLATE))
144- mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
145- ImGui::SameLine ();
146- if (ImGui::RadioButton (" Rotate" , mCurrentGizmoOperation == ImGuizmo::ROTATE))
147- mCurrentGizmoOperation = ImGuizmo::ROTATE;
148- ImGui::SameLine ();
149- if (ImGui::RadioButton (" Scale" , mCurrentGizmoOperation == ImGuizmo::SCALE)) mCurrentGizmoOperation = ImGuizmo::SCALE;
150137 float matrixTranslation[3 ], matrixRotation[3 ], matrixScale[3 ];
151138 ImGuizmo::DecomposeMatrixToComponents (glm::value_ptr (Tref), matrixTranslation, matrixRotation, matrixScale);
152139 ImGui::InputFloat3 (" Tr" , matrixTranslation);
153140 ImGui::InputFloat3 (" Rt" , matrixRotation);
154141 ImGui::InputFloat3 (" Sc" , matrixScale);
155142 ImGuizmo::RecomposeMatrixFromComponents (matrixTranslation, matrixRotation, matrixScale, glm::value_ptr (Tref));
156143
157- // TODO these don't seem to be doing anything?
158144 if (ImGui::RadioButton (" Local" , interactInLocalSpace.get ())) interactInLocalSpace = true ;
159145 ImGui::SameLine ();
160146 if (ImGui::RadioButton (" World" , !interactInLocalSpace.get ())) interactInLocalSpace = false ;
@@ -188,6 +174,9 @@ void TransformationGizmo::setAllowRotation(bool newVal) { allowRotation = newVal
188174bool TransformationGizmo::getAllowScaling () { return allowScaling.get (); }
189175void TransformationGizmo::setAllowScaling (bool newVal) { allowScaling = newVal; }
190176
177+ bool TransformationGizmo::getAllowNonUniformScaling () { return allowNonUniformScaling.get (); }
178+ void TransformationGizmo::setAllowNonUniformScaling (bool newVal) { allowNonUniformScaling = newVal; }
179+
191180bool TransformationGizmo::getInteractInLocalSpace () { return interactInLocalSpace.get (); }
192181void TransformationGizmo::setInteractInLocalSpace (bool newVal) { interactInLocalSpace = newVal; }
193182
0 commit comments