Removed useless print calls and started adding the "create subgraph" command

This commit is contained in:
RodZill4 2019-09-27 08:28:33 +02:00
parent f512b977c6
commit 101de7f32b
29 changed files with 146 additions and 360 deletions

View File

@ -12,8 +12,16 @@ func get_type_name():
return label return label
func get_parameter_defs(): func get_parameter_defs():
var params = get_node("gen_parameters")
if params != null:
return params.get_parameter_defs()
return [] return []
func set_parameter(p, v):
var params = get_node("gen_parameters")
if params != null:
return params.set_parameter(p, v)
func get_input_defs(): func get_input_defs():
var inputs = get_node("gen_inputs") var inputs = get_node("gen_inputs")
if inputs != null: if inputs != null:
@ -98,10 +106,8 @@ func disconnect_children(from, from_port : int, to, to_port : int):
return true return true
func _get_shader_code(uv : String, output_index : int, context : MMGenContext): func _get_shader_code(uv : String, output_index : int, context : MMGenContext):
print("Getting shader code from graph")
var outputs = get_node("gen_outputs") var outputs = get_node("gen_outputs")
if outputs != null: if outputs != null:
print("found!")
var rv = outputs._get_shader_code(uv, output_index, context) var rv = outputs._get_shader_code(uv, output_index, context)
while rv is GDScriptFunctionState: while rv is GDScriptFunctionState:
rv = yield(rv, "completed") rv = yield(rv, "completed")

View File

@ -76,6 +76,8 @@ func set_parameter(p, v):
print("error: incorrect config control parameter value") print("error: incorrect config control parameter value")
return return
.set_parameter(p, v) .set_parameter(p, v)
if name == "gen_parameters":
get_parent().parameters[p] = v
func _serialize(data): func _serialize(data):
data.type = "remote" data.type = "remote"

View File

@ -62,7 +62,7 @@ static func create_gen(data) -> MMGenBase:
elif data.type == "ios": elif data.type == "ios":
generator = MMGenIOs.new() generator = MMGenIOs.new()
if data.has("mask"): if data.has("mask"):
generator.mask = data.mask generator.mask = int(data.mask)
generator.ports = data.ports generator.ports = data.ports
elif data.type == "switch": elif data.type == "switch":
generator = MMGenSwitch.new() generator = MMGenSwitch.new()

View File

@ -10,9 +10,9 @@
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm" width="64"
height="297mm" height="64"
viewBox="0 0 210 297" viewBox="0 0 64 64"
version="1.1" version="1.1"
id="svg8" id="svg8"
inkscape:version="0.92.3 (2405546, 2018-03-11)" inkscape:version="0.92.3 (2405546, 2018-03-11)"
@ -48,20 +48,27 @@
borderopacity="1.0" borderopacity="1.0"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="1.1274425" inkscape:zoom="14.304427"
inkscape:cx="116.41955" inkscape:cx="46.907045"
inkscape:cy="914.64295" inkscape:cy="41.347265"
inkscape:document-units="mm" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="true" showgrid="true"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-height="1017" inkscape:window-height="1017"
inkscape:window-x="-8" inkscape:window-x="-8"
inkscape:window-y="-8" inkscape:window-y="-8"
inkscape:window-maximized="1"> inkscape:window-maximized="1"
inkscape:pagecheckerboard="true"
units="px"
scale-x="2.1"
inkscape:snap-to-guides="false"
inkscape:snap-grids="false">
<inkscape:grid <inkscape:grid
type="xygrid" type="xygrid"
id="grid815" /> id="grid815"
spacingx="4.2333332"
spacingy="4.2333332" />
</sodipodi:namedview> </sodipodi:namedview>
<metadata <metadata
id="metadata5"> id="metadata5">
@ -71,25 +78,18 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title /> <dc:title></dc:title>
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
<g <g
inkscape:label="Calque 1" inkscape:label="Calque 1"
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer1"> id="layer1"
<rect transform="translate(0,-280.06665)">
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
id="rect4533"
width="238.125"
height="174.625"
x="-10.583333"
y="-3.3020833"
ry="0.82414269" />
<g <g
id="g4582" id="g4582"
transform="matrix(1.2003144,0.26398218,-0.26389538,1.2007092,-4.1100858,-17.15364)" transform="matrix(0.63156765,0.13889911,-0.13885344,0.63177538,-0.50529,268.1154)"
inkscape:export-filename="link.png" inkscape:export-filename="link.png"
inkscape:export-xdpi="15.926786" inkscape:export-xdpi="15.926786"
inkscape:export-ydpi="15.926786"> inkscape:export-ydpi="15.926786">
@ -109,7 +109,7 @@
inkscape:export-xdpi="16.531826" inkscape:export-xdpi="16.531826"
inkscape:export-filename="remove.png" inkscape:export-filename="remove.png"
id="g4564" id="g4564"
transform="matrix(0.82426401,0.81188676,-0.82426401,0.81188676,84.358228,-6.2929802)" transform="matrix(0.43370177,0.42718925,-0.43370177,0.42718925,43.791013,273.09803)"
style="fill:#ff0909;fill-opacity:1"> style="fill:#ff0909;fill-opacity:1">
<rect <rect
style="opacity:1;fill:#ff0909;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" style="opacity:1;fill:#ff0909;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
@ -133,7 +133,7 @@
inkscape:export-filename="config.png" inkscape:export-filename="config.png"
inkscape:export-xdpi="16.559999" inkscape:export-xdpi="16.559999"
inkscape:export-ydpi="16.559999" inkscape:export-ydpi="16.559999"
transform="matrix(1.0254261,0,0,1.0022479,-9.1237225,-33.22013)"> transform="matrix(0.53954693,0,0,0.52735129,-2.0235322,258.7025)">
<path <path
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
id="path4598" id="path4598"
@ -142,7 +142,7 @@
</g> </g>
<g <g
id="g855" id="g855"
transform="matrix(0.48976049,-0.48711566,0.48711566,0.48976049,-26.645494,39.257287)" transform="matrix(0.25769655,-0.25630492,0.25630492,0.25769655,4.0104312,296.39647)"
inkscape:export-filename="edit.png" inkscape:export-filename="edit.png"
inkscape:export-xdpi="14.942099" inkscape:export-xdpi="14.942099"
inkscape:export-ydpi="14.942099"> inkscape:export-ydpi="14.942099">
@ -185,17 +185,20 @@
id="g879" id="g879"
inkscape:export-filename="save.png" inkscape:export-filename="save.png"
inkscape:export-xdpi="14" inkscape:export-xdpi="14"
inkscape:export-ydpi="14"> inkscape:export-ydpi="14"
transform="matrix(0.52616852,0,0,0.52616852,14.395212,275.18126)">
<path <path
id="rect859" id="rect859"
transform="scale(0.26458333)" transform="scale(0.26458333)"
d="M 130 152.51953 L 130 262.51953 L 240 262.51953 L 240 163.23047 L 229.28906 152.51953 L 130 152.51953 z " d="m 130,152.51953 v 110 h 110 v -99.28906 l -10.71094,-10.71094 z"
style="opacity:1;fill:#14008d;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> style="opacity:1;fill:#14008d;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
<path <path
id="rect861" id="rect861"
transform="scale(0.26458333)" transform="scale(0.26458333)"
d="M 155 152.51953 L 155 192.51953 L 215 192.51953 L 215 152.51953 L 155 152.51953 z M 195 162.51953 L 205 162.51953 L 205 182.51953 L 195 182.51953 L 195 162.51953 z " d="m 155,152.51953 v 40 h 60 v -40 z m 40,10 h 10 v 20 h -10 z"
style="opacity:1;fill:#afafaf;fill-opacity:1;stroke:none;stroke-width:4.04048538;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> style="opacity:1;fill:#afafaf;fill-opacity:1;stroke:none;stroke-width:4.04048538;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
<rect <rect
ry="2.6458347" ry="2.6458347"
y="53.583332" y="53.583332"
@ -207,34 +210,23 @@
</g> </g>
<g <g
style="fill:#18ff09;fill-opacity:1" style="fill:#18ff09;fill-opacity:1"
transform="matrix(0.00708854,0.93703452,-0.93703452,-0.00708854,131.56263,7.7603075)" transform="matrix(0.00372977,0.49303806,-0.49303806,-0.00372977,83.199877,280.80247)"
id="g849" id="g849"
inkscape:export-filename="plus.png" inkscape:export-filename="plus.png"
inkscape:export-xdpi="16.531826" inkscape:export-xdpi="16.531826"
inkscape:export-ydpi="16.531826"> inkscape:export-ydpi="16.531826">
<rect <path
ry="0" style="opacity:1;fill:#18ff09;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
y="8.604167" d="m 1.7704433,57.914123 10.5809277,8.16e-4 8.46e-4,10.584889 5.292445,4.22e-4 -8.47e-4,-10.58489 10.58489,8.46e-4 -4.24e-4,-5.292444 -10.580925,-8.16e-4 -8.47e-4,-10.58489 -5.292414,0.0035 8.14e-4,10.580928 -10.5848882,-8.47e-4 z"
x="10.583333"
height="26.458334"
width="5.2916665"
id="rect844" id="rect844"
style="opacity:1;fill:#18ff09;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> inkscape:connector-curvature="0" />
<rect
ry="0"
y="19.1875"
x="0"
height="5.2916665"
width="26.458332"
id="rect847"
style="opacity:1;fill:#18ff09;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
</g> </g>
<g <g
inkscape:export-ydpi="16.531826" inkscape:export-ydpi="16.531826"
inkscape:export-xdpi="16.531826" inkscape:export-xdpi="16.531826"
inkscape:export-filename="minus.png" inkscape:export-filename="minus.png"
id="g856" id="g856"
transform="matrix(0.00708854,0.93703452,-0.93703452,-0.00708854,162.38808,7.2064523)" transform="matrix(0.00372977,0.49303806,-0.49303806,-0.00372977,18.535206,297.77843)"
style="fill:#ff0909;fill-opacity:1"> style="fill:#ff0909;fill-opacity:1">
<rect <rect
style="opacity:1;fill:#ff0909;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" style="opacity:1;fill:#ff0909;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
@ -249,17 +241,20 @@
id="g868" id="g868"
inkscape:export-filename="load.png" inkscape:export-filename="load.png"
inkscape:export-xdpi="13.499794" inkscape:export-xdpi="13.499794"
inkscape:export-ydpi="13.499794"> inkscape:export-ydpi="13.499794"
transform="matrix(0.51223521,0,0,0.51223521,5.2214853,275.80647)">
<path <path
id="rect849" id="rect849"
transform="scale(0.26458333)" transform="scale(0.26458333)"
d="M 330 152.51953 L 330 262.51953 L 420 262.51953 L 420 169.94531 L 402.57227 152.51953 L 330 152.51953 z " d="m 330,152.51953 v 110 h 90 v -92.57422 l -17.42773,-17.42578 z"
style="opacity:1;fill:#ffed46;fill-opacity:1;stroke:#c7b115;stroke-width:3.77952761;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke;stroke-linejoin:round" /> style="opacity:1;fill:#ffed46;fill-opacity:1;stroke:#c7b115;stroke-width:3.77952766;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
<path <path
id="path855" id="path855"
transform="scale(0.26458333)" transform="scale(0.26458333)"
d="M 403 152.94727 L 403 169.51953 L 419.57422 169.51953 L 403 152.94727 z " d="m 403,152.94727 v 16.57226 h 16.57422 z"
style="opacity:1;fill:#ffed46;fill-opacity:1;stroke:#c7b115;stroke-width:3.77952761;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke;stroke-linejoin:round" /> style="opacity:1;fill:#ffed46;fill-opacity:1;stroke:#c7b115;stroke-width:3.77952766;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
<rect <rect
transform="rotate(-90)" transform="rotate(-90)"
ry="2.5431327e-006" ry="2.5431327e-006"

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -25,6 +25,7 @@ const MENU = [
{ menu="Edit", command="edit_cut", shortcut="Control+X", description="Cut" }, { menu="Edit", command="edit_cut", shortcut="Control+X", description="Cut" },
{ menu="Edit", command="edit_copy", shortcut="Control+C", description="Copy" }, { menu="Edit", command="edit_copy", shortcut="Control+C", description="Copy" },
{ menu="Edit", command="edit_paste", shortcut="Control+V", description="Paste" }, { menu="Edit", command="edit_paste", shortcut="Control+V", description="Paste" },
{ menu="Tools", command="create_subgraph", description="Create subgraph" },
{ menu="Tools", command="make_selected_nodes_editable", description="Make selected nodes editable" }, { menu="Tools", command="make_selected_nodes_editable", description="Make selected nodes editable" },
{ menu="Tools", command="add_to_user_library", description="Add selected node to user library" }, { menu="Tools", command="add_to_user_library", description="Add selected node to user library" },
{ menu="Tools", command="save_user_library", description="Save user library" }, { menu="Tools", command="save_user_library", description="Save user library" },
@ -46,6 +47,12 @@ func _ready():
m.connect("about_to_show", self, "menu_about_to_show", [ m.name, menu ]) m.connect("about_to_show", self, "menu_about_to_show", [ m.name, menu ])
new_material() new_material()
func get_current_graph_edit():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control()
if graph_edit != null and graph_edit is GraphEdit:
return graph_edit
return null
func create_menu(menu, menu_name): func create_menu(menu, menu_name):
menu.clear() menu.clear()
menu.connect("id_pressed", self, "_on_PopupMenu_id_pressed") menu.connect("id_pressed", self, "_on_PopupMenu_id_pressed")
@ -152,7 +159,7 @@ func do_load_materials(filenames):
do_load_material(f) do_load_material(f)
func do_load_material(filename): func do_load_material(filename):
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
var node_count = 2 # So test below succeeds if graph_edit is null... var node_count = 2 # So test below succeeds if graph_edit is null...
if graph_edit != null: if graph_edit != null:
node_count = 0 node_count = 0
@ -169,7 +176,7 @@ func do_load_material(filename):
add_recent(filename) add_recent(filename)
func save_material(): func save_material():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit != null: if graph_edit != null:
if graph_edit.save_path != null: if graph_edit.save_path != null:
graph_edit.save_file(graph_edit.save_path) graph_edit.save_file(graph_edit.save_path)
@ -177,7 +184,7 @@ func save_material():
save_material_as() save_material_as()
func save_material_as(): func save_material_as():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit != null: if graph_edit != null:
var dialog = FileDialog.new() var dialog = FileDialog.new()
add_child(dialog) add_child(dialog)
@ -192,12 +199,12 @@ func close_material():
$VBoxContainer/HBoxContainer/Projects.close_tab() $VBoxContainer/HBoxContainer/Projects.close_tab()
func export_material(): func export_material():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit != null : if graph_edit != null :
graph_edit.export_textures() graph_edit.export_textures()
func export_material_is_disabled(): func export_material_is_disabled():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit == null or graph_edit.save_path == null: if graph_edit == null or graph_edit.save_path == null:
return true return true
return false return false
@ -209,16 +216,16 @@ func quit():
get_tree().quit() get_tree().quit()
func edit_cut(): func edit_cut():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit != null: if graph_edit != null:
graph_edit.cut() graph_edit.cut()
func edit_cut_is_disabled(): func edit_cut_is_disabled():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
return graph_edit == null or !graph_edit.can_copy() return graph_edit == null or !graph_edit.can_copy()
func edit_copy(): func edit_copy():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit != null: if graph_edit != null:
graph_edit.copy() graph_edit.copy()
@ -226,7 +233,7 @@ func edit_copy_is_disabled():
return edit_cut_is_disabled() return edit_cut_is_disabled()
func edit_paste(): func edit_paste():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit != null: if graph_edit != null:
graph_edit.paste() graph_edit.paste()
@ -235,8 +242,8 @@ func edit_paste_is_disabled():
return data == null return data == null
func get_selected_nodes(): func get_selected_nodes():
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control() var graph_edit = get_current_graph_edit()
if graph_edit != null and graph_edit is GraphEdit: if graph_edit != null:
var selected_nodes = [] var selected_nodes = []
for n in graph_edit.get_children(): for n in graph_edit.get_children():
if n is GraphNode and n.selected: if n is GraphNode and n.selected:
@ -245,6 +252,14 @@ func get_selected_nodes():
else: else:
return [] return []
func create_subgraph():
var graph_edit = get_current_graph_edit()
var selected_nodes = get_selected_nodes()
if !selected_nodes.empty():
for n in selected_nodes:
print(n.name)
# TODO !
func make_selected_nodes_editable(): func make_selected_nodes_editable():
var selected_nodes = get_selected_nodes() var selected_nodes = get_selected_nodes()
if !selected_nodes.empty(): if !selected_nodes.empty():
@ -263,12 +278,12 @@ func add_to_user_library():
dialog.popup_centered() dialog.popup_centered()
func do_add_to_user_library(name, nodes): func do_add_to_user_library(name, nodes):
var graph_edit = get_current_graph_edit()
var data var data
if nodes.size() == 1: if nodes.size() == 1:
data = nodes[0].serialize() data = nodes[0].serialize()
data.erase("node_position") data.erase("node_position")
else: elif graph_edit != null:
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control()
data = graph_edit.serialize_selection() data = graph_edit.serialize_selection()
var dir = Directory.new() var dir = Directory.new()
dir.make_dir("user://library") dir.make_dir("user://library")
@ -276,7 +291,6 @@ func do_add_to_user_library(name, nodes):
data.library = "user://library/user.json" data.library = "user://library/user.json"
data.icon = name.right(name.rfind("/")+1).to_lower() data.icon = name.right(name.rfind("/")+1).to_lower()
$VBoxContainer/HBoxContainer/VBoxContainer/Library.add_item(data, name) $VBoxContainer/HBoxContainer/VBoxContainer/Library.add_item(data, name)
var graph_edit = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control()
graph_edit.export_texture(nodes[0], "user://library/user/"+data.icon+".png", 64) graph_edit.export_texture(nodes[0], "user://library/user/"+data.icon+".png", 64)
func save_user_library(): func save_user_library():

View File

@ -1,31 +1,45 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://addons/material_maker/nodes/edit_buttons.gd" type="Script" id=1] [ext_resource path="res://addons/material_maker/nodes/edit_buttons.gd" type="Script" id=1]
[ext_resource path="res://addons/material_maker/icons/edit.png" type="Texture" id=2] [ext_resource path="res://addons/material_maker/icons/icons.svg" type="Texture" id=2]
[ext_resource path="res://addons/material_maker/icons/load.png" type="Texture" id=3]
[ext_resource path="res://addons/material_maker/icons/save.png" type="Texture" id=4] [sub_resource type="AtlasTexture" id=1]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 16, 16, 16, 16 )
filter_clip = true
[sub_resource type="AtlasTexture" id=2]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 48, 16, 16, 16 )
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 2 )
region = Rect2( 32, 16, 16, 16 )
[node name="NodeEditButtons" type="HBoxContainer"] [node name="NodeEditButtons" type="HBoxContainer"]
margin_right = 91.0 margin_right = 65.0
margin_bottom = 22.0 margin_bottom = 22.0
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Edit" type="Button" parent="."] [node name="Edit" type="Button" parent="."]
margin_right = 27.0 margin_right = 13.0
margin_bottom = 22.0 margin_bottom = 22.0
icon = ExtResource( 2 ) icon = SubResource( 1 )
flat = true flat = true
[node name="Load" type="Button" parent="."] [node name="Load" type="Button" parent="."]
margin_left = 31.0 margin_left = 17.0
margin_right = 59.0 margin_right = 30.0
margin_bottom = 22.0 margin_bottom = 22.0
icon = ExtResource( 3 ) icon = SubResource( 2 )
flat = true flat = true
[node name="Save" type="Button" parent="."] [node name="Save" type="Button" parent="."]
margin_left = 63.0 margin_left = 34.0
margin_right = 91.0 margin_right = 47.0
margin_bottom = 22.0 margin_bottom = 22.0
icon = ExtResource( 4 ) icon = SubResource( 3 )
flat = true flat = true

View File

@ -1 +1 @@
{"connections":[{"from":"nm_convolution","from_port":0,"to":"nm_postprocess","to_port":0},{"from":"nm_postprocess","from_port":0,"to":"gen_outputs","to_port":0},{"from":"gen_inputs","from_port":0,"to":"buffer","to_port":0},{"from":"buffer","from_port":0,"to":"nm_convolution","to_port":0}],"label":"Normal Map","name":"normal_map","node_position":{"x":0,"y":0},"nodes":[{"name":"gen_inputs","node_position":{"x":-259.25,"y":-144.75},"type":"ios","ports":[{"name":"in","type":"rgba"}]},{"name":"gen_outputs","node_position":{"x":145.75,"y":-3.75},"type":"ios","ports":[{"name":"in","type":"rgba"}]},{"convolution_params":{"input_type":"f","matrix":[[[-1,-1,0],[0,-2,0],[1,-1,0]],[[-2,0,0],0,[2,0,0]],[[-1,1,0],[0,2,0],[1,1,0]]],"output_type":"rgb","x":1,"y":1},"name":"nm_convolution","node_position":{"x":-89.25,"y":-76.75},"parameters":{"size":5},"type":"shader"},{"name":"nm_postprocess","node_position":{"x":-98.25,"y":-6.75},"parameters":{"amount":0.995,"size":5},"shader_model":{"global":"","inputs":[{"default":"vec3(0.0)","label":"","name":"in","type":"rgb"}],"instance":"","name":"NormalMapPostProcess","outputs":[{"rgb":"0.5*normalize($in($uv)*$amount*$size/128.0-vec3(0.0, 0.0, 1.0))+vec3(0.5)","type":"rgb"}],"parameters":[{"default":8,"first":4,"label":"","last":11,"name":"size","type":"size"},{"default":1,"label":"","max":2,"min":0,"name":"amount","step":0.005,"type":"float"}]},"type":"shader"},{"name":"buffer","node_position":{"x":-89.663818,"y":-147.39386},"parameters":{"size":5},"type":"buffer"}],"parameters":{"amount":0.35,"size":4},"type":"graph"} {"connections":[{"from":"nm_convolution","from_port":0,"to":"nm_postprocess","to_port":0},{"from":"nm_postprocess","from_port":0,"to":"gen_outputs","to_port":0},{"from":"gen_inputs","from_port":0,"to":"buffer","to_port":0},{"from":"buffer","from_port":0,"to":"nm_convolution","to_port":0}],"label":"Normal Map","name":"normal_map","node_position":{"x":0,"y":0},"nodes":[{"mask":3,"name":"gen_inputs","node_position":{"x":-839.25,"y":177.25},"parameters":{"size":4},"ports":[{"name":"in","type":"rgba"}],"type":"ios"},{"mask":3,"name":"gen_outputs","node_position":{"x":-434.25,"y":318.25},"parameters":{"size":4},"ports":[{"name":"in","type":"rgba"}],"type":"ios"},{"convolution_params":{"input_type":"f","matrix":[[[-1,-1,0],[0,-2,0],[1,-1,0]],[[-2,0,0],0,[2,0,0]],[[-1,1,0],[0,2,0],[1,1,0]]],"output_type":"rgb","x":1,"y":1},"name":"nm_convolution","node_position":{"x":-669.25,"y":245.25},"parameters":{"size":5},"type":"shader"},{"name":"nm_postprocess","node_position":{"x":-678.25,"y":315.25},"parameters":{"amount":0.99,"size":5},"shader_model":{"global":"","inputs":[{"default":"vec3(0.0)","label":"","name":"in","type":"rgb"}],"instance":"","name":"NormalMapPostProcess","outputs":[{"rgb":"0.5*normalize($in($uv)*$amount*$size/128.0-vec3(0.0, 0.0, 1.0))+vec3(0.5)","type":"rgb"}],"parameters":[{"default":8,"first":4,"label":"","last":11,"name":"size","type":"size"},{"default":1,"label":"","max":2,"min":0,"name":"amount","step":0.005,"type":"float"}]},"type":"shader"},{"name":"buffer","node_position":{"x":-669.663818,"y":174.60614},"parameters":{"size":5},"type":"buffer"},{"name":"gen_parameters","node_position":{"x":-702.910156,"y":23.083313},"parameters":{"param0":5,"param1":0.99},"type":"remote","widgets":[{"label":"Unnamed","linked_widgets":[{"node":"buffer","widget":"size"},{"node":"nm_convolution","widget":"size"},{"node":"nm_postprocess","widget":"size"}],"type":"linked_control"},{"label":"Unnamed","linked_widgets":[{"node":"nm_postprocess","widget":"amount"}],"type":"linked_control"}]}],"parameters":{"amount":0.35,"param0":5,"param1":0.99,"size":4},"type":"graph"}

View File

@ -108,14 +108,12 @@ func _on_HBoxContainer_minimum_size_changed():
print("_on_HBoxContainer_minimum_size_changed "+str($HBoxContainer.rect_min_size)) print("_on_HBoxContainer_minimum_size_changed "+str($HBoxContainer.rect_min_size))
func on_parameter_changed(p, v): func on_parameter_changed(p, v):
print("remote.parameter_changed "+str(p)+" "+str(v))
if p == "": if p == "":
update_node() update_node()
else: else:
.on_parameter_changed(p, v) .on_parameter_changed(p, v)
func on_enter_widget(widget): func on_enter_widget(widget):
print("enter_widget "+widget.name)
var param_index = widget.name.trim_prefix("param").to_int() var param_index = widget.name.trim_prefix("param").to_int()
var w = generator.widgets[param_index] var w = generator.widgets[param_index]
var new_links = [] var new_links = []

View File

@ -51,7 +51,6 @@ func _ready():
set_value(MMGradient.new()) set_value(MMGradient.new())
func set_value(v): func set_value(v):
print("GradientEditor.set_value")
value = v value = v
for c in get_children(): for c in get_children():
if c != $Gradient and c != $Background: if c != $Gradient and c != $Background:

View File

@ -3,154 +3,45 @@
[ext_resource path="res://addons/material_maker/widgets/line_dialog.gd" type="Script" id=1] [ext_resource path="res://addons/material_maker/widgets/line_dialog.gd" type="Script" id=1]
[node name="LineDialog" type="WindowDialog"] [node name="LineDialog" type="WindowDialog"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 332.0 margin_right = 332.0
margin_bottom = 72.0 margin_bottom = 72.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
popup_exclusive = false
window_title = "blah" window_title = "blah"
resizable = false
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="." index="1"] [node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.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="VBoxContainer" index="0"] [node name="Label" type="Label" parent="VBoxContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 332.0 margin_right = 332.0
margin_bottom = 14.0 margin_bottom = 14.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 = "blah" text = "blah"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="LineEdit" type="LineEdit" parent="VBoxContainer" index="1"] [node name="LineEdit" type="LineEdit" parent="VBoxContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 18.0 margin_top = 18.0
margin_right = 332.0 margin_right = 332.0
margin_bottom = 42.0 margin_bottom = 42.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 1
size_flags_horizontal = 1
size_flags_vertical = 1
focus_mode = 2
context_menu_enabled = true
placeholder_alpha = 0.6
caret_blink = false
caret_blink_speed = 0.65
caret_position = 0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer" index="2"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 104.0 margin_left = 104.0
margin_top = 46.0 margin_top = 46.0
margin_right = 228.0 margin_right = 228.0
margin_bottom = 66.0 margin_bottom = 66.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 0 size_flags_vertical = 0
alignment = 0
_sections_unfolded = [ "Size Flags" ]
[node name="OK" type="Button" parent="VBoxContainer/HBoxContainer" index="0"] [node name="OK" type="Button" parent="VBoxContainer/HBoxContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 60.0 margin_right = 60.0
margin_bottom = 20.0 margin_bottom = 20.0
rect_min_size = Vector2( 60, 0 ) rect_min_size = Vector2( 60, 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 = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "OK" text = "OK"
flat = false
align = 1
_sections_unfolded = [ "Rect" ]
[node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer" index="1"] [node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 64.0 margin_left = 64.0
margin_right = 124.0 margin_right = 124.0
margin_bottom = 20.0 margin_bottom = 20.0
rect_min_size = Vector2( 60, 0 ) rect_min_size = Vector2( 60, 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 = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Cancel" text = "Cancel"
flat = false
align = 1
_sections_unfolded = [ "Rect" ]
[connection signal="text_entered" from="VBoxContainer/LineEdit" to="." method="_on_LineEdit_text_entered"] [connection signal="text_entered" from="VBoxContainer/LineEdit" to="." method="_on_LineEdit_text_entered"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/OK" to="." method="_on_OK_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/OK" to="." method="_on_OK_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Cancel" to="." method="queue_free"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/Cancel" to="." method="queue_free"]

1
adjust_hsv.mmg Normal file
View File

@ -0,0 +1 @@
{"name":"uniform","node_position":{"x":0,"y":0},"parameters":{"hue":0,"saturation":1,"value":1},"shader_model":{"global":"vec3 rgb_to_hsv(vec3 c) {\n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\tvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\n\tvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\n\n\tfloat d = q.x - min(q.w, q.y);\n\tfloat e = 1.0e-10;\n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\nvec3 hsv_to_rgb(vec3 c) {\n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n","inputs":[{"default":"vec4($uv.x, $uv.y, 0.0, 1.0)","label":"","name":"in","type":"rgba"}],"instance":"vec4 $(name)_f(vec4 c) {\n\tvec3 hsv = rgb_to_hsv(c.rgb);\n\treturn vec4(hsv_to_rgb(vec3(fract(hsv.x+$(hue)), clamp(hsv.y*$(saturation), 0.0, 1.0), clamp(hsv.z*$(value), 0.0, 1.0))), c.a);\n}","name":"AdjustHSV","outputs":[{"rgba":"$(name)_f($in($(uv)))"}],"parameters":[{"default":0,"label":"Hue","max":0.5,"min":-0.5,"name":"hue","step":0,"type":"float"},{"default":1,"label":"Saturation","max":2,"min":0,"name":"saturation","step":0,"type":"float"},{"default":1,"label":"Value","max":2,"min":0,"name":"value","step":0,"type":"float"}]}}

1
bricks.mmn Normal file
View File

@ -0,0 +1 @@
{"global":"\n\t\tvec3 brick(vec2 uv, vec2 bmin, vec2 bmax, float mortar, float bevel) {\n\t\t\tfloat color = 0.5;\n\t\t\tvec2 c1 = (uv-bmin-vec2(mortar))/bevel;\n\t\t\tvec2 c2 = (bmax-uv-vec2(mortar))/bevel;\n\t\t\tvec2 c = min(c1, c2);\n\t\t\tcolor = clamp(min(c.x, c.y), 0.0, 1.0);\n\t\t\treturn vec3(color, mod(bmin, vec2(1.0, 1.0)));\n\t\t}\n\n\t\tvec3 bricks_rb(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\t\t\tcount *= repeat;\n\t\t\tmortar /= max(count.x, count.y);\n\t\t\tbevel /= max(count.x, count.y);\n\t\t\tfloat x_offset = offset*step(0.5, fract(uv.y*count.y*0.5));\n\t\t\tvec2 bmin = floor(vec2(uv.x*count.x-x_offset, uv.y*count.y));\n\t\t\tbmin.x += x_offset;\n\t\t\tbmin /= count;\n\t\t\treturn brick(uv, bmin, bmin+vec2(1.0)/count, mortar, bevel);\n\t\t}\n\n\t\tvec3 bricks_rb2(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\t\t\tcount *= repeat;\n\t\t\tmortar /= max(2.0*count.x, count.y);\n\t\t\tbevel /= max(2.0*count.x, count.y);\n\t\t\tfloat x_offset = offset*step(0.5, fract(uv.y*count.y*0.5));\n\t\t\tcount.x = count.x*(1.0+step(0.5, fract(uv.y*count.y*0.5)));\n\t\t\tvec2 bmin = floor(vec2(uv.x*count.x-x_offset, uv.y*count.y));\n\t\t\tbmin.x += x_offset;\n\t\t\tbmin /= count;\n\t\t\treturn brick(uv, bmin, bmin+vec2(1.0)/count, mortar, bevel);\n\t\t}\n\n\t\tvec3 bricks_hb(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\t\t\tfloat pc = count.x+count.y;\n\t\t\tfloat c = pc*repeat;\n\t\t\tmortar /= c;\n\t\t\tbevel /= c;\n\t\t\tvec2 corner = floor(uv*c);\n\t\t\tfloat cdiff = mod(corner.x-corner.y, pc);\n\t\t\tif (cdiff < count.x) {\n\t\t\t\treturn brick(uv, (corner-vec2(cdiff, 0.0))/c, (corner-vec2(cdiff, 0.0)+vec2(count.x, 1.0))/c, mortar, bevel);\n\t\t\t} else {\n\t\t\t\treturn brick(uv, (corner-vec2(0.0, pc-cdiff-1.0))/c, (corner-vec2(0.0, pc-cdiff-1.0)+vec2(1.0, count.y))/c, mortar, bevel);\n\t\t\t}\n\t\t}\n\n\t\tvec3 bricks_bw(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\t\t\tvec2 c = 2.0*count*repeat;\n\t\t\tfloat mc = max(c.x, c.y);\n\t\t\tmortar /= mc;\n\t\t\tbevel /= mc;\n\t\t\tvec2 corner1 = floor(uv*c);\n\t\t\tvec2 corner2 = count*floor(repeat*2.0*uv);\n\t\t\tfloat cdiff = mod(dot(floor(repeat*2.0*uv), vec2(1.0)), 2.0);\n\t\t\tvec2 corner;\n\t\t\tvec2 size;\n\t\t\tif (cdiff == 0.0) {\n\t\t\t\tcorner = vec2(corner1.x, corner2.y);\n\t\t\t\tsize = vec2(1.0, count.y);\n\t\t\t} else {\n\t\t\t\tcorner = vec2(corner2.x, corner1.y);\n\t\t\t\tsize = vec2(count.x, 1.0);\n\t\t\t}\n\t\t\treturn brick(uv, corner/c, (corner+size)/c, mortar, bevel);\n\t\t}\n\n\t\tvec3 bricks_sb(vec2 uv, vec2 count, float repeat, float offset, float mortar, float bevel) {\n\t\t\tvec2 c = (count+vec2(1.0))*repeat;\n\t\t\tfloat mc = max(c.x, c.y);\n\t\t\tmortar /= mc;\n\t\t\tbevel /= mc;\n\t\t\tvec2 corner1 = floor(uv*c);\n\t\t\tvec2 corner2 = (count+vec2(1.0))*floor(repeat*uv);\n\t\t\tvec2 rcorner = corner1 - corner2;\n\t\t\tvec2 corner;\n\t\t\tvec2 size;\n\t\t\tif (rcorner.x == 0.0 && rcorner.y < count.y) {\n\t\t\t\tcorner = corner2;\n\t\t\t\tsize = vec2(1.0, count.y);\n\t\t\t} else if (rcorner.y == 0.0) {\n\t\t\t\tcorner = corner2+vec2(1.0, 0.0);\n\t\t\t\tsize = vec2(count.x, 1.0);\n\t\t\t} else if (rcorner.x == count.x) {\n\t\t\t\tcorner = corner2+vec2(count.x, 1.0);\n\t\t\t\tsize = vec2(1.0, count.y);\n\t\t\t} else if (rcorner.y == count.y) {\n\t\t\t\tcorner = corner2+vec2(0.0, count.y);\n\t\t\t\tsize = vec2(count.x, 1.0);\n\t\t\t} else {\n\t\t\t\tcorner = corner2+vec2(1.0);\n\t\t\t\tsize = vec2(count.x-1.0, count.y-1.0);\n\t\t\t}\n\t\t\treturn brick(uv, corner/c, (corner+size)/c, mortar, bevel);\n\t\t}","include":["noise"],"instance":"\n\t\tvec3 $(name)_xyz(vec2 uv) {\n\t\t\treturn bricks_$(pattern)(uv, vec2($(columns), $(rows)), $(repeat), $(row_offset), $(mortar), max(0.001, $(bevel)));\n\t\t}","name":"Bricks","outputs":[{"f":"$(name)_xyz($(uv)).x"},{"rgb":"rand3($(name)_xyz($(uv)).yz+vec2($(seed)))"}],"parameters":[{"label":"","name":"pattern","type":"enum","values":[{"name":"Running bond","value":"rb"},{"name":"Running bond (2)","value":"rb2"},{"name":"HerringBone","value":"hb"},{"name":"Basket weave","value":"bw"},{"name":"Spanish bond","value":"sb"}]},{"default":1,"label":"Repeat:","max":8,"min":1,"name":"repeat","step":1,"type":"float","widget":"spinbox"},{"default":6,"label":"Rows:","max":64,"min":1,"name":"rows","step":1,"type":"float","widget":"spinbox"},{"default":3,"label":"Columns:","max":64,"min":1,"name":"columns","step":1,"type":"float","widget":"spinbox"},{"default":0.5,"label":"Offset:","max":1,"min":0,"name":"row_offset","type":"float"},{"default":0.1,"label":"Mortar:","max":0.5,"min":0,"name":"mortar","type":"float"},{"default":0.1,"label":"Bevel:","max":0.5,"min":0,"name":"bevel","type":"float"}]}

1
combine.mmg Normal file
View File

@ -0,0 +1 @@
{"name":"uniform","node_position":{"x":-253,"y":21},"parameters":{"color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"}},"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":"Uniform","outputs":[{"rgba":"vec4($r($uv), $g($uv), $b($uv), $a($uv))"}],"parameters":[{"default":0,"label":"Label","max":0,"min":0,"name":"name","step":0,"type":"float"},{"default":0,"label":"Label","max":0,"min":0,"name":"name","step":0,"type":"float"},{"default":0,"label":"Label","max":0,"min":0,"name":"name","step":0,"type":"float"},{"default":0,"label":"Label","max":0,"min":0,"name":"name","step":0,"type":"float"}]}}

File diff suppressed because one or more lines are too long

1
noise.mmn Normal file
View File

@ -0,0 +1 @@
{"global":"\n\t\tfloat rand(vec2 x) {\n\t\t\treturn fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);\n\t\t}\n\t\tvec2 rand2(vec2 x) {\n\t\t\treturn fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),\n\t\t\t\t\t\t\t\t dot(x, vec2(3.4562, 17.398)))) * 43758.5453);\n\t\t}\n\t\tvec3 rand3(vec2 x) {\n\t\t\treturn fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),\n\t\t\t\t\t\t\t\t dot(x, vec2(3.4562, 17.398)),\n\t\t\t\t\t\t\t\t dot(x, vec2(13.254, 5.867)))) * 43758.5453);\n\t\t}","instance":"\n\t\tfloat $(name)_f(vec2 uv) {\n\t\t\treturn dots(uv, 1.0/$(size), $(density), $(seed));\n\t\t}","name":"Noise","outputs":[{"f":"$(name)_f($(uv))"}],"parameters":[{"default":8,"first":2,"label":"Grid Size:","last":12,"name":"size","type":"size"},{"label":"Density:","max":1,"min":0,"name":"density","type":"float"}]}

1
normal_map.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[{"from":"pattern","from_port":0,"to":"normal_map","to_port":0}],"label":"Graph","name":"@@39","node_position":{"x":0,"y":0},"nodes":[{"name":"Material","node_position":{"x":247,"y":-12},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"emission_energy":1,"metallic":1,"roughness":1},"type":"material"},{"name":"pattern","node_position":{"x":-338.5,"y":38.5},"parameters":{"mix":0,"x_scale":4,"x_wave":0,"y_scale":4,"y_wave":0},"type":"pattern"},{"name":"normal_map","node_position":{"x":-9.5,"y":69.5},"parameters":{"amount":0.5},"type":"normal_map"}],"parameters":{},"type":"graph"}

1
remote_test.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[{"from":"colorize_2","from_port":0,"to":"Material","to_port":0},{"from":"colorize_3","from_port":0,"to":"colorize_2","to_port":0},{"from":"perlin","from_port":0,"to":"colorize_3","to_port":0},{"from":"colorize_4","from_port":0,"to":"Material","to_port":2},{"from":"colorize_3","from_port":0,"to":"colorize_4","to_port":0}],"label":"Graph","name":"39","node_position":{"x":0,"y":0},"nodes":[{"name":"Material","node_position":{"x":105,"y":242},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"roughness":1},"type":"material"},{"name":"_2","node_position":{"x":-352.5,"y":53.5},"parameters":{"param0":0,"param1":{"points":[{"a":1,"b":1,"g":1,"pos":0,"r":1},{"a":1,"b":0,"g":0,"pos":1,"r":0}],"type":"Gradient"}},"type":"remote","widgets":[{"configurations":{"Invert":[{"node":"_2","value":{"points":[{"a":1,"b":1,"g":1,"pos":0,"r":1},{"a":1,"b":0,"g":0,"pos":1,"r":0}],"type":"Gradient"},"widget":"param1"}],"Rainbow":[{"node":"_2","value":{"points":[{"a":1,"b":0,"g":0,"pos":0,"r":1},{"a":1,"b":0,"g":1,"pos":0.239394,"r":1},{"a":1,"b":0,"g":1,"pos":0.484849,"r":0.09375},{"a":1,"b":1,"g":0.09375,"pos":0.748485,"r":0},{"a":1,"b":0.96875,"g":0,"pos":1,"r":1}],"type":"Gradient"},"widget":"param1"}],"Terrain":[{"node":"_2","value":{"points":[{"a":1,"b":1,"g":0.40625,"pos":0.154545,"r":0},{"a":1,"b":0.619792,"g":0.916829,"pos":0.20101,"r":1},{"a":1,"b":0.619792,"g":0.916829,"pos":0.328283,"r":1},{"a":1,"b":0,"g":1,"pos":0.357576,"r":0.09375},{"a":1,"b":0,"g":0.330121,"pos":0.646464,"r":0.371768},{"a":1,"b":0,"g":0.272135,"pos":0.839394,"r":0.395833},{"a":1,"b":1,"g":1,"pos":0.927273,"r":1}],"type":"Gradient"},"widget":"param1"}]},"label":"Unnamed","linked_widgets":[{"node":"colorize","widget":"gradient"},{"node":"_2","widget":"param1"}],"type":"config_control"},{"label":"Unnamed","linked_widgets":[{"node":"colorize_2","widget":"gradient"}],"type":"linked_control"}]},{"name":"colorize_2","node_position":{"x":-284.166656,"y":177},"parameters":{"gradient":{"points":[{"a":1,"b":1,"g":1,"pos":0,"r":1},{"a":1,"b":0,"g":0,"pos":1,"r":0}],"type":"Gradient"}},"type":"colorize"},{"name":"perlin","node_position":{"x":-726.388916,"y":209.166656},"parameters":{"iterations":7,"persistence":0.65,"scale_x":8,"scale_y":8},"type":"perlin"},{"name":"colorize_3","node_position":{"x":-602.188904,"y":390.166656},"parameters":{"gradient":{"points":[{"a":1,"b":0,"g":0,"pos":0.381818,"r":0},{"a":1,"b":1,"g":1,"pos":0.854545,"r":1}],"type":"Gradient"}},"type":"colorize"},{"name":"colorize_4","node_position":{"x":-248.188904,"y":414.166656},"parameters":{"gradient":{"points":[{"a":1,"b":0.182292,"g":0.182292,"pos":0.072727,"r":0.182292},{"a":1,"b":1,"g":1,"pos":0.154545,"r":1}],"type":"Gradient"}},"type":"colorize"}],"parameters":{},"type":"graph"}

1
shape_tests.ptex Normal file

File diff suppressed because one or more lines are too long

1
test.mmn Normal file
View File

@ -0,0 +1 @@
{"global":"","instance":"","name":"Test","outputs":[{"f":"abs($(uv).x+$(uv).y-1.0)"}],"parameters":[]}

BIN
test.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 204 KiB

159
test.ptex
View File

@ -1,158 +1 @@
{ {"connections":[{"from":"bricks_0","from_port":0,"to":"custom_0","to_port":0},{"from":"custom_0","from_port":0,"to":"adjust_hsv_0","to_port":0},{"from":"adjust_hsv_0","from_port":0,"to":"Material","to_port":0}],"name":"@@72","node_position":{"x":0,"y":0},"nodes":[{"name":"Material","node_position":{"x":143,"y":-210},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"resolution":1,"roughness":1},"type":"material"},{"name":"custom_0","node_position":{"x":-402,"y":-106.416656},"parameters":{"gradient":{"points":[{"a":1,"b":0,"g":0,"pos":0,"r":0},{"a":1,"b":0,"g":0,"pos":0.517045,"r":1},{"a":0,"b":1,"g":1,"pos":1,"r":1}],"type":"Gradient"}},"shader_model":{"global":"","inputs":[{"default":"0.0","label":"Input","name":"input","type":"f"}],"instance":"","name":"Colorize","outputs":[{"rgba":"$gradient($input($uv))","type":"rgba"}],"parameters":[{"default":{"points":[{"a":1,"b":0,"g":0,"pos":0,"r":0},{"a":1,"b":1,"g":1,"pos":1,"r":1}],"type":"Gradient"},"label":"Gradient","name":"gradient","type":"gradient"}]}},{"name":"adjust_hsv_0","node_position":{"x":-135.541687,"y":-150.597229},"parameters":{"hue":0.293457,"saturation":1,"value":1},"type":"adjust_hsv"},{"name":"bricks_0","node_position":{"x":-599,"y":-332},"parameters":{"bevel":0.209961,"columns":3,"mortar":0.116211,"pattern":0,"repeat":1,"row_offset":0.5,"rows":6},"type":"bricks"}],"parameters":{}}
"connections": [
{
"from": "bricks_0",
"from_port": 0,
"to": "custom_0",
"to_port": 0
},
{
"from": "custom_0",
"from_port": 0,
"to": "adjust_hsv_0",
"to_port": 0
},
{
"from": "adjust_hsv_0",
"from_port": 0,
"to": "Material",
"to_port": 0
}
],
"nodes": [
{
"name": "Material",
"node_position": {
"x": 143,
"y": -210
},
"parameters": {
"albedo_color": {
"a": 1,
"b": 1,
"g": 1,
"r": 1,
"type": "Color"
},
"ao_light_affect": 1,
"depth_scale": 1,
"emission_energy": 1,
"metallic": 1,
"normal_scale": 1,
"resolution": 1,
"roughness": 1
},
"type": "material"
},
{
"shader_model": {
"global": "",
"inputs": [
{
"default": "0.0",
"label": "Input",
"name": "input",
"type": "f"
}
],
"instance": "",
"name": "Colorize",
"outputs": [
{
"rgba": "$gradient($input($uv))"
}
],
"parameters": [
{
"default": {
"points": [
{
"a": 1,
"b": 0,
"g": 0,
"pos": 0,
"r": 0
},
{
"a": 1,
"b": 1,
"g": 1,
"pos": 1,
"r": 1
}
],
"type": "Gradient"
},
"label": "Gradient",
"name": "gradient",
"type": "gradient"
}
]
},
"name": "custom_0",
"node_position": {
"x": -433,
"y": -109.416656
},
"parameters": {
"gradient": {
"points": [
{
"a": 1,
"b": 0,
"g": 0,
"pos": 0,
"r": 0
},
{
"a": 1,
"b": 0,
"g": 0,
"pos": 0.517045,
"r": 1
},
{
"a": 0,
"b": 1,
"g": 1,
"pos": 1,
"r": 1
}
],
"type": "Gradient"
}
},
"type": "custom"
},
{
"name": "adjust_hsv_0",
"node_position": {
"x": -135.541687,
"y": -150.597229
},
"parameters": {
"hue": 0,
"saturation": 1,
"value": 1
},
"type": "adjust_hsv"
},
{
"name": "bricks_0",
"node_position": {
"x": -599,
"y": -332
},
"parameters": {
"bevel": 0.209961,
"columns": 3,
"mortar": 0.116211,
"pattern": 0,
"repeat": 1,
"row_offset": 0.5,
"rows": 6
},
"type": "bricks"
}
]
}

1
test2.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[{"from":"pattern","from_port":0,"to":"buffer","to_port":0},{"from":"buffer","from_port":0,"to":"Material","to_port":0}],"name":"@@39","node_position":{"x":0,"y":0},"nodes":[{"name":"Material","node_position":{"x":0,"y":0},"parameters":{},"type":"material"},{"name":"pattern","node_position":{"x":-282,"y":23},"parameters":{"mix":0,"x_scale":4,"x_wave":0,"y_scale":4,"y_wave":0},"type":"pattern"},{"name":"buffer","node_position":{"x":-7,"y":29},"parameters":{"size":1},"type":"buffer"}],"parameters":{}}

10
test2.tres Normal file
View File

@ -0,0 +1,10 @@
[gd_resource type="SpatialMaterial" load_steps=2 format=2]
[ext_resource path="res://test2_albedo.png" type="Texture" id=1]
[resource]
albedo_texture = ExtResource( 1 )
metallic = 1.0
roughness_texture_channel = 1

BIN
test2_albedo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

1
test3.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[{"from":"pattern_0","from_port":0,"to":"Material","to_port":0},{"from":"pattern_0","from_port":0,"to":"Material","to_port":3}],"nodes":[{"name":"Material","node_position":{"x":158,"y":-147},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"resolution":0,"roughness":1},"type":"material"},{"name":"pattern_0","node_position":{"x":-204,"y":-94},"parameters":{"mix":2,"x_scale":4,"x_wave":0,"y_scale":4,"y_wave":0},"type":"pattern"}]}

1
test4.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[{"from":"uniform_0","from_port":0,"to":"adjust_hsv_0","to_port":0},{"from":"uniform_0","from_port":0,"to":"custom_0","to_port":0}],"nodes":[{"name":"Material","node_position":{"x":511,"y":-49},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"resolution":1,"roughness":1},"type":"material"},{"name":"uniform_0","node_position":{"x":-76,"y":71},"parameters":{"color":{"a":1,"b":0,"g":0,"r":1,"type":"Color"}},"type":"uniform"},{"model_data":{"global":"vec3 rgb_to_hsv(vec3 c) {\n\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\tvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\n\tvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\n\n\tfloat d = q.x - min(q.w, q.y);\n\tfloat e = 1.0e-10;\n\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\nvec3 hsv_to_rgb(vec3 c) {\n\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n","inputs":[{"default":"vec3(1.0)","label":"","name":"in","type":"rgb"}],"instance":"vec3 $(name)_f(vec3 c) {\n\tvec3 hsv = rgb_to_hsv(c);\n\treturn hsv_to_rgb(vec3(fract(hsv.x+$(hue)), clamp(hsv.y*$(saturation), 0.0, 1.0), clamp(hsv.z*$(value), 0.0, 1.0)));\n}","name":"AdjustHSV","outputs":[{"rgb":"$(name)_f($in($(uv)))"}],"parameters":[{"default":0,"label":"Hue","max":0.5,"min":-0.5,"name":"hue","step":0,"type":"float"},{"default":1,"label":"Saturation","max":2,"min":0,"name":"saturation","step":0,"type":"float"},{"default":1,"label":"Value","max":2,"min":0,"name":"value","step":0,"type":"float"}]},"name":"custom_0","node_position":{"x":163,"y":105},"parameters":{"hue":0,"saturation":1,"value":1},"type":"custom"},{"name":"adjust_hsv_0","node_position":{"x":152,"y":18},"parameters":{"hue":0,"saturation":1,"value":1},"type":"adjust_hsv"}]}

1
test5.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[{"from":"custom_0","from_port":0,"to":"custom_2","to_port":0},{"from":"custom_1","from_port":0,"to":"Material","to_port":0}],"nodes":[{"name":"pattern_0","node_position":{"x":-15.75,"y":44.25},"parameters":{"mix":4,"x_scale":4,"x_wave":0,"y_scale":4,"y_wave":0},"type":"pattern"},{"name":"Material","node_position":{"x":455,"y":26},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"ao_light_affect":1,"depth_scale":1,"emission_energy":1,"metallic":1,"normal_scale":1,"resolution":1,"roughness":1},"type":"material"},{"model_data":{"global":"","inputs":[{"default":"vec4(vec3(mod(floor($uv.x*16.0)+floor($uv.y*16.0), 2.0)), 1.0)","label":"Label","name":"in","type":"rgba"}],"instance":"","name":"","outputs":[{"rgba":"$in($(uv)+vec2($(x)*sin(10.0*$(uv).y), $(y)*sin(10.0*$(uv).x)))"}],"parameters":[{"default":0,"label":"X","max":1,"min":-1,"name":"x","step":0,"type":"float"},{"default":0,"label":"Y","max":1,"min":-1,"name":"y","step":0,"type":"float"}]},"name":"custom_0","node_position":{"x":-56,"y":-171},"parameters":{"x":0,"y":0},"type":"custom"},{"model_data":{"global":"","inputs":[{"default":"vec4(vec3(mod(floor($uv.x*16.0)+floor($uv.y*16.0), 2.0)), 1.0)","label":"Label","name":"in","type":"rgba"}],"instance":"","name":"","outputs":[{"rgba":"0.25*($in($uv+pow(0.5, $d)*vec2(1.0, 1.0))+$in($uv+pow(0.5, $d)*vec2(-1.0, 1.0))+$in($uv+pow(0.5, $d)*vec2(1.0, -1.0))+$in($uv+pow(0.5, $d)*vec2(-1.0, -1.0)))"}],"parameters":[{"default":1,"label":"D","max":12,"min":4,"name":"d","step":1,"type":"float"}]},"name":"custom_2","node_position":{"x":200.541656,"y":-139.916656},"parameters":{"d":8},"type":"custom"},{"model_data":{"global":"","inputs":[{"default":"vec4(vec3(mod(floor($uv.x*16.0)+floor($uv.y*16.0), 2.0)), 1.0)","label":"Label","name":"in","type":"rgba"}],"instance":"","name":"","outputs":[{"rgba":"$in(vec2($x*$uv.x, $y*$uv.y+sin(TIME)))"}],"parameters":[{"default":1,"label":"X","max":2,"min":0,"name":"x","step":0,"type":"float"},{"default":1,"label":"Y","max":2,"min":0,"name":"y","step":0,"type":"float"}]},"name":"custom_1","node_position":{"x":82.916656,"y":180.583344},"parameters":{"x":0.5,"y":1.40625},"type":"custom"}]}

1
test_buffer.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[{"from":"buffer","from_port":0,"to":"blend","to_port":0},{"from":"buffer","from_port":0,"to":"blend","to_port":1},{"from":"pattern","from_port":0,"to":"buffer","to_port":0},{"from":"blend","from_port":0,"to":"Material","to_port":0},{"from":"colorize","from_port":0,"to":"Material","to_port":2},{"from":"pattern","from_port":0,"to":"colorize","to_port":0}],"name":"39","node_position":{"x":0,"y":0},"nodes":[{"name":"Material","node_position":{"x":0,"y":0},"parameters":{"albedo_color":{"a":1,"b":0,"g":0,"r":1,"type":"Color"},"emission_energy":1,"metallic":0.4,"roughness":1},"type":"[SpatialMaterial:4439]"},{"name":"blend","node_position":{"x":28,"y":-208},"parameters":{"amount":0.5,"blend_type":0},"type":"blend"},{"name":"buffer","node_position":{"x":-193,"y":-200},"parameters":{"size":1},"type":"buffer"},{"name":"pattern","node_position":{"x":-458,"y":-197},"parameters":{"mix":0,"x_scale":4,"x_wave":0,"y_scale":4,"y_wave":0},"type":"pattern"},{"name":"colorize","node_position":{"x":-229.25,"y":-87.75},"parameters":{"gradient":{"points":[{"a":1,"b":0,"g":0,"pos":0.509091,"r":0},{"a":1,"b":1,"g":1,"pos":0.536364,"r":1}],"type":"Gradient"}},"type":"colorize"}],"parameters":{}}

1
test_material.ptex Normal file
View File

@ -0,0 +1 @@
{"connections":[],"name":"@@39","node_position":{"x":0,"y":0},"nodes":[{"name":"Material","node_position":{"x":0,"y":0},"parameters":{"albedo_color":{"a":1,"b":1,"g":1,"r":1,"type":"Color"},"emission_energy":1,"metallic":1,"roughness":1},"type":"material"}],"parameters":{},"type":"graph"}