mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
code tweaks - big roy's comment
This commit is contained in:
parent
118b4c189f
commit
c2b35e2141
1 changed files with 9 additions and 2 deletions
|
|
@ -592,6 +592,10 @@ def version_up_current_workfile():
|
|||
"""Function to increment and save workfile
|
||||
"""
|
||||
host = registered_host()
|
||||
if not host.has_unsaved_changes():
|
||||
print("No unsaved changes, skipping file save..")
|
||||
return
|
||||
|
||||
project_name = get_current_project_name()
|
||||
folder_path = get_current_folder_path()
|
||||
task_name = get_current_task_name()
|
||||
|
|
@ -614,11 +618,14 @@ def version_up_current_workfile():
|
|||
|
||||
# Define saving file extension
|
||||
extensions = host.get_workfile_extensions()
|
||||
current_file = host.get_current_workfile()
|
||||
if current_file:
|
||||
extensions = [os.path.splitext(current_file)[-1]]
|
||||
|
||||
work_root = work_template["directory"].format_strict(data)
|
||||
file_template = work_template["file"].template
|
||||
last_workfile_path = get_last_workfile(
|
||||
work_root, file_template, data, extensions, True
|
||||
)
|
||||
current_workfile_path = version_up(last_workfile_path)
|
||||
host.save_workfile(current_workfile_path)
|
||||
new_workfile_path = version_up(last_workfile_path)
|
||||
host.save_workfile(new_workfile_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue