Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3461 from BigRoy/maya_merge_alembic_extractors
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolar authored Jul 6, 2022
2 parents b77a6ae + 488f58a commit e8b62e3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 119 deletions.
111 changes: 0 additions & 111 deletions openpype/hosts/maya/plugins/publish/extract_animation.py

This file was deleted.

37 changes: 29 additions & 8 deletions openpype/hosts/maya/plugins/publish/extract_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def process(self, instance):
self.log.debug("Should be processed on farm, skipping.")
return

nodes = instance[:]
nodes, roots = self.get_members_and_roots(instance)

# Collect the start and end including handles
start = float(instance.data.get("frameStartHandle", 1))
Expand All @@ -46,10 +46,6 @@ def process(self, instance):
attr_prefixes = instance.data.get("attrPrefix", "").split(";")
attr_prefixes = [value for value in attr_prefixes if value.strip()]

# Get extra export arguments
writeColorSets = instance.data.get("writeColorSets", False)
writeFaceSets = instance.data.get("writeFaceSets", False)

self.log.info("Extracting pointcache..")
dirname = self.staging_dir(instance)

Expand All @@ -63,8 +59,8 @@ def process(self, instance):
"attrPrefix": attr_prefixes,
"writeVisibility": True,
"writeCreases": True,
"writeColorSets": writeColorSets,
"writeFaceSets": writeFaceSets,
"writeColorSets": instance.data.get("writeColorSets", False),
"writeFaceSets": instance.data.get("writeFaceSets", False),
"uvWrite": True,
"selection": True,
"worldSpace": instance.data.get("worldSpace", True)
Expand All @@ -74,7 +70,7 @@ def process(self, instance):
# 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")
options["root"] = roots

if int(cmds.about(version=True)) >= 2017:
# Since Maya 2017 alembic supports multiple uv sets - write them.
Expand Down Expand Up @@ -112,3 +108,28 @@ def process(self, instance):
instance.context.data["cleanupFullPaths"].append(path)

self.log.info("Extracted {} to {}".format(instance, dirname))

def get_members_and_roots(self, instance):
return instance[:], instance.data.get("setMembers")


class ExtractAnimation(ExtractAlembic):
label = "Extract Animation"
families = ["animation"]

def get_members_and_roots(self, instance):

# Collect the out set nodes
out_sets = [node for node in instance if node.endswith("out_SET")]
if len(out_sets) != 1:
raise RuntimeError("Couldn't find exactly one out_SET: "
"{0}".format(out_sets))
out_set = out_sets[0]
roots = cmds.sets(out_set, query=True)

# Include all descendants
nodes = roots + cmds.listRelatives(roots,
allDescendents=True,
fullPath=True) or []

return nodes, roots

0 comments on commit e8b62e3

Please sign in to comment.