Skip to content

collect_plates

CollectPlate

Bases: InstancePlugin

Collect new plates.

Source code in client/ayon_resolve/plugins/publish/collect_plates.py
 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
class CollectPlate(pyblish.api.InstancePlugin):
    """Collect new plates."""

    order = pyblish.api.CollectorOrder - 0.48
    label = "Collect Plate"
    hosts = ["resolve"]
    families = ["plate"]

    def process(self, instance):
        """
        Args:
            instance (pyblish.Instance): The shot instance to update.
        """
        instance.data["families"].append("clip")

        otio_timeline = instance.context.data["otioTimeline"]
        otio_clip, marker = utils.get_marker_from_clip_index(
            otio_timeline, instance.data["clip_index"]
        )
        if not otio_clip:
            raise PublishError(
                "Could not retrieve otioClip for plate"
                f' {dict(instance.data)}'
            )

        instance.data["otioClip"] = otio_clip

        # solve reviewable options
        review_switch = instance.data["creator_attributes"].get(
            "review")
        reviewable_source = instance.data["creator_attributes"].get(
            "reviewableSource")

        if review_switch is True:
            if reviewable_source == "clip_media":
                instance.data["families"].append("review")
                instance.data.pop("reviewTrack", None)
            else:
                instance.data["reviewTrack"] = reviewable_source

        # remove creator-specific review keys from instance data
        instance.data.pop("reviewableSource", None)
        instance.data.pop("review", None)

        # Retrieve instance data from parent instance shot instance.
        parent_instance_id = instance.data["parent_instance_id"]

        try:
            edit_shared_data = instance.context.data["editorialSharedData"]
            instance.data.update(
                edit_shared_data[parent_instance_id]
            )

        # Ensure shot instance related to the audio instance exists.
        except KeyError:
            raise PublishError(
                f'Could not find shot instance for {instance.data["label"]}.'
                " Please ensure it is set and enabled."
            )

process(instance)

Parameters:

Name Type Description Default
instance Instance

The shot instance to update.

required
Source code in client/ayon_resolve/plugins/publish/collect_plates.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def process(self, instance):
    """
    Args:
        instance (pyblish.Instance): The shot instance to update.
    """
    instance.data["families"].append("clip")

    otio_timeline = instance.context.data["otioTimeline"]
    otio_clip, marker = utils.get_marker_from_clip_index(
        otio_timeline, instance.data["clip_index"]
    )
    if not otio_clip:
        raise PublishError(
            "Could not retrieve otioClip for plate"
            f' {dict(instance.data)}'
        )

    instance.data["otioClip"] = otio_clip

    # solve reviewable options
    review_switch = instance.data["creator_attributes"].get(
        "review")
    reviewable_source = instance.data["creator_attributes"].get(
        "reviewableSource")

    if review_switch is True:
        if reviewable_source == "clip_media":
            instance.data["families"].append("review")
            instance.data.pop("reviewTrack", None)
        else:
            instance.data["reviewTrack"] = reviewable_source

    # remove creator-specific review keys from instance data
    instance.data.pop("reviewableSource", None)
    instance.data.pop("review", None)

    # Retrieve instance data from parent instance shot instance.
    parent_instance_id = instance.data["parent_instance_id"]

    try:
        edit_shared_data = instance.context.data["editorialSharedData"]
        instance.data.update(
            edit_shared_data[parent_instance_id]
        )

    # Ensure shot instance related to the audio instance exists.
    except KeyError:
        raise PublishError(
            f'Could not find shot instance for {instance.data["label"]}.'
            " Please ensure it is set and enabled."
        )