mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-02-01 14:37:01 +01:00
Transfer the current editing state from the active gizmo when a new mesh data instance is selected. Also smaller cleanups.
This commit is contained in:
parent
4ef0a39fa2
commit
45a1f42e51
@ -77,17 +77,17 @@ func set_edit_mode_scale() -> void:
|
|||||||
func on_edit_mode_translate_toggled(on : bool) -> void:
|
func on_edit_mode_translate_toggled(on : bool) -> void:
|
||||||
if on:
|
if on:
|
||||||
if _plugin:
|
if _plugin:
|
||||||
_plugin.set_translate(on)
|
_plugin.set_translate()
|
||||||
|
|
||||||
func on_edit_mode_rotate_toggled(on : bool) -> void:
|
func on_edit_mode_rotate_toggled(on : bool) -> void:
|
||||||
if on:
|
if on:
|
||||||
if _plugin:
|
if _plugin:
|
||||||
_plugin.set_rotate(on)
|
_plugin.set_rotate()
|
||||||
|
|
||||||
func on_edit_mode_scale_toggled(on : bool) -> void:
|
func on_edit_mode_scale_toggled(on : bool) -> void:
|
||||||
if on:
|
if on:
|
||||||
if _plugin:
|
if _plugin:
|
||||||
_plugin.set_scale(on)
|
_plugin.set_scale()
|
||||||
|
|
||||||
#axis locks
|
#axis locks
|
||||||
func get_axis_x() -> bool:
|
func get_axis_x() -> bool:
|
||||||
|
@ -287,18 +287,18 @@ func mul_all_selected_with_basis(b : Basis) -> void:
|
|||||||
v = b * v
|
v = b * v
|
||||||
_vertices.set(j, v)
|
_vertices.set(j, v)
|
||||||
|
|
||||||
func set_translate(on : bool) -> void:
|
func set_translate() -> void:
|
||||||
if on:
|
edit_mode = EditMode.EDIT_MODE_TRANSLATE
|
||||||
edit_mode = EditMode.EDIT_MODE_TRANSLATE
|
|
||||||
|
|
||||||
func set_scale(on : bool) -> void:
|
func set_scale() -> void:
|
||||||
if on:
|
edit_mode = EditMode.EDIT_MODE_SCALE
|
||||||
edit_mode = EditMode.EDIT_MODE_SCALE
|
|
||||||
|
|
||||||
func set_rotate(on : bool) -> void:
|
|
||||||
if on:
|
|
||||||
edit_mode = EditMode.EDIT_MODE_ROTATE
|
|
||||||
|
|
||||||
|
func set_rotate() -> void:
|
||||||
|
edit_mode = EditMode.EDIT_MODE_ROTATE
|
||||||
|
|
||||||
|
func set_edit_mode(em : int) -> void:
|
||||||
|
edit_mode = em
|
||||||
|
|
||||||
func set_axis_x(on : bool) -> void:
|
func set_axis_x(on : bool) -> void:
|
||||||
if on:
|
if on:
|
||||||
axis_constraint |= AxisConstraint.X
|
axis_constraint |= AxisConstraint.X
|
||||||
@ -1233,3 +1233,9 @@ func set_pivot_mdi_origin():
|
|||||||
|
|
||||||
func set_pivot_world_origin():
|
func set_pivot_world_origin():
|
||||||
pivot_type = PivotTypes.PIVOT_TYPE_WORLD_ORIGIN
|
pivot_type = PivotTypes.PIVOT_TYPE_WORLD_ORIGIN
|
||||||
|
|
||||||
|
func transfer_state_from(other) -> void:
|
||||||
|
edit_mode = other.edit_mode
|
||||||
|
pivot_type = other.pivot_type
|
||||||
|
axis_constraint = other.axis_constraint
|
||||||
|
selection_mode = other.selection_mode
|
||||||
|
@ -14,8 +14,6 @@ var active_gizmos : Array
|
|||||||
var current_mesh_data_instance : MeshDataInstance = null
|
var current_mesh_data_instance : MeshDataInstance = null
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
#print("_enter_tree")
|
|
||||||
|
|
||||||
gizmo_plugin = MdiGizmoPlugin.new()
|
gizmo_plugin = MdiGizmoPlugin.new()
|
||||||
mdi_ed_gui = MDIEdGui.instance()
|
mdi_ed_gui = MDIEdGui.instance()
|
||||||
mdi_ed_gui.set_plugin(self)
|
mdi_ed_gui.set_plugin(self)
|
||||||
@ -58,12 +56,15 @@ func handles(object):
|
|||||||
|
|
||||||
func edit(object):
|
func edit(object):
|
||||||
var mdi : MeshDataInstance = object as MeshDataInstance
|
var mdi : MeshDataInstance = object as MeshDataInstance
|
||||||
|
|
||||||
current_mesh_data_instance = mdi
|
|
||||||
|
|
||||||
if mdi:
|
if mdi:
|
||||||
|
if current_mesh_data_instance && mdi.gizmo && current_mesh_data_instance.gizmo:
|
||||||
|
mdi.gizmo.transfer_state_from(current_mesh_data_instance.gizmo)
|
||||||
|
|
||||||
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
|
mdi_ed_gui.set_mesh_data_resource(mdi.mesh_data)
|
||||||
mdi_ed_gui.set_mesh_data_instance(mdi)
|
mdi_ed_gui.set_mesh_data_instance(mdi)
|
||||||
|
|
||||||
|
current_mesh_data_instance = mdi
|
||||||
|
|
||||||
func make_visible(visible):
|
func make_visible(visible):
|
||||||
#print("make_visible")
|
#print("make_visible")
|
||||||
@ -91,17 +92,17 @@ func unregister_gizmo(gizmo):
|
|||||||
active_gizmos.remove(i)
|
active_gizmos.remove(i)
|
||||||
return
|
return
|
||||||
|
|
||||||
func set_translate(on : bool) -> void:
|
func set_translate() -> void:
|
||||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||||
current_mesh_data_instance.gizmo.set_translate(on)
|
current_mesh_data_instance.gizmo.set_translate()
|
||||||
|
|
||||||
func set_scale(on : bool) -> void:
|
func set_scale() -> void:
|
||||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||||
current_mesh_data_instance.gizmo.set_scale(on)
|
current_mesh_data_instance.gizmo.set_scale()
|
||||||
|
|
||||||
func set_rotate(on : bool) -> void:
|
func set_rotate() -> void:
|
||||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||||
current_mesh_data_instance.gizmo.set_rotate(on)
|
current_mesh_data_instance.gizmo.set_rotate()
|
||||||
|
|
||||||
func set_axis_x(on : bool) -> void:
|
func set_axis_x(on : bool) -> void:
|
||||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||||
@ -119,7 +120,6 @@ func set_selection_mode_vertex() -> void:
|
|||||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||||
current_mesh_data_instance.gizmo.set_selection_mode_vertex()
|
current_mesh_data_instance.gizmo.set_selection_mode_vertex()
|
||||||
|
|
||||||
|
|
||||||
func set_selection_mode_edge() -> void:
|
func set_selection_mode_edge() -> void:
|
||||||
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
|
||||||
current_mesh_data_instance.gizmo.set_selection_mode_edge()
|
current_mesh_data_instance.gizmo.set_selection_mode_edge()
|
||||||
|
Loading…
Reference in New Issue
Block a user