diff --git a/addons/material_maker/graph_edit.gd b/addons/material_maker/graph_edit.gd index 6bafdca..afe7c37 100644 --- a/addons/material_maker/graph_edit.gd +++ b/addons/material_maker/graph_edit.gd @@ -22,9 +22,7 @@ func _ready(): func _gui_input(event): if event is InputEventKey and event.pressed: var scancode_with_modifiers = event.get_scancode_with_modifiers() - if scancode_with_modifiers == KEY_C: - center_view() - elif scancode_with_modifiers == KEY_DELETE || scancode_with_modifiers == KEY_BACKSPACE: + if scancode_with_modifiers == KEY_DELETE || scancode_with_modifiers == KEY_BACKSPACE: remove_selection() # Misc. useful functions diff --git a/addons/material_maker/main_window.gd b/addons/material_maker/main_window.gd index 77e6baf..0011f67 100644 --- a/addons/material_maker/main_window.gd +++ b/addons/material_maker/main_window.gd @@ -26,6 +26,8 @@ const MENU = [ { menu="Edit", command="edit_cut", shortcut="Control+X", description="Cut" }, { menu="Edit", command="edit_copy", shortcut="Control+C", description="Copy" }, { menu="Edit", command="edit_paste", shortcut="Control+V", description="Paste" }, + { menu="View", command="view_center", shortcut="C", description="Center view" }, + { menu="View", command="view_reset_zoom", shortcut="Control+0", description="Reset zoom" }, { menu="Tools", submenu="create", description="Create" }, { menu="Tools", command="create_subgraph", shortcut="Control+G", description="Create group" }, { menu="Tools", command="make_selected_nodes_editable", shortcut="Control+F", description="Make selected nodes editable" }, @@ -232,7 +234,6 @@ func quit(): else: get_tree().quit() - func edit_cut(): var graph_edit : MMGraphEdit = get_current_graph_edit() if graph_edit != null: @@ -258,6 +259,15 @@ func edit_paste(): func edit_paste_is_disabled(): var data = parse_json(OS.clipboard) return data == null + +func view_center(): + var graph_edit : MMGraphEdit = get_current_graph_edit() + graph_edit.center_view() + +func view_reset_zoom(): + var graph_edit : MMGraphEdit = get_current_graph_edit() + graph_edit.zoom = 1 + func get_selected_nodes(): var graph_edit : MMGraphEdit = get_current_graph_edit() diff --git a/addons/material_maker/main_window.tscn b/addons/material_maker/main_window.tscn index 253ad8e..327ba92 100644 --- a/addons/material_maker/main_window.tscn +++ b/addons/material_maker/main_window.tscn @@ -46,16 +46,23 @@ margin_bottom = 20.0 text = "Edit" items = [ "Cut", null, 0, false, false, 12, 134217816, null, "", false, "Copy", null, 0, false, false, 13, 134217795, null, "", false, "Paste", null, 0, false, false, 14, 134217814, null, "", false ] -[node name="Tools" type="MenuButton" parent="VBoxContainer/Menu"] +[node name="View" type="MenuButton" parent="VBoxContainer/Menu"] margin_left = 79.0 -margin_right = 125.0 +margin_right = 121.0 +margin_bottom = 20.0 +text = "View" +items = [ "Cut", null, 0, false, false, 12, 134217816, null, "", false, "Copy", null, 0, false, false, 13, 134217795, null, "", false, "Paste", null, 0, false, false, 14, 134217814, null, "", false ] + +[node name="Tools" type="MenuButton" parent="VBoxContainer/Menu"] +margin_left = 125.0 +margin_right = 171.0 margin_bottom = 20.0 text = "Tools" items = [ "Create", null, 0, false, false, -1, 0, null, "PopupMenu", false, "Create group", null, 0, false, false, 16, 134217799, null, "", false, "Make selected nodes editable", null, 0, false, false, 17, 134217798, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Add selected node to user library", null, 0, false, false, 19, 0, null, "", false, "Save user library", null, 0, false, false, 20, 0, null, "", false ] [node name="Help" type="MenuButton" parent="VBoxContainer/Menu"] -margin_left = 129.0 -margin_right = 171.0 +margin_left = 175.0 +margin_right = 217.0 margin_bottom = 20.0 text = "Help" items = [ "User manual", null, 0, false, false, 21, 0, null, "", false, "Report a bug", null, 0, false, false, 22, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "About", null, 0, false, false, 24, 0, null, "", false ] @@ -137,7 +144,6 @@ script = ExtResource( 7 ) [connection signal="tab_changed" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects" to="." method="_on_Projects_tab_changed"] [connection signal="connection_request" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" method="connect_node"] [connection signal="disconnection_request" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" method="disconnect_node"] -[connection signal="gui_input" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit" method="_on_GraphEdit_gui_input"] [connection signal="close_request" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" method="on_close_request"] [connection signal="offset_changed" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material" method="on_offset_changed"] [connection signal="value_changed" from="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material/HBoxContainer2/metallic" to="VBoxContainer/HBoxContainer/ProjectsPane/Projects/GraphEdit/node_Material/HBoxContainer2/metallic" method="update_label"]