2021-03-02 13:03:02 +01:00
|
|
|
tool
|
|
|
|
extends PanelContainer
|
|
|
|
|
2021-12-29 00:00:28 +01:00
|
|
|
var plugin : EditorPlugin
|
2021-03-02 13:03:02 +01:00
|
|
|
|
2021-03-24 19:09:02 +01:00
|
|
|
export var uv_editor_path : NodePath
|
|
|
|
|
|
|
|
var uv_editor : Node
|
|
|
|
|
2021-09-13 12:32:33 +02:00
|
|
|
func _enter_tree():
|
2021-03-24 19:09:02 +01:00
|
|
|
uv_editor = get_node(uv_editor_path)
|
2021-09-13 12:32:33 +02:00
|
|
|
|
|
|
|
func set_mesh_data_resource(a : MeshDataResource) -> void:
|
|
|
|
if uv_editor:
|
|
|
|
uv_editor.set_mesh_data_resource(a)
|
2021-03-24 19:09:02 +01:00
|
|
|
|
2021-03-02 13:03:02 +01:00
|
|
|
func _unhandled_key_input(event : InputEventKey) -> void:
|
2021-03-02 21:41:24 +01:00
|
|
|
if event.echo:
|
|
|
|
return
|
|
|
|
|
2021-03-02 13:03:02 +01:00
|
|
|
#if event.key
|
|
|
|
if event.scancode == KEY_G:
|
|
|
|
#translate
|
2021-03-02 21:41:24 +01:00
|
|
|
if plugin:
|
2021-03-24 19:09:02 +01:00
|
|
|
plugin.set_translate(event.pressed)
|
2021-03-02 13:03:02 +01:00
|
|
|
elif event.scancode == KEY_S:
|
|
|
|
#scale? probably needs a differrent key
|
2021-03-02 21:41:24 +01:00
|
|
|
if plugin:
|
2021-03-24 19:09:02 +01:00
|
|
|
plugin.set_scale(event.pressed)
|
2021-03-02 13:03:02 +01:00
|
|
|
elif event.scancode == KEY_R:
|
|
|
|
#rotate
|
2021-03-02 21:41:24 +01:00
|
|
|
if plugin:
|
2021-03-24 19:09:02 +01:00
|
|
|
plugin.set_rotate(event.pressed)
|
2021-03-02 21:41:24 +01:00
|
|
|
elif event.scancode == KEY_X:
|
|
|
|
if plugin:
|
2021-03-24 19:09:02 +01:00
|
|
|
plugin.set_axis_x(event.pressed)
|
2021-03-02 21:41:24 +01:00
|
|
|
elif event.scancode == KEY_Y:
|
|
|
|
if plugin:
|
2021-03-24 19:09:02 +01:00
|
|
|
plugin.set_axis_y(event.pressed)
|
2021-03-02 21:41:24 +01:00
|
|
|
elif event.scancode == KEY_Z:
|
|
|
|
if plugin:
|
2021-03-24 19:09:02 +01:00
|
|
|
plugin.set_axis_z(event.pressed)
|
2021-09-13 18:47:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Extrude_pressed():
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
func _on_AddBox_pressed():
|
2021-12-29 00:00:28 +01:00
|
|
|
plugin.add_box()
|
2021-09-13 18:47:56 +02:00
|
|
|
|
|
|
|
func _on_UnwrapButton_pressed():
|
|
|
|
plugin.uv_unwrap()
|