def process(self, instance): surfaces = cmds.ls(instance, noIntermediate=True, type="surfaceShape") # Collect shading networks shaders = cmds.listConnections(surfaces, type="shadingEngine") shaders = list(set(shaders)) try: _history = cmds.listHistory(shaders) _history = list(set(_history)) except RuntimeError: _history = [] # Found no items to list the history for. upstream_nodes = cmds.ls(_history, long=True) # (NOTE): The flag `pruneDagObjects` will also filter out # `place3dTexture` type node. # Remove unwanted types unwanted_types = ("groupId", "groupParts", "surfaceShape") unwanted = set(cmds.ls(upstream_nodes, type=unwanted_types, long=True)) upstream_nodes = list(set(upstream_nodes) - unwanted) # Require Avalon UUID instance.data["requireAvalonUUID"] = cmds.listRelatives(surfaces, parent=True, fullPath=True) instance.data["dagMembers"] = instance[:] instance[:] = upstream_nodes stray = pipeline.find_stray_textures(instance) if stray: create_texture_subset_from_look(instance, stray)
def process(self, instance): from reveries.maya import pipeline upstream_nodes = instance.data.get("shadingNetwork", []) file_nodes = cmds.ls(upstream_nodes, type="file") instance.data["fileNodes"] = file_nodes # Frame range if instance.data["staticCache"]: instance.data["startFrame"] = cmds.currentTime(query=True) instance.data["endFrame"] = cmds.currentTime(query=True) else: get = (lambda f: cmds.playbackOptions(query=True, **f)) instance.data["startFrame"] = get({"minTime": True}) instance.data["endFrame"] = get({"maxTime": True}) instance.data["byFrameStep"] = 1 stray = pipeline.find_stray_textures(file_nodes) if stray: self.log.warning("Found not versioned textures, creating " "instance for publish.") create_texture_subset_from_standin(instance, stray) # Yeti if cmds.ls(instance, type="pgYetiMaya"): instance.data["hasYeti"] = True
def process(self, instance): surfaces = cmds.ls(instance, noIntermediate=True, type="surfaceShape") # Require Avalon UUID instance.data["requireAvalonUUID"] = cmds.listRelatives(surfaces, parent=True, fullPath=True) instance.data["dagMembers"] = instance[:] instance[:] = instance.data.pop("shadingNetwork", []) stray = pipeline.find_stray_textures(instance) if stray: is_arnold = utils.get_renderer_by_layer() == "arnold" create_texture_subset_from_look(instance, stray, is_arnold)
def process(self, instance): from maya import cmds from reveries.maya import pipeline, utils lights = list() light_types = dict() # Find all light node from shapes for node in cmds.ls(instance, type="shape", long=True): node_type = cmds.nodeType(node) if "Light" in node_type: # (NOTE) The light node from third party render engine might # not inherited from Maya `renderLight` type node, hence you # cannot use `cmds.ls(type="light")` nor `cmds.ls(lights=True)` # to find them. # Since I found there always have "Light" in thier type name, # so I use this as a workaround to filter out all the light # nodes. lights.append(node) # Collect by type if node_type not in light_types: light_types[node_type] = list() light_types[node_type].append(node) instance.data["lights"] = lights instance.data["lightsByType"] = light_types instance.data["dagMembers"] = instance[:] upstream_nodes = cmds.ls(cmds.listHistory(lights), long=True) # Remove nodes that are not belong to current DAG hierarchy for node in cmds.ls(upstream_nodes, type="transform", long=True): if node not in instance.data["dagMembers"]: upstream_nodes.remove(node) instance[:] = list(set(upstream_nodes + instance.data["dagMembers"])) is_arnold = utils.get_renderer_by_layer() == "arnold" if is_arnold: self.collect_ai_mesh_light(instance) self.collect_ai_shader_emission(instance) stray = pipeline.find_stray_textures(instance) if stray: create_texture_subset_from_lightSet(instance, stray, is_arnold)
def get_interactive(self, instance): """Interactive Groom Spline""" descriptions = xgen.interactive.list_lead_descriptions(instance[:]) instance.data["igsDescriptions"] = descriptions bound_meshes = set() for desc in descriptions: bound_meshes.update(xgen.interactive.list_bound_meshes(desc)) instance.data["igsBoundMeshes"] = list(bound_meshes) # Create model subset for bounding meshes result = create_model_subset_from_xgen(instance) if not result: self.log.warning("No bound mesh been found.") # Create texture subet for descriptions stray = pipeline.find_stray_textures(cmds.listHistory(descriptions)) if stray: create_texture_subset_from_xgen(instance, stray)