From 410d48d0fab27dd62506e832a05e79954c805eef Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 28 Jan 2022 11:01:03 +0100 Subject: [PATCH] Remove unused code, and added a helper method. --- .../mesh_data_resource_editor/MIDGizmo.gd | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/game/addons/mesh_data_resource_editor/MIDGizmo.gd b/game/addons/mesh_data_resource_editor/MIDGizmo.gd index 82896d93..3c3b5608 100644 --- a/game/addons/mesh_data_resource_editor/MIDGizmo.gd +++ b/game/addons/mesh_data_resource_editor/MIDGizmo.gd @@ -549,29 +549,7 @@ func forward_spatial_gui_input(index, camera, event): # event is pressed _rect_drag = true _rect_drag_start_point = event.get_position() - -# elif event is InputEventMouseMotion: -# if edit_mode == EditMode.EDIT_MODE_NONE: -# return false -# elif edit_mode == EditMode.EDIT_MODE_TRANSLATE: -# for i in selected_indices: -# var v : Vector3 = vertices[i] -# -# if axis_constraint == AxisConstraint.X: -# v.x += event.relative.x * -0.001 -# elif axis_constraint == AxisConstraint.Y: -# v.y += event.relative.y * 0.001 -# elif axis_constraint == AxisConstraint.Z: -# v.z += event.relative.x * 0.001 -# -# vertices.set(i, v) -# -# redraw() -# elif edit_mode == EditMode.EDIT_MODE_SCALE: -# print("SCALE") -# elif edit_mode == EditMode.EDIT_MODE_ROTATE: -# print("ROTATE") - + return false func add_to_all_selected(ofs : Vector3) -> void: @@ -596,6 +574,17 @@ func mul_all_selected_with_basis(b : Basis) -> void: v = b * v _vertices.set(indx, v) +func mul_all_selected_with_transform(t : Transform) -> void: + for i in _selected_points: + var v : Vector3 = _handle_points[i] + v = t * v + _handle_points.set(i, v) + + for indx in _drag_op_indices: + var v : Vector3 = _drag_op_orig_verices[indx] + v = t * v + _vertices.set(indx, v) + func set_translate() -> void: edit_mode = EditMode.EDIT_MODE_TRANSLATE