Add view menu, move C to center command to view menu, add ctrl+0 to reset zoom to view menu

This commit is contained in:
jack perkins 2019-10-17 19:03:18 +02:00
parent 738ec515c9
commit 5cdc5e5b55
3 changed files with 23 additions and 9 deletions

View File

@ -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

View File

@ -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()

View File

@ -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"]