From 302c5fe21456e318e24451d2a6df190bc2dce449 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 22 Nov 2022 18:52:26 +0800 Subject: [PATCH] create and publish bb-geometry --- .../maya/plugins/create/create_proxy_abc.py | 2 + .../maya/plugins/load/load_abc_to_standin.py | 2 +- .../hosts/maya/plugins/load/load_gpucache.py | 2 +- .../hosts/maya/plugins/load/load_reference.py | 1 + .../maya/plugins/publish/extract_proxy_abc.py | 43 +++++++++---------- .../plugins/publish/collect_resources_path.py | 1 + openpype/plugins/publish/integrate.py | 1 + openpype/plugins/publish/integrate_legacy.py | 1 + .../defaults/project_settings/maya.json | 3 +- .../schemas/template_publish_families.json | 1 + 10 files changed, 32 insertions(+), 25 deletions(-) diff --git a/openpype/hosts/maya/plugins/create/create_proxy_abc.py b/openpype/hosts/maya/plugins/create/create_proxy_abc.py index f9671dfccf..57978cb4d9 100644 --- a/openpype/hosts/maya/plugins/create/create_proxy_abc.py +++ b/openpype/hosts/maya/plugins/create/create_proxy_abc.py @@ -34,6 +34,8 @@ class CreateProxyAlembic(plugin.Creator): # Creating a single bounding box per shape selected self.data["single"] = False + # remove the bbBox after publish + #self.data["removeBoundingBoxAfterPublish"] = False # name suffix for the bounding box self.data["nameSuffix"] = "_BBox" diff --git a/openpype/hosts/maya/plugins/load/load_abc_to_standin.py b/openpype/hosts/maya/plugins/load/load_abc_to_standin.py index 605a492e4d..70866a3ba6 100644 --- a/openpype/hosts/maya/plugins/load/load_abc_to_standin.py +++ b/openpype/hosts/maya/plugins/load/load_abc_to_standin.py @@ -11,7 +11,7 @@ from openpype.settings import get_project_settings class AlembicStandinLoader(load.LoaderPlugin): """Load Alembic as Arnold Standin""" - families = ["animation", "model", "pointcache"] + families = ["animation", "model", "proxyAbc", "pointcache"] representations = ["abc"] label = "Import Alembic as Arnold Standin" diff --git a/openpype/hosts/maya/plugins/load/load_gpucache.py b/openpype/hosts/maya/plugins/load/load_gpucache.py index a09f924c7b..07e5734f43 100644 --- a/openpype/hosts/maya/plugins/load/load_gpucache.py +++ b/openpype/hosts/maya/plugins/load/load_gpucache.py @@ -10,7 +10,7 @@ from openpype.settings import get_project_settings class GpuCacheLoader(load.LoaderPlugin): """Load Alembic as gpuCache""" - families = ["model", "animation", "pointcache"] + families = ["model", "animation", "proxyAbc", "pointcache"] representations = ["abc"] label = "Import Gpu Cache" diff --git a/openpype/hosts/maya/plugins/load/load_reference.py b/openpype/hosts/maya/plugins/load/load_reference.py index c762a29326..c6b07b036d 100644 --- a/openpype/hosts/maya/plugins/load/load_reference.py +++ b/openpype/hosts/maya/plugins/load/load_reference.py @@ -16,6 +16,7 @@ class ReferenceLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): families = ["model", "pointcache", + "proxyAbc", "animation", "mayaAscii", "mayaScene", diff --git a/openpype/hosts/maya/plugins/publish/extract_proxy_abc.py b/openpype/hosts/maya/plugins/publish/extract_proxy_abc.py index 4607fd8a4b..ee38979577 100644 --- a/openpype/hosts/maya/plugins/publish/extract_proxy_abc.py +++ b/openpype/hosts/maya/plugins/publish/extract_proxy_abc.py @@ -22,7 +22,8 @@ class ExtractProxyAlembic(publish.Extractor): def process(self, instance): nodes, roots = self.get_members_and_roots(instance) - + self.log.info("nodes:{}".format(nodes)) + self.log.info("roots:{}".format(roots)) # Collect the start and end including handles start = float(instance.data.get("frameStartHandle", 1)) end = float(instance.data.get("frameEndHandle", 1)) @@ -34,7 +35,7 @@ class ExtractProxyAlembic(publish.Extractor): attr_prefixes = instance.data.get("attrPrefix", "").split(";") attr_prefixes = [value for value in attr_prefixes if value.strip()] - self.log.info("Extracting pointcache..") + self.log.info("Extracting Proxy Alembic..") dirname = self.staging_dir(instance) filename = "{name}.abc".format(**instance.data) @@ -55,16 +56,22 @@ class ExtractProxyAlembic(publish.Extractor): if not instance.data.get("includeParentHierarchy", True): options["root"] = roots + self.log.info("{}".format(options["root"])) + if int(cmds.about(version=True)) >= 2017: + # Since Maya 2017 alembic supports multiple uv sets - write them. + options["writeUVSets"] = True if instance.data.get("visibleOnly", False): nodes = list(iter_visible_nodes_in_range(nodes, start=start, end=end)) - with suspended_refresh(): with maintained_selection(): - self.create_proxy_geometry(instance, nodes, start, end) + self.create_proxy_geometry(instance, + nodes, + start, + end) extract_alembic(file=path, startFrame=start, endFrame=end, @@ -91,21 +98,13 @@ class ExtractProxyAlembic(publish.Extractor): def create_proxy_geometry(self, instance, node, start, end): inst_selection = cmds.ls(node, long=True) name_suffix = instance.data.get("nameSuffix") - if instance.data.get("single", True): - cmds.geomToBBox(inst_selection, - name=instance.name, - nameSuffix=name_suffix, - single=True, - keepOriginal=True, - bakeAnimation=True, - startTime=start, - endTime=end) - else: - cmds.geomToBBox(inst_selection, - name=instance.name, - nameSuffix=name_suffix, - single=False, - keepOriginal=True, - bakeAnimation=True, - startTime=start, - endTime=end) + bbox = cmds.geomToBBox(inst_selection, + name=instance.name, + nameSuffix=name_suffix, + single=instance.data.get("single", False), + keepOriginal=True, + bakeAnimation=True, + startTime=start, + endTime=end) + return cmds.select(bbox, noExpand=True) + diff --git a/openpype/plugins/publish/collect_resources_path.py b/openpype/plugins/publish/collect_resources_path.py index 00f65b8b67..90aa0f44bb 100644 --- a/openpype/plugins/publish/collect_resources_path.py +++ b/openpype/plugins/publish/collect_resources_path.py @@ -21,6 +21,7 @@ class CollectResourcesPath(pyblish.api.InstancePlugin): order = pyblish.api.CollectorOrder + 0.495 families = ["workfile", "pointcache", + "proxyAbc", "camera", "animation", "model", diff --git a/openpype/plugins/publish/integrate.py b/openpype/plugins/publish/integrate.py index 0998e643e6..66f9a7aa59 100644 --- a/openpype/plugins/publish/integrate.py +++ b/openpype/plugins/publish/integrate.py @@ -81,6 +81,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): order = pyblish.api.IntegratorOrder families = ["workfile", "pointcache", + "proxyAbc", "camera", "animation", "model", diff --git a/openpype/plugins/publish/integrate_legacy.py b/openpype/plugins/publish/integrate_legacy.py index 536ab83f2c..d05aea1e2f 100644 --- a/openpype/plugins/publish/integrate_legacy.py +++ b/openpype/plugins/publish/integrate_legacy.py @@ -76,6 +76,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): order = pyblish.api.IntegratorOrder + 0.00001 families = ["workfile", "pointcache", + "proxyAbc", "camera", "animation", "model", diff --git a/openpype/settings/defaults/project_settings/maya.json b/openpype/settings/defaults/project_settings/maya.json index bfa3c9f0fb..f4a9fdd9ed 100644 --- a/openpype/settings/defaults/project_settings/maya.json +++ b/openpype/settings/defaults/project_settings/maya.json @@ -944,7 +944,8 @@ "subset_name_filters": [], "families": [ "animation", - "pointcache" + "pointcache", + "proxyAbc" ], "repre_names": [ "abc" diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/template_publish_families.json b/openpype/settings/entities/schemas/projects_schema/schemas/template_publish_families.json index f39ad31fbb..43dd74cdf9 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/template_publish_families.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/template_publish_families.json @@ -28,6 +28,7 @@ {"nukenodes": "nukenodes"}, {"plate": "plate"}, {"pointcache": "pointcache"}, + {"proxyAbc": "proxyAbc"}, {"prerender": "prerender"}, {"redshiftproxy": "redshiftproxy"}, {"reference": "reference"},