def process(self, project, asset, subset, version, representation): # def process(self, representation): # project, asset, subset, version = io.parenthood(representation) template = project["config"]["template"]["publish"] data = { "root": api.registered_root(), "project": project["name"], "asset": asset["name"], "silo": asset["silo"], "subset": subset["name"], "version": version["name"], "representation": representation["name"].strip("."), } fname = template.format(**data) assert os.path.exists(fname), "%s does not exist" % fname namespace = maya.unique_namespace(asset["name"], suffix="_") name = subset["name"] nodes = cmds.file(fname, namespace=namespace, reference=True, returnNewNodes=True, groupReference=True, groupName=namespace + ":" + name) # Containerising maya.containerise(name=name, namespace=namespace, nodes=nodes, asset=asset, subset=subset, version=version, representation=representation, loader=type(self).__name__) # TODO(marcus): We are hardcoding the name "out_SET" here. # Better register this keyword, so that it can be used # elsewhere, such as in the Integrator plug-in, # without duplication. output = next((node for node in nodes if node.endswith("out_SET")), None) assert output, "No output in rig, this is a bug." with maya.maintained_selection(): # Select contents of output cmds.select(output, noExpand=False) # TODO(marcus): Hardcoding the exact family here. # Better separate the relationship between loading # rigs and automatically assigning an instance to it. maya.create(name=maya.unique_name(asset["name"], suffix="_SET"), family="mindbender.animation", options={"useSelection": True}) return nodes
def process(self, project, asset, subset, version, representation): template = project["config"]["template"]["publish"] data = { "root": api.registered_root(), "project": project["name"], "asset": asset["name"], "silo": asset["silo"], "subset": subset["name"], "version": version["name"], "representation": representation["name"].strip("."), } fname = template.format(**data) assert os.path.exists(fname), "%s does not exist" % fname namespace = asset["name"] + "_" name = maya.unique_name(subset["name"]) with maya.maintained_selection(): nodes = cmds.file(fname, namespace=namespace, reference=True, returnNewNodes=True) # Containerising maya.containerise(name=name, namespace=namespace, nodes=nodes, asset=asset, subset=subset, version=version, representation=representation, loader=type(self).__name__) # Assign shaders data["representation"] = "json" fname = template.format(**data) if not os.path.isfile(fname): cmds.warning("Look development asset has no relationship data.") else: with open(fname) as f: relationships = json.load(f) # Append namespace to shader group identifier. # E.g. `blinn1SG` -> `Bruce_:blinn1SG` relationships = { "%s:%s" % (namespace, shader): relationships[shader] for shader in relationships } maya.apply_shaders(relationships) return nodes
def process(self, project, asset, subset, version, representation): cmds.loadPlugin("AbcImport.mll", quiet=True) template = project["config"]["template"]["publish"] data = { "root": api.registered_root(), "project": project["name"], "asset": asset["name"], "silo": asset["silo"], "subset": subset["name"], "version": version["name"], "representation": representation["name"].strip("."), } fname = template.format(**data) assert os.path.exists(fname), "%s does not exist" % fname name = subset["name"] namespace = subset["name"] + "_" if cmds.objExists(namespace + ":" + name): cmds.warning("Asset already imported.") nodes = cmds.file( fname, namespace=namespace, # Prevent identical alembic nodes # from being shared. sharedReferenceFile=False, groupReference=True, groupName=namespace + ":" + name, reference=True, returnNewNodes=True) # Containerising maya.containerise(name=name, namespace=namespace, nodes=nodes, asset=asset, subset=subset, version=version, representation=representation, loader=type(self).__name__) return nodes
def process(self, project, asset, subset, version, representation): template = project["config"]["template"]["publish"] data = { "root": api.registered_root(), "project": project["name"], "asset": asset["name"], "silo": asset["silo"], "subset": subset["name"], "version": version["name"], "representation": representation["name"].strip("."), } fname = template.format(**data) assert os.path.exists(fname), "%s does not exist" % fname namespace = maya.unique_namespace(asset["name"], suffix="_") name = subset["name"] with maya.maintained_selection(): nodes = cmds.file(fname, namespace=namespace, reference=True, returnNewNodes=True, groupReference=True, groupName=namespace + ":" + name) # Containerising maya.containerise(name=name, namespace=namespace, nodes=nodes, asset=asset, subset=subset, version=version, representation=representation, loader=type(self).__name__) # Assign default shader to meshes meshes = cmds.ls(nodes, type="mesh") cmds.sets(meshes, forceElement="initialShadingGroup") return nodes
def process(self, project, asset, subset, version, representation): template = project["config"]["template"]["publish"] data = { "root": api.registered_root(), "project": project["name"], "asset": asset["name"], "silo": asset["silo"], "subset": subset["name"], "version": version["name"], "representation": representation["name"].strip("."), } fname = template.format(**data) assert os.path.exists(fname), "%s does not exist" % fname namespace = asset["name"] + "_" name = maya.unique_name(subset["name"]) with maya.maintained_selection(): nodes = cmds.file(fname, namespace=namespace, reference=True, returnNewNodes=True, groupReference=True, groupName=namespace + ":" + name) # Containerising maya.containerise(name=name, namespace=namespace, nodes=nodes, asset=asset, subset=subset, version=version, representation=representation, loader=type(self).__name__) return nodes