hound fixes

This commit is contained in:
Ondrej Samohel 2021-05-04 12:55:32 +02:00 committed by Ondrej Samohel
parent 36a98caeff
commit 4be9417fe0
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
3 changed files with 17 additions and 9 deletions

View file

@ -146,7 +146,8 @@ class VRayProxyLoader(api.Loader):
name = os.path.splitext(os.path.basename(filename))[0]
parent = cmds.createNode("transform", name=name)
proxy = cmds.createNode("VRayProxy", name=name + "Shape", parent=parent)
proxy = cmds.createNode(
"VRayProxy", name="{}Shape".format(name), parent=parent)
cmds.setAttr(proxy + ".fileName", filename, type="string")
cmds.connectAttr("time1.outTime", proxy + ".currentFrame")
@ -182,4 +183,4 @@ class VRayProxyLoader(api.Loader):
self.log.debug("File: {}".format(self.fname))
return file_name
return None
return ""

View file

@ -140,7 +140,7 @@ def create_items_from_nodes(nodes):
path = cmds.getAttr("{}.fileName".format(vp))
ids = vray_proxies.get_alembic_ids_cache(path)
parent_id = {}
for k, n in ids.items():
for k, _ in ids.items():
pid = k.split(":")[0]
if not parent_id.get(pid):
parent_id.update({pid: [vp]})

View file

@ -192,7 +192,8 @@ def load_look(version_id):
# Load file
loaders = api.loaders_from_representation(api.discover(api.Loader),
representation_id)
loader = next((i for i in loaders if i.__name__ == "LookLoader"), None)
loader = next(
(i for i in loaders if i.__name__ == "LookLoader"), None)
if loader is None:
raise RuntimeError("Could not find LookLoader, this is a bug")
@ -274,8 +275,12 @@ def vrayproxy_assign_look(vrayproxy, subset="lookDefault"):
# Get only the node ids and paths related to this asset
# And get the shader edits the look supplies
asset_nodes_by_id = {node_id: nodes_by_id[node_id] for node_id in node_ids}
edits = list(lib.iter_shader_edits(relationships, shadernodes, asset_nodes_by_id))
asset_nodes_by_id = {
node_id: nodes_by_id[node_id] for node_id in node_ids
}
edits = list(
lib.iter_shader_edits(
relationships, shadernodes, asset_nodes_by_id))
# Create assignments
assignments = {}
@ -287,7 +292,8 @@ def vrayproxy_assign_look(vrayproxy, subset="lookDefault"):
print("Skipping non-shader: %s" % shader)
continue
inputs = cmds.listConnections(shader + ".surfaceShader", source=True)
inputs = cmds.listConnections(
shader + ".surfaceShader", source=True)
if not inputs:
print("Shading engine missing material: %s" % shader)
@ -295,11 +301,12 @@ def vrayproxy_assign_look(vrayproxy, subset="lookDefault"):
for i, node in enumerate(nodes):
if "." in node:
log.warning(
"Converting face assignment to full object assignment. This conversion can be lossy: %s" % node)
("Converting face assignment to full object "
"assignment. This conversion can be lossy: "
"{}").format(node))
nodes[i] = node.split(".")[0]
material = inputs[0]
assignments[material] = nodes
assign_vrayproxy_shaders(vrayproxy, assignments)