From d208ef644ba9f7bd77619c09c3c9ef2124489f70 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Mon, 9 Oct 2023 12:46:25 +0100 Subject: [PATCH 1/5] Improved error reporting for sequence frame validator --- .../publish/validate_sequence_frames.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py index 96485d5a2d..6ba4ea0d2f 100644 --- a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py +++ b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py @@ -39,8 +39,20 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): collections, remainder = clique.assemble( repr["files"], minimum_items=1, patterns=patterns) - assert not remainder, "Must not have remainder" - assert len(collections) == 1, "Must detect single collection" + if remainder: + raise ValueError( + "Some files have been found outside a sequence." + f"Invalid files: {remainder}") + if not collections: + raise ValueError( + "No collections found. There should be a single " + "collection per representation.") + if len(collections) > 1: + raise ValueError( + "Multiple collections detected. There should be a single" + "collection per representation." + f"Collections identified: {collections}") + collection = collections[0] frames = list(collection.indexes) @@ -57,4 +69,7 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): f"expected: {required_range}") missing = collection.holes().indexes - assert not missing, "Missing frames: %s" % (missing,) + if missing: + raise ValueError( + "Missing frames have been detected." + f"Missing frames: {missing}") From 31f3e68349f287e9a9a8c4da6d6f7094f8712563 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Mon, 9 Oct 2023 12:53:24 +0100 Subject: [PATCH 2/5] Fixed some spacing issues in the error reports --- .../unreal/plugins/publish/validate_sequence_frames.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py index 6ba4ea0d2f..e24729391f 100644 --- a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py +++ b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py @@ -41,7 +41,7 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): if remainder: raise ValueError( - "Some files have been found outside a sequence." + "Some files have been found outside a sequence. " f"Invalid files: {remainder}") if not collections: raise ValueError( @@ -49,8 +49,8 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): "collection per representation.") if len(collections) > 1: raise ValueError( - "Multiple collections detected. There should be a single" - "collection per representation." + "Multiple collections detected. There should be a single " + "collection per representation. " f"Collections identified: {collections}") collection = collections[0] @@ -71,5 +71,5 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): missing = collection.holes().indexes if missing: raise ValueError( - "Missing frames have been detected." + "Missing frames have been detected. " f"Missing frames: {missing}") From d27d3435d97681fb7fd9b7ea72f3b8ed4700996a Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Wed, 11 Oct 2023 10:20:18 +0100 Subject: [PATCH 3/5] Use the right class for the exception --- .../plugins/publish/validate_sequence_frames.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py index e24729391f..1f7753db37 100644 --- a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py +++ b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py @@ -3,6 +3,7 @@ import os import re import pyblish.api +from openpype.pipeline.publish import PublishValidationError class ValidateSequenceFrames(pyblish.api.InstancePlugin): @@ -40,15 +41,15 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): repr["files"], minimum_items=1, patterns=patterns) if remainder: - raise ValueError( + raise PublishValidationError( "Some files have been found outside a sequence. " f"Invalid files: {remainder}") if not collections: - raise ValueError( + raise PublishValidationError( "No collections found. There should be a single " "collection per representation.") if len(collections) > 1: - raise ValueError( + raise PublishValidationError( "Multiple collections detected. There should be a single " "collection per representation. " f"Collections identified: {collections}") @@ -65,11 +66,11 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): data["clipOut"]) if current_range != required_range: - raise ValueError(f"Invalid frame range: {current_range} - " + raise PublishValidationError(f"Invalid frame range: {current_range} - " f"expected: {required_range}") missing = collection.holes().indexes if missing: - raise ValueError( + raise PublishValidationError( "Missing frames have been detected. " f"Missing frames: {missing}") From ca07d562552f81ecbfae9d0582f145bcc6d7e182 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Wed, 11 Oct 2023 10:20:43 +0100 Subject: [PATCH 4/5] Changed error message for not finding any collection --- .../unreal/plugins/publish/validate_sequence_frames.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py index 1f7753db37..334baf0cee 100644 --- a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py +++ b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py @@ -46,8 +46,10 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): f"Invalid files: {remainder}") if not collections: raise PublishValidationError( - "No collections found. There should be a single " - "collection per representation.") + "We have been unable to find a sequence in the " + "files. Please ensure the files are named " + "appropriately. " + f"Files: {repr_files}") if len(collections) > 1: raise PublishValidationError( "Multiple collections detected. There should be a single " From 19b58d8095e26e985a922a441fd654fbab301784 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Wed, 11 Oct 2023 10:24:55 +0100 Subject: [PATCH 5/5] Hound fixes --- .../hosts/unreal/plugins/publish/validate_sequence_frames.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py index 334baf0cee..06acbf0992 100644 --- a/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py +++ b/openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py @@ -68,8 +68,9 @@ class ValidateSequenceFrames(pyblish.api.InstancePlugin): data["clipOut"]) if current_range != required_range: - raise PublishValidationError(f"Invalid frame range: {current_range} - " - f"expected: {required_range}") + raise PublishValidationError( + f"Invalid frame range: {current_range} - " + f"expected: {required_range}") missing = collection.holes().indexes if missing: