diff --git a/addons/procedural_material/bricks.gd b/addons/procedural_material/bricks.gd index 586b836..b22f2f3 100644 --- a/addons/procedural_material/bricks.gd +++ b/addons/procedural_material/bricks.gd @@ -14,7 +14,7 @@ func _ready(): func get_shader_code(uv): var rv = { defs="", code="" } if generated_variants.empty(): - rv.defs = "float "+name+"_f(vec2 uv) { return bricks(uv, vec2("+str(rows)+", "+str(columns)+"), "+str(row_offset)+", "+str(mortar)+", "+str(max(0.001, bevel))+"); }\n" + rv.defs = "float "+name+"_f(vec2 uv) { return bricks(uv, vec2("+str(columns)+", "+str(rows)+"), "+str(row_offset)+", "+str(mortar)+", "+str(max(0.001, bevel))+"); }\n" var variant_index = generated_variants.find(uv) if variant_index == -1: variant_index = generated_variants.size() diff --git a/addons/procedural_material/bricks.tscn b/addons/procedural_material/bricks.tscn index 0e69e02..9bc1cf9 100644 --- a/addons/procedural_material/bricks.tscn +++ b/addons/procedural_material/bricks.tscn @@ -91,7 +91,7 @@ mouse_filter = 0 mouse_default_cursor_shape = 1 size_flags_horizontal = 1 size_flags_vertical = 1 -text = "3" +text = "6" focus_mode = 2 context_menu_enabled = true placeholder_alpha = 0.6 @@ -137,7 +137,7 @@ mouse_filter = 0 mouse_default_cursor_shape = 1 size_flags_horizontal = 1 size_flags_vertical = 1 -text = "6" +text = "3" focus_mode = 2 context_menu_enabled = true placeholder_alpha = 0.6 diff --git a/addons/procedural_material/node_base.gd b/addons/procedural_material/node_base.gd index d430d95..26dc502 100644 --- a/addons/procedural_material/node_base.gd +++ b/addons/procedural_material/node_base.gd @@ -70,13 +70,14 @@ func serialize(): var type = get_script().resource_path type = type.right(type.find_last("/")+1) type = type.left(type.find_last(".")) - var data = { name=name, type=type } + var data = { name=name, type=type, node_position={x=offset.x, y=offset.y} } for v in _get_state_variables(): data[v] = serialize_element(get(v)) return data func deserialize(data): print("deserialize: "+name) + offset = Vector2(data.node_position.x, data.node_position.y) for v in _get_state_variables(): set(v, deserialize_element(data[v])) print(" "+v+" = "+str(deserialize_element(data[v]))) diff --git a/addons/procedural_material/pm_editor.gd b/addons/procedural_material/pm_editor.gd index fb782c9..716fdf9 100644 --- a/addons/procedural_material/pm_editor.gd +++ b/addons/procedural_material/pm_editor.gd @@ -10,7 +10,6 @@ const MENU = [ { name="bricks", description="Bricks" }, { name="iqnoise", description="IQ Noise" }, { name="perlin", description="Perlin noise" }, - { name="boolean", description="Boolean" }, { name="transform", description="Transform" }, { name="colorize", description="Colorize" }, { name="blend", description="Blend" } @@ -35,7 +34,7 @@ func _on_PopupMenu_id_pressed(id): if node_type != null: var node = node_type.instance() $GraphEdit.add_child(node) - node.set_begin(popup_position) + node.offset = ($GraphEdit.scroll_offset + popup_position - $GraphEdit.rect_global_position) / $GraphEdit.zoom func _on_GraphEdit_connection_request(from, from_slot, to, to_slot): var disconnect = $GraphEdit.get_source(to, to_slot) diff --git a/addons/procedural_material/pm_editor.tscn b/addons/procedural_material/pm_editor.tscn index a24c558..4c239e2 100644 --- a/addons/procedural_material/pm_editor.tscn +++ b/addons/procedural_material/pm_editor.tscn @@ -100,10 +100,10 @@ float perlin(vec2 uv, int iterations, float turbulence) { return f/m; } -float Bricks_f(vec2 uv) { return bricks(uv, vec2(4, 8), 0.5, 0.1, 0.1); } +float Bricks_f(vec2 uv) { return bricks(uv, vec2(Null, Null), Null, Null, 0.2); } void fragment() { float Bricks_0_f = Bricks_f(UV); -vec3 Colorize_rgb = mix(vec3(0.882813,0.134491,0.134491), vec3(0.882813,0.446795,0.062073), Bricks_0_f); +vec3 Colorize_rgb = mix(vec3(0.859375,0.198059,0.198059), vec3(0.890625,0.330505,0.111328), Bricks_0_f); vec3 Material_rgb = Colorize_rgb; COLOR = vec4(Material_rgb, 1.0); } @@ -181,7 +181,7 @@ mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 popup_exclusive = false -items = [ "Load texture", null, 0, false, false, 0, 0, null, "", false, "Save texture", null, 0, false, false, 1, 0, null, "", false, "Sine", null, 0, false, false, 2, 0, null, "", false, "Bricks", null, 0, false, false, 3, 0, null, "", false, "IQ Noise", null, 0, false, false, 4, 0, null, "", false, "Perlin noise", null, 0, false, false, 5, 0, null, "", false, "Boolean", null, 0, false, false, 6, 0, null, "", false, "Transform", null, 0, false, false, 7, 0, null, "", false, "Colorize", null, 0, false, false, 8, 0, null, "", false, "Blend", null, 0, false, false, 9, 0, null, "", false ] +items = [ "Load texture", null, 0, false, false, 0, 0, null, "", false, "Save texture", null, 0, false, false, 1, 0, null, "", false, "Sine", null, 0, false, false, 2, 0, null, "", false, "Bricks", null, 0, false, false, 3, 0, null, "", false, "IQ Noise", null, 0, false, false, 4, 0, null, "", false, "Perlin noise", null, 0, false, false, 5, 0, null, "", false, "Transform", null, 0, false, false, 6, 0, null, "", false, "Colorize", null, 0, false, false, 7, 0, null, "", false, "Blend", null, 0, false, false, 8, 0, null, "", false ] hide_on_state_item_selection = false _sections_unfolded = [ "Rect" ] diff --git a/examples/bricks.ptex b/examples/bricks.ptex index 81f0368..935294e 100644 Binary files a/examples/bricks.ptex and b/examples/bricks.ptex differ