mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
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:
parent
738ec515c9
commit
5cdc5e5b55
@ -22,9 +22,7 @@ func _ready():
|
|||||||
func _gui_input(event):
|
func _gui_input(event):
|
||||||
if event is InputEventKey and event.pressed:
|
if event is InputEventKey and event.pressed:
|
||||||
var scancode_with_modifiers = event.get_scancode_with_modifiers()
|
var scancode_with_modifiers = event.get_scancode_with_modifiers()
|
||||||
if scancode_with_modifiers == KEY_C:
|
if scancode_with_modifiers == KEY_DELETE || scancode_with_modifiers == KEY_BACKSPACE:
|
||||||
center_view()
|
|
||||||
elif scancode_with_modifiers == KEY_DELETE || scancode_with_modifiers == KEY_BACKSPACE:
|
|
||||||
remove_selection()
|
remove_selection()
|
||||||
|
|
||||||
# Misc. useful functions
|
# Misc. useful functions
|
||||||
|
@ -26,6 +26,8 @@ const MENU = [
|
|||||||
{ menu="Edit", command="edit_cut", shortcut="Control+X", description="Cut" },
|
{ menu="Edit", command="edit_cut", shortcut="Control+X", description="Cut" },
|
||||||
{ menu="Edit", command="edit_copy", shortcut="Control+C", description="Copy" },
|
{ menu="Edit", command="edit_copy", shortcut="Control+C", description="Copy" },
|
||||||
{ menu="Edit", command="edit_paste", shortcut="Control+V", description="Paste" },
|
{ 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", submenu="create", description="Create" },
|
||||||
{ menu="Tools", command="create_subgraph", shortcut="Control+G", description="Create group" },
|
{ 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" },
|
{ menu="Tools", command="make_selected_nodes_editable", shortcut="Control+F", description="Make selected nodes editable" },
|
||||||
@ -232,7 +234,6 @@ func quit():
|
|||||||
else:
|
else:
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
|
|
||||||
func edit_cut():
|
func edit_cut():
|
||||||
var graph_edit : MMGraphEdit = get_current_graph_edit()
|
var graph_edit : MMGraphEdit = get_current_graph_edit()
|
||||||
if graph_edit != null:
|
if graph_edit != null:
|
||||||
@ -258,6 +259,15 @@ func edit_paste():
|
|||||||
func edit_paste_is_disabled():
|
func edit_paste_is_disabled():
|
||||||
var data = parse_json(OS.clipboard)
|
var data = parse_json(OS.clipboard)
|
||||||
return data == null
|
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():
|
func get_selected_nodes():
|
||||||
var graph_edit : MMGraphEdit = get_current_graph_edit()
|
var graph_edit : MMGraphEdit = get_current_graph_edit()
|
||||||
|
@ -46,16 +46,23 @@ margin_bottom = 20.0
|
|||||||
text = "Edit"
|
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 ]
|
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_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
|
margin_bottom = 20.0
|
||||||
text = "Tools"
|
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 ]
|
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"]
|
[node name="Help" type="MenuButton" parent="VBoxContainer/Menu"]
|
||||||
margin_left = 129.0
|
margin_left = 175.0
|
||||||
margin_right = 171.0
|
margin_right = 217.0
|
||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
text = "Help"
|
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 ]
|
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="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="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="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="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="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"]
|
[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"]
|
||||||
|
Loading…
Reference in New Issue
Block a user