Skip to content

collect_review_frames

CollectReviewInfo

Bases: InstancePlugin

Collect data required for review instances.

ExtractReview plugin requires frame start/end, fps on instance data which are missing on instances from TrayPublishes.

Warning

This is temporary solution to "make it work". Contains removed changes from https://github.com/ynput/OpenPype/pull/4383 reduced only for review instances.

Source code in client/ayon_traypublisher/plugins/publish/collect_review_frames.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class CollectReviewInfo(pyblish.api.InstancePlugin):
    """Collect data required for review instances.

    ExtractReview plugin requires frame start/end, fps on instance data which
    are missing on instances from TrayPublishes.

    Warning:
        This is temporary solution to "make it work". Contains removed changes
            from https://github.com/ynput/OpenPype/pull/4383 reduced only for
            review instances.
    """

    label = "Collect Review Info"
    order = pyblish.api.CollectorOrder + 0.491
    families = ["review"]
    hosts = ["traypublisher"]

    def process(self, instance):

        entity = (
            instance.data.get("taskEntity")
            or instance.data.get("folderEntity")
        )
        if instance.data.get("frameStart") is not None or not entity:
            self.log.debug("Missing required data on instance")
            return

        context_attributes = entity["attrib"]
        # Store collected data for logging
        collected_data = {}
        for key in (
            "fps",
            "frameStart",
            "frameEnd",
            "handleStart",
            "handleEnd",
        ):
            if key in instance.data or key not in context_attributes:
                continue
            value = context_attributes[key]
            collected_data[key] = value
            instance.data[key] = value
        self.log.debug("Collected data: {}".format(str(collected_data)))