From 404681e684892e63e4d26915364c24ed56f23c7d Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Sun, 24 Mar 2024 10:32:08 +0100 Subject: [PATCH 1/4] Add list of attributes to always be included in alembic export even when not specified in publisher UI by user. This matches the Extract Camera Alembic logic for `bake_attributes` --- .../hosts/maya/plugins/publish/extract_pointcache.py | 9 +++++++++ server_addon/maya/server/settings/publishers.py | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py b/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py index f2187063fc..f83d2679cb 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py +++ b/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py @@ -1,4 +1,5 @@ import os +import json from maya import cmds @@ -25,6 +26,7 @@ class ExtractAlembic(publish.Extractor): hosts = ["maya"] families = ["pointcache", "model", "vrayproxy.alembic"] targets = ["local", "remote"] + bake_attributes = "[]" def process(self, instance): if instance.data.get("farm"): @@ -42,6 +44,13 @@ class ExtractAlembic(publish.Extractor): attrs += instance.data.get("userDefinedAttributes", []) attrs += ["cbId"] + # bake specified attributes in preset + bake_attributes = json.loads(self.bake_attributes) + assert isinstance(bake_attributes, list), ( + "Attributes to bake must be specified as a list" + ) + attrs += bake_attributes + attr_prefixes = instance.data.get("attrPrefix", "").split(";") attr_prefixes = [value for value in attr_prefixes if value.strip()] diff --git a/server_addon/maya/server/settings/publishers.py b/server_addon/maya/server/settings/publishers.py index 3a6de2eb44..ca99d8c57f 100644 --- a/server_addon/maya/server/settings/publishers.py +++ b/server_addon/maya/server/settings/publishers.py @@ -299,6 +299,11 @@ class ExtractAlembicModel(BaseSettingsModel): families: list[str] = SettingsField( default_factory=list, title="Families") + bake_attributes: str = SettingsField( + "[]", title="Bake Attributes", widget="textarea", + description="List of attributes that will be included in the alembic " + "export.", + ) class ExtractObjModel(BaseSettingsModel): @@ -1193,7 +1198,8 @@ DEFAULT_PUBLISH_SETTINGS = { "pointcache", "model", "vrayproxy.alembic" - ] + ], + "bake_attributes": "[]" }, "ExtractObj": { "enabled": False, From 3d9cd57df01aacde07e3424a9d9c0af8a5f834ec Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Sun, 24 Mar 2024 10:37:31 +0100 Subject: [PATCH 2/4] Expose bake attribute prefixes, plus make settings just a list of strings --- .../maya/plugins/publish/extract_pointcache.py | 15 ++++++--------- server_addon/maya/server/settings/publishers.py | 12 +++++++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py b/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py index f83d2679cb..5de72f7674 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py +++ b/client/ayon_core/hosts/maya/plugins/publish/extract_pointcache.py @@ -1,5 +1,4 @@ import os -import json from maya import cmds @@ -26,7 +25,10 @@ class ExtractAlembic(publish.Extractor): hosts = ["maya"] families = ["pointcache", "model", "vrayproxy.alembic"] targets = ["local", "remote"] - bake_attributes = "[]" + + # From settings + bake_attributes = [] + bake_attribute_prefixes = [] def process(self, instance): if instance.data.get("farm"): @@ -42,17 +44,12 @@ class ExtractAlembic(publish.Extractor): attrs = instance.data.get("attr", "").split(";") attrs = [value for value in attrs if value.strip()] attrs += instance.data.get("userDefinedAttributes", []) + attrs += self.bake_attributes attrs += ["cbId"] - # bake specified attributes in preset - bake_attributes = json.loads(self.bake_attributes) - assert isinstance(bake_attributes, list), ( - "Attributes to bake must be specified as a list" - ) - attrs += bake_attributes - attr_prefixes = instance.data.get("attrPrefix", "").split(";") attr_prefixes = [value for value in attr_prefixes if value.strip()] + attr_prefixes += self.bake_attribute_prefixes self.log.debug("Extracting pointcache..") dirname = self.staging_dir(instance) diff --git a/server_addon/maya/server/settings/publishers.py b/server_addon/maya/server/settings/publishers.py index ca99d8c57f..7ba2522e60 100644 --- a/server_addon/maya/server/settings/publishers.py +++ b/server_addon/maya/server/settings/publishers.py @@ -299,10 +299,15 @@ class ExtractAlembicModel(BaseSettingsModel): families: list[str] = SettingsField( default_factory=list, title="Families") - bake_attributes: str = SettingsField( - "[]", title="Bake Attributes", widget="textarea", + bake_attributes: list[str] = SettingsField( + "", title="Bake Attributes", widget="textarea", description="List of attributes that will be included in the alembic " "export.", + ), + bake_attribute_prefixes: list[str] = SettingsField( + "", title="Bake Attribute Prefixes", widget="textarea", + description="List of attribute prefixes for attributes that will be " + "included in the alembic export.", ) @@ -1199,7 +1204,8 @@ DEFAULT_PUBLISH_SETTINGS = { "model", "vrayproxy.alembic" ], - "bake_attributes": "[]" + "bake_attributes": [], + "bake_attribute_prefixes": [], }, "ExtractObj": { "enabled": False, From fadf720c9a9b33299a057527183f58d9d89027a6 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Sun, 24 Mar 2024 10:38:20 +0100 Subject: [PATCH 3/4] Bump version --- server_addon/maya/server/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_addon/maya/server/version.py b/server_addon/maya/server/version.py index 8202425a2d..a86a3ce0a1 100644 --- a/server_addon/maya/server/version.py +++ b/server_addon/maya/server/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring addon version.""" -__version__ = "0.1.9" +__version__ = "0.1.10" From 9a5d6427d5741186b4767107ae495bf36241ed09 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Sun, 24 Mar 2024 11:22:53 +0100 Subject: [PATCH 4/4] Fix settings --- server_addon/maya/server/settings/publishers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server_addon/maya/server/settings/publishers.py b/server_addon/maya/server/settings/publishers.py index 7ba2522e60..7c2688af55 100644 --- a/server_addon/maya/server/settings/publishers.py +++ b/server_addon/maya/server/settings/publishers.py @@ -300,12 +300,12 @@ class ExtractAlembicModel(BaseSettingsModel): default_factory=list, title="Families") bake_attributes: list[str] = SettingsField( - "", title="Bake Attributes", widget="textarea", + default_factory=list, title="Bake Attributes", description="List of attributes that will be included in the alembic " "export.", - ), + ) bake_attribute_prefixes: list[str] = SettingsField( - "", title="Bake Attribute Prefixes", widget="textarea", + default_factory=list, title="Bake Attribute Prefixes", description="List of attribute prefixes for attributes that will be " "included in the alembic export.", ) @@ -1205,7 +1205,7 @@ DEFAULT_PUBLISH_SETTINGS = { "vrayproxy.alembic" ], "bake_attributes": [], - "bake_attribute_prefixes": [], + "bake_attribute_prefixes": [] }, "ExtractObj": { "enabled": False,