This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
TVPaint: Publish workfile. #1597
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bf3a13b
Create draft PR for #1548
iLLiCiTiT fafc840
use asset from context.data
iLLiCiTiT 801444e
create workfile instance by default
iLLiCiTiT 55cc40a
trigger add_workfile_instance on collect instances
iLLiCiTiT b629742
added validation or workfile metadata on workfile publishing
iLLiCiTiT 52b8118
renamed validators filename
iLLiCiTiT 1bf4a40
removed frame data from workfile instance
iLLiCiTiT 62e583c
Merge branch 'develop' into feature/1548-tvpaint-publish-workfile
iLLiCiTiT bdcb14b
fix bug in crops
iLLiCiTiT ad89a60
a better fix of crops
iLLiCiTiT fc2edb7
added action to plugin
iLLiCiTiT acd9fe8
moved workfile instance collecting to separated collector
iLLiCiTiT f168495
rename tvpaint workfile collector
mkolar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
49 changes: 49 additions & 0 deletions
49
openpype/hosts/tvpaint/plugins/publish/validate_workfile_metadata.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,49 @@ | ||
import pyblish.api | ||
from avalon.tvpaint import save_file | ||
|
||
|
||
class ValidateWorkfileMetadataRepair(pyblish.api.Action): | ||
"""Store current context into workfile metadata.""" | ||
|
||
label = "Use current context" | ||
icon = "wrench" | ||
on = "failed" | ||
|
||
def process(self, context, _plugin): | ||
"""Save current workfile which should trigger storing of metadata.""" | ||
current_file = context.data["currentFile"] | ||
# Save file should trigger | ||
save_file(current_file) | ||
|
||
|
||
class ValidateWorkfileMetadata(pyblish.api.ContextPlugin): | ||
"""Validate if wokrfile contain required metadata for publising.""" | ||
|
||
label = "Validate Workfile Metadata" | ||
order = pyblish.api.ValidatorOrder | ||
|
||
families = ["workfile"] | ||
|
||
actions = [ValidateWorkfileMetadataRepair] | ||
|
||
required_keys = {"project", "asset", "task"} | ||
|
||
def process(self, context): | ||
workfile_context = context.data["workfile_context"] | ||
if not workfile_context: | ||
raise AssertionError( | ||
"Current workfile is missing whole metadata about context." | ||
) | ||
|
||
missing_keys = [] | ||
for key in self.required_keys: | ||
value = workfile_context.get(key) | ||
if not value: | ||
missing_keys.append(key) | ||
|
||
if missing_keys: | ||
raise AssertionError( | ||
"Current workfile is missing metadata about {}.".format( | ||
", ".join(missing_keys) | ||
) | ||
) |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'os' imported but unused