Fixed preview update problem

This commit is contained in:
RodZill4 2019-10-09 20:39:08 +02:00
parent f66cd9a71b
commit 3adeffe23c
4 changed files with 32 additions and 31 deletions

View File

@ -68,6 +68,7 @@ func notify_output_change(output_index : int):
target.generator.source_changed(target.input_index) target.generator.source_changed(target.input_index)
func source_changed(__): func source_changed(__):
emit_signal("parameter_changed", "__input_changed__", 0)
for i in range(get_output_defs().size()): for i in range(get_output_defs().size()):
notify_output_change(i) notify_output_change(i)

View File

@ -28,25 +28,26 @@ func on_offset_changed():
func on_parameter_changed(p, v): func on_parameter_changed(p, v):
if ignore_parameter_change == p: if ignore_parameter_change == p:
return return
var o = controls[p] if controls.has(p):
if o is LineEdit: var o = controls[p]
o.text = str(v) if o is LineEdit:
elif o is SpinBox: o.text = str(v)
o.value = v elif o is SpinBox:
elif o is HSlider: o.value = v
o.value = v elif o is HSlider:
elif o is OptionButton: o.value = v
o.selected = v elif o is OptionButton:
elif o is CheckBox: o.selected = v
o.pressed = v elif o is CheckBox:
elif o is ColorPickerButton: o.pressed = v
o.color = MMType.deserialize_value(v) elif o is ColorPickerButton:
elif o is MMGradientEditor: o.color = MMType.deserialize_value(v)
var gradient : MMGradient = MMGradient.new() elif o is MMGradientEditor:
gradient.deserialize(v) var gradient : MMGradient = MMGradient.new()
o.value = gradient gradient.deserialize(v)
else: o.value = gradient
print("unsupported widget "+str(o)) else:
print("unsupported widget "+str(o))
update_shaders() update_shaders()
func initialize_properties(): func initialize_properties():

View File

@ -3,14 +3,14 @@
[ext_resource path="res://addons/material_maker/nodes/remote.gd" type="Script" id=1] [ext_resource path="res://addons/material_maker/nodes/remote.gd" type="Script" id=1]
[ext_resource path="res://addons/material_maker/icons/icons.svg" type="Texture" id=2] [ext_resource path="res://addons/material_maker/icons/icons.svg" type="Texture" id=2]
[sub_resource type="Theme" id=3] [sub_resource type="Theme" id=1]
[sub_resource type="AtlasTexture" id=2] [sub_resource type="AtlasTexture" id=2]
flags = 4 flags = 4
atlas = ExtResource( 2 ) atlas = ExtResource( 2 )
region = Rect2( 48, 32, 16, 16 ) region = Rect2( 48, 32, 16, 16 )
[sub_resource type="AtlasTexture" id=4] [sub_resource type="AtlasTexture" id=3]
flags = 4 flags = 4
atlas = ExtResource( 2 ) atlas = ExtResource( 2 )
region = Rect2( 32, 32, 16, 16 ) region = Rect2( 32, 32, 16, 16 )
@ -19,7 +19,7 @@ region = Rect2( 32, 32, 16, 16 )
margin_right = 95.0 margin_right = 95.0
margin_bottom = 52.0 margin_bottom = 52.0
mouse_filter = 1 mouse_filter = 1
theme = SubResource( 3 ) theme = SubResource( 1 )
title = "Remote" title = "Remote"
show_close = true show_close = true
slot/0/left_enabled = false slot/0/left_enabled = false
@ -61,7 +61,7 @@ margin_left = 32.0
margin_right = 60.0 margin_right = 60.0
margin_bottom = 22.0 margin_bottom = 22.0
hint_tooltip = "Add configurations" hint_tooltip = "Add configurations"
icon = SubResource( 4 ) icon = SubResource( 3 )
[connection signal="close_request" from="." to="." method="on_close_request"] [connection signal="close_request" from="." to="." method="on_close_request"]
[connection signal="offset_changed" from="." to="." method="on_offset_changed"] [connection signal="offset_changed" from="." to="." method="on_offset_changed"]
[connection signal="pressed" from="HBoxContainer/AddLink" to="." method="_on_AddLink_pressed"] [connection signal="pressed" from="HBoxContainer/AddLink" to="." method="_on_AddLink_pressed"]

View File

@ -16,35 +16,34 @@ size = 12
font_data = SubResource( 2 ) font_data = SubResource( 2 )
[node name="Output" type="HBoxContainer"] [node name="Output" type="HBoxContainer"]
margin_right = 201.0 margin_right = 251.0
margin_bottom = 24.0 margin_bottom = 22.0
size_flags_horizontal = 3 size_flags_horizontal = 3
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Delete" type="Button" parent="."] [node name="Delete" type="Button" parent="."]
margin_right = 28.0 margin_right = 28.0
margin_bottom = 24.0 margin_bottom = 25.0
icon = SubResource( 1 ) icon = SubResource( 1 )
flat = true flat = true
[node name="Type" type="OptionButton" parent="."] [node name="Type" type="OptionButton" parent="."]
margin_left = 32.0 margin_left = 32.0
margin_right = 136.0 margin_right = 136.0
margin_bottom = 24.0 margin_bottom = 25.0
rect_min_size = Vector2( 102, 0 ) rect_min_size = Vector2( 102, 0 )
hint_tooltip = "Input flag" hint_tooltip = "Input flag"
text = "GreyScale" text = "GreyScale"
items = [ "GreyScale", null, false, 0, null, "Color", null, false, 1, null, "RGBA", null, false, -1, null ] items = [ "GreyScale", null, false, 0, null, "Color", null, false, 1, null, "RGBA", null, false, -1, null ]
selected = 0 selected = 0
[node name="Value" type="TextEdit" parent="."] [node name="Value" type="LineEdit" parent="."]
margin_left = 140.0 margin_left = 140.0
margin_right = 201.0 margin_right = 251.0
margin_bottom = 24.0 margin_bottom = 25.0
hint_tooltip = "Default value" hint_tooltip = "Default value"
size_flags_horizontal = 3 size_flags_horizontal = 3
custom_fonts/font = SubResource( 3 ) custom_fonts/font = SubResource( 3 )
text = "0.0" text = "0.0"
syntax_highlighting = true
context_menu_enabled = false context_menu_enabled = false
[connection signal="pressed" from="Delete" to="." method="_on_Delete_pressed"] [connection signal="pressed" from="Delete" to="." method="_on_Delete_pressed"]