Skip to content
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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand All @@ -17,7 +18,8 @@ class ExtractActiveViewThumbnail(plugin.HoudiniExtractorPlugin,
"""
order = pyblish.api.ExtractorOrder + 0.49
label = "Extract Active View Thumbnail"
families = ["workfile"]
families = ["workfile",
"review"]
Copy link
Contributor

@MustafaJafar MustafaJafar Dec 12, 2024

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 or jpg).
My feeling, it can be a core feature for all DCCs. It's actually a core feature...

Copy link
Author

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?

Copy link
Contributor

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.


def process(self, instance):
if not self.is_active(instance.data):
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
)

you shouldn't add representation for the thumbnail as there are dedicated plugins for creating the representation.

Copy link
Author

Choose a reason for hiding this comment

The 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?"

class ExtractThumbnail(pyblish.api.InstancePlugin):
    """Create jpg thumbnail from sequence using ffmpeg"""

    label = "Extract Thumbnail"
    order = pyblish.api.ExtractorOrder + 0.49
    families = [
        "imagesequence", "render", "render2d", "prerender",
        "source", "clip", "take", "online", "image", "review"
    ]
    hosts = [
        "shell",
        "fusion",
        "resolve",
        "traypublisher",
        "substancepainter",
        "nuke",
        "aftereffects",
        "unreal",
        "houdini",
    ]
    enabled = False

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!
Houdini host is missing as you have pointed out.


def get_view_thumbnail(self, instance):

Expand Down
Loading