From f823b065d312c8f9dc24d10d51ebcb014319866c Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 22 Mar 2023 22:36:11 +0100 Subject: [PATCH 1/4] celaction: moving conditional workfile parameters into settings --- .../celaction/hooks/pre_celaction_setup.py | 22 +++++++++++-------- .../publish/collect_celaction_cli_kwargs.py | 2 +- .../defaults/project_settings/celaction.json | 9 ++++++++ .../schema_project_celaction.json | 14 ++++++++++++ 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/celaction/hooks/pre_celaction_setup.py b/openpype/hosts/celaction/hooks/pre_celaction_setup.py index 62cebf99ed..7506f1a52c 100644 --- a/openpype/hosts/celaction/hooks/pre_celaction_setup.py +++ b/openpype/hosts/celaction/hooks/pre_celaction_setup.py @@ -38,8 +38,9 @@ class CelactionPrelaunchHook(PreLaunchHook): ) path_to_cli = os.path.join(CELACTION_SCRIPTS_DIR, "publish_cli.py") - subproces_args = get_openpype_execute_args("run", path_to_cli) - openpype_executable = subproces_args.pop(0) + subprocess_args = get_openpype_execute_args("run", path_to_cli) + openpype_executable = subprocess_args.pop(0) + workfile_settings = self.get_workfile_settings() winreg.SetValueEx( hKey, @@ -49,15 +50,15 @@ class CelactionPrelaunchHook(PreLaunchHook): openpype_executable ) - parameters = subproces_args + [ - "--currentFile", "*SCENE*", - "--chunk", "*CHUNK*", - "--frameStart", "*START*", - "--frameEnd", "*END*", - "--resolutionWidth", "*X*", - "--resolutionHeight", "*Y*" + # add required arguments for workfile path + parameters = subprocess_args + [ + "--currentFile", "*SCENE*" ] + # Add custom parameters from workfile settings + if workfile_settings["parameters"]: + parameters += workfile_settings["parameters"] + winreg.SetValueEx( hKey, "SubmitParametersTitle", 0, winreg.REG_SZ, subprocess.list2cmdline(parameters) @@ -135,3 +136,6 @@ class CelactionPrelaunchHook(PreLaunchHook): self.log.info(f"Workfile to open: \"{workfile_path}\"") return workfile_path + + def get_workfile_settings(self): + return self.data["project_settings"]["celaction"]["workfile"] diff --git a/openpype/hosts/celaction/plugins/publish/collect_celaction_cli_kwargs.py b/openpype/hosts/celaction/plugins/publish/collect_celaction_cli_kwargs.py index 43b81b83e7..54dea15dff 100644 --- a/openpype/hosts/celaction/plugins/publish/collect_celaction_cli_kwargs.py +++ b/openpype/hosts/celaction/plugins/publish/collect_celaction_cli_kwargs.py @@ -39,7 +39,7 @@ class CollectCelactionCliKwargs(pyblish.api.Collector): passing_kwargs[key] = value if missing_kwargs: - raise RuntimeError("Missing arguments {}".format( + self.log.debug("Missing arguments {}".format( ", ".join( [f'"{key}"' for key in missing_kwargs] ) diff --git a/openpype/settings/defaults/project_settings/celaction.json b/openpype/settings/defaults/project_settings/celaction.json index bdba6d7322..0194b2c48c 100644 --- a/openpype/settings/defaults/project_settings/celaction.json +++ b/openpype/settings/defaults/project_settings/celaction.json @@ -9,6 +9,15 @@ "rules": {} } }, + "workfile": { + "parameters": [ + "--chunk *CHUNK*", + "--frameStart *START*", + "--frameEnd *END*", + "--resolutionWidth *X*", + "--resolutionHeight *Y*" + ] + }, "publish": { "CollectRenderPath": { "output_extension": "png", diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json b/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json index 2320d9ae26..4ca3cbb4da 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json @@ -22,6 +22,20 @@ ] }, + { + "type": "dict", + "collapsible": true, + "key": "workfile", + "label": "Workfile", + "children": [ + { + "key": "parameters", + "label": "Parameters", + "type": "list", + "object_type": "text" + } + ] + }, { "type": "dict", "collapsible": true, From 79eb8f105f02c9309949d64d425f64095ac6e7c5 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 23 Mar 2023 12:54:55 +0100 Subject: [PATCH 2/4] celaction: make parameters enumerator --- .../celaction/hooks/pre_celaction_setup.py | 16 ++++++++++++++-- .../defaults/project_settings/celaction.json | 10 ++++------ .../schema_project_celaction.json | 19 +++++++++++++++---- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/openpype/hosts/celaction/hooks/pre_celaction_setup.py b/openpype/hosts/celaction/hooks/pre_celaction_setup.py index 7506f1a52c..81f5f2bf11 100644 --- a/openpype/hosts/celaction/hooks/pre_celaction_setup.py +++ b/openpype/hosts/celaction/hooks/pre_celaction_setup.py @@ -56,8 +56,20 @@ class CelactionPrelaunchHook(PreLaunchHook): ] # Add custom parameters from workfile settings - if workfile_settings["parameters"]: - parameters += workfile_settings["parameters"] + if "render_chunk" in workfile_settings["submission_overrides"]: + parameters += [ + "--chunk *CHUNK*" + ] + elif "resolution" in workfile_settings["submission_overrides"]: + parameters += [ + "--resolutionWidth *X*", + "--resolutionHeight *Y*" + ] + elif "frame_range" in workfile_settings["submission_overrides"]: + parameters += [ + "--frameStart *START*", + "--frameEnd *END*" + ] winreg.SetValueEx( hKey, "SubmitParametersTitle", 0, winreg.REG_SZ, diff --git a/openpype/settings/defaults/project_settings/celaction.json b/openpype/settings/defaults/project_settings/celaction.json index 0194b2c48c..822604fd2f 100644 --- a/openpype/settings/defaults/project_settings/celaction.json +++ b/openpype/settings/defaults/project_settings/celaction.json @@ -10,12 +10,10 @@ } }, "workfile": { - "parameters": [ - "--chunk *CHUNK*", - "--frameStart *START*", - "--frameEnd *END*", - "--resolutionWidth *X*", - "--resolutionHeight *Y*" + "submission_overrides": [ + "render_chunk", + "frame_range", + "resolution" ] }, "publish": { diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json b/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json index 4ca3cbb4da..c5ca3eb9f5 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_celaction.json @@ -29,10 +29,21 @@ "label": "Workfile", "children": [ { - "key": "parameters", - "label": "Parameters", - "type": "list", - "object_type": "text" + "key": "submission_overrides", + "label": "Submission workfile overrides", + "type": "enum", + "multiselection": true, + "enum_items": [ + { + "render_chunk": "Pass chunk size" + }, + { + "frame_range": "Pass frame range" + }, + { + "resolution": "Pass resolution" + } + ] } ] }, From 011e635c1f91a3e49b282aaf3bf935da3ba31bd0 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 23 Mar 2023 12:56:54 +0100 Subject: [PATCH 3/4] hound --- openpype/hosts/celaction/hooks/pre_celaction_setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/celaction/hooks/pre_celaction_setup.py b/openpype/hosts/celaction/hooks/pre_celaction_setup.py index 81f5f2bf11..c7e8bc5d0c 100644 --- a/openpype/hosts/celaction/hooks/pre_celaction_setup.py +++ b/openpype/hosts/celaction/hooks/pre_celaction_setup.py @@ -58,8 +58,8 @@ class CelactionPrelaunchHook(PreLaunchHook): # Add custom parameters from workfile settings if "render_chunk" in workfile_settings["submission_overrides"]: parameters += [ - "--chunk *CHUNK*" - ] + "--chunk *CHUNK*" + ] elif "resolution" in workfile_settings["submission_overrides"]: parameters += [ "--resolutionWidth *X*", From f5117f4593f62b086e6af1809331c5d3580af73c Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 23 Mar 2023 14:28:05 +0100 Subject: [PATCH 4/4] celaction: fixes after testing --- .../hosts/celaction/hooks/pre_celaction_setup.py | 16 +++++++++------- .../plugins/publish/submit_celaction_deadline.py | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openpype/hosts/celaction/hooks/pre_celaction_setup.py b/openpype/hosts/celaction/hooks/pre_celaction_setup.py index c7e8bc5d0c..96e784875c 100644 --- a/openpype/hosts/celaction/hooks/pre_celaction_setup.py +++ b/openpype/hosts/celaction/hooks/pre_celaction_setup.py @@ -58,17 +58,17 @@ class CelactionPrelaunchHook(PreLaunchHook): # Add custom parameters from workfile settings if "render_chunk" in workfile_settings["submission_overrides"]: parameters += [ - "--chunk *CHUNK*" + "--chunk", "*CHUNK*" ] - elif "resolution" in workfile_settings["submission_overrides"]: + if "resolution" in workfile_settings["submission_overrides"]: parameters += [ - "--resolutionWidth *X*", - "--resolutionHeight *Y*" + "--resolutionWidth", "*X*", + "--resolutionHeight", "*Y*" ] - elif "frame_range" in workfile_settings["submission_overrides"]: + if "frame_range" in workfile_settings["submission_overrides"]: parameters += [ - "--frameStart *START*", - "--frameEnd *END*" + "--frameStart", "*START*", + "--frameEnd", "*END*" ] winreg.SetValueEx( @@ -76,6 +76,8 @@ class CelactionPrelaunchHook(PreLaunchHook): subprocess.list2cmdline(parameters) ) + self.log.debug(f"__ parameters: \"{parameters}\"") + # setting resolution parameters path_submit = "\\".join([ path_user_settings, "Dialogs", "SubmitOutput" diff --git a/openpype/modules/deadline/plugins/publish/submit_celaction_deadline.py b/openpype/modules/deadline/plugins/publish/submit_celaction_deadline.py index 038ee4fc03..bcf0850768 100644 --- a/openpype/modules/deadline/plugins/publish/submit_celaction_deadline.py +++ b/openpype/modules/deadline/plugins/publish/submit_celaction_deadline.py @@ -106,7 +106,7 @@ class CelactionSubmitDeadline(pyblish.api.InstancePlugin): # define chunk and priority chunk_size = instance.context.data.get("chunk") - if chunk_size == 0: + if not chunk_size: chunk_size = self.deadline_chunk_size # search for %02d pattern in name, and padding number