Merge pull request #1569 from MoritzBrueckner/trait-names
Print warning if logic node tree and generated trait names differ
This commit is contained in:
commit
1c2b147592
1 changed files with 9 additions and 4 deletions
|
@ -46,6 +46,11 @@ def build_node_tree(node_group):
|
||||||
pack_path = arm.utils.safestr(bpy.data.worlds['Arm'].arm_project_package)
|
pack_path = arm.utils.safestr(bpy.data.worlds['Arm'].arm_project_package)
|
||||||
path = 'Sources/' + pack_path.replace('.', '/') + '/node/'
|
path = 'Sources/' + pack_path.replace('.', '/') + '/node/'
|
||||||
group_name = arm.utils.safesrc(node_group.name[0].upper() + node_group.name[1:])
|
group_name = arm.utils.safesrc(node_group.name[0].upper() + node_group.name[1:])
|
||||||
|
|
||||||
|
if group_name != node_group.name:
|
||||||
|
arm.log.warn('Logic node tree and generated trait names differ! Node'
|
||||||
|
f' tree: "{node_group.name}", trait: "{group_name}"')
|
||||||
|
|
||||||
file = path + group_name + '.hx'
|
file = path + group_name + '.hx'
|
||||||
|
|
||||||
# Import referenced node group
|
# Import referenced node group
|
||||||
|
@ -74,7 +79,7 @@ def build_node_tree(node_group):
|
||||||
for node in root_nodes:
|
for node in root_nodes:
|
||||||
build_node(node, f)
|
build_node(node, f)
|
||||||
f.write('\t}\n')
|
f.write('\t}\n')
|
||||||
|
|
||||||
# Create node functions
|
# Create node functions
|
||||||
for node_name in function_nodes:
|
for node_name in function_nodes:
|
||||||
node = function_nodes[node_name]
|
node = function_nodes[node_name]
|
||||||
|
@ -154,7 +159,7 @@ def build_node(node, f):
|
||||||
else:
|
else:
|
||||||
prop = str(prop)
|
prop = str(prop)
|
||||||
f.write('\t\t' + name + '.property' + str(i) + ' = ' + prop + ';\n')
|
f.write('\t\t' + name + '.property' + str(i) + ' = ' + prop + ';\n')
|
||||||
|
|
||||||
# Create inputs
|
# Create inputs
|
||||||
for inp in node.inputs:
|
for inp in node.inputs:
|
||||||
# Is linked - find node
|
# Is linked - find node
|
||||||
|
@ -179,7 +184,7 @@ def build_node(node, f):
|
||||||
inp_from = 0
|
inp_from = 0
|
||||||
# Add input
|
# Add input
|
||||||
f.write('\t\t' + name + '.addInput(' + inp_name + ', ' + str(inp_from) + ');\n')
|
f.write('\t\t' + name + '.addInput(' + inp_name + ', ' + str(inp_from) + ');\n')
|
||||||
|
|
||||||
# Create outputs
|
# Create outputs
|
||||||
for out in node.outputs:
|
for out in node.outputs:
|
||||||
if out.is_linked:
|
if out.is_linked:
|
||||||
|
@ -216,7 +221,7 @@ def collect_nodes_from_output(out, f):
|
||||||
for o in reroute.outputs:
|
for o in reroute.outputs:
|
||||||
outputs = outputs + collect_nodes_from_output(o, f)
|
outputs = outputs + collect_nodes_from_output(o, f)
|
||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
def get_root_nodes(node_group):
|
def get_root_nodes(node_group):
|
||||||
roots = []
|
roots = []
|
||||||
for node in node_group.nodes:
|
for node in node_group.nodes:
|
||||||
|
|
Loading…
Reference in a new issue