-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic thumbnail generation on publishing review #189
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,5 @@ | ||||||||||||||||||||||||||||||||
import tempfile | ||||||||||||||||||||||||||||||||
import os | ||||||||||||||||||||||||||||||||
import pyblish.api | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
from ayon_core.pipeline import OptionalPyblishPluginMixin | ||||||||||||||||||||||||||||||||
|
@@ -17,7 +18,8 @@ class ExtractActiveViewThumbnail(plugin.HoudiniExtractorPlugin, | |||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||
order = pyblish.api.ExtractorOrder + 0.49 | ||||||||||||||||||||||||||||||||
label = "Extract Active View Thumbnail" | ||||||||||||||||||||||||||||||||
families = ["workfile"] | ||||||||||||||||||||||||||||||||
families = ["workfile", | ||||||||||||||||||||||||||||||||
"review"] | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
def process(self, instance): | ||||||||||||||||||||||||||||||||
if not self.is_active(instance.data): | ||||||||||||||||||||||||||||||||
|
@@ -42,6 +44,21 @@ def process(self, instance): | |||||||||||||||||||||||||||||||
.format(view_thumbnail) | ||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||
instance.data["thumbnailPath"] = view_thumbnail | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
instance.data.setdefault("representations", []) | ||||||||||||||||||||||||||||||||
representation = { | ||||||||||||||||||||||||||||||||
"name": "thumbnail", | ||||||||||||||||||||||||||||||||
"ext": "jpg", | ||||||||||||||||||||||||||||||||
"files": os.path.basename(view_thumbnail), | ||||||||||||||||||||||||||||||||
"stagingDir": os.path.dirname(view_thumbnail), | ||||||||||||||||||||||||||||||||
"thumbnail": True | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
# Adding representation to instance | ||||||||||||||||||||||||||||||||
instance.data["representations"].append(representation) | ||||||||||||||||||||||||||||||||
self.log.debug( | ||||||||||||||||||||||||||||||||
"Adding thumbnail representation: {}".format(representation) | ||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||
Comment on lines
+47
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
you shouldn't add representation for the thumbnail as there are dedicated plugins for creating the representation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great! I didn’t know there were more general plugins in the core addon. That would’ve saved me some time figuring out how to add the thumbnail (even though it’s pretty easy, haha). So, creating a PR in the ayon-core repo to implement the 'review' family and 'houdini' as host is the right approach, correct?"
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes! |
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
def get_view_thumbnail(self, instance): | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
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.
My feeling, this is more of a "workaround" than a "proper solution".
Additionally, a snapshot from the sceneview may not look the same as the first frame of the review.
This is not for review only but also render and image sequence products.
What about using the first frame as the thumbnail? (we'll need to convert it to
png
orjpg
).My feeling, it can be a core feature for all DCCs. It's actually a core feature...
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.
Using the first frame as the thumbnail could also work. The input from our artists was that it would be great to be able to choose a specific frame. But you are right. In the end that will not look like the real render by using the screenshot of the viewport. So perhaps adding a option in the publisher to be able to select which frame should be used as thumbnail (not only the middle frame of the sequence) could be an option?
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.
feel free to create an issue for it on ayon-core.