diff --git a/.gitignore b/.gitignore index 3fe36e8..ae0beb6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ addons/procedural_material/models/models.dae addons/procedural_material/models/models.dae.import /examples/*.png /examples/*.import +examples/input_image.png.import +examples/input_image.png.import diff --git a/addons/procedural_material/graph_edit.gd b/addons/procedural_material/graph_edit.gd index 07de118..289343c 100644 --- a/addons/procedural_material/graph_edit.gd +++ b/addons/procedural_material/graph_edit.gd @@ -1,6 +1,9 @@ tool extends GraphEdit +var save_path = null + +signal save_path_changed signal graph_changed func _ready(): @@ -11,15 +14,12 @@ func get_source(node, port): if c.to == node && c.to_port == port: return { node=c.from, slot=c.from_port } -func add_node(node, position = null): +func add_node(node, global_position = null): add_child(node) - if position != null: - node.offset = position + if global_position != null: + node.offset = (scroll_offset + global_position - rect_global_position) / zoom node.connect("close_request", self, "remove_node", [ node ]) -func add_node_globalpos(node, global_position): - add_node(node, (scroll_offset + global_position - rect_global_position) / zoom) - func remove_node(node): var node_name = node.name for c in get_connection_list(): @@ -39,22 +39,66 @@ func _on_GraphEdit_disconnection_request(from, from_slot, to, to_slot): disconnect_node(from, from_slot, to, to_slot) send_changed_signal(); +# Global operations on graph + +func update_tab_title(): + var title = "[unnamed]" + if save_path != null: + title = save_path.right(save_path.rfind("/")+1) + get_parent().set_tab_title(get_index(), title) + +func set_save_path(path): + if path != save_path: + save_path = path + if get_parent() is TabContainer: + update_tab_title() + else: + emit_signal("save_path_changed", self, path) + func clear_material(): clear_connections() for c in get_children(): if c is GraphNode: remove_child(c) c.free() + send_changed_signal() func new_material(): clear_material() - var node_type = load("res://addons/procedural_material/nodes/material.tscn") + create_node({name="Material", type="material"}) + set_save_path(null) + +func create_node(data, global_position = null): + if !data.has("type"): + return null + var node_type = load("res://addons/procedural_material/nodes/"+data.type+".tscn") if node_type != null: var node = node_type.instance() - add_node(node) - do_send_changed_signal() + if data.has("name") && !has_node(data.name): + node.name = data.name + else: + var i = 0 + while true: + var node_name = data.type+"_"+str(i) + if !has_node(node_name): + node.name = node_name + break + i += 1 + add_node(node, global_position) + node.deserialize(data) + send_changed_signal() -func load_file(filename): +func load_file(): + var dialog = FileDialog.new() + add_child(dialog) + dialog.rect_min_size = Vector2(500, 500) + dialog.access = FileDialog.ACCESS_FILESYSTEM + dialog.mode = FileDialog.MODE_OPEN_FILE + dialog.add_filter("*.ptex;Procedural textures file") + dialog.connect("file_selected", self, "do_load_file") + dialog.popup_centered() + +func do_load_file(filename): var file = File.new() if file.open(filename, File.READ) != OK: return @@ -62,19 +106,29 @@ func load_file(filename): file.close() clear_material() for n in data.nodes: - if !n.has("type"): - continue - var node_type = load("res://addons/procedural_material/nodes/"+n.type+".tscn") - if node_type != null: - var node = node_type.instance() - node.name = n.name - add_node(node) - node.deserialize(n) + var node = create_node(n) for c in data.connections: connect_node(c.from, c.from_port, c.to, c.to_port) - do_send_changed_signal() + set_save_path(filename) + send_changed_signal() -func save_file(filename): +func save_file(): + if save_path != null: + do_save_file(save_path) + else: + save_file_as() + +func save_file_as(): + var dialog = FileDialog.new() + add_child(dialog) + dialog.rect_min_size = Vector2(500, 500) + dialog.access = FileDialog.ACCESS_FILESYSTEM + dialog.mode = FileDialog.MODE_SAVE_FILE + dialog.add_filter("*.ptex;Procedural textures file") + dialog.connect("file_selected", self, "do_save_file") + dialog.popup_centered() + +func do_save_file(filename): var data = { nodes = [] } for c in get_children(): if c is GraphNode: @@ -84,20 +138,34 @@ func save_file(filename): if file.open(filename, File.WRITE) == OK: file.store_string(to_json(data)) file.close() + set_save_path(filename) + +func export_textures(size = 512): + if save_path != null: + var prefix = save_path.left(save_path.rfind(".")) + $GraphEdit/Material.export_textures(prefix) func send_changed_signal(): + $Timer.stop() $Timer.start() func do_send_changed_signal(): emit_signal("graph_changed") +func can_drop_data(position, data): + return typeof(data) == TYPE_DICTIONARY and data.has('type') + +func drop_data(position, data): + var node = create_node(data, get_global_transform().xform(position)) + return true + +# Save shader to image, create image texture + func setup_material(shader_material, textures, shader_code): for k in textures.keys(): shader_material.set_shader_param(k+"_tex", textures[k]) shader_material.shader.code = shader_code -# Save shader to image - var render_queue = [] func render_to_viewport(node, size, method, args): diff --git a/addons/procedural_material/graph_edit.tscn b/addons/procedural_material/graph_edit.tscn index ef1a3d2..127d8aa 100644 --- a/addons/procedural_material/graph_edit.tscn +++ b/addons/procedural_material/graph_edit.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://addons/procedural_material/graph_edit.gd" type="Script" id=1] [ext_resource path="res://addons/procedural_material/nodes/material.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/procedural_material/nodes/material.gd" type="Script" id=3] [sub_resource type="Theme" id=1] @@ -249,10 +248,8 @@ shader = SubResource( 2 ) self_modulate = Color( 1, 1, 1, 0 ) anchor_left = 0.0 anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_right = 1280.0 -margin_bottom = 718.0 +anchor_right = 1.0 +anchor_bottom = 1.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = true focus_mode = 2 @@ -268,75 +265,21 @@ zoom = 1.0 script = ExtResource( 1 ) _sections_unfolded = [ "Material", "Mouse", "Visibility" ] -[node name="Material" type="GraphNode" parent="." index="2" instance=ExtResource( 2 )] +[node name="Material" parent="." index="0" instance=ExtResource( 2 )] -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 margin_right = 111.0 margin_bottom = 118.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -mouse_filter = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 theme = SubResource( 1 ) -title = "Material" -offset = Vector2( 0, 0 ) -show_close = false -resizable = false -selected = false -comment = false -overlay = 0 -slot/0/left_enabled = true -slot/0/left_type = 0 -slot/0/left_color = Color( 0.5, 0.5, 1, 1 ) -slot/0/right_enabled = false -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.5, 0.5, 1, 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 = true -slot/2/left_type = 0 -slot/2/left_color = Color( 0.498039, 0.498039, 1, 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.498039, 0.498039, 1, 1 ) -slot/3/right_enabled = false -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( 0.498039, 0.498039, 1, 1 ) -slot/5/left_enabled = true -slot/5/left_type = 0 -slot/5/left_color = Color( 0.498039, 0.498039, 1, 1 ) -slot/5/right_enabled = false -slot/5/right_type = 0 -slot/5/right_color = Color( 0.498039, 0.498039, 1, 1 ) -script = ExtResource( 3 ) _sections_unfolded = [ "Anchor", "Margin", "Mouse", "Theme", "slot", "slot/2", "slot/3", "slot/4", "slot/5" ] -[node name="Timer" type="Timer" parent="." index="3"] +[node name="Timer" type="Timer" parent="." index="1"] process_mode = 1 -wait_time = 0.1 +wait_time = 0.2 one_shot = true autostart = false -[node name="SaveViewport" type="Viewport" parent="." index="4"] +[node name="SaveViewport" type="Viewport" parent="." index="2"] arvr = false size = Vector2( 0, 0 ) diff --git a/addons/procedural_material/library.gd b/addons/procedural_material/library.gd new file mode 100644 index 0000000..4c7099a --- /dev/null +++ b/addons/procedural_material/library.gd @@ -0,0 +1,49 @@ +extends Tree + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" + +func get_drag_data(position): + var selected_item = get_selected() + if selected_item != null: + var data = selected_item.get_metadata(0) + return data + return null + + +func _ready(): + var root = create_item() + add_library("res://addons/procedural_material/material_library.json") + +func add_library(filename): + var root = get_root() + var file = File.new() + if file.open(filename, File.READ) != OK: + return + var lib = parse_json(file.get_as_text()) + file.close() + for m in lib.lib: + add_item(m, m.tree_item, root) + +func add_item(item, item_name, item_parent): + var slash_position = item_name.find("/") + if slash_position == -1: + var new_item = create_item(item_parent) + new_item.set_text(0, item_name) + new_item.set_metadata(0, item) + return new_item + else: + var prefix = item_name.left(slash_position) + var suffix = item_name.right(slash_position+1) + var new_parent = null + var c = item_parent.get_children() + while c != null: + if c.get_text(0) == prefix: + new_parent = c + break + c = c.get_next() + if new_parent == null: + new_parent = create_item(item_parent) + new_parent.set_text(0, prefix) + return add_item(item, suffix, new_parent) diff --git a/addons/procedural_material/main_window.gd b/addons/procedural_material/main_window.gd new file mode 100644 index 0000000..cac4ca0 --- /dev/null +++ b/addons/procedural_material/main_window.gd @@ -0,0 +1,86 @@ +extends Panel + +var current_tab = -1 + +const MENU = [ + { menu="File", command="new_material", description="New material" }, + { menu="File", command="load_material", description="Load material" }, + { menu="File" }, + { menu="File", command="save_material", description="Save material" }, + { menu="File", command="save_material_as", description="Save material as..." }, + { menu="File", command="save_all_materials", description="Save all materials..." }, + { menu="File" }, + { menu="File", command="export_material", description="Export material" }, + { menu="File" }, + { menu="File", command="close_material", description="Close material" }, + { menu="File", command="exit", description="Exit" }, + { menu="Help", command="about", description="About" } +] + +func _ready(): + for m in $VBoxContainer/Menu.get_children(): + create_menu(m.get_popup(), m.name) + +func create_menu(menu, menu_name): + menu.connect("id_pressed", self, "_on_PopupMenu_id_pressed") + for i in MENU.size(): + if MENU[i].menu != menu_name: + continue + if MENU[i].has("submenu"): + var submenu = PopupMenu.new() + create_menu(submenu, MENU[i].submenu) + menu.add_child(submenu) + menu.add_submenu_item(MENU[i].description, submenu.get_name()) + elif MENU[i].has("description"): + menu.add_item(MENU[i].description, i) + else: + menu.add_separator() + return menu + +func new_material(): + var graph_edit = preload("res://addons/procedural_material/graph_edit.tscn").instance() + $VBoxContainer/HBoxContainer/Projects.add_child(graph_edit) + $VBoxContainer/HBoxContainer/Projects.current_tab = graph_edit.get_index() + graph_edit.update_tab_title() + +func load_material(): + var dialog = FileDialog.new() + add_child(dialog) + dialog.rect_min_size = Vector2(500, 500) + dialog.access = FileDialog.ACCESS_FILESYSTEM + dialog.mode = FileDialog.MODE_OPEN_FILE + dialog.add_filter("*.ptex;Procedural textures file") + dialog.connect("file_selected", self, "do_load_material") + dialog.popup_centered() + +func do_load_material(filename): + var graph_edit = preload("res://addons/procedural_material/graph_edit.tscn").instance() + $VBoxContainer/HBoxContainer/Projects.add_child(graph_edit) + $VBoxContainer/HBoxContainer/Projects.current_tab = graph_edit.get_index() + graph_edit.do_load_file(filename) + +func save_material(): + $VBoxContainer/HBoxContainer/Projects.get_current_tab_control().save_file() + +func save_material_as(): + $VBoxContainer/HBoxContainer/Projects.get_current_tab_control().save_file_as() + +func close_material(): + $VBoxContainer/HBoxContainer/Projects.get_current_tab_control().queue_free() + +func exit(): + queue_free() + +func _on_PopupMenu_id_pressed(id): + var node_type = null + if MENU[id].has("command"): + call(MENU[id].command) + +func update_preview(): + var material_node = $VBoxContainer/HBoxContainer/Projects.get_current_tab_control().get_node("Material") + if material_node != null: + material_node.update_materials($VBoxContainer/HBoxContainer/VBoxContainer/Preview.get_materials()) + +func _on_Projects_tab_changed(tab): + $VBoxContainer/HBoxContainer/Projects.get_current_tab_control().connect("graph_changed", self, "update_preview") + current_tab = tab diff --git a/main_window.tscn b/addons/procedural_material/main_window.tscn similarity index 63% rename from main_window.tscn rename to addons/procedural_material/main_window.tscn index ace0be6..d71564d 100644 --- a/main_window.tscn +++ b/addons/procedural_material/main_window.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://addons/procedural_material/graph_edit.tscn" type="PackedScene" id=1] +[ext_resource path="res://addons/procedural_material/main_window.gd" type="Script" id=1] +[ext_resource path="res://addons/procedural_material/library.gd" type="Script" id=2] +[ext_resource path="res://addons/procedural_material/preview.tscn" type="PackedScene" id=3] -[node name="PanelContainer" type="Panel"] +[node name="MainWindow" type="Panel" index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -14,6 +16,7 @@ mouse_filter = 0 mouse_default_cursor_shape = 0 size_flags_horizontal = 3 size_flags_vertical = 3 +script = ExtResource( 1 ) _sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Rect", "Size Flags", "custom_constants" ] [node name="VBoxContainer" type="VBoxContainer" parent="." index="0"] @@ -47,7 +50,7 @@ size_flags_horizontal = 1 size_flags_vertical = 1 alignment = 0 -[node name="FileMenu" type="MenuButton" parent="VBoxContainer/Menu" index="0"] +[node name="File" type="MenuButton" parent="VBoxContainer/Menu" index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -71,7 +74,7 @@ flat = true align = 1 items = [ ] -[node name="HelpMenu" type="MenuButton" parent="VBoxContainer/Menu" index="1"] +[node name="Help" type="MenuButton" parent="VBoxContainer/Menu" index="1"] anchor_left = 0.0 anchor_top = 0.0 @@ -116,22 +119,58 @@ collapsed = false dragger_visibility = 0 _sections_unfolded = [ "Size Flags" ] -[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer" index="0"] +[node name="VBoxContainer" type="VSplitContainer" parent="VBoxContainer/HBoxContainer" index="0"] anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_right = 100.0 +margin_right = 314.0 margin_bottom = 696.0 -rect_min_size = Vector2( 100, 100 ) 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 -_sections_unfolded = [ "Rect" ] +size_flags_horizontal = 3 +size_flags_vertical = 3 +split_offset = 0 +collapsed = false +dragger_visibility = 0 +_sections_unfolded = [ "Size Flags" ] + +[node name="Library" type="Tree" parent="VBoxContainer/HBoxContainer/VBoxContainer" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 314.0 +margin_bottom = 342.0 +rect_min_size = Vector2( 100, 100 ) +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = true +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +columns = 1 +allow_reselect = false +allow_rmb_select = false +hide_folding = false +hide_root = true +drop_mode_flags = 0 +select_mode = 0 +script = ExtResource( 2 ) + +[node name="Preview" parent="VBoxContainer/HBoxContainer/VBoxContainer" index="1" instance=ExtResource( 3 )] + +anchor_left = 0.0 +anchor_right = 0.0 +margin_left = 0.0 +margin_top = 354.0 +margin_right = 314.0 +margin_bottom = 696.0 [node name="Projects" type="TabContainer" parent="VBoxContainer/HBoxContainer" index="1"] @@ -139,26 +178,20 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 112.0 +margin_left = 326.0 margin_right = 1280.0 margin_bottom = 696.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_horizontal = 3 size_flags_vertical = 3 +size_flags_stretch_ratio = 3.0 tab_align = 0 tabs_visible = true _sections_unfolded = [ "Size Flags" ] -[node name="blah" parent="VBoxContainer/HBoxContainer/Projects" index="0" instance=ExtResource( 1 )] - -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 4.0 -margin_top = 32.0 -margin_right = -4.0 -margin_bottom = -4.0 +[connection signal="tab_changed" from="VBoxContainer/HBoxContainer/Projects" to="." method="_on_Projects_tab_changed"] diff --git a/addons/procedural_material/material_library.json b/addons/procedural_material/material_library.json new file mode 100644 index 0000000..e3c8f31 --- /dev/null +++ b/addons/procedural_material/material_library.json @@ -0,0 +1,70 @@ +{"lib":[ + { + "tree_item":"Generators/Image", + "type":"image", + "file_path":null + }, + { + "tree_item":"Generators/Pattern", + "type":"pattern", + "mix":0, + "x_scale":4, + "x_wave":0, + "y_scale":4, + "y_wave":0 + }, + { + "tree_item":"Generators/Bricks", + "type":"bricks", + "bevel":0.1, + "columns":3, + "mortar":0.1, + "row_offset":0.5, + "rows":6 + }, + { + "tree_item":"Generators/Perlin Noise", + "type":"perlin", + "iterations":3, + "persistence":0.5, + "scale_x":4, + "scale_y":4 + }, + { + "tree_item":"Generators/Voronoi Noise", + "type":"voronoi", + "intensity":1, + "scale_x":4, + "scale_y":4 + }, + { + "tree_item":"Filters/Colorize", + "type":"colorize", + "gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":1,"r":1}], + "name":"colorize_0" + }, + { + "tree_item":"Filters/Blend", + "type":"blend", + "amount":0.5, + "blend_type":0 + }, + { + "tree_item":"Filters/Transform", + "type":"transform", + "rotate":0, + "scale":1, + "translate_x":0, + "translate_y":0 + }, + { + "tree_item":"Filters/Warp", + "type":"warp", + "amount":0.5 + }, + { + "tree_item":"Filters/Normal map", + "type":"normal_map", + "amount":0.5 + } +]} \ No newline at end of file diff --git a/addons/procedural_material/node_base.gd b/addons/procedural_material/node_base.gd index 17f704a..8ec0139 100644 --- a/addons/procedural_material/node_base.gd +++ b/addons/procedural_material/node_base.gd @@ -170,7 +170,8 @@ func serialize(): return data func deserialize(data): - offset = Vector2(data.node_position.x, data.node_position.y) + if data.has("node_position"): + offset = Vector2(data.node_position.x, data.node_position.y) for w in property_widgets: var variable = w.name if data.has(variable): diff --git a/addons/procedural_material/nodes/colorize.gd b/addons/procedural_material/nodes/colorize.gd index 6bfd92f..8325856 100644 --- a/addons/procedural_material/nodes/colorize.gd +++ b/addons/procedural_material/nodes/colorize.gd @@ -29,5 +29,6 @@ func serialize(): return data func deserialize(data): - $Control.deserialize(data.gradient) + if data.has("gradient"): + $Control.deserialize(data.gradient) .deserialize(data) diff --git a/addons/procedural_material/nodes/image.gd b/addons/procedural_material/nodes/image.gd index 8176898..196603d 100644 --- a/addons/procedural_material/nodes/image.gd +++ b/addons/procedural_material/nodes/image.gd @@ -12,7 +12,7 @@ func set_texture(path): if path != null: texture.load(path) $TextureButton.texture_normal = texture - get_parent().get_parent().generate_shader() + update_shaders() func get_textures(): var list = {} @@ -47,5 +47,6 @@ func serialize(): return data func deserialize(data): - set_texture(data.file_path) + if data.has("file_path"): + set_texture(data.file_path) .deserialize(data) diff --git a/addons/procedural_material/nodes/pattern.tscn b/addons/procedural_material/nodes/pattern.tscn index 07075ad..e4d969b 100644 --- a/addons/procedural_material/nodes/pattern.tscn +++ b/addons/procedural_material/nodes/pattern.tscn @@ -12,8 +12,8 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_top = 1.0 -margin_right = 192.0 -margin_bottom = 79.0 +margin_right = 208.0 +margin_bottom = 100.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -21,7 +21,7 @@ mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 theme = SubResource( 1 ) -title = "Sine" +title = "Pattern" offset = Vector2( 0, 0 ) show_close = true resizable = false @@ -57,13 +57,13 @@ anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 16.0 margin_top = 24.0 -margin_right = 177.0 +margin_right = 192.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 = 0 +size_flags_horizontal = 3 size_flags_vertical = 1 alignment = 0 _sections_unfolded = [ "Size Flags" ] @@ -75,7 +75,7 @@ anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 margin_top = 3.0 -margin_right = 66.0 +margin_right = 81.0 margin_bottom = 17.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false @@ -94,8 +94,8 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 70.0 -margin_right = 161.0 +margin_left = 85.0 +margin_right = 176.0 margin_bottom = 20.0 rect_min_size = Vector2( 82, 0 ) rect_pivot_offset = Vector2( 0, 0 ) @@ -131,9 +131,10 @@ rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 +size_flags_horizontal = 3 size_flags_vertical = 1 alignment = 0 +_sections_unfolded = [ "Size Flags" ] [node name="Label" type="Label" parent="HBoxContainer1" index="0"] @@ -225,7 +226,7 @@ rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 +size_flags_horizontal = 3 size_flags_vertical = 1 alignment = 0 _sections_unfolded = [ "Rect", "Size Flags" ] diff --git a/addons/procedural_material/pm_editor.gd b/addons/procedural_material/pm_editor.gd index 455c840..958e60c 100644 --- a/addons/procedural_material/pm_editor.gd +++ b/addons/procedural_material/pm_editor.gd @@ -1,14 +1,13 @@ tool extends Container -var save_path = null - var popup_menu = null var popup_position = Vector2(0, 0) -var selected_node = null var texture_preview_material = null +var preview_maximized = false + const MENU = [ { command="new_texture", description="New material" }, { command="load_texture", description="Load material" }, @@ -69,79 +68,57 @@ func _on_PopupMenu_id_pressed(id): if MENU[id].has("command"): call(MENU[id].command) elif MENU[id].has("name"): - node_type = load("res://addons/procedural_material/nodes/"+MENU[id].name+".tscn") - if node_type != null: - var node = node_type.instance() - var i = 0 - while true: - var name = MENU[id].name+"_"+str(i) - if !$GraphEdit.has_node(name): - node.set_name(name) - break - i += 1 - $GraphEdit.add_node(node, popup_position) - node.offset = ($GraphEdit.scroll_offset + popup_position - $GraphEdit.rect_global_position) / $GraphEdit.zoom + $GraphEdit.create_node({type=MENU[id].name}, popup_position) -func set_save_path(path): - save_path = path +func set_save_path(graph_edit, path): if !Engine.editor_hint: - if save_path != null: - OS.set_window_title("Procedural textures (%s)" % save_path) + if path != null: + OS.set_window_title("Procedural textures (%s)" % path) else: OS.set_window_title("Procedural textures") func new_texture(): $GraphEdit.new_material() - set_save_path(null) func load_texture(): - selected_node = null - var dialog = FileDialog.new() - add_child(dialog) - dialog.rect_min_size = Vector2(500, 500) - dialog.access = FileDialog.ACCESS_FILESYSTEM - dialog.mode = FileDialog.MODE_OPEN_FILE - dialog.add_filter("*.ptex;Procedural textures file") - dialog.connect("file_selected", self, "do_load_texture") - dialog.popup_centered() - -func do_load_texture(path): - set_save_path(path) - $GraphEdit.load_file(save_path) + $GraphEdit.load_file() func save_texture(): - if save_path != null: - $GraphEdit.save_file(save_path) - else: - save_texture_as() + $GraphEdit.save_file() func save_texture_as(): - var dialog = FileDialog.new() - add_child(dialog) - dialog.rect_min_size = Vector2(500, 500) - dialog.access = FileDialog.ACCESS_FILESYSTEM - dialog.mode = FileDialog.MODE_SAVE_FILE - dialog.add_filter("*.ptex;Procedural textures file") - dialog.connect("file_selected", self, "do_save_texture") - dialog.popup_centered() + $GraphEdit.save_file_as() -func do_save_texture(path): - set_save_path(path) - $GraphEdit.save_file(save_path) +func export_texture(): + $GraphEdit.export_textures() -func export_texture(size = 512): - #$GraphEdit.export_texture(selected_node, "res://generated_image.png", size) - var prefix = save_path.left(save_path.rfind(".")) - $GraphEdit/Material.export_textures(prefix) +func get_selected_node(): + var rv = null + for c in $GraphEdit.get_children(): + if c is GraphNode && c.selected: + if rv != null: + return null + else: + rv = c + return rv func generate_shader(): + var selected_node = get_selected_node() if $GraphEdit/Material != null: $GraphEdit/Material.update_materials($Preview/Preview.get_materials()) - if selected_node != null && selected_node is GraphNode: + if selected_node != null: $GraphEdit.setup_material(texture_preview_material, selected_node.get_textures(), selected_node.generate_shader()) func _on_GraphEdit_node_selected(node): - if selected_node != node && node is GraphNode: - selected_node = node + var selected_node = get_selected_node() + if selected_node != null: $GraphEdit.setup_material(texture_preview_material, selected_node.get_textures(), selected_node.generate_shader()) +func _on_SelectedPreview_gui_input(ev): + if ev is InputEventMouseButton && ev.button_index == 1 && ev.doubleclick: + if preview_maximized: + $Preview/Preview/SelectedPreview/SelectedPreviewAnimation.play("minimize") + else: + $Preview/Preview/SelectedPreview/SelectedPreviewAnimation.play("maximize") + preview_maximized = !preview_maximized + diff --git a/addons/procedural_material/pm_editor.tscn b/addons/procedural_material/pm_editor.tscn index 34f086b..50b97b9 100644 --- a/addons/procedural_material/pm_editor.tscn +++ b/addons/procedural_material/pm_editor.tscn @@ -1,203 +1,10 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://addons/procedural_material/pm_editor.gd" type="Script" id=1] [ext_resource path="res://addons/procedural_material/graph_edit.tscn" type="PackedScene" id=2] -[ext_resource path="res://addons/procedural_material/preview.gd" type="Script" id=3] -[ext_resource path="res://addons/procedural_material/panoramas/park.hdr" type="Texture" id=4] +[ext_resource path="res://addons/procedural_material/preview.tscn" type="PackedScene" id=3] -[sub_resource type="Animation" id=1] - -length = 1.0 -loop = true -step = 0.1 -tracks/0/type = "value" -tracks/0/path = NodePath("MaterialPreview/Objects:rotation_degrees") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 1 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 0, -"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ] -} - -[sub_resource type="ArrayMesh" id=2] - -blend_shape_mode = 1 -custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) -surfaces/0 = { -"aabb": AABB( -1, -1, -1, 2.00001, 2, 2 ), -"array_data": PoolByteArray( 0, 60, 0, 188, 255, 187, 0, 60, 0, 129, 0, 0, 126, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 255, 187, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 255, 59, 0, 60, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 0, 60, 0, 60, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 4, 18, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 60, 25, 0, 188, 0, 188, 255, 59, 0, 60, 0, 0, 127, 0, 126, 0, 0, 129, 4, 18, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 126, 129, 4, 18, 60, 25, 0, 188, 0, 60, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 0, 129, 0, 130, 0, 0, 129, 252, 59, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 252, 59, 60, 25 ), -"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 4, 0, 5, 0, 6, 0, 4, 0, 7, 0, 5, 0, 8, 0, 9, 0, 10, 0, 8, 0, 11, 0, 9, 0, 12, 0, 13, 0, 14, 0, 12, 0, 15, 0, 13, 0, 16, 0, 17, 0, 18, 0, 16, 0, 19, 0, 17, 0, 20, 0, 21, 0, 22, 0, 20, 0, 23, 0, 21, 0 ), -"blend_shape_data": [ ], -"format": 98071, -"index_count": 36, -"name": "Material", -"primitive": 4, -"skeleton_aabb": [ ], -"vertex_count": 24 -} -_sections_unfolded = [ "surface_1" ] - -[sub_resource type="SpatialMaterial" id=3] - -render_priority = 0 -flags_transparent = false -flags_unshaded = false -flags_vertex_lighting = false -flags_no_depth_test = false -flags_use_point_size = false -flags_world_triplanar = false -flags_fixed_size = false -flags_albedo_tex_force_srgb = false -vertex_color_use_as_albedo = false -vertex_color_is_srgb = false -params_diffuse_mode = 0 -params_specular_mode = 0 -params_blend_mode = 0 -params_cull_mode = 0 -params_depth_draw_mode = 0 -params_line_width = 1.0 -params_point_size = 1.0 -params_billboard_mode = 0 -params_grow = false -params_use_alpha_scissor = false -albedo_color = Color( 1, 1, 1, 1 ) -metallic = 1.0 -metallic_specular = 1.0 -metallic_texture_channel = 0 -roughness = 1.0 -roughness_texture_channel = 0 -emission_enabled = false -normal_enabled = false -rim_enabled = false -clearcoat_enabled = false -anisotropy_enabled = false -ao_enabled = false -depth_enabled = true -depth_scale = 0.05 -depth_deep_parallax = false -subsurf_scatter_enabled = false -transmission_enabled = false -refraction_enabled = false -detail_enabled = false -uv1_scale = Vector3( 1, 1, 1 ) -uv1_offset = Vector3( 0, 0, 0 ) -uv1_triplanar = false -uv1_triplanar_sharpness = 1.0 -uv2_scale = Vector3( 1, 1, 1 ) -uv2_offset = Vector3( 0, 0, 0 ) -uv2_triplanar = false -uv2_triplanar_sharpness = 1.0 -proximity_fade_enable = false -distance_fade_enable = false -_sections_unfolded = [ "Depth", "Metallic" ] - -[sub_resource type="ArrayMesh" id=4] - -blend_shape_mode = 1 -custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) -surfaces/0 = { -"aabb": AABB( -1, -1, -1, 2, 2, 2 ), -"array_data": PoolByteArray( 0, 0, 0, 188, 0, 188, 0, 60, 0, 172, 162, 0, 129, 0, 0, 129, 201, 58, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 36, 84, 169, 0, 139, 0, 208, 129, 73, 57, 198, 37, 0, 0, 0, 60, 0, 188, 0, 60, 0, 84, 162, 0, 129, 0, 0, 129, 201, 58, 198, 37, 31, 54, 0, 188, 100, 187, 0, 60, 36, 172, 169, 0, 139, 0, 208, 129, 73, 57, 209, 59, 168, 57, 0, 60, 168, 185, 0, 60, 67, 84, 189, 0, 167, 0, 167, 129, 147, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 67, 172, 189, 0, 167, 0, 167, 129, 147, 55, 209, 59, 100, 59, 0, 60, 31, 182, 0, 60, 87, 84, 220, 0, 208, 0, 139, 129, 147, 52, 198, 37, 100, 59, 0, 188, 31, 182, 0, 60, 87, 172, 220, 0, 208, 0, 139, 129, 147, 52, 209, 59, 0, 60, 0, 60, 0, 0, 0, 60, 94, 84, 0, 0, 0, 0, 130, 129, 77, 46, 198, 37, 0, 60, 0, 188, 0, 0, 0, 60, 94, 172, 0, 0, 0, 0, 129, 129, 77, 46, 209, 59, 100, 59, 0, 60, 31, 54, 0, 60, 87, 84, 36, 0, 48, 0, 139, 129, 178, 173, 198, 37, 100, 59, 0, 188, 31, 54, 0, 60, 87, 172, 36, 0, 48, 0, 139, 129, 178, 173, 209, 59, 168, 57, 0, 60, 168, 57, 0, 60, 67, 84, 67, 0, 89, 0, 167, 129, 108, 180, 198, 37, 168, 57, 0, 188, 168, 57, 0, 60, 67, 172, 67, 0, 89, 0, 167, 129, 108, 180, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 36, 84, 87, 0, 117, 0, 208, 129, 108, 183, 198, 37, 31, 54, 0, 188, 100, 59, 0, 60, 36, 172, 87, 0, 117, 0, 208, 129, 108, 183, 209, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 84, 94, 0, 127, 0, 0, 129, 54, 185, 198, 37, 0, 0, 0, 188, 0, 60, 0, 60, 0, 172, 94, 0, 127, 0, 0, 129, 54, 185, 209, 59, 31, 182, 0, 60, 100, 59, 0, 60, 220, 84, 87, 0, 117, 0, 48, 129, 182, 186, 198, 37, 31, 182, 0, 188, 100, 59, 0, 60, 220, 172, 87, 0, 117, 0, 48, 129, 182, 186, 209, 59, 168, 185, 0, 60, 168, 57, 0, 60, 189, 84, 67, 0, 89, 0, 89, 129, 27, 188, 198, 37, 168, 185, 0, 188, 168, 57, 0, 60, 189, 172, 67, 0, 89, 0, 89, 129, 27, 188, 209, 59, 100, 187, 0, 60, 31, 54, 0, 60, 169, 84, 36, 0, 48, 0, 117, 129, 219, 188, 198, 37, 100, 187, 0, 188, 31, 54, 0, 60, 169, 172, 36, 0, 48, 0, 117, 129, 219, 188, 209, 59, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 11, 12, 125, 129, 155, 189, 198, 37, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 11, 244, 125, 129, 155, 189, 209, 59, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 245, 12, 125, 129, 100, 62, 209, 59, 100, 187, 0, 60, 31, 182, 0, 60, 169, 84, 220, 0, 208, 0, 117, 129, 164, 61, 198, 37, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 245, 244, 125, 129, 100, 62, 198, 37, 100, 187, 0, 188, 31, 182, 0, 60, 169, 172, 220, 0, 208, 0, 117, 129, 164, 61, 209, 59, 168, 185, 0, 60, 168, 185, 0, 60, 189, 84, 189, 0, 167, 0, 89, 129, 228, 60, 198, 37, 168, 185, 0, 188, 168, 185, 0, 60, 189, 172, 189, 0, 167, 0, 89, 129, 228, 60, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 138, 43, 31, 182, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 138, 43, 0, 0, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 198, 37, 168, 185, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 50, 49, 100, 187, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 19, 53, 0, 188, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 140, 28, 0, 56, 100, 187, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 118, 57, 168, 185, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 179, 58, 31, 182, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 135, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 135, 59, 168, 57, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 179, 58, 100, 59, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 118, 57, 0, 60, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 172, 59, 0, 56, 100, 59, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 19, 53, 168, 57, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 50, 49, 31, 182, 0, 60, 100, 187, 0, 60, 220, 84, 169, 0, 139, 0, 48, 129, 36, 60, 198, 37, 31, 182, 0, 188, 100, 187, 0, 60, 220, 172, 169, 0, 139, 0, 48, 129, 36, 60, 209, 59, 0, 0, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 50, 49, 31, 54, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 138, 43, 100, 59, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 19, 53, 0, 60, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 172, 59, 0, 56, 100, 59, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 118, 57, 168, 57, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 179, 58, 31, 54, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 135, 59, 0, 0, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 209, 59, 31, 182, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 135, 59, 168, 185, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 179, 58, 100, 187, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 118, 57, 0, 188, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 140, 28, 0, 56, 100, 187, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 19, 53, 168, 185, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 50, 49, 31, 182, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 138, 43 ), -"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 3, 0, 4, 0, 1, 0, 3, 0, 5, 0, 4, 0, 5, 0, 6, 0, 4, 0, 5, 0, 7, 0, 6, 0, 7, 0, 8, 0, 6, 0, 7, 0, 9, 0, 8, 0, 9, 0, 10, 0, 8, 0, 9, 0, 11, 0, 10, 0, 11, 0, 12, 0, 10, 0, 11, 0, 13, 0, 12, 0, 13, 0, 14, 0, 12, 0, 13, 0, 15, 0, 14, 0, 15, 0, 16, 0, 14, 0, 15, 0, 17, 0, 16, 0, 17, 0, 18, 0, 16, 0, 17, 0, 19, 0, 18, 0, 19, 0, 20, 0, 18, 0, 19, 0, 21, 0, 20, 0, 21, 0, 22, 0, 20, 0, 21, 0, 23, 0, 22, 0, 23, 0, 24, 0, 22, 0, 23, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 26, 0, 29, 0, 27, 0, 29, 0, 30, 0, 27, 0, 29, 0, 31, 0, 30, 0, 32, 0, 33, 0, 34, 0, 32, 0, 35, 0, 33, 0, 32, 0, 36, 0, 35, 0, 32, 0, 37, 0, 36, 0, 32, 0, 38, 0, 37, 0, 32, 0, 39, 0, 38, 0, 32, 0, 40, 0, 39, 0, 32, 0, 41, 0, 40, 0, 32, 0, 42, 0, 41, 0, 32, 0, 43, 0, 42, 0, 32, 0, 44, 0, 43, 0, 32, 0, 45, 0, 44, 0, 32, 0, 46, 0, 45, 0, 32, 0, 47, 0, 46, 0, 31, 0, 48, 0, 30, 0, 31, 0, 49, 0, 48, 0, 49, 0, 2, 0, 48, 0, 49, 0, 0, 0, 2, 0, 50, 0, 51, 0, 52, 0, 50, 0, 53, 0, 51, 0, 50, 0, 54, 0, 53, 0, 50, 0, 55, 0, 54, 0, 50, 0, 56, 0, 55, 0, 50, 0, 57, 0, 56, 0, 50, 0, 58, 0, 57, 0, 50, 0, 59, 0, 58, 0, 50, 0, 60, 0, 59, 0, 50, 0, 61, 0, 60, 0, 50, 0, 62, 0, 61, 0, 50, 0, 63, 0, 62, 0, 50, 0, 64, 0, 63, 0, 50, 0, 65, 0, 64, 0 ), -"blend_shape_data": [ ], -"format": 98071, -"index_count": 180, -"primitive": 4, -"skeleton_aabb": [ ], -"vertex_count": 66 -} -_sections_unfolded = [ "surface_1" ] - -[sub_resource type="PanoramaSky" id=5] - -radiance_size = 2 -panorama = ExtResource( 4 ) - -[sub_resource type="Environment" id=6] - -background_mode = 2 -background_sky = SubResource( 5 ) -background_sky_custom_fov = 0.0 -background_color = Color( 0, 0, 0, 1 ) -background_energy = 1.0 -background_canvas_max_layer = 0 -ambient_light_color = Color( 0, 0, 0, 1 ) -ambient_light_energy = 1.0 -ambient_light_sky_contribution = 1.0 -fog_enabled = false -fog_color = Color( 0.5, 0.6, 0.7, 1 ) -fog_sun_color = Color( 1, 0.9, 0.7, 1 ) -fog_sun_amount = 0.0 -fog_depth_enabled = true -fog_depth_begin = 10.0 -fog_depth_curve = 1.0 -fog_transmit_enabled = false -fog_transmit_curve = 1.0 -fog_height_enabled = false -fog_height_min = 0.0 -fog_height_max = 100.0 -fog_height_curve = 1.0 -tonemap_mode = 0 -tonemap_exposure = 1.0 -tonemap_white = 1.0 -auto_exposure_enabled = false -auto_exposure_scale = 0.4 -auto_exposure_min_luma = 0.05 -auto_exposure_max_luma = 8.0 -auto_exposure_speed = 0.5 -ss_reflections_enabled = false -ss_reflections_max_steps = 64 -ss_reflections_fade_in = 0.15 -ss_reflections_fade_out = 2.0 -ss_reflections_depth_tolerance = 0.2 -ss_reflections_roughness = true -ssao_enabled = false -ssao_radius = 1.0 -ssao_intensity = 1.0 -ssao_radius2 = 0.0 -ssao_intensity2 = 1.0 -ssao_bias = 0.01 -ssao_light_affect = 0.0 -ssao_color = Color( 0, 0, 0, 1 ) -ssao_quality = 0 -ssao_blur = 3 -ssao_edge_sharpness = 4.0 -dof_blur_far_enabled = false -dof_blur_far_distance = 10.0 -dof_blur_far_transition = 5.0 -dof_blur_far_amount = 0.1 -dof_blur_far_quality = 1 -dof_blur_near_enabled = false -dof_blur_near_distance = 2.0 -dof_blur_near_transition = 1.0 -dof_blur_near_amount = 0.1 -dof_blur_near_quality = 1 -glow_enabled = false -glow_levels/1 = false -glow_levels/2 = false -glow_levels/3 = true -glow_levels/4 = false -glow_levels/5 = true -glow_levels/6 = false -glow_levels/7 = false -glow_intensity = 0.8 -glow_strength = 1.0 -glow_bloom = 0.0 -glow_blend_mode = 2 -glow_hdr_threshold = 1.0 -glow_hdr_scale = 2.0 -glow_bicubic_upscale = false -adjustment_enabled = false -adjustment_brightness = 1.0 -adjustment_contrast = 1.0 -adjustment_saturation = 1.0 -_sections_unfolded = [ "Background" ] - -[sub_resource type="Shader" id=7] +[sub_resource type="Shader" id=1] code = "shader_type canvas_item; @@ -207,18 +14,18 @@ void fragment() { " _sections_unfolded = [ "Resource" ] -[sub_resource type="ShaderMaterial" id=8] +[sub_resource type="ShaderMaterial" id=2] render_priority = 0 -shader = SubResource( 7 ) +shader = SubResource( 1 ) -[sub_resource type="Animation" id=9] +[sub_resource type="Animation" id=3] length = 0.2 loop = false step = 0.1 tracks/0/type = "value" -tracks/0/path = NodePath("SelectedPreview:rect_position") +tracks/0/path = NodePath(".:rect_position") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -230,7 +37,7 @@ tracks/0/keys = { "values": [ Vector2( 3, 251 ), Vector2( 2, 2 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("SelectedPreview:rect_size") +tracks/1/path = NodePath(".:rect_size") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -254,13 +61,13 @@ tracks/2/keys = { "values": [ 0 ] } -[sub_resource type="Animation" id=10] +[sub_resource type="Animation" id=4] length = 0.2 loop = false step = 0.1 tracks/0/type = "value" -tracks/0/path = NodePath("SelectedPreview:rect_position") +tracks/0/path = NodePath(".:rect_position") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -272,7 +79,7 @@ tracks/0/keys = { "values": [ Vector2( 2, 2 ), Vector2( 2, 252 ) ] } tracks/1/type = "value" -tracks/1/path = NodePath("SelectedPreview:rect_size") +tracks/1/path = NodePath(".:rect_size") tracks/1/interp = 1 tracks/1/loop_wrap = true tracks/1/imported = false @@ -316,6 +123,11 @@ _sections_unfolded = [ "Rect" ] [node name="GraphEdit" parent="." index="0" instance=ExtResource( 2 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 1280.0 +margin_bottom = 718.0 + [node name="Preview" type="Container" parent="." index="1"] anchor_left = 0.0 @@ -332,207 +144,11 @@ size_flags_horizontal = 1 size_flags_vertical = 1 _sections_unfolded = [ "Mouse" ] -[node name="Preview" type="ViewportContainer" parent="Preview" index="0"] - -anchor_left = 1.0 -anchor_top = 0.0 -anchor_right = 1.0 -anchor_bottom = 0.0 -margin_left = -364.0 -margin_top = 3.0 -margin_right = -14.0 -margin_bottom = 353.0 -rect_min_size = Vector2( 350, 350 ) -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 = 1 -stretch = false -stretch_shrink = 1 -script = ExtResource( 3 ) -_sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Mouse", "Rect" ] - -[node name="ObjectRotate" type="AnimationPlayer" parent="Preview/Preview" index="0"] - -root_node = NodePath("..") -autoplay = "rotate" -playback_process_mode = 1 -playback_default_blend_time = 0.0 -playback_speed = 0.1 -anims/rotate = SubResource( 1 ) -blend_times = [ ] -_sections_unfolded = [ "Playback Options" ] - -[node name="MaterialPreview" type="Viewport" parent="Preview/Preview" index="1"] - -arvr = false -size = Vector2( 350, 350 ) -own_world = true -world = null -transparent_bg = false -msaa = 0 -hdr = true -disable_3d = false -usage = 2 -debug_draw = 0 -render_target_v_flip = false -render_target_clear_mode = 1 -render_target_update_mode = 3 -audio_listener_enable_2d = false -audio_listener_enable_3d = false -physics_object_picking = false -gui_disable_input = false -gui_snap_controls_to_pixels = true -shadow_atlas_size = 0 -shadow_atlas_quad_0 = 2 -shadow_atlas_quad_1 = 2 -shadow_atlas_quad_2 = 3 -shadow_atlas_quad_3 = 4 -_sections_unfolded = [ "GUI", "Render Target" ] - -[node name="Objects" type="Spatial" parent="Preview/Preview/MaterialPreview" index="0"] - -transform = Transform( 0.305445, 0, 0.952206, 0, 1, 0, -0.952206, 0, 0.305445, 0, 0, 0 ) -_sections_unfolded = [ "Transform" ] - -[node name="Cube" type="MeshInstance" parent="Preview/Preview/MaterialPreview/Objects" index="0"] - -layers = 1 -material_override = null -cast_shadow = 1 -extra_cull_margin = 0.0 -use_in_baked_light = false -lod_min_distance = 0.0 -lod_min_hysteresis = 0.0 -lod_max_distance = 0.0 -lod_max_hysteresis = 0.0 -mesh = SubResource( 2 ) -skeleton = NodePath("..") -material/0 = SubResource( 3 ) -_sections_unfolded = [ "Geometry", "Transform", "material" ] - -[node name="Cylinder" type="MeshInstance" parent="Preview/Preview/MaterialPreview/Objects" index="1"] - -visible = false -layers = 1 -material_override = null -cast_shadow = 1 -extra_cull_margin = 0.0 -use_in_baked_light = false -lod_min_distance = 0.0 -lod_min_hysteresis = 0.0 -lod_max_distance = 0.0 -lod_max_hysteresis = 0.0 -mesh = SubResource( 4 ) -skeleton = NodePath("..") -material/0 = SubResource( 3 ) -_sections_unfolded = [ "Geometry", "Transform", "material" ] - -[node name="OmniLight" type="OmniLight" parent="Preview/Preview/MaterialPreview" index="1"] - -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.04729, 1.80471, -2.51024 ) -layers = 1 -light_color = Color( 1, 1, 1, 1 ) -light_energy = 1.0 -light_indirect_energy = 1.0 -light_negative = false -light_specular = 0.5 -light_bake_mode = 1 -light_cull_mask = -1 -shadow_enabled = false -shadow_color = Color( 0, 0, 0, 1 ) -shadow_bias = 0.15 -shadow_contact = 0.0 -shadow_reverse_cull_face = false -editor_only = false -omni_range = 6.46518 -omni_attenuation = 1.0 -omni_shadow_mode = 1 -omni_shadow_detail = 1 -_sections_unfolded = [ "Shadow" ] - -[node name="Camera" type="Camera" parent="Preview/Preview/MaterialPreview" index="2"] - -transform = Transform( 1, 0, 0, 0, 0.766044, 0.642787, 0, -0.642787, 0.766044, 0, 1.83022, 2.2549 ) -keep_aspect = 1 -cull_mask = 1048575 -environment = SubResource( 6 ) -h_offset = 0.0 -v_offset = 0.0 -doppler_tracking = 0 -projection = 0 -current = true -fov = 70.0 -size = 1.0 -near = 0.05 -far = 100.0 -_sections_unfolded = [ "Transform" ] - -[node name="WorldEnvironment" type="WorldEnvironment" parent="Preview/Preview/MaterialPreview" index="3"] - -environment = SubResource( 6 ) - -[node name="Model" type="OptionButton" parent="Preview/Preview" index="2"] - -anchor_left = 1.0 -anchor_top = 0.0 -anchor_right = 1.0 -anchor_bottom = 0.0 -margin_left = -348.0 -margin_top = 2.0 -margin_right = -238.0 -margin_bottom = 22.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 -action_mode = 0 -enabled_focus_mode = 2 -shortcut = null -group = null -text = "Cube" -flat = false -align = 0 -items = [ "Cube", null, false, 0, null, "Cylinder", null, false, 1, null ] -selected = 0 - -[node name="Environment" type="OptionButton" parent="Preview/Preview" index="3"] - -anchor_left = 1.0 -anchor_top = 0.0 -anchor_right = 1.0 -anchor_bottom = 0.0 -margin_left = -112.0 -margin_top = 2.0 -margin_right = -2.0 -margin_bottom = 22.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 -action_mode = 0 -enabled_focus_mode = 2 -shortcut = null -group = null -text = "Park" -flat = false -align = 0 -items = [ "Experiment", null, false, 0, null, "Lobby", null, false, 1, null, "Night", null, false, 2, null, "Park", null, false, 3, null, "Schelde", null, false, 4, null ] -selected = 3 +[node name="Preview" parent="Preview" index="0" instance=ExtResource( 3 )] [node name="SelectedPreview" type="ColorRect" parent="Preview/Preview" index="4"] -material = SubResource( 8 ) +material = SubResource( 2 ) anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 @@ -551,15 +167,15 @@ size_flags_vertical = 0 color = Color( 1, 1, 1, 1 ) _sections_unfolded = [ "Material", "Mouse", "Rect" ] -[node name="SelectedPreviewAnimation" type="AnimationPlayer" parent="Preview/Preview" index="5"] +[node name="SelectedPreviewAnimation" type="AnimationPlayer" parent="Preview/Preview/SelectedPreview" index="0"] root_node = NodePath("..") autoplay = "" playback_process_mode = 1 playback_default_blend_time = 0.0 playback_speed = 1.0 -anims/maximize = SubResource( 9 ) -anims/minimize = SubResource( 10 ) +anims/maximize = SubResource( 3 ) +anims/minimize = SubResource( 4 ) blend_times = [ ] [connection signal="graph_changed" from="GraphEdit" to="." method="generate_shader"] @@ -568,10 +184,8 @@ blend_times = [ ] [connection signal="popup_request" from="GraphEdit" to="." method="_on_GraphEdit_popup_request"] -[connection signal="item_selected" from="Preview/Preview/Model" to="Preview/Preview" method="_on_Model_item_selected"] +[connection signal="save_path_changed" from="GraphEdit" to="." method="set_save_path"] -[connection signal="item_selected" from="Preview/Preview/Environment" to="Preview/Preview" method="_on_Environment_item_selected"] - -[connection signal="gui_input" from="Preview/Preview/SelectedPreview" to="Preview/Preview" method="_on_SelectedPreview_gui_input"] +[connection signal="gui_input" from="Preview/Preview/SelectedPreview" to="." method="_on_SelectedPreview_gui_input"] diff --git a/addons/procedural_material/preview.gd b/addons/procedural_material/preview.gd index 9cf0293..88bfd8c 100644 --- a/addons/procedural_material/preview.gd +++ b/addons/procedural_material/preview.gd @@ -1,8 +1,6 @@ tool extends ViewportContainer -var preview_maximized = false - const ENVIRONMENTS = [ "experiment", "lobby", "night", "park", "schelde" ] @@ -14,14 +12,6 @@ func _ready(): $ObjectRotate.play("rotate") _on_Environment_item_selected($Environment.selected) -func _on_SelectedPreview_gui_input(ev): - if ev is InputEventMouseButton && ev.button_index == 1 && ev.doubleclick: - if preview_maximized: - $SelectedPreviewAnimation.play("minimize") - else: - $SelectedPreviewAnimation.play("maximize") - preview_maximized = !preview_maximized - func _on_Environment_item_selected(id): $MaterialPreview/WorldEnvironment.environment.background_sky.panorama = load("res://addons/procedural_material/panoramas/"+ENVIRONMENTS[id]+".hdr") @@ -32,3 +22,7 @@ func _on_Model_item_selected(id): func get_materials(): return [ $MaterialPreview/Objects/Cube.get_surface_material(0) ] + + +func _on_Preview_item_rect_changed(): + $MaterialPreview.size = rect_size diff --git a/addons/procedural_material/preview.tscn b/addons/procedural_material/preview.tscn new file mode 100644 index 0000000..d453854 --- /dev/null +++ b/addons/procedural_material/preview.tscn @@ -0,0 +1,395 @@ +[gd_scene load_steps=9 format=2] + +[ext_resource path="res://addons/procedural_material/preview.gd" type="Script" id=1] +[ext_resource path="res://addons/procedural_material/panoramas/park.hdr" type="Texture" id=2] + +[sub_resource type="Animation" id=1] + +length = 1.0 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("MaterialPreview/Objects:rotation_degrees") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ] +} + +[sub_resource type="ArrayMesh" id=2] + +blend_shape_mode = 1 +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +surfaces/0 = { +"aabb": AABB( -1, -1, -1, 2.00001, 2, 2 ), +"array_data": PoolByteArray( 0, 60, 0, 188, 255, 187, 0, 60, 0, 129, 0, 0, 126, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 255, 187, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 251, 59, 255, 59, 0, 60, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 60, 25, 0, 60, 0, 60, 255, 187, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 252, 59, 60, 25, 0, 60, 0, 188, 0, 60, 0, 60, 127, 0, 0, 0, 0, 0, 129, 129, 4, 18, 251, 59, 0, 60, 0, 188, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 251, 59, 0, 188, 0, 60, 255, 59, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 4, 18, 60, 25, 255, 59, 0, 60, 0, 60, 0, 60, 0, 0, 127, 0, 127, 0, 0, 129, 252, 59, 60, 25, 0, 188, 0, 188, 255, 59, 0, 60, 0, 0, 127, 0, 126, 0, 0, 129, 4, 18, 251, 59, 0, 188, 0, 188, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 126, 129, 4, 18, 60, 25, 0, 188, 0, 60, 255, 59, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 252, 59, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 129, 0, 0, 0, 0, 0, 127, 129, 4, 18, 251, 59, 0, 60, 0, 60, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 60, 25, 255, 187, 0, 188, 0, 188, 0, 60, 0, 0, 129, 0, 130, 0, 0, 129, 252, 59, 251, 59, 0, 60, 0, 188, 255, 187, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 4, 18, 251, 59, 255, 187, 0, 60, 0, 188, 0, 60, 0, 0, 129, 0, 129, 0, 0, 129, 252, 59, 60, 25 ), +"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 4, 0, 5, 0, 6, 0, 4, 0, 7, 0, 5, 0, 8, 0, 9, 0, 10, 0, 8, 0, 11, 0, 9, 0, 12, 0, 13, 0, 14, 0, 12, 0, 15, 0, 13, 0, 16, 0, 17, 0, 18, 0, 16, 0, 19, 0, 17, 0, 20, 0, 21, 0, 22, 0, 20, 0, 23, 0, 21, 0 ), +"blend_shape_data": [ ], +"format": 98071, +"index_count": 36, +"name": "Material", +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 24 +} +_sections_unfolded = [ "surface_1" ] + +[sub_resource type="SpatialMaterial" id=3] + +render_priority = 0 +flags_transparent = false +flags_unshaded = false +flags_vertex_lighting = false +flags_no_depth_test = false +flags_use_point_size = false +flags_world_triplanar = false +flags_fixed_size = false +flags_albedo_tex_force_srgb = false +vertex_color_use_as_albedo = false +vertex_color_is_srgb = false +params_diffuse_mode = 0 +params_specular_mode = 0 +params_blend_mode = 0 +params_cull_mode = 0 +params_depth_draw_mode = 0 +params_line_width = 1.0 +params_point_size = 1.0 +params_billboard_mode = 0 +params_grow = false +params_use_alpha_scissor = false +albedo_color = Color( 1, 1, 1, 1 ) +metallic = 1.0 +metallic_specular = 1.0 +metallic_texture_channel = 0 +roughness = 1.0 +roughness_texture_channel = 0 +emission_enabled = false +normal_enabled = false +rim_enabled = false +clearcoat_enabled = false +anisotropy_enabled = false +ao_enabled = false +depth_enabled = true +depth_scale = 0.05 +depth_deep_parallax = false +subsurf_scatter_enabled = false +transmission_enabled = false +refraction_enabled = false +detail_enabled = false +uv1_scale = Vector3( 1, 1, 1 ) +uv1_offset = Vector3( 0, 0, 0 ) +uv1_triplanar = false +uv1_triplanar_sharpness = 1.0 +uv2_scale = Vector3( 1, 1, 1 ) +uv2_offset = Vector3( 0, 0, 0 ) +uv2_triplanar = false +uv2_triplanar_sharpness = 1.0 +proximity_fade_enable = false +distance_fade_enable = false +_sections_unfolded = [ "Depth", "Metallic" ] + +[sub_resource type="ArrayMesh" id=4] + +blend_shape_mode = 1 +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +surfaces/0 = { +"aabb": AABB( -1, -1, -1, 2, 2, 2 ), +"array_data": PoolByteArray( 0, 0, 0, 188, 0, 188, 0, 60, 0, 172, 162, 0, 129, 0, 0, 129, 201, 58, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 36, 84, 169, 0, 139, 0, 208, 129, 73, 57, 198, 37, 0, 0, 0, 60, 0, 188, 0, 60, 0, 84, 162, 0, 129, 0, 0, 129, 201, 58, 198, 37, 31, 54, 0, 188, 100, 187, 0, 60, 36, 172, 169, 0, 139, 0, 208, 129, 73, 57, 209, 59, 168, 57, 0, 60, 168, 185, 0, 60, 67, 84, 189, 0, 167, 0, 167, 129, 147, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 67, 172, 189, 0, 167, 0, 167, 129, 147, 55, 209, 59, 100, 59, 0, 60, 31, 182, 0, 60, 87, 84, 220, 0, 208, 0, 139, 129, 147, 52, 198, 37, 100, 59, 0, 188, 31, 182, 0, 60, 87, 172, 220, 0, 208, 0, 139, 129, 147, 52, 209, 59, 0, 60, 0, 60, 0, 0, 0, 60, 94, 84, 0, 0, 0, 0, 130, 129, 77, 46, 198, 37, 0, 60, 0, 188, 0, 0, 0, 60, 94, 172, 0, 0, 0, 0, 129, 129, 77, 46, 209, 59, 100, 59, 0, 60, 31, 54, 0, 60, 87, 84, 36, 0, 48, 0, 139, 129, 178, 173, 198, 37, 100, 59, 0, 188, 31, 54, 0, 60, 87, 172, 36, 0, 48, 0, 139, 129, 178, 173, 209, 59, 168, 57, 0, 60, 168, 57, 0, 60, 67, 84, 67, 0, 89, 0, 167, 129, 108, 180, 198, 37, 168, 57, 0, 188, 168, 57, 0, 60, 67, 172, 67, 0, 89, 0, 167, 129, 108, 180, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 36, 84, 87, 0, 117, 0, 208, 129, 108, 183, 198, 37, 31, 54, 0, 188, 100, 59, 0, 60, 36, 172, 87, 0, 117, 0, 208, 129, 108, 183, 209, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 84, 94, 0, 127, 0, 0, 129, 54, 185, 198, 37, 0, 0, 0, 188, 0, 60, 0, 60, 0, 172, 94, 0, 127, 0, 0, 129, 54, 185, 209, 59, 31, 182, 0, 60, 100, 59, 0, 60, 220, 84, 87, 0, 117, 0, 48, 129, 182, 186, 198, 37, 31, 182, 0, 188, 100, 59, 0, 60, 220, 172, 87, 0, 117, 0, 48, 129, 182, 186, 209, 59, 168, 185, 0, 60, 168, 57, 0, 60, 189, 84, 67, 0, 89, 0, 89, 129, 27, 188, 198, 37, 168, 185, 0, 188, 168, 57, 0, 60, 189, 172, 67, 0, 89, 0, 89, 129, 27, 188, 209, 59, 100, 187, 0, 60, 31, 54, 0, 60, 169, 84, 36, 0, 48, 0, 117, 129, 219, 188, 198, 37, 100, 187, 0, 188, 31, 54, 0, 60, 169, 172, 36, 0, 48, 0, 117, 129, 219, 188, 209, 59, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 11, 12, 125, 129, 155, 189, 198, 37, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 11, 244, 125, 129, 155, 189, 209, 59, 0, 188, 0, 188, 0, 0, 0, 60, 162, 172, 0, 0, 245, 12, 125, 129, 100, 62, 209, 59, 100, 187, 0, 60, 31, 182, 0, 60, 169, 84, 220, 0, 208, 0, 117, 129, 164, 61, 198, 37, 0, 188, 0, 60, 0, 0, 0, 60, 162, 84, 0, 0, 245, 244, 125, 129, 100, 62, 198, 37, 100, 187, 0, 188, 31, 182, 0, 60, 169, 172, 220, 0, 208, 0, 117, 129, 164, 61, 209, 59, 168, 185, 0, 60, 168, 185, 0, 60, 189, 84, 189, 0, 167, 0, 89, 129, 228, 60, 198, 37, 168, 185, 0, 188, 168, 185, 0, 60, 189, 172, 189, 0, 167, 0, 89, 129, 228, 60, 209, 59, 31, 54, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 138, 43, 31, 182, 0, 60, 100, 187, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 138, 43, 0, 0, 0, 60, 0, 188, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 198, 37, 168, 185, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 50, 49, 100, 187, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 19, 53, 0, 188, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 140, 28, 0, 56, 100, 187, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 56, 41, 118, 57, 168, 185, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 157, 48, 179, 58, 31, 182, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 201, 52, 135, 59, 0, 0, 0, 60, 0, 60, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 181, 55, 209, 59, 31, 54, 0, 60, 100, 59, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 81, 57, 135, 59, 168, 57, 0, 60, 168, 57, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 179, 58, 100, 59, 0, 60, 31, 54, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 118, 57, 0, 60, 0, 60, 0, 0, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 172, 59, 0, 56, 100, 59, 0, 60, 31, 182, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 98, 59, 19, 53, 168, 57, 0, 60, 168, 185, 0, 60, 0, 127, 0, 0, 127, 0, 0, 129, 142, 58, 50, 49, 31, 182, 0, 60, 100, 187, 0, 60, 220, 84, 169, 0, 139, 0, 48, 129, 36, 60, 198, 37, 31, 182, 0, 188, 100, 187, 0, 60, 220, 172, 169, 0, 139, 0, 48, 129, 36, 60, 209, 59, 0, 0, 0, 188, 0, 188, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 198, 37, 168, 57, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 50, 49, 31, 54, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 138, 43, 100, 59, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 19, 53, 0, 60, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 172, 59, 0, 56, 100, 59, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 98, 59, 118, 57, 168, 57, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 142, 58, 179, 58, 31, 54, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 81, 57, 135, 59, 0, 0, 0, 188, 0, 60, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 181, 55, 209, 59, 31, 182, 0, 188, 100, 59, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 135, 59, 168, 185, 0, 188, 168, 57, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 179, 58, 100, 187, 0, 188, 31, 54, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 118, 57, 0, 188, 0, 188, 0, 0, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 140, 28, 0, 56, 100, 187, 0, 188, 31, 182, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 56, 41, 19, 53, 168, 185, 0, 188, 168, 185, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 157, 48, 50, 49, 31, 182, 0, 188, 100, 187, 0, 60, 0, 129, 0, 0, 127, 0, 0, 127, 201, 52, 138, 43 ), +"array_index_data": PoolByteArray( 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 1, 0, 3, 0, 4, 0, 1, 0, 3, 0, 5, 0, 4, 0, 5, 0, 6, 0, 4, 0, 5, 0, 7, 0, 6, 0, 7, 0, 8, 0, 6, 0, 7, 0, 9, 0, 8, 0, 9, 0, 10, 0, 8, 0, 9, 0, 11, 0, 10, 0, 11, 0, 12, 0, 10, 0, 11, 0, 13, 0, 12, 0, 13, 0, 14, 0, 12, 0, 13, 0, 15, 0, 14, 0, 15, 0, 16, 0, 14, 0, 15, 0, 17, 0, 16, 0, 17, 0, 18, 0, 16, 0, 17, 0, 19, 0, 18, 0, 19, 0, 20, 0, 18, 0, 19, 0, 21, 0, 20, 0, 21, 0, 22, 0, 20, 0, 21, 0, 23, 0, 22, 0, 23, 0, 24, 0, 22, 0, 23, 0, 25, 0, 24, 0, 26, 0, 27, 0, 28, 0, 26, 0, 29, 0, 27, 0, 29, 0, 30, 0, 27, 0, 29, 0, 31, 0, 30, 0, 32, 0, 33, 0, 34, 0, 32, 0, 35, 0, 33, 0, 32, 0, 36, 0, 35, 0, 32, 0, 37, 0, 36, 0, 32, 0, 38, 0, 37, 0, 32, 0, 39, 0, 38, 0, 32, 0, 40, 0, 39, 0, 32, 0, 41, 0, 40, 0, 32, 0, 42, 0, 41, 0, 32, 0, 43, 0, 42, 0, 32, 0, 44, 0, 43, 0, 32, 0, 45, 0, 44, 0, 32, 0, 46, 0, 45, 0, 32, 0, 47, 0, 46, 0, 31, 0, 48, 0, 30, 0, 31, 0, 49, 0, 48, 0, 49, 0, 2, 0, 48, 0, 49, 0, 0, 0, 2, 0, 50, 0, 51, 0, 52, 0, 50, 0, 53, 0, 51, 0, 50, 0, 54, 0, 53, 0, 50, 0, 55, 0, 54, 0, 50, 0, 56, 0, 55, 0, 50, 0, 57, 0, 56, 0, 50, 0, 58, 0, 57, 0, 50, 0, 59, 0, 58, 0, 50, 0, 60, 0, 59, 0, 50, 0, 61, 0, 60, 0, 50, 0, 62, 0, 61, 0, 50, 0, 63, 0, 62, 0, 50, 0, 64, 0, 63, 0, 50, 0, 65, 0, 64, 0 ), +"blend_shape_data": [ ], +"format": 98071, +"index_count": 180, +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 66 +} +_sections_unfolded = [ "surface_1" ] + +[sub_resource type="PanoramaSky" id=5] + +radiance_size = 2 +panorama = ExtResource( 2 ) + +[sub_resource type="Environment" id=6] + +background_mode = 2 +background_sky = SubResource( 5 ) +background_sky_custom_fov = 0.0 +background_color = Color( 0, 0, 0, 1 ) +background_energy = 1.0 +background_canvas_max_layer = 0 +ambient_light_color = Color( 0, 0, 0, 1 ) +ambient_light_energy = 1.0 +ambient_light_sky_contribution = 1.0 +fog_enabled = false +fog_color = Color( 0.5, 0.6, 0.7, 1 ) +fog_sun_color = Color( 1, 0.9, 0.7, 1 ) +fog_sun_amount = 0.0 +fog_depth_enabled = true +fog_depth_begin = 10.0 +fog_depth_curve = 1.0 +fog_transmit_enabled = false +fog_transmit_curve = 1.0 +fog_height_enabled = false +fog_height_min = 0.0 +fog_height_max = 100.0 +fog_height_curve = 1.0 +tonemap_mode = 0 +tonemap_exposure = 1.0 +tonemap_white = 1.0 +auto_exposure_enabled = false +auto_exposure_scale = 0.4 +auto_exposure_min_luma = 0.05 +auto_exposure_max_luma = 8.0 +auto_exposure_speed = 0.5 +ss_reflections_enabled = false +ss_reflections_max_steps = 64 +ss_reflections_fade_in = 0.15 +ss_reflections_fade_out = 2.0 +ss_reflections_depth_tolerance = 0.2 +ss_reflections_roughness = true +ssao_enabled = false +ssao_radius = 1.0 +ssao_intensity = 1.0 +ssao_radius2 = 0.0 +ssao_intensity2 = 1.0 +ssao_bias = 0.01 +ssao_light_affect = 0.0 +ssao_color = Color( 0, 0, 0, 1 ) +ssao_quality = 0 +ssao_blur = 3 +ssao_edge_sharpness = 4.0 +dof_blur_far_enabled = false +dof_blur_far_distance = 10.0 +dof_blur_far_transition = 5.0 +dof_blur_far_amount = 0.1 +dof_blur_far_quality = 1 +dof_blur_near_enabled = false +dof_blur_near_distance = 2.0 +dof_blur_near_transition = 1.0 +dof_blur_near_amount = 0.1 +dof_blur_near_quality = 1 +glow_enabled = false +glow_levels/1 = false +glow_levels/2 = false +glow_levels/3 = true +glow_levels/4 = false +glow_levels/5 = true +glow_levels/6 = false +glow_levels/7 = false +glow_intensity = 0.8 +glow_strength = 1.0 +glow_bloom = 0.0 +glow_blend_mode = 2 +glow_hdr_threshold = 1.0 +glow_hdr_scale = 2.0 +glow_bicubic_upscale = false +adjustment_enabled = false +adjustment_brightness = 1.0 +adjustment_contrast = 1.0 +adjustment_saturation = 1.0 +_sections_unfolded = [ "Background" ] + +[node name="Preview" type="ViewportContainer"] + +anchor_left = 1.0 +anchor_top = 0.0 +anchor_right = 1.0 +anchor_bottom = 0.0 +margin_left = -364.0 +margin_top = 3.0 +margin_right = -14.0 +margin_bottom = 353.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 = 3 +stretch = true +stretch_shrink = 1 +script = ExtResource( 1 ) +_sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Mouse", "Rect", "Size Flags" ] + +[node name="ObjectRotate" type="AnimationPlayer" parent="." index="0"] + +root_node = NodePath("..") +autoplay = "rotate" +playback_process_mode = 1 +playback_default_blend_time = 0.0 +playback_speed = 0.1 +anims/rotate = SubResource( 1 ) +blend_times = [ ] +_sections_unfolded = [ "Playback Options" ] + +[node name="MaterialPreview" type="Viewport" parent="." index="1"] + +arvr = false +size = Vector2( 350, 350 ) +own_world = true +world = null +transparent_bg = false +msaa = 0 +hdr = true +disable_3d = false +usage = 2 +debug_draw = 0 +render_target_v_flip = false +render_target_clear_mode = 1 +render_target_update_mode = 3 +audio_listener_enable_2d = false +audio_listener_enable_3d = false +physics_object_picking = false +gui_disable_input = false +gui_snap_controls_to_pixels = true +shadow_atlas_size = 0 +shadow_atlas_quad_0 = 2 +shadow_atlas_quad_1 = 2 +shadow_atlas_quad_2 = 3 +shadow_atlas_quad_3 = 4 +_sections_unfolded = [ "GUI", "Render Target" ] + +[node name="Objects" type="Spatial" parent="MaterialPreview" index="0"] + +transform = Transform( 0.965183, 0, -0.26156, 0, 1, 0, 0.26156, 0, 0.965183, 0, 0, 0 ) +_sections_unfolded = [ "Transform" ] + +[node name="Cube" type="MeshInstance" parent="MaterialPreview/Objects" index="0"] + +layers = 1 +material_override = null +cast_shadow = 1 +extra_cull_margin = 0.0 +use_in_baked_light = false +lod_min_distance = 0.0 +lod_min_hysteresis = 0.0 +lod_max_distance = 0.0 +lod_max_hysteresis = 0.0 +mesh = SubResource( 2 ) +skeleton = NodePath("..") +material/0 = SubResource( 3 ) +_sections_unfolded = [ "Geometry", "Transform", "material" ] + +[node name="Cylinder" type="MeshInstance" parent="MaterialPreview/Objects" index="1"] + +visible = false +layers = 1 +material_override = null +cast_shadow = 1 +extra_cull_margin = 0.0 +use_in_baked_light = false +lod_min_distance = 0.0 +lod_min_hysteresis = 0.0 +lod_max_distance = 0.0 +lod_max_hysteresis = 0.0 +mesh = SubResource( 4 ) +skeleton = NodePath("..") +material/0 = SubResource( 3 ) +_sections_unfolded = [ "Geometry", "Transform", "material" ] + +[node name="OmniLight" type="OmniLight" parent="MaterialPreview" index="1"] + +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.04729, 1.80471, -2.51024 ) +layers = 1 +light_color = Color( 1, 1, 1, 1 ) +light_energy = 1.0 +light_indirect_energy = 1.0 +light_negative = false +light_specular = 0.5 +light_bake_mode = 1 +light_cull_mask = -1 +shadow_enabled = false +shadow_color = Color( 0, 0, 0, 1 ) +shadow_bias = 0.15 +shadow_contact = 0.0 +shadow_reverse_cull_face = false +editor_only = false +omni_range = 6.46518 +omni_attenuation = 1.0 +omni_shadow_mode = 1 +omni_shadow_detail = 1 +_sections_unfolded = [ "Shadow" ] + +[node name="Camera" type="Camera" parent="MaterialPreview" index="2"] + +transform = Transform( 1, 0, 0, 0, 0.766044, 0.642787, 0, -0.642787, 0.766044, 0, 1.83022, 2.2549 ) +keep_aspect = 1 +cull_mask = 1048575 +environment = SubResource( 6 ) +h_offset = 0.0 +v_offset = 0.0 +doppler_tracking = 0 +projection = 0 +current = true +fov = 70.0 +size = 1.0 +near = 0.05 +far = 100.0 +_sections_unfolded = [ "Transform" ] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="MaterialPreview" index="3"] + +environment = SubResource( 6 ) + +[node name="Model" type="OptionButton" parent="." index="2"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 110.0 +margin_bottom = 20.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 +action_mode = 0 +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Cube" +flat = false +align = 0 +items = [ "Cube", null, false, 0, null, "Cylinder", null, false, 1, null ] +selected = 0 + +[node name="Environment" type="OptionButton" parent="." index="3"] + +anchor_left = 1.0 +anchor_top = 0.0 +anchor_right = 1.0 +anchor_bottom = 0.0 +margin_left = -110.0 +margin_bottom = 20.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 +action_mode = 0 +enabled_focus_mode = 2 +shortcut = null +group = null +text = "Park" +flat = false +align = 0 +items = [ "Experiment", null, false, 0, null, "Lobby", null, false, 1, null, "Night", null, false, 2, null, "Park", null, false, 3, null, "Schelde", null, false, 4, null ] +selected = 3 + +[connection signal="item_selected" from="Model" to="." method="_on_Model_item_selected"] + +[connection signal="item_selected" from="Environment" to="." method="_on_Environment_item_selected"] + + diff --git a/examples/dry_earth.ptex b/examples/dry_earth.ptex new file mode 100644 index 0000000..9eca287 --- /dev/null +++ b/examples/dry_earth.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"perlin_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"voronoi_0","from_port":1,"to":"colorize_1","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":1},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"colorize_1","from_port":0,"to":"warp_0","to_port":0},{"from":"perlin_1","from_port":0,"to":"warp_0","to_port":1},{"from":"warp_0","from_port":0,"to":"blend_0","to_port":0},{"from":"perlin_1","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"Material","to_port":2},{"from":"colorize_3","from_port":0,"to":"Material","to_port":1},{"from":"perlin_1","from_port":0,"to":"colorize_3","to_port":0},{"from":"warp_0","from_port":0,"to":"colorize_4","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"colorize_4","from_port":0,"to":"blend_1","to_port":1},{"from":"blend_1","from_port":0,"to":"normal_map_0","to_port":0},{"from":"perlin_0","from_port":0,"to":"blend_1","to_port":0}],"nodes":[{"intensity":0.6,"name":"voronoi_0","node_position":{"x":-165,"y":-96.75},"scale_x":4,"scale_y":4,"type":"voronoi"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":0.081818,"r":1}],"name":"colorize_1","node_position":{"x":93,"y":-117.75},"type":"colorize"},{"iterations":3,"name":"perlin_1","node_position":{"x":-144,"y":50.25},"persistence":0.5,"scale_x":4,"scale_y":4,"type":"perlin"},{"gradient":[{"b":0.200277,"g":0.378784,"pos":0.254545,"r":0.557292},{"b":0.03776,"g":0.150513,"pos":0.663636,"r":0.25}],"name":"colorize_0","node_position":{"x":338,"y":-237.75},"type":"colorize"},{"iterations":10,"name":"perlin_0","node_position":{"x":56,"y":-361.75},"persistence":0.9,"scale_x":2,"scale_y":2,"type":"perlin"},{"name":"Material","node_position":{"x":786,"y":53},"type":"material"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0.15625,"g":0.15625,"pos":1,"r":0.15625}],"name":"colorize_3","node_position":{"x":465,"y":33.25},"type":"colorize"},{"gradient":[{"b":0.90625,"g":0.90625,"pos":0,"r":0.90625},{"b":0.890625,"g":0.890625,"pos":1,"r":0.890625}],"name":"colorize_2","node_position":{"x":454,"y":104.25},"type":"colorize"},{"amount":0.4,"blend_type":2,"name":"blend_0","node_position":{"x":541,"y":-82.75},"type":"blend"},{"amount":0.4,"name":"warp_0","node_position":{"x":264,"y":-13.75},"type":"warp"},{"amount":0.35,"name":"normal_map_0","node_position":{"x":652,"y":222.25},"type":"normal_map"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_4","node_position":{"x":228,"y":213.25},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_1","node_position":{"x":454,"y":226.25},"type":"blend"}]} \ No newline at end of file diff --git a/examples/floor1.ptex b/examples/floor1.ptex new file mode 100644 index 0000000..618b49a --- /dev/null +++ b/examples/floor1.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"bricks_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"perlin_0","from_port":0,"to":"warp_0","to_port":1},{"from":"colorize_0","from_port":0,"to":"warp_0","to_port":0},{"from":"bricks_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"transform_0","from_port":0,"to":"blend_0","to_port":0},{"from":"blend_0","from_port":0,"to":"blend_1","to_port":1},{"from":"transform_1","from_port":0,"to":"transform_2","to_port":0},{"from":"transform_1","from_port":0,"to":"blend_2","to_port":0},{"from":"transform_2","from_port":0,"to":"blend_2","to_port":1},{"from":"blend_2","from_port":0,"to":"colorize_3","to_port":0},{"from":"colorize_3","from_port":0,"to":"transform_3","to_port":0},{"from":"blend_1","from_port":0,"to":"transform_1","to_port":0},{"from":"pattern_1","from_port":0,"to":"blend_0","to_port":1},{"from":"pattern_1","from_port":0,"to":"transform_0","to_port":0},{"from":"pattern_0","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"blend_1","to_port":0},{"from":"colorize_1","from_port":0,"to":"normal_map_0","to_port":0},{"from":"warp_0","from_port":0,"to":"blend_3","to_port":0},{"from":"blend_3","from_port":0,"to":"Material","to_port":0},{"from":"colorize_0","from_port":0,"to":"colorize_4","to_port":0},{"from":"colorize_4","from_port":0,"to":"blend_3","to_port":1},{"from":"transform_3","from_port":0,"to":"blend_3","to_port":2}],"nodes":[{"bevel":0.05,"columns":6,"mortar":0.05,"name":"bricks_0","node_position":{"x":22,"y":247},"row_offset":0,"rows":6,"type":"bricks"},{"iterations":3,"name":"perlin_0","node_position":{"x":295,"y":220},"persistence":0.5,"scale_x":4,"scale_y":4,"type":"perlin"},{"gradient":[{"b":0.406358,"g":0.500692,"pos":0.027273,"r":0.557292},{"b":0,"g":0.21875,"pos":0.127273,"r":1}],"name":"colorize_0","node_position":{"x":294,"y":83},"type":"colorize"},{"amount":1,"name":"normal_map_0","node_position":{"x":759,"y":424},"type":"normal_map"},{"name":"Material","node_position":{"x":916,"y":424},"type":"material"},{"mix":0,"name":"pattern_0","node_position":{"x":-840,"y":785},"type":"pattern","x_scale":2,"x_wave":0,"y_scale":1,"y_wave":0},{"name":"transform_0","node_position":{"x":-792,"y":930},"rotate":270,"scale":1,"translate_x":0,"translate_y":0,"type":"transform"},{"mix":0,"name":"pattern_1","node_position":{"x":-884,"y":1153},"type":"pattern","x_scale":1,"x_wave":2,"y_scale":1,"y_wave":2},{"amount":1,"blend_type":3,"name":"blend_0","node_position":{"x":-513,"y":1036},"type":"blend"},{"name":"transform_2","node_position":{"x":-189,"y":938},"rotate":90,"scale":1,"translate_x":0,"translate_y":0,"type":"transform"},{"amount":0.5,"blend_type":0,"name":"blend_2","node_position":{"x":41,"y":910},"type":"blend"},{"gradient":[{"b":0,"g":0,"pos":0.645455,"r":0},{"b":1,"g":1,"pos":0.781818,"r":1}],"name":"colorize_2","node_position":{"x":-572.181396,"y":751},"type":"colorize"},{"amount":1,"blend_type":2,"name":"blend_1","node_position":{"x":-393,"y":822},"type":"blend"},{"name":"transform_1","node_position":{"x":-185,"y":775},"rotate":0,"scale":1,"translate_x":-0.25,"translate_y":-0,"type":"transform"},{"gradient":[{"b":1,"g":1,"pos":0.309091,"r":1},{"b":0,"g":0,"pos":0.481818,"r":0}],"name":"colorize_3","node_position":{"x":47,"y":803},"type":"colorize"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":1,"r":1}],"name":"colorize_1","node_position":{"x":329,"y":383},"type":"colorize"},{"name":"transform_3","node_position":{"x":137,"y":618},"rotate":0,"scale":0.5,"translate_x":0,"translate_y":0,"type":"transform"},{"amount":0.2,"name":"warp_0","node_position":{"x":694,"y":155},"type":"warp"},{"amount":1,"blend_type":0,"name":"blend_3","node_position":{"x":876.976318,"y":196.25},"type":"blend"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0.489583},{"b":0,"g":0,"pos":1,"r":0.489583}],"name":"colorize_4","node_position":{"x":598.976318,"y":258.25},"type":"colorize"}]} \ No newline at end of file diff --git a/examples/grass with flowers.ptex b/examples/grass with flowers.ptex new file mode 100644 index 0000000..d1dd564 --- /dev/null +++ b/examples/grass with flowers.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"perlin_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"voronoi_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":0},{"from":"colorize_1","from_port":0,"to":"blend_0","to_port":2},{"from":"perlin_0","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"colorize_3","from_port":0,"to":"Material","to_port":1},{"from":"colorize_1","from_port":0,"to":"colorize_3","to_port":0},{"from":"colorize_3","from_port":0,"to":"Material","to_port":2},{"from":"voronoi_0","from_port":2,"to":"blend_0","to_port":1},{"from":"voronoi_0","from_port":0,"to":"colorize_2","to_port":0},{"from":"perlin_0","from_port":0,"to":"colorize_4","to_port":0},{"from":"blend_0","from_port":0,"to":"blend_1","to_port":0},{"from":"colorize_4","from_port":0,"to":"blend_1","to_port":1},{"from":"blend_1","from_port":0,"to":"Material","to_port":0},{"from":"colorize_2","from_port":0,"to":"blend_1","to_port":2}],"nodes":[{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_3","node_position":{"x":655,"y":93.25},"type":"colorize"},{"gradient":[{"b":0.15682,"g":0.734375,"pos":0.454545,"r":0.247062},{"b":0.112522,"g":0.317708,"pos":0.881818,"r":0.144582}],"name":"colorize_0","node_position":{"x":335,"y":-261.75},"type":"colorize"},{"iterations":9,"name":"perlin_0","node_position":{"x":-25,"y":-27.75},"persistence":0.8,"scale_x":6,"scale_y":6,"type":"perlin"},{"intensity":1,"name":"voronoi_0","node_position":{"x":269,"y":-104.75},"scale_x":14,"scale_y":14,"type":"voronoi"},{"name":"Material","node_position":{"x":996,"y":22},"type":"material"},{"amount":0.8,"name":"normal_map_0","node_position":{"x":494,"y":258.25},"type":"normal_map"},{"gradient":[{"b":0,"g":0,"pos":0.263636,"r":0},{"b":1,"g":1,"pos":0.436364,"r":1}],"name":"colorize_1","node_position":{"x":524,"y":-26.75},"type":"colorize"},{"gradient":[{"b":0,"g":0,"pos":0.118182,"r":0},{"b":1,"g":1,"pos":0.190909,"r":1}],"name":"colorize_2","node_position":{"x":413,"y":71.25},"type":"colorize"},{"gradient":[{"b":0,"g":0.96875,"pos":0,"r":1},{"b":0,"g":1,"pos":1,"r":1}],"name":"colorize_4","node_position":{"x":407,"y":-177.75},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":643,"y":-244.75},"type":"blend"},{"amount":0.5,"blend_type":0,"name":"blend_1","node_position":{"x":826,"y":-119.75},"type":"blend"}]} \ No newline at end of file diff --git a/examples/rock.ptex b/examples/rock.ptex new file mode 100644 index 0000000..21c80e1 --- /dev/null +++ b/examples/rock.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"voronoi_0","from_port":0,"to":"blend_0","to_port":0},{"from":"voronoi_0","from_port":1,"to":"blend_0","to_port":1},{"from":"perlin_0","from_port":0,"to":"blend_0","to_port":2},{"from":"blend_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"Material","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"perlin_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"colorize_1","from_port":0,"to":"Material","to_port":1},{"from":"perlin_0","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"Material","to_port":2},{"from":"perlin_0","from_port":0,"to":"normal_map_0","to_port":0}],"nodes":[{"name":"Material","node_position":{"x":768,"y":239},"type":"material"},{"intensity":1,"name":"voronoi_0","node_position":{"x":128,"y":394},"scale_x":4,"scale_y":4,"type":"voronoi"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":531,"y":432},"type":"normal_map"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0.260417,"g":0.260417,"pos":1,"r":0.260417}],"name":"colorize_1","node_position":{"x":533,"y":343},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":327,"y":411},"type":"blend"},{"gradient":[{"b":0.391927,"g":0.523519,"pos":0,"r":0.583333},{"b":0.240885,"g":0.276693,"pos":0.354545,"r":0.3125},{"b":0.391927,"g":0.523519,"pos":0.681818,"r":0.583333},{"b":0.240885,"g":0.276693,"pos":0.963636,"r":0.3125}],"name":"colorize_0","node_position":{"x":530,"y":171},"type":"colorize"},{"iterations":6,"name":"perlin_0","node_position":{"x":122,"y":191},"persistence":0.85,"scale_x":4,"scale_y":4,"type":"perlin"},{"gradient":[{"b":0.364583,"g":0.364583,"pos":0,"r":0.364583},{"b":1,"g":1,"pos":1,"r":1}],"name":"colorize_2","node_position":{"x":526,"y":258},"type":"colorize"}]} \ No newline at end of file diff --git a/examples/stone_wall.ptex b/examples/stone_wall.ptex new file mode 100644 index 0000000..75194bc --- /dev/null +++ b/examples/stone_wall.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"Warp","from_port":0,"to":"colorize_2","to_port":0},{"from":"colorize_2","from_port":0,"to":"blend_0","to_port":2},{"from":"colorize_1","from_port":0,"to":"blend_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":1},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"colorize_2","from_port":0,"to":"colorize_4","to_port":0},{"from":"colorize_4","from_port":0,"to":"Material","to_port":2},{"from":"colorize_2","from_port":0,"to":"colorize_5","to_port":0},{"from":"colorize_5","from_port":0,"to":"Material","to_port":1},{"from":"Bricks","from_port":0,"to":"Warp","to_port":0},{"from":"blend_1","from_port":0,"to":"colorize_1","to_port":0},{"from":"Bricks","from_port":1,"to":"blend_1","to_port":1},{"from":"Warp","from_port":0,"to":"blend_2","to_port":0},{"from":"Perlin","from_port":0,"to":"blend_2","to_port":1},{"from":"blend_2","from_port":0,"to":"colorize_3","to_port":0},{"from":"blend_2","from_port":0,"to":"colorize_6","to_port":0},{"from":"colorize_6","from_port":0,"to":"normal_map_0","to_port":0},{"from":"Perlin","from_port":0,"to":"blend_1","to_port":0},{"from":"Perlin","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_3","from_port":0,"to":"Material","to_port":5},{"from":"perlin_0","from_port":0,"to":"Warp","to_port":1}],"nodes":[{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_5","node_position":{"x":837,"y":157},"type":"colorize"},{"amount":0.1,"name":"Warp","node_position":{"x":384,"y":10.75},"type":"warp"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_6","node_position":{"x":743,"y":291},"type":"colorize"},{"gradient":[{"b":0.119792,"g":0.119792,"pos":0,"r":0.119792},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_3","node_position":{"x":774,"y":400},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_2","node_position":{"x":536,"y":331},"type":"blend"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":0.063636,"r":1}],"name":"colorize_2","node_position":{"x":535.943665,"y":163},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":836.943726,"y":-71},"type":"blend"},{"gradient":[{"b":0.864583,"g":0.864583,"pos":0,"r":0.864583},{"b":0.854167,"g":0.854167,"pos":1,"r":0.854167}],"name":"colorize_4","node_position":{"x":708,"y":224},"type":"colorize"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":917,"y":273},"type":"normal_map"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":1,"g":1,"pos":1,"r":1}],"name":"colorize_0","node_position":{"x":560.943665,"y":50},"type":"colorize"},{"iterations":4,"name":"perlin_0","node_position":{"x":92,"y":210},"persistence":0.75,"scale_x":4,"scale_y":4,"type":"perlin"},{"amount":0.5,"blend_type":6,"name":"blend_1","node_position":{"x":351,"y":244},"type":"blend"},{"bevel":0.2,"columns":3,"mortar":0.1,"name":"Bricks","node_position":{"x":107,"y":-27},"row_offset":0.5,"rows":6,"type":"bricks"},{"iterations":10,"name":"Perlin","node_position":{"x":102,"y":-195},"persistence":0.75,"scale_x":4,"scale_y":4,"type":"perlin"},{"name":"Material","node_position":{"x":1109,"y":161},"type":"material"},{"gradient":[{"b":0.557292,"g":0.557292,"pos":0,"r":0.557292},{"b":0.180664,"g":0.22934,"pos":0.2,"r":0.234375},{"b":0.60574,"g":0.694487,"pos":0.345455,"r":0.755208},{"b":0.144423,"g":0.184147,"pos":0.554545,"r":0.229167},{"b":0.447537,"g":0.553291,"pos":0.736364,"r":0.588542},{"b":0.212674,"g":0.236125,"pos":1,"r":0.291667}],"name":"colorize_1","node_position":{"x":561.943665,"y":-78},"type":"colorize"}]} \ No newline at end of file diff --git a/examples/wooden_floor.ptex b/examples/wooden_floor.ptex new file mode 100644 index 0000000..2c32c76 --- /dev/null +++ b/examples/wooden_floor.ptex @@ -0,0 +1 @@ +{"connections":[{"from":"bricks_0","from_port":0,"to":"colorize_0","to_port":0},{"from":"colorize_0","from_port":0,"to":"blend_0","to_port":0},{"from":"perlin_0","from_port":0,"to":"blend_0","to_port":1},{"from":"blend_0","from_port":0,"to":"Material","to_port":0},{"from":"blend_0","from_port":0,"to":"colorize_1","to_port":0},{"from":"colorize_1","from_port":0,"to":"normal_map_0","to_port":0},{"from":"normal_map_0","from_port":0,"to":"Material","to_port":4},{"from":"blend_0","from_port":0,"to":"Material","to_port":2},{"from":"colorize_2","from_port":0,"to":"Material","to_port":1},{"from":"blend_0","from_port":0,"to":"colorize_2","to_port":0}],"nodes":[{"name":"Material","node_position":{"x":1036,"y":14},"type":"material"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_2","node_position":{"x":862,"y":16.25},"type":"colorize"},{"amount":0.5,"name":"normal_map_0","node_position":{"x":891,"y":82.25},"type":"normal_map"},{"gradient":[{"b":1,"g":1,"pos":0,"r":1},{"b":0,"g":0,"pos":1,"r":0}],"name":"colorize_1","node_position":{"x":726,"y":100.25},"type":"colorize"},{"amount":0.5,"blend_type":0,"name":"blend_0","node_position":{"x":660,"y":-20.75},"type":"blend"},{"gradient":[{"b":0,"g":0,"pos":0,"r":0},{"b":0.213623,"g":0.391325,"pos":0.154545,"r":0.651042}],"name":"colorize_0","node_position":{"x":478,"y":-5.75},"type":"colorize"},{"bevel":0,"columns":1,"mortar":0.05,"name":"bricks_0","node_position":{"x":281,"y":-2.75},"row_offset":0.5,"rows":9,"type":"bricks"},{"iterations":7,"name":"perlin_0","node_position":{"x":391,"y":157.25},"persistence":0.75,"scale_x":4,"scale_y":20,"type":"perlin"}]} \ No newline at end of file diff --git a/project.godot b/project.godot index 0f45716..3a3192a 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=3 [application] config/name="Procedural textures" -run/main_scene="res://addons/procedural_material/pm_editor.tscn" +run/main_scene="res://addons/procedural_material/main_window.tscn" config/icon="res://icon.png" [display]