mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
More fixes and cleanup
This commit is contained in:
parent
be2e7f6e59
commit
82f83ca482
@ -22,6 +22,9 @@ func get_parameter_defs():
|
||||
|
||||
func get_input_defs():
|
||||
return [ { name="in", type="rgba" } ]
|
||||
|
||||
func get_output_defs():
|
||||
return [ { type="rgba" } ]
|
||||
|
||||
func _get_shader_code(uv : String, output_index : int, context : MMGenContext):
|
||||
var source = get_source(0)
|
||||
|
@ -33,6 +33,15 @@ func get_output_defs():
|
||||
func set_shader_model(data: Dictionary):
|
||||
shader_model = data
|
||||
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):
|
||||
var search_string = "$%s(" % keyword
|
||||
|
@ -64,7 +64,9 @@ func remove_node(node):
|
||||
# Global operations on graph
|
||||
|
||||
func update_tab_title():
|
||||
print("update_tab_title")
|
||||
if !get_parent().has_method("set_tab_title"):
|
||||
print("no set_tab_title method")
|
||||
return
|
||||
var title = "[unnamed]"
|
||||
if save_path != null:
|
||||
@ -115,7 +117,7 @@ func new_material():
|
||||
if generator != null:
|
||||
add_child(generator)
|
||||
update_graph(generator.get_children(), generator.connections)
|
||||
set_save_path(filename)
|
||||
set_save_path(null)
|
||||
set_need_save(false)
|
||||
center_view()
|
||||
|
||||
|
@ -180,17 +180,14 @@ func update_node():
|
||||
var outputs = generator.get_output_defs()
|
||||
for i in range(outputs.size()):
|
||||
var output = outputs[i]
|
||||
var enable_right = false
|
||||
var enable_right = true
|
||||
var color_right = Color(0.5, 0.5, 0.5)
|
||||
if typeof(output) == TYPE_DICTIONARY:
|
||||
if output.has("rgb"):
|
||||
enable_right = true
|
||||
color_right = Color(0.5, 0.5, 1.0)
|
||||
elif output.has("rgba"):
|
||||
enable_right = true
|
||||
color_right = Color(0.0, 0.5, 0.0, 0.5)
|
||||
elif output.has("f"):
|
||||
enable_right = true
|
||||
assert(typeof(output) == TYPE_DICTIONARY)
|
||||
assert(output.has("type"))
|
||||
enable_right = true
|
||||
match output.type:
|
||||
"rgb": color_right = Color(0.5, 0.5, 1.0)
|
||||
"rgba": color_right = Color(0.0, 0.5, 0.0, 0.5)
|
||||
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():
|
||||
var control = Control.new()
|
||||
|
@ -4,31 +4,15 @@
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
|
||||
[node name="Warp" type="GraphNode" index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
[node name="Warp" type="GraphNode"]
|
||||
margin_left = 1.0
|
||||
margin_top = 1.0
|
||||
margin_right = 91.0
|
||||
margin_bottom = 84.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 1
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
theme = SubResource( 1 )
|
||||
title = "Warp"
|
||||
offset = Vector2( 0, 0 )
|
||||
show_close = true
|
||||
resizable = false
|
||||
selected = false
|
||||
comment = false
|
||||
overlay = 0
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
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_color = Color( 1, 1, 1, 1 )
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Theme", "slot", "slot/1" ]
|
||||
|
||||
[node name="Label1" type="Label" parent="." index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
[node name="Label1" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 90.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"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="Label2" type="Label" parent="." index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 38.0
|
||||
margin_right = 90.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"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="amount" type="SpinBox" parent="." index="2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
[node name="amount" type="SpinBox" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 53.0
|
||||
margin_right = 90.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
|
||||
step = 0.05
|
||||
page = 0.0
|
||||
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"]
|
||||
|
||||
|
||||
|
@ -56,7 +56,6 @@ func set_value(v):
|
||||
remove_child(c)
|
||||
c.free()
|
||||
for p in value.points:
|
||||
print(p)
|
||||
add_cursor(p.v*(rect_size.x-GradientCursor.WIDTH), p.c)
|
||||
update_shader()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user