diff --git a/README.md b/README.md index c95ef40..6600c6b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ as interconnected texture generators and operators. ## License -Copyright (c) 2018-2019 Rodolphe Suescun and contributors +Copyright (c) 2018-2019 Rodz Labs and contributors Unless otherwise specified, files in this repository are licensed under the MIT license. See [LICENSE.md](LICENSE.md) for more information. diff --git a/addons/material_maker/engine/gen_shader.gd b/addons/material_maker/engine/gen_shader.gd index 022808e..e4d750a 100644 --- a/addons/material_maker/engine/gen_shader.gd +++ b/addons/material_maker/engine/gen_shader.gd @@ -165,8 +165,6 @@ func subst(string, context, uv = "") -> Dictionary: var tmp_string = replace_variable(string, "seed", str(get_seed())) if tmp_string != string: string = tmp_string - if uv != "": - string = replace_variable(string, "uv", "("+uv+")") if shader_model.has("parameters") and typeof(shader_model.parameters) == TYPE_ARRAY: for p in shader_model.parameters: if !p.has("name") or !p.has("type"): @@ -191,6 +189,8 @@ func subst(string, context, uv = "") -> Dictionary: print("Cannot replace parameter of type "+p.type) if value_string != null: string = replace_variable(string, p.name, value_string) + if uv != "": + string = replace_variable(string, "uv", "("+uv+")") if shader_model.has("inputs") and typeof(shader_model.inputs) == TYPE_ARRAY: var cont = true while cont: diff --git a/addons/material_maker/nodes/switch.gd b/addons/material_maker/nodes/switch.gd index fd02326..20626a6 100644 --- a/addons/material_maker/nodes/switch.gd +++ b/addons/material_maker/nodes/switch.gd @@ -27,7 +27,7 @@ func update_node() -> void: var lines_list = [] if generator.editable: lines_list.push_back( { name="outputs", tooltip="Outputs count", min=1, max=5 } ) - lines_list.push_back( { name="choices", tooltip="Choices count", min=2, max=5 } ) + lines_list.push_back( { name="choices", tooltip="Choices count", min=2, max=10 } ) lines_list.push_back( { name="source", tooltip="Current choice", min=0, max=generator.parameters.choices-1 } ) for l in lines_list: var sizer = HBoxContainer.new() diff --git a/addons/material_maker/widgets/linked_widgets/link.gd b/addons/material_maker/widgets/linked_widgets/link.gd index f93b8de..b7784a0 100644 --- a/addons/material_maker/widgets/linked_widgets/link.gd +++ b/addons/material_maker/widgets/linked_widgets/link.gd @@ -41,7 +41,7 @@ func find_control(gp) -> Dictionary: if c.get("controls") != null: for w in c.controls: var widget = c.controls[w] - if Rect2(widget.rect_global_position, widget.rect_size*widget.get_global_transform().get_scale()).has_point(gp): + if widget != null and Rect2(widget.rect_global_position, widget.rect_size*widget.get_global_transform().get_scale()).has_point(gp): return { node=c, widget=widget } return {} @@ -67,7 +67,7 @@ func _input(event: InputEvent) -> void: elif event is InputEventMouseMotion: var control = find_control(event.global_position) end = get_global_transform().xform_inv(event.global_position) - target = control.widget if !control.empty() and generator.can_link_parameter(param_name, control.node.generator, control.widget.name) else null + target = control.widget if control != null and !control.empty() and generator.can_link_parameter(param_name, control.node.generator, control.widget.name) else null update() elif event is InputEventMouseButton: if event.pressed: diff --git a/addons/material_maker/widgets/node_editor/parameter_enum.gd b/addons/material_maker/widgets/node_editor/parameter_enum.gd index 125570e..1891131 100644 --- a/addons/material_maker/widgets/node_editor/parameter_enum.gd +++ b/addons/material_maker/widgets/node_editor/parameter_enum.gd @@ -4,11 +4,11 @@ extends HBoxContainer var enum_values = [ {name="Foo", value="foo"} ] var enum_current = 0 -const ENUM_ADD = -1 -const ENUM_EDIT = -2 -const ENUM_REMOVE = -3 -const ENUM_UP = -4 -const ENUM_DOWN = -5 +const ENUM_ADD = 10000 +const ENUM_EDIT = 10001 +const ENUM_REMOVE = 10002 +const ENUM_UP = 10003 +const ENUM_DOWN = 10004 func _ready() -> void: update_enum_list()