nuke: start new workfile from tempate wip

This commit is contained in:
Jakub Jezek 2023-02-28 14:22:38 +01:00
parent 8a6efcd6ef
commit 2ed1a97864
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
4 changed files with 39 additions and 17 deletions

View file

@ -48,7 +48,6 @@ from openpype.pipeline.colorspace import (
get_imageio_config
)
from openpype.pipeline.workfile import BuildWorkfile
from . import gizmo_menu
from .constants import ASSIST
@ -2678,6 +2677,17 @@ def process_workfile_builder():
open_file(last_workfile_path)
def start_workfile_template_builder():
from .workfile_template_builder import (
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()
@deprecated
def recreate_instance(origin_node, avalon_data=None):
"""Recreate input instance to different data

View file

@ -33,6 +33,7 @@ from .lib import (
add_publish_knob,
WorkfileSettings,
process_workfile_builder,
start_workfile_template_builder,
launch_workfiles_app,
check_inventory_versions,
set_avalon_knob_data,
@ -48,7 +49,6 @@ from .workfile_template_builder import (
NukePlaceholderLoadPlugin,
NukePlaceholderCreatePlugin,
build_workfile_template,
update_workfile_template,
create_placeholder,
update_placeholder,
)
@ -155,6 +155,7 @@ 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(process_workfile_builder, nodeClass="Root")

View file

@ -15,7 +15,7 @@ from openpype.pipeline.workfile.workfile_template_builder import (
from openpype.tools.workfile_template_build import (
WorkfileBuildPlaceholderDialog,
)
from openpype.host import IWorkfileHost
from .lib import (
find_free_space_to_paste_nodes,
get_extreme_positions,
@ -56,6 +56,24 @@ class NukeTemplateBuilder(AbstractTemplateBuilder):
return True
def create_first_workfile_version(self):
"""
Create first version of workfile.
Should load the content of template into scene so
'populate_scene_placeholders' can be started.
Args:
template_path (str): Fullpath for current task and
host's template file.
"""
last_workfile_path = os.environ.get("AVALON_LAST_WORKFILE")
# Save current scene, continue to open file
if isinstance(self.host, IWorkfileHost):
self.host.save_workfile(last_workfile_path)
else:
self.host.save_file(last_workfile_path)
class NukePlaceholderPlugin(PlaceholderPlugin):
node_color = 4278190335