Skip to content

load_clip_batch

LoadClipBatch

Bases: ClipLoader

Load a product to timeline as clip

Place clip to timeline on its asset origin timings collected during conforming to project

Source code in client/ayon_flame/plugins/load/load_clip_batch.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
67
68
69
70
71
72
73
74
75
class LoadClipBatch(ayfapi.ClipLoader):
    """Load a product to timeline as clip

    Place clip to timeline on its asset origin timings collected
    during conforming to project
    """

    product_base_types = {
        "render2d", "source", "plate", "render", "review"
    }
    representations = {"*"}
    extensions = set(
        ext.lstrip(".") for ext in IMAGE_EXTENSIONS.union(VIDEO_EXTENSIONS)
    )

    label = "Load as clip to current batch"
    order = -10
    icon = "code-fork"
    color = "orange"

    # settings
    reel_name = "AYON_LoadedReel"
    clip_name_template = "{batch}_{folder[name]}_{product[name]}<_{output}>"

    """ Anatomy keys from version context data and dynamically added:
        - {layerName} - original layer name token
        - {layerUID} - original layer UID token
        - {originalBasename} - original clip name taken from file
    """
    layer_rename_template = "{folder[name]}_{product[name]}<_{output}>"
    layer_rename_patterns = []

    @property
    def product_types(self):
        return self.product_base_types

    def _get_formatting_data(self, context, options):
        formatting_data = super()._get_formatting_data(context, options)
        self.batch = options.get("batch") or flame.batch
        folder_entity = context["folder"]
        product_entity = context["product"]
        formatting_data["batch"] = self.batch.name.get_value()
        formatting_data.update({
            "asset": folder_entity["name"],
            "folder": {
                "name": folder_entity["name"],
            },
            "subset": product_entity["name"],
            "family": product_entity["productType"],
            "product": {
                "name": product_entity["name"],
                "type": product_entity["productType"],
                "basetype": product_entity["productBaseType"],
            }
        })
        return formatting_data

    def _get_reel(self):
        matching_reel = [
            rg for rg in self.batch.reels
            if rg.name.get_value() == self.reel_name
        ]

        return (
            matching_reel.pop()
            if matching_reel
            else self.batch.create_reel(str(self.reel_name))
        )

clip_name_template = '{batch}_{folder[name]}_{product[name]}<_{output}>' class-attribute instance-attribute

Anatomy keys from version context data and dynamically added: - {layerName} - original layer name token - {layerUID} - original layer UID token - {originalBasename} - original clip name taken from file