Added an Apply button to the node editor window

This commit is contained in:
RodZill4 2018-11-20 07:46:51 +01:00
parent 3bb9dd50db
commit 65a08b4650
3 changed files with 37 additions and 7 deletions

View File

@ -3,7 +3,7 @@ extends "res://addons/material_maker/nodes/node_generic.gd"
func _on_Edit_pressed(): func _on_Edit_pressed():
var edit_window = load("res://addons/material_maker/widgets/node_editor/node_editor.tscn").instance() var edit_window = load("res://addons/material_maker/widgets/node_editor/node_editor.tscn").instance()
add_child(edit_window) get_parent().add_child(edit_window)
if model_data != null: if model_data != null:
edit_window.set_model_data(model_data) edit_window.set_model_data(model_data)
edit_window.connect("node_changed", self, "update_node") edit_window.connect("node_changed", self, "update_node")

View File

@ -61,6 +61,9 @@ func _on_AddInput_pressed():
func _on_AddOutput_pressed(): func _on_AddOutput_pressed():
add_item($Sizer/Tabs/Outputs/Outputs/Sizer, OutputEditor) add_item($Sizer/Tabs/Outputs/Outputs/Sizer, OutputEditor)
func _on_Apply_pressed():
emit_signal("node_changed", get_model_data())
func _on_OK_pressed(): func _on_OK_pressed():
emit_signal("node_changed", get_model_data()) emit_signal("node_changed", get_model_data())
queue_free() queue_free()

View File

@ -3,7 +3,7 @@
[ext_resource path="res://addons/material_maker/widgets/node_editor/node_editor.gd" type="Script" id=1] [ext_resource path="res://addons/material_maker/widgets/node_editor/node_editor.gd" type="Script" id=1]
[ext_resource path="res://addons/material_maker/icons/plus.png" type="Texture" id=2] [ext_resource path="res://addons/material_maker/icons/plus.png" type="Texture" id=2]
[node name="NodeEditor" type="WindowDialog"] [node name="NodeEditor" type="WindowDialog" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -482,9 +482,9 @@ anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_left = 344.0 margin_left = 307.0
margin_top = 378.0 margin_top = 378.0
margin_right = 488.0 margin_right = 525.0
margin_bottom = 398.0 margin_bottom = 398.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
@ -495,7 +495,7 @@ size_flags_vertical = 1
alignment = 0 alignment = 0
_sections_unfolded = [ "Size Flags" ] _sections_unfolded = [ "Size Flags" ]
[node name="OK" type="Button" parent="Sizer/HBoxContainer" index="0"] [node name="Apply" type="Button" parent="Sizer/HBoxContainer" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -515,11 +515,11 @@ toggle_mode = false
enabled_focus_mode = 2 enabled_focus_mode = 2
shortcut = null shortcut = null
group = null group = null
text = "OK" text = "Apply"
flat = false flat = false
align = 1 align = 1
[node name="Cancel" type="Button" parent="Sizer/HBoxContainer" index="1"] [node name="OK" type="Button" parent="Sizer/HBoxContainer" index="1"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -540,6 +540,31 @@ toggle_mode = false
enabled_focus_mode = 2 enabled_focus_mode = 2
shortcut = null shortcut = null
group = null group = null
text = "OK"
flat = false
align = 1
[node name="Cancel" type="Button" parent="Sizer/HBoxContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 148.0
margin_right = 218.0
margin_bottom = 20.0
rect_min_size = Vector2( 70, 0 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Cancel" text = "Cancel"
flat = false flat = false
align = 1 align = 1
@ -550,6 +575,8 @@ align = 1
[connection signal="pressed" from="Sizer/Tabs/Outputs/Outputs/Sizer/AddOutput" to="." method="_on_AddOutput_pressed"] [connection signal="pressed" from="Sizer/Tabs/Outputs/Outputs/Sizer/AddOutput" to="." method="_on_AddOutput_pressed"]
[connection signal="pressed" from="Sizer/HBoxContainer/Apply" to="." method="_on_Apply_pressed"]
[connection signal="pressed" from="Sizer/HBoxContainer/OK" to="." method="_on_OK_pressed"] [connection signal="pressed" from="Sizer/HBoxContainer/OK" to="." method="_on_OK_pressed"]
[connection signal="pressed" from="Sizer/HBoxContainer/Cancel" to="." method="_on_Cancel_pressed"] [connection signal="pressed" from="Sizer/HBoxContainer/Cancel" to="." method="_on_Cancel_pressed"]