Merge remote-tracking branch 'origin/feature/909-define-basic-trait-type-using-dataclasses' into feature/911-new-traits-based-integrator

This commit is contained in:
Ondřej Samohel 2024-11-30 01:26:47 +01:00
commit 45bf8aaaf5
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
2 changed files with 14 additions and 12 deletions

View file

@ -16,6 +16,7 @@ from .trait import (
TraitBase,
TraitValidationError,
)
from .two_dimensional import UDIM
from .utils import get_sequence_from_files
@ -130,14 +131,15 @@ class FileLocations(TraitBase):
if representation.contains_trait(FrameRanged):
self._validate_frame_range(representation)
if not representation.contains_trait(Sequence) \
and not representation.contains_trait(Bundle):
and not representation.contains_trait(Bundle) \
and not representation.contains_trait(UDIM):
# we have multiple files, but it is not a sequence or bundle
# what it it then? If the files are not related to each other
# then this representation is invalid.
# or UDIM tile set what it it then? If the files are not related
# to each other then this representation is invalid.
msg = (
"Multiple file locations defined, but no Sequence or Bundle "
"trait defined. If the files are not related to each other, "
"the representation is invalid."
"or UDIM trait defined. If the files are not related to "
"each other, the representation is invalid."
)
raise TraitValidationError(self.name, msg)

View file

@ -82,13 +82,13 @@ def test_sequence_validations() -> None:
# do the same but set handles as exclusive
representation = Representation(name="test_3", traits=[
FileLocations(file_paths=[
FileLocation(
file_path=Path(f"/path/to/file.{frame}.exr"),
file_size=1024,
file_hash=None,
)
for frame in range(996, 1105 + 1) # because range is zero based
]),
FileLocation(
file_path=Path(f"/path/to/file.{frame}.exr"),
file_size=1024,
file_hash=None,
)
for frame in range(996, 1105 + 1) # because range is zero based
]),
Handles(
frame_start_handle=5,
frame_end_handle=5,