Skip to content

load_matchmove

MatchmoveLoader

Bases: Loader

This will run matchmove script to create track in scene.

Supported script types are .py and .mel

Source code in client/ayon_maya/plugins/load/load_matchmove.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 MatchmoveLoader(plugin.Loader):
    """
    This will run matchmove script to create track in scene.

    Supported script types are .py and .mel
    """

    product_types = {"matchmove"}
    representations = {"py", "mel"}
    defaults = ["Camera", "Object", "Mocap"]

    label = "Run matchmove script"
    icon = "empire"
    color = "orange"

    def load(self, context, name, namespace, data):
        path = self.filepath_from_context(context)
        if path.lower().endswith(".py"):
            runpy.run_path(path, run_name="__main__")

        elif path.lower().endswith(".mel"):
            mel.eval('source "{}"'.format(path))

        else:
            self.log.error("Unsupported script type")

        return True