Skip to content

Commit

Permalink
Strip namespaces for referenced materials
Browse files Browse the repository at this point in the history
  • Loading branch information
ababak committed May 13, 2019
1 parent 7f83d94 commit 247016f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def process_node(node, renderer, mappings):
'''
if 'name' not in node:
return None
node_name = node['name']
node_name = utils.strip_namespace(node['name'])
node_type = node['type']
if node_type not in mappings:
return None
Expand Down Expand Up @@ -444,9 +444,9 @@ def calc_tree_pos(branch, x=0):
def connect_xml(node_xml, dest, source):
port_node = node_xml.find(".//port[@name='{param}']".format(param=dest))
if port_node is not None:
connSource = utils.get_out_connection(source)
if connSource:
port_node.attrib['source'] = connSource
conn_source = utils.get_out_connection(source)
if conn_source:
port_node.attrib['source'] = conn_source
return True
return False

Expand Down
11 changes: 10 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_out_connection(connection):
'''
if not connection:
return ''
out_port = [connection['node']]
out_port = [strip_namespace(connection['node'])]
if connection.get('original_port').startswith(
('outDisplacement', 'outEigenvalue')):
out_port.append(connection.get('original_port'))
Expand Down Expand Up @@ -134,3 +134,12 @@ def has_connection(node, param):
Check if node dictionary includes the requested attribute connection
'''
return param in node['connections']


def strip_namespace(name):
'''
Strip all namespaces.
Katana imports nodes with namespaces but at least RenderMan
refuses to render them
'''
return name.rsplit(':', 1)[-1]

0 comments on commit 247016f

Please sign in to comment.