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 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 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): node = container["node"] # Update the file path parents = io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) file_path = self.file_path(representation) file_path = file_path.replace("\\", "/") node.setParms({"ar_filename": file_path}) # Update attribute node.setParms({"representation": str(representation["_id"])})
def update(self, container, representation): import os read_nodes = dict() parents = avalon.io.parenthood(representation) version, subset, asset, project = parents self.package_path = get_representation_path_(representation, parents) sequences = representation["data"]["sequence"] start = version["data"]["startFrame"] end = version["data"]["endFrame"] if os.path.isdir(self.package_path): sequence_root = self.package_path else: sequence_root = self._fallback_stage(representation, version) self.resolve_path(sequences, sequence_root) for node in container["_members"]: if node.Class() == "Read": data = lib.get_avalon_knob_data(node) read_nodes[data["aov"]] = node with lib.sync_copies(list(read_nodes.values())): for aov_name, data in sequences.items(): read = read_nodes.get(aov_name) if not read: # (TODO) Create Read node for new or removed AOV. continue self.set_path(read, aov_name=aov_name, path=data["_resolved"]) # self.set_format(read, data["resolution"]) self.set_range(read, start=start, end=end) node = container["_node"] with lib.sync_copies([node], force=True): asset_name = asset["data"].get("shortName", asset["name"]) families = subset["data"]["families"] # avalon-core:subset-3.0 family_name = families[0].split(".")[-1] update = { "name": subset["name"], "representation": str(representation["_id"]), "namespace": "%s_%s" % (asset_name, family_name) } pipeline.update_container(node, update)
def update(self, container, representation): node = container["node"] # Update the file path parents = io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) file_path = self.file_path(representation) file_path = file_path.replace("\\", "/") # Update attributes node.setParms({"fileName": file_path, "representation": str(representation["_id"])}) # Rebuild node.parm("buildHierarchy").pressButton()
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)
def update(self, container, representation): node = container["node"] try: alembic_node = next(n for n in node.children() if n.type().name() == "alembic") except StopIteration: self.log.error("Could not find node of type `alembic`") return # Update the file path parents = io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) file_path = self.file_path(representation) file_path = file_path.replace("\\", "/") if file_path.endswith(".ma"): file_path = file_path.rsplit("ma", 1)[0] + "abc" alembic_node.setParms({"fileName": file_path}) # Update attribute node.setParms({"representation": str(representation["_id"])})
def update(self, container, representation): read_nodes = dict() parents = avalon.io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) for node in container["_members"]: if node.Class() == "Read": data = lib.get_avalon_knob_data(node) read_nodes[data["aov"]] = node with lib.sync_copies(list(read_nodes.values())): for name, data in representation["data"]["sequence"].items(): read = read_nodes.get(name) if not read: continue self.set_path(read, aov_name=name, file_name=data["fname"]) self.set_format(read, data["resolution"]) self.set_range(read, start=data["seqStart"], end=data["seqEnd"]) node = container["_node"] with lib.sync_copies([node], force=True): version, subset, asset, project = parents asset_name = asset["data"].get("shortName", asset["name"]) families = subset["data"]["families"] # avalon-core:subset-3.0 family_name = families[0].split(".")[-1] update = { "name": subset["name"], "representation": str(representation["_id"]), "namespace": "%s_%s" % (asset_name, family_name) } pipeline.update_container(node, update)
def update(self, container, representation): parents = avalon.io.parenthood(representation) self.package_path = get_representation_path_(representation, parents) members = container["_members"] with lib.sync_copies(members): precomp = members[0] self.setup_precomp(precomp, representation) node = container["_node"] with lib.sync_copies([node], force=True): version, subset, asset, project = parents asset_name = asset["data"].get("shortName", asset["name"]) families = subset["data"]["families"] # avalon-core:subset-3.0 family_name = families[0].split(".")[-1] update = { "name": subset["name"], "representation": str(representation["_id"]), "namespace": "%s_%s" % (asset_name, family_name) } pipeline.update_container(node, update)