-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #330 from BigRoy/enhancement/maya_load_published_w…
…orkfile_as_template Maya: Load published workfile as template
- Loading branch information
Showing
3 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
client/ayon_core/hosts/maya/plugins/load/load_as_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from ayon_core.lib import ( | ||
BoolDef | ||
) | ||
from ayon_core.pipeline import ( | ||
load, | ||
registered_host | ||
) | ||
from ayon_core.hosts.maya.api.workfile_template_builder import ( | ||
MayaTemplateBuilder | ||
) | ||
|
||
|
||
class LoadAsTemplate(load.LoaderPlugin): | ||
"""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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters