Minor fixes and cleanup

This commit is contained in:
RodZill4 2019-09-10 21:01:08 +02:00
parent 27d5ddbe97
commit 34349c98ca
8 changed files with 31 additions and 320 deletions

View File

@ -16,7 +16,7 @@ func get_variant(generator, uv):
if variants.has(generator):
rv = variants[generator].find(uv)
if rv == -1:
variants[generator].push(uv)
variants[generator].push_back(uv)
else:
variants[generator] = [uv]
return rv

View File

@ -12,11 +12,11 @@ func get_output_defs():
return [ { rgba="" } ]
func _get_shader_code(uv : String, output_index : int, context : MMGenContext):
var rv = { defs="" }
var rv = { defs="", code="" }
var texture_name = name+"_tex"
var variant_index = context.get_variant(self, uv)
if variant_index == -1:
variant_index = context.get_variant(self, uv)
var texture_name = name+"_tex"
rv.code = "vec4 %s_%d = texture(%s, %s);\n" % [ name, variant_index, texture_name, uv ]
rv.rgba = "%s_%d" % [ name, variant_index ]
rv.textures = { texture_name:texture }

View File

@ -40,7 +40,6 @@ func add_node(node):
node.connect("close_request", self, "remove_node", [ node ])
func connect_node(from, from_slot, to, to_slot):
print("Connecting "+str(from)+"("+str(from_slot)+") to "+str(to)+"("+str(to_slot)+")")
if generator.connect_children(get_node(from).generator, from_slot, get_node(to).generator, to_slot):
var disconnect = get_source(to, to_slot)
if disconnect != null:

View File

@ -42,14 +42,14 @@ margin_left = 79.0
margin_right = 125.0
margin_bottom = 20.0
text = "Tools"
items = [ "Add selected node to user library", null, 0, false, false, 15, 0, null, "", false, "Save user library", null, 0, false, false, 16, 0, null, "", false ]
items = [ "Make selected nodes editable", null, 0, false, false, 15, 0, null, "", false, "Add selected node to user library", null, 0, false, false, 16, 0, null, "", false, "Save user library", null, 0, false, false, 17, 0, null, "", false ]
[node name="Help" type="MenuButton" parent="VBoxContainer/Menu"]
margin_left = 129.0
margin_right = 171.0
margin_bottom = 20.0
text = "Help"
items = [ "User manual", null, 0, false, false, 17, 0, null, "", false, "Report a bug", null, 0, false, false, 18, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "About", null, 0, false, false, 20, 0, null, "", false ]
items = [ "User manual", null, 0, false, false, 18, 0, null, "", false, "Report a bug", null, 0, false, false, 19, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "About", null, 0, false, false, 21, 0, null, "", false ]
[node name="HBoxContainer" type="HSplitContainer" parent="VBoxContainer"]
margin_top = 24.0

View File

@ -1 +1 @@
{"name":"uniform","node_position":{"x":-130,"y":-66},"parameters":{"color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"name":0},"shader_model":{"global":"","inputs":[{"default":"0.0","label":"R","name":"r","type":"f"},{"default":"0.0","label":"G","name":"g","type":"f"},{"default":"0.0","label":"B","name":"b","type":"f"},{"default":"1.0","label":"A","name":"a","type":"f"}],"instance":"","name":"Combine","outputs":[{"rgba":"vec4($r($uv), $g($uv), $b($uv), $a($uv))"}],"parameters":[]}}
{"name":"uniform","node_position":{"x":0,"y":0},"parameters":{"color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"name":0},"shader_model":{"global":"","inputs":[{"default":"0.0","label":"R","name":"r","type":"f"},{"default":"0.0","label":"G","name":"g","type":"f"},{"default":"0.0","label":"B","name":"b","type":"f"},{"default":"1.0","label":"A","name":"a","type":"f"}],"instance":"","name":"Combine","outputs":[{"rgba":"vec4($r($uv), $g($uv), $b($uv), $a($uv))"}],"parameters":[]}}

View File

@ -0,0 +1 @@
{"name":"decompose","node_position":{"x":0,"y":0},"parameters":{},"shader_model":{"global":"","inputs":[{"default":"vec4(1.0)","label":"","name":"i","type":"rgba"}],"instance":"","name":"Decompose","outputs":[{"f":"$i($uv).r"},{"f":"$i($uv).g"},{"f":"$i($uv).b"},{"f":"$i($uv).a"}],"parameters":[]}}

View File

@ -13,7 +13,6 @@ func set_generator(g):
update_node()
func on_close_request():
print("close")
generator.get_parent().remove_generator(generator)
func on_offset_changed():
@ -205,7 +204,6 @@ func load_generator():
dialog.popup_centered()
func do_load_generator(file_name : String):
print(file_name)
var new_generator = null
if file_name.ends_with(".mmn"):
var file = File.new()
@ -217,10 +215,8 @@ func do_load_generator(file_name : String):
new_generator = MMGenLoader.load_gen(file_name)
if new_generator != null:
var parent_generator = generator.get_parent()
print("before: "+generator.name)
parent_generator.replace_generator(generator, new_generator)
generator = new_generator
print("after: "+generator.name)
update_node()
func save_generator():
@ -235,6 +231,7 @@ func save_generator():
func do_save_generator(file_name : String):
var data = generator.serialize()
data.node_position = { x=0, y=0 }
var file = File.new()
if file.open(file_name, File.WRITE) == OK:
file.store_string(to_json(data))

View File

@ -4,37 +4,21 @@
[sub_resource type="Theme" id=1]
[node name="Transform" type="GraphNode" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Transform" type="GraphNode"]
margin_left = 1.0
margin_top = 1.0
margin_right = 185.0
margin_bottom = 179.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 = "Transform"
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, 1, 0, 0.502784 )
slot/0/left_color = Color( 0.5, 0.5, 1, 1 )
slot/0/right_enabled = true
slot/0/right_type = 0
slot/0/right_color = Color( 0, 1, 0, 0.501961 )
slot/0/right_color = Color( 0.5, 0.5, 1, 1 )
slot/1/left_enabled = true
slot/1/left_type = 0
slot/1/left_color = Color( 0.760784, 0.760784, 0.760784, 1 )
@ -72,422 +56,152 @@ slot/6/right_enabled = false
slot/6/right_type = 0
slot/6/right_color = Color( 1, 1, 1, 1 )
script = ExtResource( 1 )
_sections_unfolded = [ "Theme", "slot", "slot/0", "slot/1", "slot/2" ]
[node name="HBoxContainer0" type="HBoxContainer" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="HBoxContainer0" type="HBoxContainer" parent="."]
margin_left = 16.0
margin_top = 24.0
margin_right = 168.0
margin_bottom = 44.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
alignment = 0
[node name="Input" type="Label" parent="HBoxContainer0" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Input" type="Label" parent="HBoxContainer0"]
margin_right = 74.0
margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Input"
valign = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="Output" type="Label" parent="HBoxContainer0" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Output" type="Label" parent="HBoxContainer0"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 20.0
rect_min_size = Vector2( 0, 20 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Output"
align = 2
valign = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="HBoxContainer1" type="HBoxContainer" parent="." index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="HBoxContainer1" type="HBoxContainer" parent="."]
margin_left = 16.0
margin_top = 44.0
margin_right = 168.0
margin_bottom = 68.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
alignment = 0
[node name="Label" type="Label" parent="HBoxContainer1" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Label" type="Label" parent="HBoxContainer1"]
margin_top = 5.0
margin_right = 74.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Translate X:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="translate_x" type="SpinBox" parent="HBoxContainer1" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="translate_x" type="SpinBox" parent="HBoxContainer1"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 0
size_flags_vertical = 4
min_value = -1.0
max_value = 1.0
step = 0.05
page = 0.0
value = 0.0
exp_edit = false
rounded = false
editable = true
prefix = ""
suffix = ""
_sections_unfolded = [ "Caret", "Placeholder", "Rect" ]
[node name="HBoxContainer2" type="HBoxContainer" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
margin_left = 16.0
margin_top = 69.0
margin_right = 168.0
margin_bottom = 93.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
alignment = 0
[node name="Label" type="Label" parent="HBoxContainer2" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Label" type="Label" parent="HBoxContainer2"]
margin_top = 5.0
margin_right = 74.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Translate Y:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="translate_y" type="SpinBox" parent="HBoxContainer2" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="translate_y" type="SpinBox" parent="HBoxContainer2"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 0
size_flags_vertical = 4
min_value = -1.0
max_value = 1.0
step = 0.05
page = 0.0
value = 0.0
exp_edit = false
rounded = false
editable = true
prefix = ""
suffix = ""
_sections_unfolded = [ "Caret", "Placeholder" ]
[node name="HBoxContainer3" type="HBoxContainer" parent="." index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="HBoxContainer3" type="HBoxContainer" parent="."]
margin_left = 16.0
margin_top = 94.0
margin_right = 168.0
margin_bottom = 118.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
alignment = 0
[node name="Label" type="Label" parent="HBoxContainer3" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Label" type="Label" parent="HBoxContainer3"]
margin_top = 5.0
margin_right = 74.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Rotate:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags" ]
[node name="rotate" type="SpinBox" parent="HBoxContainer3" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="rotate" type="SpinBox" parent="HBoxContainer3"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 0
size_flags_vertical = 4
min_value = -720.0
max_value = 720.0
step = 5.0
page = 0.0
value = 0.0
exp_edit = false
rounded = false
editable = true
prefix = ""
suffix = ""
_sections_unfolded = [ "Caret", "Placeholder", "Size Flags" ]
[node name="HBoxContainer4" type="HBoxContainer" parent="." index="4"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="HBoxContainer4" type="HBoxContainer" parent="."]
margin_left = 16.0
margin_top = 119.0
margin_right = 168.0
margin_bottom = 143.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
alignment = 0
[node name="Label" type="Label" parent="HBoxContainer4" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Label" type="Label" parent="HBoxContainer4"]
margin_top = 5.0
margin_right = 74.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Scale X:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags" ]
[node name="scale_x" type="SpinBox" parent="HBoxContainer4" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="scale_x" type="SpinBox" parent="HBoxContainer4"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 0
size_flags_vertical = 4
min_value = 0.05
max_value = 50.0
step = 0.05
page = 0.0
value = 1.0
exp_edit = false
rounded = false
editable = true
prefix = ""
suffix = ""
_sections_unfolded = [ "Caret", "Placeholder" ]
[node name="HBoxContainer5" type="HBoxContainer" parent="." index="5"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="HBoxContainer5" type="HBoxContainer" parent="."]
margin_left = 16.0
margin_top = 144.0
margin_right = 168.0
margin_bottom = 168.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
alignment = 0
[node name="Label" type="Label" parent="HBoxContainer5" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="Label" type="Label" parent="HBoxContainer5"]
margin_top = 5.0
margin_right = 74.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Scale Y:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags" ]
[node name="scale_y" type="SpinBox" parent="HBoxContainer5" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="scale_y" type="SpinBox" parent="HBoxContainer5"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 0
size_flags_vertical = 4
min_value = 0.05
max_value = 50.0
step = 0.05
page = 0.0
value = 1.0
exp_edit = false
rounded = false
editable = true
prefix = ""
suffix = ""
_sections_unfolded = [ "Caret", "Placeholder" ]
[node name="repeat" type="CheckBox" parent="." index="6"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="repeat" type="CheckBox" parent="."]
margin_left = 16.0
margin_top = 169.0
margin_right = 168.0
margin_bottom = 193.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 = true
pressed = true
enabled_focus_mode = 2
shortcut = null
group = null
text = "Repeat"
flat = false
align = 0