diff --git a/colorbleed/plugins/maya/publish/extract_alembic.py b/colorbleed/plugins/maya/publish/extract_alembic.py index 2bde0bfe9a..7db7f2ea18 100644 --- a/colorbleed/plugins/maya/publish/extract_alembic.py +++ b/colorbleed/plugins/maya/publish/extract_alembic.py @@ -1,12 +1,12 @@ import os -import copy +from maya import cmds import avalon.maya import colorbleed.api from colorbleed.maya.lib import extract_alembic -class ExtractAlembic(colorbleed.api.Extractor): +class ExtractColorbleedAlembic(colorbleed.api.Extractor): """Extract Alembic Cache This extracts an Alembic cache using the `-selection` flag to minimize @@ -17,18 +17,35 @@ class ExtractAlembic(colorbleed.api.Extractor): families = ["colorbleed.model", "colorbleed.pointcache", "colorbleed.proxy"] - optional = True def process(self, instance): parent_dir = self.staging_dir(instance) filename = "%s.abc" % instance.name path = os.path.join(parent_dir, filename) + options = dict() - options = copy.deepcopy(instance.data) + # Collect the start and end including handles if any provided + # otherwise assume frame 1 as startFrame and the same as endFrame + start = instance.data.get("startFrame", 1) + end = instance.data.get("endFrame", start) + handles = instance.data.get("handles", 0) + if handles: + start -= handles + end += handles + options['frameRange'] = (start, end) - options['selection'] = True + # Default verbosity to False + options['verbose'] = instance.data.get("verbose", False) + + # Collect instance options if found in `instance.data` + # for specific settings (for user customization) + for key in ["renderableOnly", "writeColorSets"]: + if key in instance.data: + options[key] = instance.data[key] with avalon.maya.suspended_refresh(): with avalon.maya.maintained_selection(): + nodes = instance[:] + cmds.select(nodes, replace=True, noExpand=True) extract_alembic(file=path, **options)