mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
More progress on remote, bug fixes, cleanup and changes for standalone release
This commit is contained in:
parent
201f911f75
commit
bd24b3e87e
@ -21,7 +21,7 @@ const ADDON_TEXTURE_LIST = [
|
||||
{ port=0, texture="albedo" },
|
||||
{ port=3, texture="emission" },
|
||||
{ port=4, texture="normal_texture" },
|
||||
{ ports=[1, 2, 5], default_values=["0.0", "1.0", "1.0"], texture="mrao" },
|
||||
{ ports=[5, 1, 2], default_values=["1.0", "0.0", "1.0"], texture="orm" },
|
||||
{ port=6, texture="depth_texture" }
|
||||
]
|
||||
|
||||
@ -73,15 +73,16 @@ func generate_material(renderer : MMGenRenderer):
|
||||
|
||||
func render_textures(renderer : MMGenRenderer):
|
||||
for t in texture_list:
|
||||
var source = get_source(t.port)
|
||||
var texture = null
|
||||
if source != null:
|
||||
var status = source.generator.render(source.output_index, renderer, 512)
|
||||
while status is GDScriptFunctionState:
|
||||
status = yield(status, "completed")
|
||||
texture = ImageTexture.new()
|
||||
texture.create_from_image(renderer.get_texture().get_data())
|
||||
generated_textures[t.texture] = texture
|
||||
if t.has("port"):
|
||||
var source = get_source(t.port)
|
||||
var texture = null
|
||||
if source != null:
|
||||
var status = source.generator.render(source.output_index, renderer, 512)
|
||||
while status is GDScriptFunctionState:
|
||||
status = yield(status, "completed")
|
||||
texture = ImageTexture.new()
|
||||
texture.create_from_image(renderer.get_texture().get_data())
|
||||
generated_textures[t.texture] = texture
|
||||
|
||||
func update_materials(material_list):
|
||||
for m in material_list:
|
||||
|
@ -52,7 +52,6 @@ func get_parameter_defs():
|
||||
return rv
|
||||
|
||||
func set_parameter(p, v):
|
||||
.set_parameter(p, v)
|
||||
var parent = get_parent()
|
||||
var param_index = p.trim_prefix("param").to_int()
|
||||
var widget = widgets[param_index]
|
||||
@ -61,8 +60,14 @@ func set_parameter(p, v):
|
||||
for w in widget.linked_widgets:
|
||||
parent.get_node(w.node).set_parameter(w.widget, v)
|
||||
"config_control":
|
||||
for w in widget.configurations[widget.configurations.keys()[v]]:
|
||||
parent.get_node(w.node).set_parameter(w.widget, w.value)
|
||||
if v < widget.configurations.size():
|
||||
for w in widget.configurations[widget.configurations.keys()[v]]:
|
||||
parent.get_node(w.node).set_parameter(w.widget, w.value)
|
||||
else:
|
||||
# incorrect configuration index
|
||||
print("error: incorrect config control parameter value")
|
||||
return
|
||||
.set_parameter(p, v)
|
||||
|
||||
func _serialize(data):
|
||||
data.type = "remote"
|
||||
|
@ -68,7 +68,12 @@ static func create_gen(data) -> MMGenBase:
|
||||
generator = MMGenSwitch.new()
|
||||
else:
|
||||
var file = File.new()
|
||||
if file.open("res://addons/material_maker/nodes/"+data.type+".mmg", File.READ) == OK:
|
||||
var gen_path = OS.get_executable_path().get_base_dir()+"/generators"
|
||||
if file.open(gen_path+"/"+data.type+".mmg", File.READ) == OK:
|
||||
generator = create_gen(parse_json(file.get_as_text()))
|
||||
generator.model = data.type
|
||||
file.close()
|
||||
elif file.open("res://addons/material_maker/nodes/"+data.type+".mmg", File.READ) == OK:
|
||||
generator = create_gen(parse_json(file.get_as_text()))
|
||||
generator.model = data.type
|
||||
file.close()
|
||||
|
@ -91,7 +91,7 @@ func render_shader(shader, textures, render_size):
|
||||
render_target_update_mode = Viewport.UPDATE_ONCE
|
||||
update_worlds()
|
||||
yield(get_tree(), "idle_frame")
|
||||
#yield(get_tree(), "idle_frame")
|
||||
yield(get_tree(), "idle_frame")
|
||||
rendering = false
|
||||
return true
|
||||
emit_signal("done")
|
||||
|
@ -27,8 +27,7 @@ func get_drag_data(position):
|
||||
|
||||
func _ready():
|
||||
var root = create_item()
|
||||
var lib_path = OS.get_executable_path()
|
||||
lib_path = lib_path.left(max(lib_path.rfind("\\"), lib_path.rfind("/"))+1)+"library/base.json"
|
||||
var lib_path = OS.get_executable_path().get_base_dir()+"/library/base.json"
|
||||
if !add_library(lib_path):
|
||||
add_library("res://addons/material_maker/library/base.json")
|
||||
add_library("user://library/user.json")
|
||||
|
@ -96,7 +96,6 @@ tab_align = 0
|
||||
tab_close_display_policy = 1
|
||||
|
||||
[node name="Renderer" parent="." instance=ExtResource( 5 )]
|
||||
debug_path = ""
|
||||
|
||||
[node name="NodeFactory" type="Node" parent="."]
|
||||
script = ExtResource( 6 )
|
||||
|
@ -8,13 +8,9 @@ func _ready():
|
||||
|
||||
func create_node(type):
|
||||
var node = null
|
||||
if File.new().file_exists("res://addons/material_maker/nodes/"+type+".mmn"):
|
||||
node = preload("res://addons/material_maker/nodes/node_generic.gd").new()
|
||||
node.model = type
|
||||
var node_type = load("res://addons/material_maker/nodes/"+type+".tscn")
|
||||
if node_type != null:
|
||||
node = node_type.instance()
|
||||
else:
|
||||
var node_type = load("res://addons/material_maker/nodes/"+type+".tscn")
|
||||
if node_type != null:
|
||||
node = node_type.instance()
|
||||
else:
|
||||
node = preload("res://addons/material_maker/nodes/generic.tscn").instance()
|
||||
node = preload("res://addons/material_maker/nodes/generic.tscn").instance()
|
||||
return node
|
||||
|
@ -1,51 +0,0 @@
|
||||
tool
|
||||
extends "res://addons/material_maker/node_base.gd"
|
||||
|
||||
const BLEND_TYPES = [
|
||||
{ name="Normal", shortname="normal" },
|
||||
{ name="Dissolve", shortname="dissolve" },
|
||||
{ name="Multiply", shortname="multiply" },
|
||||
{ name="Screen", shortname="screen" },
|
||||
{ name="Overlay", shortname="overlay" },
|
||||
{ name="Hard Light", shortname="hard_light" },
|
||||
{ name="Soft Light", shortname="soft_light" },
|
||||
{ name="Burn", shortname="burn" },
|
||||
{ name="Dodge", shortname="dodge" },
|
||||
{ name="Lighten", shortname="lighten" },
|
||||
{ name="Darken", shortname="darken" },
|
||||
{ name="Difference", shortname="difference" }
|
||||
]
|
||||
|
||||
func _ready():
|
||||
$blend_type.clear()
|
||||
for i in range(BLEND_TYPES.size()):
|
||||
$blend_type.add_item(BLEND_TYPES[i].name, i)
|
||||
initialize_properties([ $blend_type, $HBoxContainer/amount ])
|
||||
|
||||
func _get_shader_code(uv, slot = 0):
|
||||
var rv = { defs="", code="" }
|
||||
var src0 = get_source(0)
|
||||
var src1 = get_source(1)
|
||||
var src2 = get_source(2)
|
||||
if src0 == null or src1 == null:
|
||||
return rv
|
||||
var src0_code = src0.get_shader_code(uv)
|
||||
var src1_code = src1.get_shader_code(uv)
|
||||
var src2_code = { defs="", code="" }
|
||||
var amount_str = "%.9f" % parameters.amount
|
||||
if src2 != null:
|
||||
src2_code = src2.get_shader_code(uv)
|
||||
amount_str = src2_code.f
|
||||
if generated_variants.empty():
|
||||
rv.defs = src0_code.defs+src1_code.defs+src2_code.defs
|
||||
var variant_index = generated_variants.find(uv)
|
||||
if variant_index == -1:
|
||||
variant_index = generated_variants.size()
|
||||
generated_variants.append(uv)
|
||||
rv.code = src0_code.code+src1_code.code+src2_code.code
|
||||
rv.code += "vec4 %s_%d_rgba = vec4(blend_%s(%s, %s, %s, %s * %s.a), min(1.0, %s.a + %s * %s.a));\n" % [ name, variant_index, BLEND_TYPES[parameters.blend_type].shortname, uv, src0_code.rgb, src1_code.rgb, amount_str, src0_code.rgba, src1_code.rgba, amount_str, src0_code.rgba ]
|
||||
rv.rgba = "%s_%d_rgba" % [ name, variant_index ]
|
||||
return rv
|
||||
|
||||
func _get_state_variables():
|
||||
return [ "amount" ]
|
@ -1,82 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/material_maker/nodes/blend/blend.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
[node name="Blend" type="GraphNode"]
|
||||
margin_left = 1.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 104.0
|
||||
mouse_filter = 1
|
||||
theme = SubResource( 1 )
|
||||
title = "Blend"
|
||||
show_close = true
|
||||
slot/0/left_enabled = false
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color( 1, 1, 1, 1 )
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color( 0, 1, 0, 0.501961 )
|
||||
slot/1/left_enabled = true
|
||||
slot/1/left_type = 0
|
||||
slot/1/left_color = Color( 0, 1, 0, 0.501961 )
|
||||
slot/1/right_enabled = false
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/2/left_enabled = true
|
||||
slot/2/left_type = 0
|
||||
slot/2/left_color = Color( 0, 1, 0, 0.501961 )
|
||||
slot/2/right_enabled = false
|
||||
slot/2/right_type = 0
|
||||
slot/2/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/3/left_enabled = true
|
||||
slot/3/left_type = 0
|
||||
slot/3/left_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/3/right_enabled = false
|
||||
slot/3/right_type = 0
|
||||
slot/3/right_color = Color( 1, 1, 1, 0.501961 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="blend_type" type="OptionButton" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 44.0
|
||||
text = "Normal"
|
||||
items = [ "Normal", null, false, 0, null, "Dissolve", null, false, 1, null, "Multiply", null, false, 2, null, "Screen", null, false, 3, null, "Overlay", null, false, 4, null, "Hard Light", null, false, 5, null, "Soft Light", null, false, 6, null, "Burn", null, false, 7, null, "Dodge", null, false, 8, null, "Lighten", null, false, 9, null, "Darken", null, false, 10, null, "Difference", null, false, 11, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="Label1" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 44.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 58.0
|
||||
text = "Source 1"
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 59.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 73.0
|
||||
text = "Source 2"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 74.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 98.0
|
||||
|
||||
[node name="Label3" type="Label" parent="HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 49.0
|
||||
margin_bottom = 19.0
|
||||
text = "Opacity"
|
||||
|
||||
[node name="amount" type="SpinBox" parent="HBoxContainer"]
|
||||
margin_left = 53.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 24.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
value = 0.5
|
@ -1,37 +0,0 @@
|
||||
tool
|
||||
extends "res://addons/material_maker/node_base.gd"
|
||||
|
||||
func _get_shader_code(uv, slot = 0):
|
||||
var rv = { defs="", code="" }
|
||||
var src0 = get_source(0)
|
||||
var src1 = get_source(1)
|
||||
var src2 = get_source(2)
|
||||
var src3 = get_source(3)
|
||||
var src0_code = { defs="", code="", f="0.0" }
|
||||
var src1_code = { defs="", code="", f="0.0" }
|
||||
var src2_code = { defs="", code="", f="0.0" }
|
||||
var src3_code = { defs="", code="", f="1.0" }
|
||||
if src0 != null:
|
||||
src0_code = src0.get_shader_code(uv)
|
||||
if src1 != null:
|
||||
src1_code = src1.get_shader_code(uv)
|
||||
if src2 != null:
|
||||
src2_code = src2.get_shader_code(uv)
|
||||
if src3 != null:
|
||||
src3_code = src3.get_shader_code(uv)
|
||||
if generated_variants.empty():
|
||||
rv.defs = src0_code.defs;
|
||||
rv.defs += src1_code.defs;
|
||||
rv.defs += src2_code.defs;
|
||||
rv.defs += src3_code.defs;
|
||||
var variant_index = generated_variants.find(uv)
|
||||
if variant_index == -1:
|
||||
variant_index = generated_variants.size()
|
||||
generated_variants.append(uv)
|
||||
rv.code = src0_code.code
|
||||
rv.code += src1_code.code
|
||||
rv.code += src2_code.code
|
||||
rv.code += src3_code.code
|
||||
rv.code += "vec4 %s_%d_rgba = vec4(%s, %s, %s, %s);\n" % [ name, variant_index, src0_code.f, src1_code.f, src2_code.f, src3_code.f ]
|
||||
rv.rgba = "%s_%d_rgba" % [ name, variant_index ]
|
||||
return rv
|
@ -1,143 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/material_maker/nodes/combine/combine.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
|
||||
[node name="Combine" type="GraphNode"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 204.0
|
||||
margin_top = 72.0
|
||||
margin_right = 306.0
|
||||
margin_bottom = 145.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 = "Combine"
|
||||
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.756863, 0.756863, 0.756863, 1 )
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color( 0.414353, 1, 0.388902, 0.353608 )
|
||||
slot/1/left_enabled = true
|
||||
slot/1/left_type = 0
|
||||
slot/1/left_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/1/right_enabled = false
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/2/left_enabled = true
|
||||
slot/2/left_type = 0
|
||||
slot/2/left_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/2/right_enabled = false
|
||||
slot/2/right_type = 0
|
||||
slot/2/right_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/3/left_enabled = true
|
||||
slot/3/left_type = 0
|
||||
slot/3/left_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/3/right_enabled = false
|
||||
slot/3/right_type = 0
|
||||
slot/3/right_color = Color( 1, 1, 1, 1 )
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Theme", "slot", "slot/0", "slot/1", "slot/2", "slot/3" ]
|
||||
|
||||
[node name="R" type="Label" parent="." index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 86.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 = "R"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="G" type="Label" parent="." index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 38.0
|
||||
margin_right = 86.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 = "G"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="B" type="Label" parent="." index="2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 53.0
|
||||
margin_right = 86.0
|
||||
margin_bottom = 67.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 = "B"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="A" type="Label" parent="." index="3"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 68.0
|
||||
margin_right = 86.0
|
||||
margin_bottom = 82.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 = "A"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
tool
|
||||
extends "res://addons/material_maker/node_base.gd"
|
||||
|
||||
const OUTPUTS = [ "r", "g", "b", "a" ]
|
||||
|
||||
func _get_shader_code(uv, output = 0):
|
||||
var rv = { defs="", code="" }
|
||||
var src = get_source()
|
||||
var src_code = { defs="", code="", rgba="vec4(0.0)" }
|
||||
if src != null:
|
||||
src_code = src.get_shader_code(uv)
|
||||
if generated_variants.empty():
|
||||
rv.defs = src_code.defs;
|
||||
var variant_index = generated_variants.find(uv)
|
||||
if variant_index == -1:
|
||||
variant_index = generated_variants.size()
|
||||
generated_variants.append(uv)
|
||||
rv.code = src_code.code
|
||||
rv.code += "vec4 %s_%d_rgba = %s;\n" % [ name, variant_index, src_code.rgba ]
|
||||
rv.f = "%s_%d_rgba.%s" % [ name, variant_index, OUTPUTS[output] ]
|
||||
return rv
|
@ -1,147 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/material_maker/nodes/decompose/decompose.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
|
||||
[node name="Decompose" type="GraphNode"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 204.0
|
||||
margin_top = 72.0
|
||||
margin_right = 306.0
|
||||
margin_bottom = 145.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 = "Decompose"
|
||||
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.411765, 1, 0.388235, 0.352941 )
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/1/left_enabled = false
|
||||
slot/1/left_type = 0
|
||||
slot/1/left_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/1/right_enabled = true
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/2/left_enabled = false
|
||||
slot/2/left_type = 0
|
||||
slot/2/left_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/2/right_enabled = true
|
||||
slot/2/right_type = 0
|
||||
slot/2/right_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/3/left_enabled = false
|
||||
slot/3/left_type = 0
|
||||
slot/3/left_color = Color( 1, 1, 1, 1 )
|
||||
slot/3/right_enabled = true
|
||||
slot/3/right_type = 0
|
||||
slot/3/right_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Theme", "slot", "slot/0", "slot/1", "slot/2", "slot/3" ]
|
||||
|
||||
[node name="R" type="Label" parent="." index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 106.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 = "R"
|
||||
align = 2
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="G" type="Label" parent="." index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 38.0
|
||||
margin_right = 106.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 = "G"
|
||||
align = 2
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="B" type="Label" parent="." index="2"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 53.0
|
||||
margin_right = 106.0
|
||||
margin_bottom = 67.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 = "B"
|
||||
align = 2
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="A" type="Label" parent="." index="3"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 68.0
|
||||
margin_right = 106.0
|
||||
margin_bottom = 82.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 = "A"
|
||||
align = 2
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
tool
|
||||
extends HBoxContainer
|
||||
|
||||
func connect_buttons(object, edit_fct, load_fct, save_fct):
|
||||
|
@ -1,64 +0,0 @@
|
||||
tool
|
||||
extends "res://addons/material_maker/node_base.gd"
|
||||
|
||||
var input_shader = ""
|
||||
var input_texture
|
||||
var final_texture
|
||||
|
||||
const CONVOLUTION = {
|
||||
x=1,
|
||||
y=1,
|
||||
kernel=[
|
||||
Vector3(-1, -1, 0), Vector3(0, -2, 0), Vector3(1, -1, 0),
|
||||
Vector3(-2, 0, 0), 0, Vector3(2, 0, 0),
|
||||
Vector3(-1, 1, 0), Vector3(0, 2, 0), Vector3(1, 1, 0),
|
||||
],
|
||||
epsilon=1.0/1024,
|
||||
normalize=true,
|
||||
translate_before_normalize=Vector3(0.0, 0.0, -1.0),
|
||||
scale_before_normalize=0.5,
|
||||
translate=Vector3(0.5, 0.5, 0.5),
|
||||
scale=0.5
|
||||
}
|
||||
|
||||
func _ready():
|
||||
# init size widget
|
||||
$HBoxContainer1/size.clear()
|
||||
for i in range(7):
|
||||
$HBoxContainer1/size.add_item(str(int(pow(2, 5+i))), i)
|
||||
parameters.size = 2
|
||||
$HBoxContainer1/size.selected = parameters.size
|
||||
input_texture = ImageTexture.new()
|
||||
final_texture = ImageTexture.new()
|
||||
initialize_properties([ $HBoxContainer1/size, $HBoxContainer2/amount ])
|
||||
|
||||
func _rerender():
|
||||
get_parent().renderer.precalculate_shader(input_shader, get_source().get_textures(), int(pow(2, 5+parameters.size)), input_texture, self, "pass_1", [])
|
||||
|
||||
func pass_1():
|
||||
var convolution = CONVOLUTION
|
||||
convolution.epsilon=1.0/pow(2, 5+parameters.size)
|
||||
convolution.scale_before_normalize = pow(2, parameters.size-1)*parameters.amount
|
||||
get_parent().renderer.precalculate_shader(get_convolution_shader(convolution), { input=input_texture}, int(pow(2, 5+parameters.size)), final_texture, self, "rerender_targets", [])
|
||||
|
||||
func get_textures():
|
||||
var list = {}
|
||||
list[name] = final_texture
|
||||
return list
|
||||
|
||||
func _get_shader_code(uv, slot = 0):
|
||||
var rv = { defs="", code="" }
|
||||
var src = get_source()
|
||||
if src == null:
|
||||
return rv
|
||||
input_shader = get_parent().renderer.generate_shader(src.get_shader_code_with_globals("UV"))
|
||||
_rerender()
|
||||
if generated_variants.empty():
|
||||
rv.defs = "uniform sampler2D %s_tex;\n" % [ name ]
|
||||
var variant_index = generated_variants.find(uv)
|
||||
if variant_index == -1:
|
||||
variant_index = generated_variants.size()
|
||||
generated_variants.append(uv)
|
||||
rv.code = "vec3 %s_%d_rgb = texture(%s_tex, %s).rgb;\n" % [ name, variant_index, name, uv ]
|
||||
rv.rgb = "%s_%d_rgb" % [ name, variant_index ]
|
||||
return rv
|
@ -1,184 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/material_maker/nodes/normal_map/normal_map.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
|
||||
[node name="NormalMap" 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_top = 1.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 75.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 = "Normal Map"
|
||||
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.756863, 0.756863, 0.756863, 1 )
|
||||
slot/0/right_enabled = true
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color( 0.5, 0.5, 1, 1 )
|
||||
slot/1/left_enabled = false
|
||||
slot/1/left_type = 0
|
||||
slot/1/left_color = Color( 1, 1, 1, 1 )
|
||||
slot/1/right_enabled = false
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 1, 1, 1, 1 )
|
||||
script = ExtResource( 1 )
|
||||
_sections_unfolded = [ "Theme", "slot", "slot/0" ]
|
||||
|
||||
[node name="HBoxContainer1" type="HBoxContainer" parent="." index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 156.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 = 3
|
||||
size_flags_vertical = 1
|
||||
alignment = 0
|
||||
_sections_unfolded = [ "Size Flags" ]
|
||||
|
||||
[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
|
||||
margin_top = 3.0
|
||||
margin_right = 61.0
|
||||
margin_bottom = 17.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 = "Grid size:"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
_sections_unfolded = [ "Anchor", "Margin", "Size Flags" ]
|
||||
|
||||
[node name="size" type="OptionButton" parent="HBoxContainer1" index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 65.0
|
||||
margin_right = 140.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 75, 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 = 11
|
||||
size_flags_vertical = 1
|
||||
toggle_mode = false
|
||||
action_mode = 0
|
||||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
group = null
|
||||
text = "1024"
|
||||
flat = false
|
||||
align = 0
|
||||
items = [ "32", null, false, 0, null, "64", null, false, 1, null, "128", null, false, 2, null, "256", null, false, 3, null, "512", null, false, 4, null, "1024", null, false, 5, null, "2048", null, false, 6, null ]
|
||||
selected = 5
|
||||
_sections_unfolded = [ "Anchor", "Caret", "Placeholder", "Rect", "Size Flags" ]
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="." index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 16.0
|
||||
margin_top = 44.0
|
||||
margin_right = 156.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 = 3
|
||||
size_flags_vertical = 1
|
||||
alignment = 0
|
||||
_sections_unfolded = [ "Size Flags" ]
|
||||
|
||||
[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
|
||||
margin_top = 5.0
|
||||
margin_right = 62.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 = "Amount:"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
_sections_unfolded = [ "Anchor", "Margin", "Size Flags" ]
|
||||
|
||||
[node name="amount" type="SpinBox" parent="HBoxContainer2" index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 66.0
|
||||
margin_right = 140.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 = 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" ]
|
||||
|
||||
|
@ -2,9 +2,6 @@ tool
|
||||
extends MMGraphNodeGeneric
|
||||
class_name MMGraphNodeRemote
|
||||
|
||||
const LinkedControl = preload("res://addons/material_maker/widgets/linked_widgets/linked_control.tscn")
|
||||
const ConfigControl = preload("res://addons/material_maker/widgets/linked_widgets/config_control.tscn")
|
||||
|
||||
func add_control(text, control):
|
||||
var index = $Controls.get_child_count() / 4
|
||||
var label = preload("res://addons/material_maker/widgets/linked_widgets/editable_label.tscn").instance()
|
||||
@ -32,10 +29,30 @@ func update_node():
|
||||
control.name = p.name
|
||||
controls[control.name] = control
|
||||
add_control(generator.widgets[i].label, control)
|
||||
if generator.widgets[i].type == "config_control":
|
||||
var current = null
|
||||
if control.get_item_count() > 0:
|
||||
control.selected = generator.parameters["param"+str(i)]
|
||||
current = control.get_item_text(control.selected)
|
||||
control.add_separator()
|
||||
control.add_item("<add configuration>")
|
||||
if current != null:
|
||||
control.add_separator()
|
||||
control.add_item("<update "+current+">")
|
||||
control.add_item("<remove "+current+">")
|
||||
i += 1
|
||||
rect_size = Vector2(0, 0)
|
||||
initialize_properties()
|
||||
|
||||
func _on_value_changed(new_value, variable):
|
||||
var param_index = variable.trim_prefix("param").to_int()
|
||||
var widget = generator.widgets[param_index]
|
||||
if widget.type == "config_control" and new_value >= widget.configurations.size():
|
||||
var command = new_value - widget.configurations.size()
|
||||
print(command)
|
||||
else:
|
||||
._on_value_changed(new_value, variable)
|
||||
|
||||
func _on_AddLink_pressed():
|
||||
var widget = Control.new()
|
||||
add_control("Unnamed", widget)
|
||||
|
@ -1,25 +0,0 @@
|
||||
tool
|
||||
extends "res://addons/material_maker/node_base.gd"
|
||||
|
||||
func _ready():
|
||||
initialize_properties([ $source ])
|
||||
|
||||
func reset():
|
||||
generated = false
|
||||
generated_variants = [ [], [] ]
|
||||
|
||||
func _get_shader_code(uv, index = 0):
|
||||
var rv = { defs="", code="" }
|
||||
var src = get_source(2*parameters.source+index)
|
||||
var src_code = { defs="", code="", rgb="0.0" }
|
||||
if src != null:
|
||||
src_code = src.get_shader_code(uv)
|
||||
if generated_variants[index].empty():
|
||||
rv.defs = src_code.defs;
|
||||
var variant_index = generated_variants[index].find(uv)
|
||||
if variant_index == -1:
|
||||
variant_index = generated_variants[index].size()
|
||||
generated_variants[index].append(uv)
|
||||
rv.code = src_code.code
|
||||
rv.rgb = src_code.rgb
|
||||
return rv
|
@ -1,107 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/material_maker/nodes/switch/switch.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
[node name="Switch" type="GraphNode"]
|
||||
margin_left = 1.0
|
||||
margin_top = 1.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 110.0
|
||||
mouse_filter = 1
|
||||
theme = SubResource( 1 )
|
||||
title = "Switch"
|
||||
show_close = true
|
||||
slot/0/left_enabled = false
|
||||
slot/0/left_type = 0
|
||||
slot/0/left_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/0/right_enabled = false
|
||||
slot/0/right_type = 0
|
||||
slot/0/right_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/1/left_enabled = true
|
||||
slot/1/left_type = 0
|
||||
slot/1/left_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/1/right_enabled = false
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/2/left_enabled = true
|
||||
slot/2/left_type = 0
|
||||
slot/2/left_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/2/right_enabled = true
|
||||
slot/2/right_type = 0
|
||||
slot/2/right_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/3/left_enabled = true
|
||||
slot/3/left_type = 0
|
||||
slot/3/left_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/3/right_enabled = true
|
||||
slot/3/right_type = 0
|
||||
slot/3/right_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/4/left_enabled = true
|
||||
slot/4/left_type = 0
|
||||
slot/4/left_color = Color( 0.498039, 0.498039, 1, 1 )
|
||||
slot/4/right_enabled = false
|
||||
slot/4/right_type = 0
|
||||
slot/4/right_color = Color( 1, 0, 0, 1 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="source" type="OptionButton" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 44.0
|
||||
text = "1"
|
||||
items = [ "1", null, false, 0, null, "2", null, false, 1, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="Label1" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 44.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 58.0
|
||||
text = "A1"
|
||||
|
||||
[node name="HBoxContainer1" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 59.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 73.0
|
||||
|
||||
[node name="Label1" type="Label" parent="HBoxContainer1"]
|
||||
margin_right = 54.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
text = "B1"
|
||||
|
||||
[node name="Label2" type="Label" parent="HBoxContainer1"]
|
||||
margin_left = 58.0
|
||||
margin_right = 67.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 9
|
||||
text = "A"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 74.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 88.0
|
||||
|
||||
[node name="Label1" type="Label" parent="HBoxContainer2"]
|
||||
margin_right = 54.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
text = "A2"
|
||||
|
||||
[node name="Label2" type="Label" parent="HBoxContainer2"]
|
||||
margin_left = 58.0
|
||||
margin_right = 67.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 9
|
||||
text = "B"
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 89.0
|
||||
margin_right = 83.0
|
||||
margin_bottom = 103.0
|
||||
text = "B2"
|
@ -1,39 +0,0 @@
|
||||
tool
|
||||
extends "res://addons/material_maker/node_base.gd"
|
||||
|
||||
func _ready():
|
||||
set_slot(0, true, 0, Color(0.5, 0.5, 1), true, 0, Color(0.5, 0.5, 1))
|
||||
initialize_properties([ $HBoxContainer1/translate_x, $HBoxContainer2/translate_y, $HBoxContainer3/rotate, $HBoxContainer4/scale_x, $HBoxContainer5/scale_y, $repeat ])
|
||||
|
||||
func _get_shader_code(uv, slot = 0):
|
||||
var rv = { defs="", code="" }
|
||||
var src = get_source()
|
||||
if src == null:
|
||||
return rv
|
||||
var variant_index = generated_variants.find(uv)
|
||||
if variant_index == -1:
|
||||
variant_index = generated_variants.size()
|
||||
generated_variants.append(uv)
|
||||
var inputs = [ "", "", "", "", "" ]
|
||||
for i in range(5):
|
||||
var tsrc = get_source(i+1)
|
||||
if tsrc != null:
|
||||
var tsrc_code = tsrc.get_shader_code(uv)
|
||||
if generated_variants.size() == 1:
|
||||
rv.defs += tsrc_code.defs
|
||||
rv.code += tsrc_code.code
|
||||
inputs[i] = "*(2.0*(%s)-1.0)" % tsrc_code.f
|
||||
rv.code += "vec2 %s_%d_uv = %s(%s, vec2(%.9f%s, %.9f%s), %.9f%s, vec2(%.9f%s, %.9f%s));\n" % [ name, variant_index, "transform_repeat" if parameters.repeat else "transform_norepeat", uv, parameters.translate_x, inputs[0], parameters.translate_y, inputs[1], PI*parameters.rotate/180.0, inputs[2], parameters.scale_x, inputs[3], parameters.scale_y, inputs[4] ]
|
||||
var src_code = src.get_shader_code("%s_%d_uv" % [ name, variant_index ])
|
||||
if rv.code != "":
|
||||
if generated_variants.size() == 1:
|
||||
rv.defs += src_code.defs
|
||||
rv.code += src_code.code
|
||||
rv.rgba = src_code.rgba
|
||||
return rv
|
||||
|
||||
func deserialize(data):
|
||||
if data.has("scale"):
|
||||
parameters.scale_x = data.scale
|
||||
parameters.scale_y = data.scale
|
||||
.deserialize(data)
|
@ -1,216 +0,0 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/material_maker/nodes/transform/transform.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=1]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=3]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=4]
|
||||
|
||||
[node name="Transform" type="GraphNode"]
|
||||
margin_left = 1.0
|
||||
margin_top = 1.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 179.0
|
||||
mouse_filter = 1
|
||||
custom_styles/position = SubResource( 1 )
|
||||
custom_styles/defaultfocus = SubResource( 2 )
|
||||
custom_styles/breakpoint = SubResource( 3 )
|
||||
custom_styles/defaultframe = SubResource( 4 )
|
||||
title = "Transform"
|
||||
show_close = true
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
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.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 )
|
||||
slot/1/right_enabled = false
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/2/left_enabled = true
|
||||
slot/2/left_type = 0
|
||||
slot/2/left_color = Color( 0.760784, 0.760784, 0.760784, 1 )
|
||||
slot/2/right_enabled = false
|
||||
slot/2/right_type = 0
|
||||
slot/2/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/3/left_enabled = true
|
||||
slot/3/left_type = 0
|
||||
slot/3/left_color = Color( 0.760784, 0.760784, 0.760784, 1 )
|
||||
slot/3/right_enabled = false
|
||||
slot/3/right_type = 0
|
||||
slot/3/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/4/left_enabled = true
|
||||
slot/4/left_type = 0
|
||||
slot/4/left_color = Color( 0.760784, 0.760784, 0.760784, 1 )
|
||||
slot/4/right_enabled = false
|
||||
slot/4/right_type = 0
|
||||
slot/4/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/5/left_enabled = true
|
||||
slot/5/left_type = 0
|
||||
slot/5/left_color = Color( 0.761719, 0.761719, 0.761719, 1 )
|
||||
slot/5/right_enabled = false
|
||||
slot/5/right_type = 0
|
||||
slot/5/right_color = Color( 1, 1, 1, 1 )
|
||||
slot/6/left_enabled = false
|
||||
slot/6/left_type = 0
|
||||
slot/6/left_color = Color( 1, 1, 1, 1 )
|
||||
slot/6/right_enabled = false
|
||||
slot/6/right_type = 0
|
||||
slot/6/right_color = Color( 1, 1, 1, 1 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="HBoxContainer0" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 168.0
|
||||
margin_bottom = 44.0
|
||||
|
||||
[node name="Input" type="Label" parent="HBoxContainer0"]
|
||||
margin_right = 74.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 0, 20 )
|
||||
size_flags_horizontal = 3
|
||||
text = "Input"
|
||||
valign = 1
|
||||
|
||||
[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 )
|
||||
size_flags_horizontal = 3
|
||||
text = "Output"
|
||||
align = 2
|
||||
valign = 1
|
||||
|
||||
[node name="HBoxContainer1" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 44.0
|
||||
margin_right = 168.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer1"]
|
||||
margin_top = 5.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Translate X:"
|
||||
|
||||
[node name="translate_x" type="SpinBox" parent="HBoxContainer1"]
|
||||
margin_left = 78.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 4
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 69.0
|
||||
margin_right = 168.0
|
||||
margin_bottom = 93.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer2"]
|
||||
margin_top = 5.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Translate Y:"
|
||||
|
||||
[node name="translate_y" type="SpinBox" parent="HBoxContainer2"]
|
||||
margin_left = 78.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 4
|
||||
min_value = -1.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 94.0
|
||||
margin_right = 168.0
|
||||
margin_bottom = 118.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer3"]
|
||||
margin_top = 5.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Rotate:"
|
||||
|
||||
[node name="rotate" type="SpinBox" parent="HBoxContainer3"]
|
||||
margin_left = 78.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 4
|
||||
min_value = -720.0
|
||||
max_value = 720.0
|
||||
step = 5.0
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 119.0
|
||||
margin_right = 168.0
|
||||
margin_bottom = 143.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer4"]
|
||||
margin_top = 5.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Scale X:"
|
||||
|
||||
[node name="scale_x" type="SpinBox" parent="HBoxContainer4"]
|
||||
margin_left = 78.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 4
|
||||
min_value = 0.05
|
||||
max_value = 50.0
|
||||
step = 0.05
|
||||
value = 1.0
|
||||
|
||||
[node name="HBoxContainer5" type="HBoxContainer" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 144.0
|
||||
margin_right = 168.0
|
||||
margin_bottom = 168.0
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer5"]
|
||||
margin_top = 5.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Scale Y:"
|
||||
|
||||
[node name="scale_y" type="SpinBox" parent="HBoxContainer5"]
|
||||
margin_left = 78.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 4
|
||||
min_value = 0.05
|
||||
max_value = 50.0
|
||||
step = 0.05
|
||||
value = 1.0
|
||||
|
||||
[node name="repeat" type="CheckBox" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 169.0
|
||||
margin_right = 168.0
|
||||
margin_bottom = 193.0
|
||||
pressed = true
|
||||
text = "Repeat"
|
@ -1,32 +0,0 @@
|
||||
tool
|
||||
extends "res://addons/material_maker/node_base.gd"
|
||||
|
||||
func _ready():
|
||||
initialize_properties([ $amount ])
|
||||
|
||||
func _get_shader_code(uv, slot = 0):
|
||||
var epsilon = 0.01
|
||||
var rv = { defs="", code="" }
|
||||
var src0 = get_source(0)
|
||||
var src1 = get_source(1)
|
||||
if src0 == null || src1 == null:
|
||||
return rv
|
||||
var variant_index = generated_variants.find(uv)
|
||||
if variant_index == -1:
|
||||
variant_index = generated_variants.size()
|
||||
generated_variants.append(uv)
|
||||
var src1_code0 = src1.get_shader_code("fract(%s+vec2(%.9f, 0.0))" % [ uv, epsilon ])
|
||||
var src1_code1 = src1.get_shader_code("fract(%s-vec2(%.9f, 0.0))" % [ uv, epsilon ])
|
||||
var src1_code2 = src1.get_shader_code("fract(%s+vec2(0.0, %.9f))" % [ uv, epsilon ])
|
||||
var src1_code3 = src1.get_shader_code("fract(%s-vec2(0.0, %.9f))" % [ uv, epsilon ])
|
||||
rv.defs = src1_code0.defs
|
||||
rv.code = src1_code0.code+src1_code1.code+src1_code2.code+src1_code3.code
|
||||
rv.code += "vec2 %s_%d_uv = %s+%.9f*vec2((%s)-(%s), (%s)-(%s));\n" % [ name, variant_index, uv, parameters.amount, src1_code0.f, src1_code1.f, src1_code2.f, src1_code3.f ]
|
||||
var src0_code = src0.get_shader_code("%s_%d_uv" % [ name, variant_index ])
|
||||
rv.defs += src0_code.defs
|
||||
rv.code += src0_code.code
|
||||
rv.code += "vec3 %s_%d_rgb = %s;\n" % [ name, variant_index, src0_code.rgb ]
|
||||
rv.code += "float %s_%d_f = %s;\n" % [ name, variant_index, src0_code.f ]
|
||||
rv.rgb = "%s_%d_rgb" % [ name, variant_index ]
|
||||
rv.f = "%s_%d_f" % [ name, variant_index ]
|
||||
return rv
|
@ -1,58 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/material_maker/nodes/warp/warp.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
[node name="Warp" type="GraphNode"]
|
||||
margin_left = 1.0
|
||||
margin_top = 1.0
|
||||
margin_right = 91.0
|
||||
margin_bottom = 84.0
|
||||
mouse_filter = 1
|
||||
theme = SubResource( 1 )
|
||||
title = "Warp"
|
||||
show_close = true
|
||||
slot/0/left_enabled = true
|
||||
slot/0/left_type = 0
|
||||
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.5, 0.5, 1, 1 )
|
||||
slot/1/left_enabled = true
|
||||
slot/1/left_type = 0
|
||||
slot/1/left_color = Color( 0.756863, 0.756863, 0.756863, 1 )
|
||||
slot/1/right_enabled = false
|
||||
slot/1/right_type = 0
|
||||
slot/1/right_color = Color( 0.5, 0.5, 1, 1 )
|
||||
slot/2/left_enabled = false
|
||||
slot/2/left_type = 0
|
||||
slot/2/left_color = Color( 1, 1, 1, 1 )
|
||||
slot/2/right_enabled = false
|
||||
slot/2/right_type = 0
|
||||
slot/2/right_color = Color( 1, 1, 1, 1 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Label1" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 24.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 38.0
|
||||
text = "Source"
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 38.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 52.0
|
||||
text = "Displace"
|
||||
|
||||
[node name="amount" type="SpinBox" parent="."]
|
||||
margin_left = 16.0
|
||||
margin_top = 53.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 77.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
value = 0.5
|
||||
[connection signal="close_request" from="." to="." method="queue_free"]
|
Loading…
Reference in New Issue
Block a user