mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
Fixed a bug that allowed Material to be duplicated
This commit is contained in:
parent
4542c2d22e
commit
8650a5ae40
@ -96,6 +96,15 @@ func get_port_targets(gen_name: String, output_index: int) -> Array:
|
|||||||
|
|
||||||
func add_generator(generator : MMGenBase) -> bool:
|
func add_generator(generator : MMGenBase) -> bool:
|
||||||
var name = generator.name
|
var name = generator.name
|
||||||
|
if generator.name == "Material":
|
||||||
|
if has_node("Material"):
|
||||||
|
# Cannot create a material if it exists already
|
||||||
|
return false
|
||||||
|
else:
|
||||||
|
var parent = get_parent()
|
||||||
|
if parent != null and parent is Object and parent.get_script() == get_script():
|
||||||
|
# Material is always in top level graph
|
||||||
|
return false
|
||||||
var index = 1
|
var index = 1
|
||||||
while has_node(name):
|
while has_node(name):
|
||||||
index += 1
|
index += 1
|
||||||
|
@ -24,7 +24,7 @@ static func add_to_gen_graph(gen_graph, generators, connections) -> Dictionary:
|
|||||||
var g = create_gen(n)
|
var g = create_gen(n)
|
||||||
if g != null:
|
if g != null:
|
||||||
var orig_name = g.name
|
var orig_name = g.name
|
||||||
gen_graph.add_generator(g)
|
if gen_graph.add_generator(g):
|
||||||
rv.generators.append(g)
|
rv.generators.append(g)
|
||||||
gennames[orig_name] = g.name
|
gennames[orig_name] = g.name
|
||||||
for c in connections:
|
for c in connections:
|
||||||
|
Loading…
Reference in New Issue
Block a user