Skip to content

collect_instance_frames

CollectOutputFrameRange

Bases: InstancePlugin

Collect frame start/end from context.

When instances are collected context does not contain frameStart and frameEnd keys yet. They are collected in global plugin CollectContextEntities.

Source code in client/ayon_tvpaint/plugins/publish/collect_instance_frames.py
 4
 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
class CollectOutputFrameRange(pyblish.api.InstancePlugin):
    """Collect frame start/end from context.

    When instances are collected context does not contain `frameStart` and
    `frameEnd` keys yet. They are collected in global plugin
    `CollectContextEntities`.
    """

    label = "Collect output frame range"
    order = pyblish.api.CollectorOrder + 0.4999
    hosts = ["tvpaint"]
    families = ["review", "render"]

    settings_category = "tvpaint"

    def process(self, instance):
        entity = instance.data.get("taskEntity")
        if not entity:
            # Task may be optional for an instance
            entity = instance.data.get("folderEntity")
        if not entity:
            return

        context = instance.context

        frame_start = entity["attrib"]["frameStart"]
        fps = entity["attrib"]["fps"]
        frame_end = frame_start + (
            context.data["sceneMarkOut"] - context.data["sceneMarkIn"]
        )
        instance.data["fps"] = fps
        instance.data["frameStart"] = frame_start
        instance.data["frameEnd"] = frame_end
        self.log.info(
            "Set frames {}-{} on instance {} ".format(
                frame_start, frame_end, instance.data["productName"]
            )
        )