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)
func source_changed(__):
emit_signal("parameter_changed", "__input_changed__", 0)
for i in range(get_output_defs().size()):
notify_output_change(i)

View File

@ -28,25 +28,26 @@ func on_offset_changed():
func on_parameter_changed(p, v):
if ignore_parameter_change == p:
return
var o = controls[p]
if o is LineEdit:
o.text = str(v)
elif o is SpinBox:
o.value = v
elif o is HSlider:
o.value = v
elif o is OptionButton:
o.selected = v
elif o is CheckBox:
o.pressed = v
elif o is ColorPickerButton:
o.color = MMType.deserialize_value(v)
elif o is MMGradientEditor:
var gradient : MMGradient = MMGradient.new()
gradient.deserialize(v)
o.value = gradient
else:
print("unsupported widget "+str(o))
if controls.has(p):
var o = controls[p]
if o is LineEdit:
o.text = str(v)
elif o is SpinBox:
o.value = v
elif o is HSlider:
o.value = v
elif o is OptionButton:
o.selected = v
elif o is CheckBox:
o.pressed = v
elif o is ColorPickerButton:
o.color = MMType.deserialize_value(v)
elif o is MMGradientEditor:
var gradient : MMGradient = MMGradient.new()
gradient.deserialize(v)
o.value = gradient
else:
print("unsupported widget "+str(o))
update_shaders()
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/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]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 48, 32, 16, 16 )
[sub_resource type="AtlasTexture" id=4]
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 32, 32, 16, 16 )
@ -19,7 +19,7 @@ region = Rect2( 32, 32, 16, 16 )
margin_right = 95.0
margin_bottom = 52.0
mouse_filter = 1
theme = SubResource( 3 )
theme = SubResource( 1 )
title = "Remote"
show_close = true
slot/0/left_enabled = false
@ -61,7 +61,7 @@ margin_left = 32.0
margin_right = 60.0
margin_bottom = 22.0
hint_tooltip = "Add configurations"
icon = SubResource( 4 )
icon = SubResource( 3 )
[connection signal="close_request" from="." to="." method="on_close_request"]
[connection signal="offset_changed" from="." to="." method="on_offset_changed"]
[connection signal="pressed" from="HBoxContainer/AddLink" to="." method="_on_AddLink_pressed"]

View File

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