global, nuke: adding support for first workfile creation

This commit is contained in:
Jakub Jezek 2023-03-06 16:55:05 +01:00
parent 0993fa447d
commit b2eb14914b
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
5 changed files with 39 additions and 21 deletions

View file

@ -2682,11 +2682,12 @@ def start_workfile_template_builder():
build_workfile_template
)
# to avoid looping of the callback, remove it!
# nuke.removeOnCreate(start_workfile_template_builder, nodeClass="Root")
log.info("Starting workfile template builder...")
build_workfile_template(run_from_callback=True)
# to avoid looping of the callback, remove it!
log.info("Starting workfile template builder...")
build_workfile_template(workfile_creation_enabled=True)
nuke.removeOnCreate(start_workfile_template_builder, nodeClass="Root")
@deprecated
def recreate_instance(origin_node, avalon_data=None):

View file

@ -155,8 +155,8 @@ def add_nuke_callbacks():
# Set context settings.
nuke.addOnCreate(
workfile_settings.set_context_settings, nodeClass="Root")
nuke.addOnCreate(start_workfile_template_builder, nodeClass="Root")
nuke.addOnCreate(workfile_settings.set_favorites, nodeClass="Root")
nuke.addOnCreate(start_workfile_template_builder, nodeClass="Root")
nuke.addOnCreate(process_workfile_builder, nodeClass="Root")
# fix ffmpeg settings on script

View file

@ -56,7 +56,6 @@ class NukeTemplateBuilder(AbstractTemplateBuilder):
return True
class NukePlaceholderPlugin(PlaceholderPlugin):
node_color = 4278190335

View file

@ -13,7 +13,7 @@ def has_unsaved_changes():
def save_file(filepath):
path = filepath.replace("\\", "/")
nuke.scriptSaveAs(path)
nuke.scriptSaveAs(path, overwrite=1)
nuke.Root()["name"].setValue(path)
nuke.Root()["project_directory"].setValue(os.path.dirname(path))
nuke.Root().setModified(False)