mirror of
https://github.com/Relintai/material-maker.git
synced 2025-01-09 05:39:38 +01:00
More fixes and cleanup
This commit is contained in:
parent
be2e7f6e59
commit
82f83ca482
@ -23,6 +23,9 @@ func get_parameter_defs():
|
|||||||
func get_input_defs():
|
func get_input_defs():
|
||||||
return [ { name="in", type="rgba" } ]
|
return [ { name="in", type="rgba" } ]
|
||||||
|
|
||||||
|
func get_output_defs():
|
||||||
|
return [ { type="rgba" } ]
|
||||||
|
|
||||||
func _get_shader_code(uv : String, output_index : int, context : MMGenContext):
|
func _get_shader_code(uv : String, output_index : int, context : MMGenContext):
|
||||||
var source = get_source(0)
|
var source = get_source(0)
|
||||||
if source != null:
|
if source != null:
|
||||||
|
@ -33,6 +33,15 @@ func get_output_defs():
|
|||||||
func set_shader_model(data: Dictionary):
|
func set_shader_model(data: Dictionary):
|
||||||
shader_model = data
|
shader_model = data
|
||||||
init_parameters()
|
init_parameters()
|
||||||
|
if shader_model.has("outputs"):
|
||||||
|
for i in range(shader_model.outputs.size()):
|
||||||
|
var output = shader_model.outputs[i]
|
||||||
|
if output.has("rgba"):
|
||||||
|
shader_model.outputs[i].type = "rgba"
|
||||||
|
elif output.has("rgb"):
|
||||||
|
shader_model.outputs[i].type = "rgb"
|
||||||
|
else:
|
||||||
|
shader_model.outputs[i].type = "f"
|
||||||
|
|
||||||
func find_keyword_call(string, keyword):
|
func find_keyword_call(string, keyword):
|
||||||
var search_string = "$%s(" % keyword
|
var search_string = "$%s(" % keyword
|
||||||
|
@ -64,7 +64,9 @@ func remove_node(node):
|
|||||||
# Global operations on graph
|
# Global operations on graph
|
||||||
|
|
||||||
func update_tab_title():
|
func update_tab_title():
|
||||||
|
print("update_tab_title")
|
||||||
if !get_parent().has_method("set_tab_title"):
|
if !get_parent().has_method("set_tab_title"):
|
||||||
|
print("no set_tab_title method")
|
||||||
return
|
return
|
||||||
var title = "[unnamed]"
|
var title = "[unnamed]"
|
||||||
if save_path != null:
|
if save_path != null:
|
||||||
@ -115,7 +117,7 @@ func new_material():
|
|||||||
if generator != null:
|
if generator != null:
|
||||||
add_child(generator)
|
add_child(generator)
|
||||||
update_graph(generator.get_children(), generator.connections)
|
update_graph(generator.get_children(), generator.connections)
|
||||||
set_save_path(filename)
|
set_save_path(null)
|
||||||
set_need_save(false)
|
set_need_save(false)
|
||||||
center_view()
|
center_view()
|
||||||
|
|
||||||
|
@ -180,17 +180,14 @@ func update_node():
|
|||||||
var outputs = generator.get_output_defs()
|
var outputs = generator.get_output_defs()
|
||||||
for i in range(outputs.size()):
|
for i in range(outputs.size()):
|
||||||
var output = outputs[i]
|
var output = outputs[i]
|
||||||
var enable_right = false
|
var enable_right = true
|
||||||
var color_right = Color(0.5, 0.5, 0.5)
|
var color_right = Color(0.5, 0.5, 0.5)
|
||||||
if typeof(output) == TYPE_DICTIONARY:
|
assert(typeof(output) == TYPE_DICTIONARY)
|
||||||
if output.has("rgb"):
|
assert(output.has("type"))
|
||||||
enable_right = true
|
enable_right = true
|
||||||
color_right = Color(0.5, 0.5, 1.0)
|
match output.type:
|
||||||
elif output.has("rgba"):
|
"rgb": color_right = Color(0.5, 0.5, 1.0)
|
||||||
enable_right = true
|
"rgba": color_right = Color(0.0, 0.5, 0.0, 0.5)
|
||||||
color_right = Color(0.0, 0.5, 0.0, 0.5)
|
|
||||||
elif output.has("f"):
|
|
||||||
enable_right = true
|
|
||||||
set_slot(i, is_slot_enabled_left(i), get_slot_type_left(i), get_slot_color_left(i), enable_right, 0, color_right)
|
set_slot(i, is_slot_enabled_left(i), get_slot_type_left(i), get_slot_color_left(i), enable_right, 0, color_right)
|
||||||
if i >= get_child_count():
|
if i >= get_child_count():
|
||||||
var control = Control.new()
|
var control = Control.new()
|
||||||
|
@ -4,31 +4,15 @@
|
|||||||
|
|
||||||
[sub_resource type="Theme" id=1]
|
[sub_resource type="Theme" id=1]
|
||||||
|
|
||||||
|
[node name="Warp" type="GraphNode"]
|
||||||
[node name="Warp" type="GraphNode" index="0"]
|
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 1.0
|
margin_left = 1.0
|
||||||
margin_top = 1.0
|
margin_top = 1.0
|
||||||
margin_right = 91.0
|
margin_right = 91.0
|
||||||
margin_bottom = 84.0
|
margin_bottom = 84.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 1
|
|
||||||
size_flags_vertical = 1
|
|
||||||
theme = SubResource( 1 )
|
theme = SubResource( 1 )
|
||||||
title = "Warp"
|
title = "Warp"
|
||||||
offset = Vector2( 0, 0 )
|
|
||||||
show_close = true
|
show_close = true
|
||||||
resizable = false
|
|
||||||
selected = false
|
|
||||||
comment = false
|
|
||||||
overlay = 0
|
|
||||||
slot/0/left_enabled = true
|
slot/0/left_enabled = true
|
||||||
slot/0/left_type = 0
|
slot/0/left_type = 0
|
||||||
slot/0/left_color = Color( 0.5, 0.5, 1, 1 )
|
slot/0/left_color = Color( 0.5, 0.5, 1, 1 )
|
||||||
@ -48,78 +32,27 @@ slot/2/right_enabled = false
|
|||||||
slot/2/right_type = 0
|
slot/2/right_type = 0
|
||||||
slot/2/right_color = Color( 1, 1, 1, 1 )
|
slot/2/right_color = Color( 1, 1, 1, 1 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
_sections_unfolded = [ "Theme", "slot", "slot/1" ]
|
|
||||||
|
|
||||||
[node name="Label1" type="Label" parent="." index="0"]
|
[node name="Label1" type="Label" parent="."]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 16.0
|
margin_left = 16.0
|
||||||
margin_top = 24.0
|
margin_top = 24.0
|
||||||
margin_right = 90.0
|
margin_right = 90.0
|
||||||
margin_bottom = 38.0
|
margin_bottom = 38.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 1
|
|
||||||
size_flags_vertical = 4
|
|
||||||
text = "Source"
|
text = "Source"
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="Label2" type="Label" parent="." index="1"]
|
[node name="Label2" type="Label" parent="."]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 16.0
|
margin_left = 16.0
|
||||||
margin_top = 38.0
|
margin_top = 38.0
|
||||||
margin_right = 90.0
|
margin_right = 90.0
|
||||||
margin_bottom = 52.0
|
margin_bottom = 52.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 2
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 1
|
|
||||||
size_flags_vertical = 4
|
|
||||||
text = "Displace"
|
text = "Displace"
|
||||||
percent_visible = 1.0
|
|
||||||
lines_skipped = 0
|
|
||||||
max_lines_visible = -1
|
|
||||||
|
|
||||||
[node name="amount" type="SpinBox" parent="." index="2"]
|
[node name="amount" type="SpinBox" parent="."]
|
||||||
|
|
||||||
anchor_left = 0.0
|
|
||||||
anchor_top = 0.0
|
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
margin_left = 16.0
|
margin_left = 16.0
|
||||||
margin_top = 53.0
|
margin_top = 53.0
|
||||||
margin_right = 90.0
|
margin_right = 90.0
|
||||||
margin_bottom = 77.0
|
margin_bottom = 77.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
|
||||||
rect_clip_content = false
|
|
||||||
mouse_filter = 0
|
|
||||||
mouse_default_cursor_shape = 0
|
|
||||||
size_flags_horizontal = 1
|
|
||||||
size_flags_vertical = 1
|
|
||||||
min_value = 0.0
|
|
||||||
max_value = 1.0
|
max_value = 1.0
|
||||||
step = 0.05
|
step = 0.05
|
||||||
page = 0.0
|
|
||||||
value = 0.5
|
value = 0.5
|
||||||
exp_edit = false
|
|
||||||
rounded = false
|
|
||||||
editable = true
|
|
||||||
prefix = ""
|
|
||||||
suffix = ""
|
|
||||||
_sections_unfolded = [ "Caret", "Placeholder" ]
|
|
||||||
|
|
||||||
[connection signal="close_request" from="." to="." method="queue_free"]
|
[connection signal="close_request" from="." to="." method="queue_free"]
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ func set_value(v):
|
|||||||
remove_child(c)
|
remove_child(c)
|
||||||
c.free()
|
c.free()
|
||||||
for p in value.points:
|
for p in value.points:
|
||||||
print(p)
|
|
||||||
add_cursor(p.v*(rect_size.x-GradientCursor.WIDTH), p.c)
|
add_cursor(p.v*(rect_size.x-GradientCursor.WIDTH), p.c)
|
||||||
update_shader()
|
update_shader()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user