From 3bc341b8ba5d877db9e9cb8a3c9eb616d1f21636 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 5 Dec 2023 22:01:18 +0800 Subject: [PATCH 01/10] make sure the processEvents not rushing into indefinite loop --- openpype/hosts/substancepainter/api/lib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openpype/hosts/substancepainter/api/lib.py b/openpype/hosts/substancepainter/api/lib.py index 2cd08f862e..7055c1f8ba 100644 --- a/openpype/hosts/substancepainter/api/lib.py +++ b/openpype/hosts/substancepainter/api/lib.py @@ -588,6 +588,7 @@ def prompt_new_file_with_mesh(mesh_filepath): # the file while not file_dialog.selectedFiles(): app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 1000) + continue print(f"Selected: {file_dialog.selectedFiles()}") # Set it again now we know the path is refreshed - without this From 7c104e1336984071cbd341e4e4938421c094b54e Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 6 Dec 2023 22:28:35 +0800 Subject: [PATCH 02/10] make sure the select file dialog is closed after selecting the mesh file and make sure the new project dialog hit accepted after finishing the mesh selection and other settings --- openpype/hosts/substancepainter/api/lib.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/openpype/hosts/substancepainter/api/lib.py b/openpype/hosts/substancepainter/api/lib.py index 7055c1f8ba..71b7e3630a 100644 --- a/openpype/hosts/substancepainter/api/lib.py +++ b/openpype/hosts/substancepainter/api/lib.py @@ -583,21 +583,7 @@ def prompt_new_file_with_mesh(mesh_filepath): file_dialog.setDirectory(os.path.dirname(mesh_filepath)) url = QtCore.QUrl.fromLocalFile(os.path.basename(mesh_filepath)) file_dialog.selectUrl(url) - - # Give the explorer window time to refresh to the folder and select - # the file - while not file_dialog.selectedFiles(): - app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 1000) - continue - print(f"Selected: {file_dialog.selectedFiles()}") - - # Set it again now we know the path is refreshed - without this - # accepting the dialog will often not trigger the correct filepath - file_dialog.setDirectory(os.path.dirname(mesh_filepath)) - url = QtCore.QUrl.fromLocalFile(os.path.basename(mesh_filepath)) - file_dialog.selectUrl(url) - - file_dialog.done(file_dialog.Accepted) + file_dialog.close() app.processEvents(QtCore.QEventLoop.AllEvents) def _setup_prompt(): @@ -630,6 +616,8 @@ def prompt_new_file_with_mesh(mesh_filepath): if not mesh_filename_label.text(): dialog.close() raise RuntimeError(f"Failed to set mesh path: {mesh_filepath}") + else: + dialog.done(dialog.Accepted) new_action = _get_new_project_action() if not new_action: From e88b692d2acd44b686bec7e6759892ca1404b94a Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 7 Dec 2023 11:57:50 +0800 Subject: [PATCH 03/10] add the processEvents after the dialog has selected the file URL --- openpype/hosts/substancepainter/api/lib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/substancepainter/api/lib.py b/openpype/hosts/substancepainter/api/lib.py index 71b7e3630a..bb4481bb1d 100644 --- a/openpype/hosts/substancepainter/api/lib.py +++ b/openpype/hosts/substancepainter/api/lib.py @@ -583,7 +583,9 @@ def prompt_new_file_with_mesh(mesh_filepath): file_dialog.setDirectory(os.path.dirname(mesh_filepath)) url = QtCore.QUrl.fromLocalFile(os.path.basename(mesh_filepath)) file_dialog.selectUrl(url) - file_dialog.close() + app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 3000) + + file_dialog.done(file_dialog.Accepted) app.processEvents(QtCore.QEventLoop.AllEvents) def _setup_prompt(): From 459000ec90fa3cdcd11608c4085a620844f5e0c9 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 7 Dec 2023 18:28:28 +0800 Subject: [PATCH 04/10] if the prompt dialog can't help to import mesh, use substance_painter.project.create instead to 'load' the mesh into the scene --- .../hosts/substancepainter/plugins/load/load_mesh.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/substancepainter/plugins/load/load_mesh.py b/openpype/hosts/substancepainter/plugins/load/load_mesh.py index 57db869a11..ca22163c5d 100644 --- a/openpype/hosts/substancepainter/plugins/load/load_mesh.py +++ b/openpype/hosts/substancepainter/plugins/load/load_mesh.py @@ -44,14 +44,20 @@ class SubstanceLoadProjectMesh(load.LoaderPlugin): # Get user inputs import_cameras = data.get("import_cameras", True) preserve_strokes = data.get("preserve_strokes", True) - + sp_settings = substance_painter.project.Settings( + import_cameras=import_cameras + ) if not substance_painter.project.is_open(): # Allow to 'initialize' a new project path = self.filepath_from_context(context) result = prompt_new_file_with_mesh(mesh_filepath=path) if not result: - self.log.info("User cancelled new project prompt.") - return + self.log.info("User cancelled new project prompt." + "Creating new project directly from" + " Substance Painter API Instead.") + settings = substance_painter.project.create( + mesh_file_path=path, settings=sp_settings + ) else: # Reload the mesh From aeaee28539a2903eb2fb061e14ab673204f2a11b Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 7 Dec 2023 18:51:07 +0800 Subject: [PATCH 05/10] edit the comment --- openpype/hosts/substancepainter/api/lib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/substancepainter/api/lib.py b/openpype/hosts/substancepainter/api/lib.py index bb4481bb1d..35e5b63625 100644 --- a/openpype/hosts/substancepainter/api/lib.py +++ b/openpype/hosts/substancepainter/api/lib.py @@ -617,7 +617,9 @@ def prompt_new_file_with_mesh(mesh_filepath): mesh_filename_label = mesh_filename.findChild(QtWidgets.QLabel) if not mesh_filename_label.text(): dialog.close() - raise RuntimeError(f"Failed to set mesh path: {mesh_filepath}") + substance_painter.logging.warning( + f"Failed to set mesh path with the prompt dialog: {mesh_filepath}\n\n" + "Creating new project directly with the mesh path instead.") else: dialog.done(dialog.Accepted) From 34bb371b810ca0c12ff99729cfb9d045aaa1bdeb Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 7 Dec 2023 18:53:04 +0800 Subject: [PATCH 06/10] hound --- openpype/hosts/substancepainter/api/lib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/substancepainter/api/lib.py b/openpype/hosts/substancepainter/api/lib.py index 35e5b63625..4d3a1d19bd 100644 --- a/openpype/hosts/substancepainter/api/lib.py +++ b/openpype/hosts/substancepainter/api/lib.py @@ -618,7 +618,8 @@ def prompt_new_file_with_mesh(mesh_filepath): if not mesh_filename_label.text(): dialog.close() substance_painter.logging.warning( - f"Failed to set mesh path with the prompt dialog: {mesh_filepath}\n\n" + "Failed to set mesh path with the prompt dialog:" + f"{mesh_filepath}\n\n" "Creating new project directly with the mesh path instead.") else: dialog.done(dialog.Accepted) From f0692c87777f9bd31f73a48d3731c54f0f46c1d0 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 7 Dec 2023 20:53:53 +0800 Subject: [PATCH 07/10] add comment --- openpype/hosts/substancepainter/api/lib.py | 2 ++ openpype/hosts/substancepainter/plugins/load/load_mesh.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openpype/hosts/substancepainter/api/lib.py b/openpype/hosts/substancepainter/api/lib.py index 4d3a1d19bd..1cb480b552 100644 --- a/openpype/hosts/substancepainter/api/lib.py +++ b/openpype/hosts/substancepainter/api/lib.py @@ -583,6 +583,8 @@ def prompt_new_file_with_mesh(mesh_filepath): file_dialog.setDirectory(os.path.dirname(mesh_filepath)) url = QtCore.QUrl.fromLocalFile(os.path.basename(mesh_filepath)) file_dialog.selectUrl(url) + # TODO: find a way to improve the process event to + # load more complicated mesh app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 3000) file_dialog.done(file_dialog.Accepted) diff --git a/openpype/hosts/substancepainter/plugins/load/load_mesh.py b/openpype/hosts/substancepainter/plugins/load/load_mesh.py index ca22163c5d..6b4b79753b 100644 --- a/openpype/hosts/substancepainter/plugins/load/load_mesh.py +++ b/openpype/hosts/substancepainter/plugins/load/load_mesh.py @@ -50,6 +50,8 @@ class SubstanceLoadProjectMesh(load.LoaderPlugin): if not substance_painter.project.is_open(): # Allow to 'initialize' a new project path = self.filepath_from_context(context) + #TODO: improve the prompt dialog function to not + # only works for simple polygon scene result = prompt_new_file_with_mesh(mesh_filepath=path) if not result: self.log.info("User cancelled new project prompt." From 16c7d5565d072d84d9a1f5e717c54b832431b7fc Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 7 Dec 2023 20:54:35 +0800 Subject: [PATCH 08/10] hound --- openpype/hosts/substancepainter/plugins/load/load_mesh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/substancepainter/plugins/load/load_mesh.py b/openpype/hosts/substancepainter/plugins/load/load_mesh.py index 6b4b79753b..08c1d5c391 100644 --- a/openpype/hosts/substancepainter/plugins/load/load_mesh.py +++ b/openpype/hosts/substancepainter/plugins/load/load_mesh.py @@ -50,7 +50,7 @@ class SubstanceLoadProjectMesh(load.LoaderPlugin): if not substance_painter.project.is_open(): # Allow to 'initialize' a new project path = self.filepath_from_context(context) - #TODO: improve the prompt dialog function to not + # TODO: improve the prompt dialog function to not # only works for simple polygon scene result = prompt_new_file_with_mesh(mesh_filepath=path) if not result: From 6d36857fe8026f793d30cabc15bb5e1d432e3570 Mon Sep 17 00:00:00 2001 From: Toke Jepsen Date: Mon, 11 Dec 2023 11:19:43 +0000 Subject: [PATCH 09/10] Testing: Validate errors and failed status from Deadline jobs. (#5986) * Validate errors from Deadline jobs. * Check dependency chain and failed jobs. * Houd * Fix wrong datatype It failed on expecting string but receiving dictionary. --------- Co-authored-by: kalisp --- tests/lib/testing_classes.py | 57 +++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/tests/lib/testing_classes.py b/tests/lib/testing_classes.py index 7a90f76662..ade38d60c8 100644 --- a/tests/lib/testing_classes.py +++ b/tests/lib/testing_classes.py @@ -481,7 +481,7 @@ class DeadlinePublishTest(PublishTest): while not valid_date_finished: time.sleep(0.5) if time.time() - time_start > timeout: - raise ValueError("Timeout for DL finish reached") + raise ValueError("Timeout for Deadline finish reached") response = requests.get(url, timeout=10) if not response.ok: @@ -491,6 +491,61 @@ class DeadlinePublishTest(PublishTest): if not response.json(): raise ValueError("Couldn't find {}".format(deadline_job_id)) + job = response.json()[0] + + def recursive_dependencies(job, results=None): + if results is None: + results = [] + + for dependency in job["Props"]["Dep"]: + dependency = requests.get( + "{}/api/jobs?JobId={}".format( + deadline_url, dependency["JobID"] + ), + timeout=10 + ).json()[0] + results.append(dependency) + grand_dependencies = recursive_dependencies( + dependency, results=results + ) + for grand_dependency in grand_dependencies: + if grand_dependency not in results: + results.append(grand_dependency) + return results + + job_status = { + 0: "Unknown", + 1: "Active", + 2: "Suspended", + 3: "Completed", + 4: "Failed", + 6: "Pending" + } + + jobs_to_validate = [job] + jobs_to_validate.extend(recursive_dependencies(job)) + failed_jobs = [] + errors = [] + for job in jobs_to_validate: + if "Failed" == job_status[job["Stat"]]: + failed_jobs.append(str(job)) + + resp_error = requests.get( + "{}/api/jobreports?JobID={}&Data=allerrorcontents".format( + deadline_url, job["_id"] + ), + timeout=10 + ) + errors.extend(resp_error.json()) + + msg = "Errors in Deadline:\n" + msg += "\n".join(errors) + assert not errors, msg + + msg = "Failed in Deadline:\n" + msg += "\n".join(failed_jobs) + assert not failed_jobs, msg + # '0001-...' returned until job is finished valid_date_finished = response.json()[0]["DateComp"][:4] != "0001" From 2d73f6a6aaa5e54134cf7b43dc4402609529cf06 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:51:58 +0100 Subject: [PATCH 10/10] Chore: Staging mode determination (#5895) * use 'is_staging_enabled' to determine if staging resource is used * fix bug in 'is_running_staging' --- openpype/lib/openpype_version.py | 2 +- openpype/resources/__init__.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openpype/lib/openpype_version.py b/openpype/lib/openpype_version.py index 1c8356d5fe..5618eb0c2e 100644 --- a/openpype/lib/openpype_version.py +++ b/openpype/lib/openpype_version.py @@ -140,7 +140,7 @@ def is_running_staging(): latest_version = get_latest_version(local=False, remote=True) staging_version = latest_version - if current_version == production_version: + if current_version == staging_version: return True return is_staging_enabled() diff --git a/openpype/resources/__init__.py b/openpype/resources/__init__.py index b33d1bf023..c429fb8c3e 100644 --- a/openpype/resources/__init__.py +++ b/openpype/resources/__init__.py @@ -1,6 +1,6 @@ import os from openpype import AYON_SERVER_ENABLED -from openpype.lib.openpype_version import is_running_staging +from openpype.lib.openpype_version import is_staging_enabled RESOURCES_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -59,7 +59,7 @@ def get_openpype_icon_filepath(staging=None): return get_resource("icons", "AYON_icon_dev.png") if staging is None: - staging = is_running_staging() + staging = is_staging_enabled() if staging: return get_openpype_staging_icon_filepath() @@ -68,7 +68,7 @@ def get_openpype_icon_filepath(staging=None): def get_openpype_splash_filepath(staging=None): if staging is None: - staging = is_running_staging() + staging = is_staging_enabled() if AYON_SERVER_ENABLED: if os.getenv("AYON_USE_DEV") == "1":