Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/ayon_maya/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
is_workfile_locked,
is_workfile_lock_enabled
)

from ayon_maya import MAYA_ROOT_DIR
from ayon_maya.lib import create_workspace_mel

Expand Down
4 changes: 2 additions & 2 deletions client/ayon_maya/api/workfile_template_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ def read(self, node):
return data


def build_workfile_template(*args):
def build_workfile_template(*args, **kwargs):
builder = MayaTemplateBuilder(registered_host())
builder.build_template()
builder.build_template(*args, **kwargs)


def update_workfile_template(*args):
Expand Down
20 changes: 17 additions & 3 deletions client/ayon_maya/startup/userSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from ayon_core.settings import get_project_settings
from ayon_core.pipeline import install_host, get_current_project_name
from ayon_maya.api import MayaHost
from ayon_maya.api import MayaHost, workfile_template_builder
from ayon_core.pipeline.workfile.workfile_template_builder import (
TemplateProfileNotFound
)

from maya import cmds

Expand Down Expand Up @@ -39,8 +42,19 @@ def _explicit_load_plugins():
if bool(int(os.environ.get(key, "0"))):
def _log_and_open():
path = os.environ["AYON_LAST_WORKFILE"]
print("Opening \"{}\"".format(path))
cmds.file(path, open=True, force=True)
if os.path.exists(path):
print("Opening \"{}\"".format(path))
cmds.file(path, open=True, force=True)
else:
try:
workfile_template_builder.build_workfile_template(
workfile_creation_enabled=True)
except TemplateProfileNotFound:
print(
"No workfile template profile enabled for current context. "
"Skipping workfile creation."
)

cmds.evalDeferred(
_log_and_open,
lowestPriority=True
Expand Down
7 changes: 7 additions & 0 deletions server/settings/templated_workfile_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ class WorkfileBuildProfilesModel(BaseSettingsModel):
default_factory=list, title="Task names"
)
path: str = SettingsField("", title="Path to template")
keep_placeholder: bool = SettingsField(
False,
title="Keep placeholders")
create_first_version: bool = SettingsField(
True,
title="Create first version"
)


class TemplatedProfilesModel(BaseSettingsModel):
Expand Down