Merge pull request #213 from BigRoy/PLN-205

Exclude parent hierarchy by default for pointcaches
This commit is contained in:
Roy Nieterau 2018-12-14 12:54:01 +01:00 committed by GitHub
commit 5df5c59609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 12 deletions

View file

@ -29,3 +29,6 @@ class CreateAnimation(avalon.maya.Creator):
# Include only nodes that are visible at least once during the
# frame range.
self.data["visibleOnly"] = False
# Include the groups above the out_SET content
self.data["includeParentHierarchy"] = False # Include parent groups

View file

@ -1,5 +1,3 @@
from collections import OrderedDict
import avalon.maya
@ -14,8 +12,12 @@ class CreateModel(avalon.maya.Creator):
def __init__(self, *args, **kwargs):
super(CreateModel, self).__init__(*args, **kwargs)
data = {"writeColorSets": False, # Vertex colors with the geometry.
"attr": "", # Add options for custom attributes
"attrPrefix": ""}
# Vertex colors with the geometry
self.data["writeColorSets"] = False
self.data.update(data)
# Include attributes by attribute name or prefix
self.data["attr"] = ""
self.data["attrPrefix"] = ""
# Whether to include parent hierarchy of nodes in the instance
self.data["includeParentHierarchy"] = False

View file

@ -19,6 +19,7 @@ class CreatePointCache(avalon.maya.Creator):
self.data["writeColorSets"] = False # Vertex colors with the geometry.
self.data["renderableOnly"] = False # Only renderable visible shapes
self.data["visibleOnly"] = False # only nodes that are visible
self.data["includeParentHierarchy"] = False # Include parent groups
# Add options for custom attributes
self.data["attr"] = ""

View file

@ -84,7 +84,11 @@ class CollectInstances(pyblish.api.ContextPlugin):
fullPath=True) or []
children = cmds.ls(children, noIntermediate=True, long=True)
parents = self.get_all_parents(members)
parents = []
if data.get("includeParentHierarchy", True):
# If `includeParentHierarchy` then include the parents
# so they will also be picked up in the instance by validators
parents = self.get_all_parents(members)
members_hierarchy = list(set(members + children + parents))
# Create the instance

View file

@ -27,12 +27,12 @@ class ExtractColorbleedAnimation(colorbleed.api.Extractor):
raise RuntimeError("Couldn't find exactly one out_SET: "
"{0}".format(out_sets))
out_set = out_sets[0]
nodes = cmds.sets(out_set, query=True)
roots = cmds.sets(out_set, query=True)
# Include all descendants
nodes += cmds.listRelatives(nodes,
allDescendents=True,
fullPath=True) or []
nodes = roots + cmds.listRelatives(roots,
allDescendents=True,
fullPath=True) or []
# Collect the start and end including handles
start = instance.data["startFrame"]
@ -58,6 +58,12 @@ class ExtractColorbleedAnimation(colorbleed.api.Extractor):
"selection": True
}
if not instance.data.get("includeParentHierarchy", True):
# Set the root nodes if we don't want to include parents
# The roots are to be considered the ones that are the actual
# direct members of the set
options["root"] = roots
if int(cmds.about(version=True)) >= 2017:
# Since Maya 2017 alembic supports multiple uv sets - write them.
options["writeUVSets"] = True

View file

@ -60,6 +60,12 @@ class ExtractColorbleedAlembic(colorbleed.api.Extractor):
"selection": True
}
if not instance.data.get("includeParentHierarchy", True):
# Set the root nodes if we don't want to include parents
# The roots are to be considered the ones that are the actual
# direct members of the set
options["root"] = instance.data.get("setMembers")
if int(cmds.about(version=True)) >= 2017:
# Since Maya 2017 alembic supports multiple uv sets - write them.
options["writeUVSets"] = True

View file

@ -63,7 +63,8 @@ class ValidateModelContent(pyblish.api.InstancePlugin):
cls.log.error("Must have exactly one top group")
if len(assemblies) == 0:
cls.log.warning("No top group found. "
"(Are there objects in the instance?)")
"(Are there objects in the instance?"
" Or is it parented in another group?)")
return assemblies or True
def _is_visible(node):