Merge branch 'master' into dev-new-nodes

This commit is contained in:
RodZill4 2019-12-04 22:31:36 +01:00
commit 256272a125
5 changed files with 11 additions and 11 deletions

View File

@ -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.

View File

@ -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:

View File

@ -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()

View File

@ -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:

View File

@ -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()