From 1e668f3fdf632f45172bf1df3785ed86ca0ac516 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Tue, 16 Jul 2024 00:08:47 +0200 Subject: [PATCH] Cosmetics --- .../plugins/publish/extract_ornatrix_cache.py | 27 +++++++++++-------- .../publish/validate_ornatrix_content.py | 5 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/client/ayon_maya/plugins/publish/extract_ornatrix_cache.py b/client/ayon_maya/plugins/publish/extract_ornatrix_cache.py index 6cc0299a..097d6df3 100644 --- a/client/ayon_maya/plugins/publish/extract_ornatrix_cache.py +++ b/client/ayon_maya/plugins/publish/extract_ornatrix_cache.py @@ -20,12 +20,13 @@ def process(self, instance): # Define extract output file path ox_nodes = cmds.ls(instance[:], shapes=True, long=True) ox_shape_nodes = cmds.ls(ox_nodes, type="HairShape") - self.log.debug(f"{ox_shape_nodes}") + self.log.debug( + f"Ornatrix HairShape nodes to extract: {ox_shape_nodes}") dirname = self.staging_dir(instance) # Start writing the files for snap shot - ox_abc_path = os.path.join(dirname, f"{instance.name}ornatrix.abc") + ox_abc_path = os.path.join(dirname, f"{instance.name}_ornatrix.abc") with lib.maintained_selection(): - cmds.select(ox_shape_nodes) + cmds.select(ox_shape_nodes, replace=True, noExpand=True) self._extract(instance, ox_abc_path) settings = instance.data["cachesettings"] self.log.debug("Writing metadata file") @@ -58,20 +59,24 @@ def process(self, instance): self.log.debug("Extracted {} to {}".format(instance, dirname)) def _extract(self, instance, filepath): - """Export Ornatrix Alembic by Mel Script. + """Export Ornatrix Alembic by using `OxAlembicExport` command. Args: + instance (pyblish.api.Instance): Publish instance. filepath (str): output filepath - attr_values (dict): creator attributes data """ attr_values = instance.data["creator_attributes"] filepath = filepath.replace("\\", "/") frame_range = get_frame_range(instance.data["taskEntity"]) - frameStart = attr_values.get("frameStart", frame_range["frameStart"]) - frameEnd = attr_values.get("frameEnd", frame_range["frameEnd"]) - frameStep = attr_values.get("step", 1.0) - exp_format = attr_values.get("format", 0) - ox_base_command = f'OxAlembicExport "{filepath}" -ft "{frameStart}" -tt "{frameEnd}" -s {frameStep} -f {exp_format}' # noqa + frame_start = attr_values.get("frameStart", frame_range["frameStart"]) + frame_end = attr_values.get("frameEnd", frame_range["frameEnd"]) + frame_step = attr_values.get("step", 1.0) + export_format = attr_values.get("format", 0) + ox_base_command = ( + f'OxAlembicExport "{filepath}" ' + f'-ft "{frame_start}" -tt "{frame_end}" ' + f'-s {frame_step} -f {export_format}' + ) ox_export_options = [ox_base_command] if attr_values.get("renderVersion", False): ox_export_options.append("-r") @@ -86,4 +91,4 @@ def _extract(self, instance, filepath): ) ox_export_options.append(interval_velocity_cmd) ox_export_cmd = " ".join(ox_export_options) - return mel.eval(f"{ox_export_cmd};") + return mel.eval(ox_export_cmd) diff --git a/client/ayon_maya/plugins/publish/validate_ornatrix_content.py b/client/ayon_maya/plugins/publish/validate_ornatrix_content.py index 3e0b93ae..aef5c9ac 100644 --- a/client/ayon_maya/plugins/publish/validate_ornatrix_content.py +++ b/client/ayon_maya/plugins/publish/validate_ornatrix_content.py @@ -9,14 +9,12 @@ from ayon_maya.api import plugin from maya import cmds - ORNATRIX_NODES = { "HairFromGuidesNode", "GuidesFromMeshNode", "MeshFromStrandsNode", "SurfaceCombNode" } - class ValidateOrnatrixContent(plugin.MayaInstancePlugin, OptionalPyblishPluginMixin): """Adheres to the content of 'oxrig' product type @@ -59,7 +57,8 @@ def process(self, instance): if invalid: raise PublishValidationError( title="Ornatrix content is invalid", - message="Ornatrix content is invalid. See log for more details.", + message="Ornatrix content is invalid. " + "See log for more details.", description=self.get_description() )