def update(self, container, representation): import maya.cmds as cmds members = cmds.sets(container["objectName"], query=True) proxy_node = cmds.ls(members, type="tcAtomsProxy") if not proxy_node: raise Exception("No Atoms Proxy node, this is a bug.") parents = avalon.io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) entry_path = self.file_path(representation) entry_path = os.path.expandvars(entry_path) variation_file = representation["data"]["variationFile"] variation_path = os.path.dirname(entry_path) + "/" + variation_file shape = proxy_node[0] self.log.info(entry_path) cmds.setAttr(shape + ".cachePath", entry_path, type="string") cmds.setAttr(shape + ".variationsPath", variation_path, type="string") # Update container version, subset, asset, _ = parents pipeline.update_container(container, asset, subset, version, representation)
def update(self, container, representation): import maya.cmds as cmds from avalon import io from reveries.maya import pipeline from reveries.utils import get_representation_path_ members = cmds.sets(container["objectName"], query=True) standins = cmds.ls(members, type="aiStandIn", long=True) if not standins: raise Exception("No Arnold Stand-In node, this is a bug.") parents = io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) entry_path, use_sequence = self.retrive(representation) if not entry_path.endswith(".ass"): raise Exception("Not a Arnold Stand-In file, this is a bug: " "%s" % entry_path) for standin in standins: # This would allow all copies getting updated together cmds.setAttr(standin + ".dso", entry_path, type="string") cmds.setAttr(standin + ".useFrameExtension", use_sequence) # Update container version, subset, asset, _ = parents pipeline.update_container(container, asset, subset, version, representation)
def update(self, container, representation): import maya.cmds as cmds from reveries.maya import pipeline from reveries.utils import get_representation_path_ members = cmds.sets(container["objectName"], query=True) volumes = cmds.ls(members, type="aiVolume", long=True) if not volumes: raise Exception("No Arnold Volume node, this is a bug.") parents = avalon.io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) use_sequence = "startFrame" in representation["data"] entry_path = self.file_path(representation) if not entry_path.endswith(".vdb"): raise Exception("Not a VDB file, this is a bug: " "%s" % entry_path) for volume in volumes: # This would allow all copies getting updated together cmds.setAttr(volume + ".filename", entry_path, type="string") cmds.setAttr(volume + ".useFrameExtension", use_sequence) # Update container version, subset, asset, _ = parents pipeline.update_container(container, asset, subset, version, representation)
def update(self, container, representation): from maya import cmds from reveries import utils from reveries.maya import pipeline import avalon.io node = container["objectName"] # Get reference node from container reference_node = self.get_reference_node(container) with self.patch(reference_node): parents = avalon.io.parenthood(representation) self.package_path = utils.get_representation_path_( representation, parents) entry_path = self.file_path(representation) self.log.info("Reloading reference from: {!r}".format(entry_path)) cmds.file(entry_path, loadReference=reference_node, type="mayaBinary", defaultExtensions=False) # Add new nodes of the reference to the container nodes = cmds.referenceQuery(reference_node, nodes=True, dagPath=True) cmds.sets(nodes, forceElement=node) # Remove any placeHolderList attribute entries from the set that # are remaining from nodes being removed from the referenced file. # (NOTE) This ensures the reference update correctly when node name # changed (e.g. shadingEngine) in different version. holders = (lambda N: [ x for x in cmds.sets(N, query=True) or [] if ".placeHolderList" in x ]) cmds.sets(holders(node), remove=node) # Update container version, subset, asset, _ = parents pipeline.update_container(container, asset, subset, version, representation)
def update(self, container, representation): import maya.cmds as cmds members = cmds.sets(container["objectName"], query=True) standin = next(iter(cmds.ls(members, type="aiStandIn")), None) if not standin: raise Exception("No Arnold Stand-In node, this is a bug.") parents = avalon.io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) entry_path, use_sequence = self.retrive(representation) cmds.setAttr(standin + ".dso", entry_path, type="string") cmds.setAttr(standin + ".useFrameExtension", use_sequence) # Update container version, subset, asset, _ = parents pipeline.update_container(container, asset, subset, version, representation)