def get_invalid(cls, instance): from maya import cmds from reveries.maya import lib invalid = list() display_attrs = { ".visibility": True, ".lodVisibility": True, ".template": False, ".hideOnPlayback": False, ".hiddenInOutliner": False, ".ghosting": False } for node in cmds.ls(instance, long=True, type="transform"): # Ensure transform shape is not hidden not_hidden = ( all([cmds.getAttr(node + attr) is display_attrs[attr] for attr in display_attrs.keys()]) ) not_hidden = lib.is_visible(node) and not_hidden if not not_hidden: invalid.append(node) return invalid
def get_invalid(cls, instance): from reveries.maya import lib from maya import cmds containers = lib.lsAttr("id", AVALON_CONTAINER_ID) surfaces = cmds.ls(instance, type="surfaceShape", noIntermediate=True, long=True) # Check on transform node transforms = set( cmds.listRelatives(surfaces, parent=True, fullPath=True) or []) has_versioned = set() # Is node being containerized ? for node in transforms: for set_ in cmds.listSets(object=node) or []: if set_ in containers: has_versioned.add(node) break not_containerized = transforms - has_versioned other_instances = [ i for i in instance.context if (i.data["family"] not in cls.families and i.data.get("publish", True)) ] # Is node being publish ? for node in not_containerized: for inst in other_instances: if node in inst: has_versioned.add(node) break # Or hidden ? start = instance.data["startFrame"] end = instance.data["endFrame"] step = instance.data["byFrameStep"] not_versioned_visible = set() not_versioned = transforms - has_versioned for node in not_versioned: frame = start while frame < end: if lib.is_visible(node, time=frame): not_versioned_visible.add(node) break frame += step return list(not_versioned_visible)
def get_invalid(cls, instance): from maya import cmds from reveries.maya import lib invalid = list() if not depended_plugins_succeed(cls, instance): raise Exception("Depended plugin failed. See error log.") for mesh in cls.get_excluded_meshes(instance): node = cmds.listRelatives(mesh, parent=True, fullPath=True)[0] if lib.is_visible(node, displayLayer=False, intermediateObject=False): invalid.append(node) elif cmds.listConnections(node + ".visibility", source=True, destination=False, connections=False): invalid.append(node) return invalid
def cache_by_visibility(self, cacheables): for node in list(cacheables): if not lib.is_visible(node, displayLayer=False): cacheables.remove(node) return cacheables