From fec4610344a6586aa92d7b3aef50922d02d0f875 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 1 Apr 2024 12:11:19 +0100 Subject: [PATCH] Fix publishing and add settings. --- .../create/create_animation_pointcache.py | 20 +-- .../validate_alembic_options_defaults.py | 4 +- .../maya/server/settings/publishers.py | 143 ++++++++++++++++-- server_addon/maya/server/version.py | 2 +- 4 files changed, 143 insertions(+), 26 deletions(-) diff --git a/client/ayon_core/hosts/maya/plugins/create/create_animation_pointcache.py b/client/ayon_core/hosts/maya/plugins/create/create_animation_pointcache.py index 967c7b0e2d..6ade9eaeb5 100644 --- a/client/ayon_core/hosts/maya/plugins/create/create_animation_pointcache.py +++ b/client/ayon_core/hosts/maya/plugins/create/create_animation_pointcache.py @@ -1,12 +1,12 @@ from maya import cmds -from openpype.hosts.maya.api import lib, plugin +from ayon_core.hosts.maya.api import lib, plugin -from openpype.lib import ( +from ayon_core.lib import ( BoolDef, NumberDef, ) -from openpype.pipeline import CreatedInstance +from ayon_core.pipeline import CreatedInstance def _get_animation_attr_defs(cls): @@ -91,11 +91,12 @@ class CreateAnimation(plugin.MayaHiddenCreator): include_user_defined_attributes = False def collect_instances(self): + key = "maya_cached_instance_data" try: - cached_subsets = self.collection_shared_data["maya_cached_subsets"] + cached_subsets = self.collection_shared_data[key] except KeyError: - self.cache_subsets(self.collection_shared_data) - cached_subsets = self.collection_shared_data["maya_cached_subsets"] + self.cache_instance_data(self.collection_shared_data) + cached_subsets = self.collection_shared_data[key] for node in cached_subsets.get(self.identifier, []): node_data = self.read_instance_node(node) @@ -125,11 +126,12 @@ class CreatePointCache(plugin.MayaCreator): include_user_defined_attributes = False def collect_instances(self): + key = "maya_cached_instance_data" try: - cached_subsets = self.collection_shared_data["maya_cached_subsets"] + cached_subsets = self.collection_shared_data[key] except KeyError: - self.cache_subsets(self.collection_shared_data) - cached_subsets = self.collection_shared_data["maya_cached_subsets"] + self.cache_instance_data(self.collection_shared_data) + cached_subsets = self.collection_shared_data[key] for node in cached_subsets.get(self.identifier, []): node_data = self.read_instance_node(node) diff --git a/client/ayon_core/hosts/maya/plugins/publish/validate_alembic_options_defaults.py b/client/ayon_core/hosts/maya/plugins/publish/validate_alembic_options_defaults.py index e16196a6d3..0a9fc0c6e5 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/validate_alembic_options_defaults.py +++ b/client/ayon_core/hosts/maya/plugins/publish/validate_alembic_options_defaults.py @@ -1,7 +1,7 @@ import pyblish.api -from openpype.pipeline import OptionalPyblishPluginMixin -from openpype.pipeline.publish import RepairAction, PublishValidationError +from ayon_core.pipeline import OptionalPyblishPluginMixin +from ayon_core.pipeline.publish import RepairAction, PublishValidationError class ValidateAlembicOptionsDefaults( diff --git a/server_addon/maya/server/settings/publishers.py b/server_addon/maya/server/settings/publishers.py index f1e63f36be..0e12d10c75 100644 --- a/server_addon/maya/server/settings/publishers.py +++ b/server_addon/maya/server/settings/publishers.py @@ -35,6 +35,76 @@ def angular_unit_enum(): ] +def extract_alembic_flags_enum(): + """Get flags for alembic extraction enumerator.""" + return [ + {"label": "autoSubd", "value": "autoSubd"}, + { + "label": "dontSkipUnwrittenFrames", + "value": "dontSkipUnwrittenFrames" + }, + {"label": "eulerFilter", "value": "eulerFilter"}, + {"label": "noNormals", "value": "noNormals"}, + {"label": "preRoll", "value": "preRoll"}, + {"label": "renderableOnly", "value": "renderableOnly"}, + {"label": "stripNamespaces", "value": "stripNamespaces"}, + {"label": "uvWrite", "value": "uvWrite"}, + {"label": "uvsOnly", "value": "uvsOnly"}, + {"label": "verbose", "value": "verbose"}, + {"label": "wholeFrameGeo", "value": "wholeFrameGeo"}, + {"label": "worldSpace", "value": "worldSpace"}, + {"label": "writeColorSets", "value": "writeColorSets"}, + {"label": "writeFaceSets", "value": "writeFaceSets"}, + {"label": "writeNormals", "value": "writeNormals"}, + {"label": "writeUVSets", "value": "writeUVSets"}, + {"label": "writeVisibility", "value": "writeVisibility"} + ] + + +def extract_alembic_data_format_enum(): + return [ + {"label": "ogawa", "value": "ogawa"}, + {"label": "HDF", "value": "HDF"} + ] + + +def extract_alembic_overrides_enum(): + return [ + {"value": "attr", "label": "Custom Attributes"}, + {"value": "attrPrefix", "label": "Custom Attributes Prefix"}, + {"value": "autoSubd", "label": "autoSubd"}, + {"value": "dataFormat", "label": "dataFormat"}, + { + "value": "dontSkipUnwrittenFrames", + "label": "dontSkipUnwrittenFrames" + }, + {"value": "eulerFilter", "label": "eulerFilter"}, + {"value": "melPerFrameCallback", "label": "melPerFrameCallback"}, + {"value": "melPostJobCallback", "label": "melPostJobCallback"}, + {"value": "noNormals", "label": "noNormals"}, + {"value": "preRoll", "label": "preRoll"}, + {"value": "preRollStartFrame", "label": "Pre Roll Start Frame"}, + {"value": "pythonPerFrameCallback", "label": "pythonPerFrameCallback"}, + {"value": "pythonPostJobCallback", "label": "pythonPostJobCallback"}, + {"value": "renderableOnly", "label": "renderableOnly"}, + {"value": "stripNamespaces", "label": "stripNamespaces"}, + {"value": "userAttr", "label": "userAttr"}, + {"value": "userAttrPrefix", "label": "userAttrPrefix"}, + {"value": "uvWrite", "label": "uvWrite"}, + {"value": "uvsOnly", "label": "uvsOnly"}, + {"value": "verbose", "label": "verbose"}, + {"value": "visibleOnly", "label": "Visible Only"}, + {"value": "wholeFrameGeo", "label": "wholeFrameGeo"}, + {"value": "worldSpace", "label": "worldSpace"}, + {"value": "writeColorSets", "label": "writeColorSets"}, + {"value": "writeCreases", "label": "writeCreases"}, + {"value": "writeFaceSets", "label": "writeFaceSets"}, + {"value": "writeNormals", "label": "writeNormals"}, + {"value": "writeUVSets", "label": "writeUVSets"}, + {"value": "writeVisibility", "label": "writeVisibility"} + ] + + class BasicValidateModel(BaseSettingsModel): enabled: bool = SettingsField(title="Enabled") optional: bool = SettingsField(title="Optional") @@ -309,6 +379,25 @@ class ExtractAlembicModel(BaseSettingsModel): description="List of attribute prefixes for attributes that will be " "included in the alembic export.", ) + flags: list[str] = SettingsField( + enum_resolver=extract_alembic_flags_enum, title="Export Flags" + ) + attr: str = SettingsField(title="Custom Attributes") + attrPrefix: str = SettingsField(title="Custom Attributes Prefix") + dataFormat: str = SettingsField( + enum_resolver=extract_alembic_data_format_enum, title="Data Format" + ) + melPerFrameCallback: str = SettingsField(title="melPerFrameCallback") + melPostFrameCallback: str = SettingsField(title="melPostFrameCallback") + preRollStartFrame: int = SettingsField(title="Pre Roll Start Frame") + pythonPerFrameCallback: str = SettingsField(title="pythonPerFrameCallback") + pythonPostJobCallback: str = SettingsField(title="pythonPostJobCallback") + userAttr: str = SettingsField(title="userAttr") + userAttrPrefix: str = SettingsField(title="userAttrPrefix") + visibleOnly: bool = SettingsField(title="Visible Only") + overrides: list[str] = SettingsField( + enum_resolver=extract_alembic_overrides_enum, title="Exposed Overrides" + ) class ExtractObjModel(BaseSettingsModel): @@ -665,10 +754,6 @@ class PublishersModel(BaseSettingsModel): title="Extract Proxy Alembic", section="Model Extractors", ) - ExtractAlembic: ExtractAlembicModel = SettingsField( - default_factory=ExtractAlembicModel, - title="Extract Alembic", - ) ExtractObj: ExtractObjModel = SettingsField( default_factory=ExtractObjModel, title="Extract OBJ" @@ -799,6 +884,10 @@ class PublishersModel(BaseSettingsModel): default_factory=ExtractGPUCacheModel, title="Extract GPU Cache", ) + ExtractAlembic: ExtractAlembicModel = SettingsField( + default_factory=ExtractAlembicModel, + title="Extract Alembic", + ) DEFAULT_SUFFIX_NAMING = { @@ -1188,16 +1277,6 @@ DEFAULT_PUBLISH_SETTINGS = { "proxyAbc" ] }, - "ExtractAlembic": { - "enabled": True, - "families": [ - "pointcache", - "model", - "vrayproxy.alembic" - ], - "bake_attributes": [], - "bake_attribute_prefixes": [] - }, "ExtractObj": { "enabled": False, "optional": True, @@ -1353,5 +1432,41 @@ DEFAULT_PUBLISH_SETTINGS = { "optimizeAnimationsForMotionBlur": True, "writeMaterials": True, "useBaseTessellation": True + }, + "ExtractAlembic": { + "enabled": True, + "families": [ + "pointcache", + "model", + "vrayproxy.alembic" + ], + "bake_attributes": [], + "bake_attribute_prefixes": [], + "flags": [ + "stripNamespaces", + "writeNormals", + "worldSpace" + ], + "attr": "", + "attrPrefix": "", + "dataFormat": "ogawa", + "melPerFrameCallback": "", + "melPostFrameCallback": "", + "preRollStartFrame": 0, + "pythonPerFrameCallback": "", + "pythonPostJobCallback": "", + "userAttr": "", + "userAttrPrefix": "", + "visibleOnly": False, + "overrides": [ + "attr", + "attrPrefix", + "worldSpace", + "writeColorSets", + "writeNormals", + "writeFaceSets", + "renderableOnly", + "visibleOnly" + ] } } diff --git a/server_addon/maya/server/version.py b/server_addon/maya/server/version.py index 71b4bc4ca6..1a4f79a972 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.12" +__version__ = "0.1.13"