mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge branch 'feature/909-define-basic-trait-type-using-dataclasses' into feature/911-new-traits-based-integrator
This commit is contained in:
commit
348c7345b5
2 changed files with 6 additions and 5 deletions
|
|
@ -140,7 +140,7 @@ class FileLocations(TraitBase):
|
||||||
Optional[FileLocation]: File location for the frame.
|
Optional[FileLocation]: File location for the frame.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
frame_regex = r"\.(?P<frame>(?P<padding>0*)\d+)\.\D+\d?$"
|
frame_regex = r"\.(?P<index>(?P<padding>0*)\d+)\.\D+\d?$"
|
||||||
if sequence_trait and sequence_trait.frame_regex:
|
if sequence_trait and sequence_trait.frame_regex:
|
||||||
frame_regex = sequence_trait.frame_regex
|
frame_regex = sequence_trait.frame_regex
|
||||||
|
|
||||||
|
|
@ -148,7 +148,7 @@ class FileLocations(TraitBase):
|
||||||
for location in self.file_paths:
|
for location in self.file_paths:
|
||||||
result = re.search(frame_regex, location.file_path.name)
|
result = re.search(frame_regex, location.file_path.name)
|
||||||
if result:
|
if result:
|
||||||
frame_index = int(result.group("frame"))
|
frame_index = int(result.group("index"))
|
||||||
if frame_index == frame:
|
if frame_index == frame:
|
||||||
return location
|
return location
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,8 @@ class Sequence(TraitBase):
|
||||||
sequence.
|
sequence.
|
||||||
frame_padding (int): Frame padding.
|
frame_padding (int): Frame padding.
|
||||||
frame_regex (str): Frame regex - regular expression to match
|
frame_regex (str): Frame regex - regular expression to match
|
||||||
frame numbers. Must include 'frame' named group.
|
frame numbers. Must include 'index' named group and 'padding'
|
||||||
|
named group.
|
||||||
frame_spec (str): Frame list specification of frames. This takes
|
frame_spec (str): Frame list specification of frames. This takes
|
||||||
string like "1-10,20-30,40-50" etc.
|
string like "1-10,20-30,40-50" etc.
|
||||||
|
|
||||||
|
|
@ -136,8 +137,8 @@ class Sequence(TraitBase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate_frame_regex(cls, v: Optional[str]) -> str:
|
def validate_frame_regex(cls, v: Optional[str]) -> str:
|
||||||
"""Validate frame regex."""
|
"""Validate frame regex."""
|
||||||
if v is not None and "?P<frame>" not in v:
|
if v and any(s not in v for s in ["?P<index>", "?P<padding>"]):
|
||||||
msg = "Frame regex must include 'frame' named group"
|
msg = "Frame regex must include 'index' and `padding named groups"
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue