MCPcopy Index your code
hub / github.com/SpaiR/imgui-java / editTransform

Method editTransform

example/src/main/java/ExampleImGuizmo.java:143–245  ·  view source on GitHub ↗
(final ImBoolean showImGuizmoWindow)

Source from the content-addressed store, hash-verified

141 }
142
143 private static void editTransform(final ImBoolean showImGuizmoWindow) {
144 if (ImGui.isKeyPressed(ImGuiKey.T)) {
145 currentGizmoOperation = Operation.TRANSLATE;
146 } else if (ImGui.isKeyPressed(ImGuiKey.R)) {
147 currentGizmoOperation = Operation.ROTATE;
148 } else if (ImGui.isKeyPressed(ImGuiKey.S)) {
149 currentGizmoOperation = Operation.SCALE;
150 } else if (ImGui.isKeyPressed(ImGuiKey.LeftShift)) {
151 USE_SNAP.set(!USE_SNAP.get());
152 }
153
154 if (ImGuizmo.isUsing()) {
155 ImGuizmo.decomposeMatrixToComponents(OBJECT_MATRICES[0], INPUT_MATRIX_TRANSLATION, INPUT_MATRIX_ROTATION, INPUT_MATRIX_SCALE);
156 }
157
158 ImGui.inputFloat3("Tr", INPUT_MATRIX_TRANSLATION, "%.3f", ImGuiInputTextFlags.ReadOnly);
159 ImGui.inputFloat3("Rt", INPUT_MATRIX_ROTATION, "%.3f", ImGuiInputTextFlags.ReadOnly);
160 ImGui.inputFloat3("Sc", INPUT_MATRIX_SCALE, "%.3f", ImGuiInputTextFlags.ReadOnly);
161
162 if (ImGuizmo.isUsing()) {
163 ImGuizmo.recomposeMatrixFromComponents(INPUT_MATRIX_TRANSLATION, INPUT_MATRIX_ROTATION, INPUT_MATRIX_SCALE, OBJECT_MATRICES[0]);
164 }
165
166 if (currentGizmoOperation != Operation.SCALE) {
167 if (ImGui.radioButton("Local", currentMode == Mode.LOCAL)) {
168 currentMode = Mode.LOCAL;
169 }
170 ImGui.sameLine();
171 if (ImGui.radioButton("World", currentMode == Mode.WORLD)) {
172 currentMode = Mode.WORLD;
173 }
174 }
175
176 ImGui.checkbox("Snap Checkbox", USE_SNAP);
177
178 INPUT_FLOAT.set(INPUT_SNAP_VALUE[0]);
179 switch (currentGizmoOperation) {
180 case Operation.TRANSLATE:
181 ImGui.inputFloat3("Snap Value", INPUT_SNAP_VALUE);
182 break;
183 case Operation.ROTATE:
184 ImGui.inputFloat("Angle Value", INPUT_FLOAT);
185 float rotateValue = INPUT_FLOAT.get();
186 Arrays.fill(INPUT_SNAP_VALUE, rotateValue); //avoiding allocation
187 break;
188 case Operation.SCALE:
189 ImGui.inputFloat("Scale Value", INPUT_FLOAT);
190 float scaleValue = INPUT_FLOAT.get();
191 Arrays.fill(INPUT_SNAP_VALUE, scaleValue);
192 break;
193 }
194
195 ImGui.checkbox("Show Bound Sizing", BOUNDING_SIZE);
196
197 if (BOUNDING_SIZE.get()) {
198 if (ImGui.checkbox("BoundSizingSnap", boundSizingSnap)) {
199 boundSizingSnap = !boundSizingSnap;
200 }

Callers 1

showMethod · 0.95

Calls 15

isKeyPressedMethod · 0.95
isUsingMethod · 0.95
inputFloat3Method · 0.95
radioButtonMethod · 0.95
sameLineMethod · 0.95
checkboxMethod · 0.95
inputFloatMethod · 0.95
setNextWindowPosMethod · 0.95
getMainViewportMethod · 0.95
setNextWindowSizeMethod · 0.95

Tested by

no test coverage detected