@ -7,6 +7,7 @@ Base class for texture generators, that defines their API
|
||||
"""
|
||||
|
||||
signal parameter_changed
|
||||
signal output_changed(index)
|
||||
|
||||
class InputPort:
|
||||
var generator : MMGenBase = null
|
||||
@ -49,6 +50,9 @@ func can_be_deleted() -> bool:
|
||||
func toggle_editable() -> bool:
|
||||
return false
|
||||
|
||||
func is_template() -> bool:
|
||||
return model != null
|
||||
|
||||
func is_editable() -> bool:
|
||||
return false
|
||||
|
||||
@ -117,6 +121,7 @@ func notify_output_change(output_index : int) -> void:
|
||||
var targets = get_targets(output_index)
|
||||
for target in targets:
|
||||
target.generator.source_changed(target.input_index)
|
||||
emit_signal("output_changed", output_index)
|
||||
|
||||
func source_changed(__) -> void:
|
||||
emit_signal("parameter_changed", "__input_changed__", 0)
|
||||
|
@ -10,7 +10,13 @@ var editable : bool = false
|
||||
var transmits_seed : bool = true
|
||||
|
||||
signal connections_changed(removed_connections, added_connections)
|
||||
signal hierarchy_changed
|
||||
|
||||
func emit_hierarchy_changed():
|
||||
var top = self
|
||||
while top.get_parent() != null and top.get_parent().get_script() == get_script():
|
||||
top = top.get_parent()
|
||||
top.emit_signal("hierarchy_changed")
|
||||
|
||||
func fix_remotes() -> void:
|
||||
for c in get_children():
|
||||
@ -111,6 +117,8 @@ func add_generator(generator : MMGenBase) -> bool:
|
||||
name = generator.name + "_" + str(index)
|
||||
generator.name = name
|
||||
add_child(generator)
|
||||
if generator.get_script() == get_script():
|
||||
emit_hierarchy_changed()
|
||||
return true
|
||||
|
||||
func remove_generator(generator : MMGenBase) -> bool:
|
||||
@ -123,6 +131,8 @@ func remove_generator(generator : MMGenBase) -> bool:
|
||||
connections = new_connections
|
||||
remove_child(generator)
|
||||
fix_remotes()
|
||||
if generator.get_script() == get_script():
|
||||
emit_hierarchy_changed()
|
||||
generator.queue_free()
|
||||
return true
|
||||
|
||||
@ -130,8 +140,10 @@ func replace_generator(old : MMGenBase, new : MMGenBase) -> void:
|
||||
new.name = old.name
|
||||
new.position = old.position
|
||||
remove_child(old)
|
||||
old.free()
|
||||
add_child(new)
|
||||
if old.get_script() == get_script() or new.get_script() == get_script():
|
||||
emit_hierarchy_changed()
|
||||
old.free()
|
||||
|
||||
func get_connected_inputs(generator) -> Array:
|
||||
var rv : Array = []
|
||||
@ -312,10 +324,11 @@ func create_subgraph(gens : Array) -> MMGenGraph:
|
||||
if !found_remote:
|
||||
var gen_parameters = remote_script.new()
|
||||
gen_parameters.name = "gen_parameters"
|
||||
gen_parameters.position = Vector2(center.x - 200, upper_bound-300)
|
||||
gen_parameters.position = Vector2(center.x-200, upper_bound-300)
|
||||
new_graph.add_child(gen_parameters)
|
||||
fix_remotes()
|
||||
new_graph.fix_remotes()
|
||||
emit_hierarchy_changed()
|
||||
return new_graph
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ func create_gen(data) -> MMGenBase:
|
||||
if generator == null and data.has("type"):
|
||||
if types.has(data.type):
|
||||
generator = types[data.type].new()
|
||||
else:
|
||||
elif predefined_generators.has(data.type):
|
||||
generator = create_gen(predefined_generators[data.type])
|
||||
if generator == null:
|
||||
print("Cannot find description for "+data.type)
|
||||
|
BIN
material_maker/doc/images/create_node_menu.gif
Normal file
After Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.8 KiB |