Renamed a few methods in the mesh data resource editor.

This commit is contained in:
Relintai 2021-03-24 19:09:02 +01:00
parent 18b13ce815
commit d87694cb03
4 changed files with 32 additions and 25 deletions

View File

@ -3,30 +3,36 @@ extends PanelContainer
var plugin var plugin
export var uv_editor_path : NodePath
var uv_editor : Node
func _init():
uv_editor = get_node(uv_editor_path)
func _unhandled_key_input(event : InputEventKey) -> void: func _unhandled_key_input(event : InputEventKey) -> void:
if event.echo: if event.echo:
return return
#if event.key #if event.key
if event.scancode == KEY_G: if event.scancode == KEY_G:
#translate #translate
if plugin: if plugin:
plugin.translate_key_pressed(event.pressed) plugin.set_translate(event.pressed)
elif event.scancode == KEY_S: elif event.scancode == KEY_S:
#scale? probably needs a differrent key #scale? probably needs a differrent key
if plugin: if plugin:
plugin.scale_key_pressed(event.pressed) plugin.set_scale(event.pressed)
elif event.scancode == KEY_R: elif event.scancode == KEY_R:
#rotate #rotate
if plugin: if plugin:
plugin.rotate_key_pressed(event.pressed) plugin.set_rotate(event.pressed)
elif event.scancode == KEY_X: elif event.scancode == KEY_X:
if plugin: if plugin:
plugin.axis_key_x(event.pressed) plugin.set_axis_x(event.pressed)
elif event.scancode == KEY_Y: elif event.scancode == KEY_Y:
if plugin: if plugin:
plugin.axis_key_y(event.pressed) plugin.set_axis_y(event.pressed)
elif event.scancode == KEY_Z: elif event.scancode == KEY_Z:
if plugin: if plugin:
plugin.axis_key_z(event.pressed) plugin.set_axis_z(event.pressed)

View File

@ -11,6 +11,7 @@ script = ExtResource( 1 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
uv_editor_path = NodePath("VBoxContainer/ScrollContainer/UVEditor")
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 7.0 margin_left = 7.0

View File

@ -239,33 +239,33 @@ func forward_spatial_gui_input(index, camera, event):
return false return false
func translate_key_pressed(on : bool) -> void: func set_translate(on : bool) -> void:
if on: if on:
edit_mode = EditMode.TRANSLATE edit_mode = EditMode.TRANSLATE
func scale_key_pressed(on : bool) -> void: func set_scale(on : bool) -> void:
if on: if on:
edit_mode = EditMode.SCALE edit_mode = EditMode.SCALE
func rotate_key_pressed(on : bool) -> void: func set_rotate(on : bool) -> void:
if on: if on:
edit_mode = EditMode.ROTATE edit_mode = EditMode.ROTATE
func axis_key_x(on : bool) -> void: func set_axis_x(on : bool) -> void:
if on: if on:
if (axis_constraint & AxisConstraint.X) != 0: if (axis_constraint & AxisConstraint.X) != 0:
axis_constraint ^= AxisConstraint.X axis_constraint ^= AxisConstraint.X
else: else:
axis_constraint |= AxisConstraint.X axis_constraint |= AxisConstraint.X
func axis_key_y(on : bool) -> void: func set_axis_y(on : bool) -> void:
if on: if on:
if (axis_constraint & AxisConstraint.Y) != 0: if (axis_constraint & AxisConstraint.Y) != 0:
axis_constraint ^= AxisConstraint.Y axis_constraint ^= AxisConstraint.Y
else: else:
axis_constraint |= AxisConstraint.Y axis_constraint |= AxisConstraint.Y
func axis_key_z(on : bool) -> void: func set_axis_z(on : bool) -> void:
if on: if on:
if (axis_constraint & AxisConstraint.Z) != 0: if (axis_constraint & AxisConstraint.Z) != 0:
axis_constraint ^= AxisConstraint.Z axis_constraint ^= AxisConstraint.Z

View File

@ -77,29 +77,29 @@ func unregister_gizmo(gizmo):
active_gizmos.remove(i) active_gizmos.remove(i)
return return
func translate_key_pressed(on : bool) -> void: func set_translate(on : bool) -> void:
for g in active_gizmos: for g in active_gizmos:
g.translate_key_pressed(on) g.set_translate(on)
func scale_key_pressed(on : bool) -> void: func set_scale(on : bool) -> void:
for g in active_gizmos: for g in active_gizmos:
g.scale_key_pressed(on) g.set_scale(on)
func rotate_key_pressed(on : bool) -> void: func set_rotate(on : bool) -> void:
for g in active_gizmos: for g in active_gizmos:
g.rotate_key_pressed(on) g.set_rotate(on)
func axis_key_x(on : bool) -> void: func set_axis_x(on : bool) -> void:
for g in active_gizmos: for g in active_gizmos:
g.axis_key_x(on) g.set_axis_x(on)
func axis_key_y(on : bool) -> void: func set_axis_y(on : bool) -> void:
for g in active_gizmos: for g in active_gizmos:
g.axis_key_y(on) g.set_axis_y(on)
func axis_key_z(on : bool) -> void: func set_axis_z(on : bool) -> void:
for g in active_gizmos: for g in active_gizmos:
g.axis_key_z(on) g.set_axis_z(on)
func forward_spatial_gui_input(camera, event): func forward_spatial_gui_input(camera, event):
for g in active_gizmos: for g in active_gizmos: