fix bug in NodePath and use better parameter name

This commit is contained in:
Jason0214
2018-05-11 00:28:16 -07:00
parent acf3b3ea14
commit 4ff158ba0f
2 changed files with 8 additions and 8 deletions

View File

@@ -55,7 +55,7 @@ def export_mesh_node(escn_file, export_settings, node, parent_gd_node):
mesh_node['visible'] = not node.hide
if skeleton_node is not None:
mesh_node['skeleton'] = NodePath(
skeleton_node.get_path(), mesh_node.get_path())
mesh_node.get_path(), skeleton_node.get_path())
if not physics.has_physics(node) or not physics.is_physics_root(node):
mesh_node['transform'] = node.matrix_local
else:

View File

@@ -269,17 +269,17 @@ class Array(list):
class NodePath:
"""Nodes in scene refers to other nodes or nodes' attribute,
for example MeshInstane refers Skeleton. """
def __init__(self, referee_path, referrer_path, referrer_attr=''):
self.ref_path = os.path.relpath(referee_path, referrer_path)
self.attr_name = referrer_attr
"""Node in scene points to other node or node's attribute,
for example, a MeshInstane points to a Skeleton. """
def __init__(self, from_here, to_there, attribute_pointed=''):
self.relative_path = os.path.relpath(to_there, from_here)
self.attribute_name = attribute_pointed
def to_string(self):
"""Serialize a node path"""
return 'NodePath("{}:{}")'.format(
self.ref_path,
self.attr_name
self.relative_path,
self.attribute_name
)