Skip to content

load_as_template

LoadAsTemplate

Bases: Loader

Load workfile as a template

Source code in client/ayon_maya/plugins/load/load_as_template.py
 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
class LoadAsTemplate(plugin.Loader):
    """Load workfile as a template """

    product_types = {"workfile", "mayaScene"}
    label = "Load as template"
    representations = ["ma", "mb"]
    icon = "wrench"
    color = "#775555"
    order = 10

    options = [
        BoolDef("keep_placeholders",
                label="Keep Placeholders",
                default=False),
        BoolDef("create_first_version",
                label="Create First Version",
                default=False),
    ]

    def load(self, context, name, namespace, data):
        keep_placeholders = data.get("keep_placeholders", False)
        create_first_version = data.get("create_first_version", False)
        path = self.filepath_from_context(context)
        builder = MayaTemplateBuilder(registered_host())
        builder.build_template(template_path=path,
                               keep_placeholders=keep_placeholders,
                               create_first_version=create_first_version)