-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4477 from ynput/enhancement/unreal-render_creator…
…_improvements
- Loading branch information
Showing
3 changed files
with
228 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
openpype/hosts/unreal/plugins/publish/validate_sequence_frames.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import clique | ||
|
||
import pyblish.api | ||
|
||
|
||
class ValidateSequenceFrames(pyblish.api.InstancePlugin): | ||
"""Ensure the sequence of frames is complete | ||
The files found in the folder are checked against the frameStart and | ||
frameEnd of the instance. If the first or last file is not | ||
corresponding with the first or last frame it is flagged as invalid. | ||
""" | ||
|
||
order = pyblish.api.ValidatorOrder | ||
label = "Validate Sequence Frames" | ||
families = ["render"] | ||
hosts = ["unreal"] | ||
optional = True | ||
|
||
def process(self, instance): | ||
representations = instance.data.get("representations") | ||
for repr in representations: | ||
data = instance.data.get("assetEntity", {}).get("data", {}) | ||
patterns = [clique.PATTERNS["frames"]] | ||
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" | ||
collection = collections[0] | ||
frames = list(collection.indexes) | ||
|
||
current_range = (frames[0], frames[-1]) | ||
required_range = (data["frameStart"], | ||
data["frameEnd"]) | ||
|
||
if current_range != required_range: | ||
raise ValueError(f"Invalid frame range: {current_range} - " | ||
f"expected: {required_range}") | ||
|
||
missing = collection.holes().indexes | ||
assert not missing, "Missing frames: %s" % (missing,) |