mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
add version up workfile in the general ayon core function
This commit is contained in:
parent
c4942d3ab8
commit
a696470fa2
6 changed files with 30 additions and 27 deletions
|
|
@ -6,10 +6,8 @@ from ayon_api import get_project, get_folder_by_path
|
|||
|
||||
from ayon_core.pipeline import (
|
||||
get_current_project_name,
|
||||
get_current_folder_path,
|
||||
registered_host
|
||||
get_current_folder_path
|
||||
)
|
||||
from ayon_core.lib import version_up
|
||||
|
||||
|
||||
class ToolWindows:
|
||||
|
|
@ -121,14 +119,3 @@ def reset_resolution():
|
|||
|
||||
cmds.setAttr(width_attr_name, resolution_width)
|
||||
cmds.setAttr(height_attr_name, resolution_height)
|
||||
|
||||
|
||||
def version_up_workfile():
|
||||
"""Function to increment and save workfile
|
||||
"""
|
||||
host = registered_host()
|
||||
current_file = host.get_current_workfile()
|
||||
if not current_file:
|
||||
return None
|
||||
filepath = version_up(current_file)
|
||||
host.save_workfile(filepath)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from .workfile_template_builder import (
|
|||
build_workfile_template,
|
||||
update_workfile_template
|
||||
)
|
||||
from ayon_core.pipeline.context_tools import version_up_workfile
|
||||
from ayon_core.tools.workfile_template_build import open_template_ui
|
||||
from .workfile_template_builder import MayaTemplateBuilder
|
||||
|
||||
|
|
@ -76,6 +77,14 @@ def install(project_settings):
|
|||
|
||||
cmds.menuItem(divider=True)
|
||||
|
||||
if project_settings["core"].get("version_up_workfile"):
|
||||
cmds.menuItem(
|
||||
"Version Up Workfile",
|
||||
command=lambda *args: version_up_workfile()
|
||||
)
|
||||
|
||||
cmds.menuItem(divider=True)
|
||||
|
||||
cmds.menuItem(
|
||||
"Create...",
|
||||
command=lambda *args: host_tools.show_publisher(
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from pyblish.lib import MessageHandler
|
|||
|
||||
from ayon_core import AYON_CORE_ROOT
|
||||
from ayon_core.host import HostBase
|
||||
from ayon_core.lib import is_in_tests, initialize_ayon_connection, emit_event
|
||||
from ayon_core.lib import is_in_tests, initialize_ayon_connection, emit_event, version_up
|
||||
from ayon_core.addon import load_addons, AddonsManager
|
||||
from ayon_core.settings import get_project_settings
|
||||
|
||||
|
|
@ -579,3 +579,14 @@ def get_process_id():
|
|||
if _process_id is None:
|
||||
_process_id = str(uuid.uuid4())
|
||||
return _process_id
|
||||
|
||||
|
||||
def version_up_workfile():
|
||||
"""Function to increment and save workfile
|
||||
"""
|
||||
host = registered_host()
|
||||
current_file = host.get_current_workfile()
|
||||
if not current_file:
|
||||
return None
|
||||
filepath = version_up(current_file)
|
||||
host.save_workfile(filepath)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
name = "core"
|
||||
title = "Core"
|
||||
version = "0.3.3-dev.1"
|
||||
version = "0.3.3-dev.2"
|
||||
|
||||
client_dir = "ayon_core"
|
||||
|
||||
|
|
|
|||
|
|
@ -219,6 +219,11 @@ class CoreSettings(BaseSettingsModel):
|
|||
title="Project environments",
|
||||
section="---"
|
||||
)
|
||||
version_up_workfile: bool = SettingsField(
|
||||
False,
|
||||
title="Version Up Workfile",
|
||||
section="---"
|
||||
)
|
||||
|
||||
@validator(
|
||||
"environments",
|
||||
|
|
@ -313,5 +318,6 @@ DEFAULT_VALUES = {
|
|||
"project_environments": json.dumps(
|
||||
{},
|
||||
indent=4
|
||||
)
|
||||
),
|
||||
"version_up_workfile": False
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,16 +83,6 @@ DEFAULT_SCRIPTSMENU_SETTINGS = {
|
|||
"pipeline",
|
||||
"shader"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "action",
|
||||
"command": "import openpype.hosts.maya.api.commands as op_cmds; op_cmds.version_up_workfile()",
|
||||
"sourcetype": "python",
|
||||
"title": "Version Up",
|
||||
"tooltip": "Save workfile with upversioning",
|
||||
"tags": [
|
||||
"pipeline"
|
||||
]
|
||||
}
|
||||
],
|
||||
"definition_json": "[]"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue