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
 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 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: dict,
             name: Optional[str] = None,
             namespace: Optional[str] = None,
             options: Optional[dict] = None) -> None:
        """Load the matchmove script."""
        path = Path(self.filepath_from_context(context))
        if path.suffix.lower() == ".py":
            runpy.run_path(path.as_posix(), run_name="__main__")

        elif path.suffix.lower() == ".mel":
            cmds.file(
                path.as_posix(), type="mel",
                renameAll=True, i=True, ignoreVersion=True,
                importTimeRange="override",
                options="v=0;", pr=True, loadReferenceDepth="all")
        else:
            self.log.error("Unsupported script type %s", path.suffix)

load(context, name=None, namespace=None, options=None)

Load the matchmove script.

Source code in client/ayon_maya/plugins/load/load_matchmove.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def load(self,
         context: dict,
         name: Optional[str] = None,
         namespace: Optional[str] = None,
         options: Optional[dict] = None) -> None:
    """Load the matchmove script."""
    path = Path(self.filepath_from_context(context))
    if path.suffix.lower() == ".py":
        runpy.run_path(path.as_posix(), run_name="__main__")

    elif path.suffix.lower() == ".mel":
        cmds.file(
            path.as_posix(), type="mel",
            renameAll=True, i=True, ignoreVersion=True,
            importTimeRange="override",
            options="v=0;", pr=True, loadReferenceDepth="all")
    else:
        self.log.error("Unsupported script type %s", path.suffix)