mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 14:22:37 +01:00
update render version synchronize
This commit is contained in:
parent
a1b58e2a63
commit
f445864e01
7 changed files with 64 additions and 12 deletions
|
|
@ -36,7 +36,8 @@ def writes_version_sync():
|
|||
for each in nuke.allNodes():
|
||||
if each.Class() == 'Write':
|
||||
avalon_knob_data = get_avalon_knob_data(each)
|
||||
if not avalon_knob_data:
|
||||
if avalon_knob_data['families'] not in ["render"]:
|
||||
log.info(avalon_knob_data['families'])
|
||||
continue
|
||||
try:
|
||||
node_file = each['file'].value()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
|
|||
|
||||
order = pyblish.api.IntegratorOrder + 0.48
|
||||
label = 'Integrate Ftrack Component'
|
||||
families = ["render.frames", "still.frames"]
|
||||
|
||||
family_mapping = {'camera': 'cam',
|
||||
'look': 'look',
|
||||
|
|
@ -27,7 +26,12 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
|
|||
'render': 'render'
|
||||
}
|
||||
|
||||
exclude = ["prerender.frames"]
|
||||
|
||||
def process(self, instance):
|
||||
for ex in self.exclude:
|
||||
if ex in instance.data['families']:
|
||||
return
|
||||
|
||||
self.log.debug('instance {}'.format(instance))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
|
||||
import tempfile
|
||||
import nuke
|
||||
import pyblish.api
|
||||
import logging
|
||||
|
|
@ -47,6 +47,8 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
path = nuke.filename(node)
|
||||
output_dir = os.path.dirname(path)
|
||||
self.log.debug('output dir: {}'.format(output_dir))
|
||||
|
||||
instance.data.update({"stagingDir": output_dir})
|
||||
# Include start and end render frame in label
|
||||
name = node.name()
|
||||
|
||||
|
|
@ -60,7 +62,8 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
if not node["render"].value():
|
||||
try:
|
||||
families = [
|
||||
"{}.frames".format(instance.data["avalonKnob"]["families"]),
|
||||
"{}.frames".format(
|
||||
instance.data["avalonKnob"]["families"]),
|
||||
'ftrack'
|
||||
]
|
||||
collected_frames = os.listdir(output_dir)
|
||||
|
|
@ -71,7 +74,8 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
instance.data['transfer'] = False
|
||||
except Exception:
|
||||
node["render"].setValue(True)
|
||||
raise self.log.warning("needs to refresh the publishing")
|
||||
raise AttributeError(
|
||||
"Files in `{}`. Needs to refresh the publishing".format(output_dir))
|
||||
else:
|
||||
# dealing with local/farm rendering
|
||||
if node["render_farm"].value():
|
||||
|
|
@ -81,6 +85,8 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
families = [
|
||||
"{}.local".format(instance.data["avalonKnob"]["families"])
|
||||
]
|
||||
# adding for local renderings
|
||||
instance.data.update({"stagingDir": tempfile.mkdtemp().replace("\\", "/")})
|
||||
|
||||
self.log.debug("checking for error: {}".format(label))
|
||||
instance.data.update({
|
||||
|
|
@ -92,7 +98,6 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
"startFrame": first_frame,
|
||||
"endFrame": last_frame,
|
||||
"outputType": output_type,
|
||||
"stagingDir": output_dir,
|
||||
"colorspace": node["colorspace"].value(),
|
||||
"handles": int(asset_data["data"].get("handles", 0)),
|
||||
"step": 1,
|
||||
|
|
|
|||
|
|
@ -3,16 +3,18 @@ import nuke
|
|||
import pyblish.api
|
||||
|
||||
|
||||
class IncrementScriptVersion(pyblish.api.Extractor):
|
||||
class IncrementScriptVersion(pyblish.api.InstancePlugin):
|
||||
"""Increment current script version."""
|
||||
|
||||
order = pyblish.api.Extractor.order - 0.35
|
||||
order = pyblish.api.IntegratorOrder + 9
|
||||
label = "Increment Current Script Version"
|
||||
optional = True
|
||||
hosts = ['nuke']
|
||||
families = ["render.frames"]
|
||||
|
||||
def process(self, context):
|
||||
def process(self, instance):
|
||||
from pype.lib import version_up
|
||||
context = instance.context
|
||||
path = context.data["currentFile"]
|
||||
nuke.scriptSaveAs(version_up(path))
|
||||
self.log.info('Incrementing script version')
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
|
||||
assumed_data = instance.data["assumedTemplateData"]
|
||||
assumed_version = assumed_data["version"]
|
||||
|
||||
if assumed_version != next_version:
|
||||
raise AttributeError("Assumed version 'v{0:03d}' does not match"
|
||||
"next version in database "
|
||||
|
|
@ -237,8 +238,6 @@ class IntegrateFrames(pyblish.api.InstancePlugin):
|
|||
}
|
||||
destination_list.append(dst)
|
||||
instance.data['destination_list'] = destination_list
|
||||
self.log.warning("instance: {}".format(instance))
|
||||
instance[0]["render"].setValue(False)
|
||||
representations.append(representation)
|
||||
|
||||
self.log.info("Registering {} items".format(len(representations)))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import pyblish.api
|
||||
import nuke
|
||||
import shutil
|
||||
import os
|
||||
|
||||
|
||||
class NukeRenderLocal(pyblish.api.InstancePlugin):
|
||||
|
|
@ -17,7 +19,7 @@ class NukeRenderLocal(pyblish.api.InstancePlugin):
|
|||
families = ["render.local", "prerender.local", "still.local"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
node = instance[0]
|
||||
# This should be a ContextPlugin, but this is a workaround
|
||||
# for a bug in pyblish to run once for a family: issue #250
|
||||
context = instance.context
|
||||
|
|
@ -33,6 +35,12 @@ class NukeRenderLocal(pyblish.api.InstancePlugin):
|
|||
last_frame = instance.data.get("endFrame", None)
|
||||
node_subset_name = instance.data.get("name", None)
|
||||
|
||||
# swap path to stageDir
|
||||
temp_dir = instance.data.get("stagingDir")
|
||||
output_dir = instance.data.get("outputDir")
|
||||
path = node['file'].value()
|
||||
node['file'].setValue(path.replace(output_dir, temp_dir))
|
||||
|
||||
self.log.info("Starting render")
|
||||
self.log.info("Start frame: {}".format(first_frame))
|
||||
self.log.info("End frame: {}".format(last_frame))
|
||||
|
|
@ -43,6 +51,22 @@ class NukeRenderLocal(pyblish.api.InstancePlugin):
|
|||
int(first_frame),
|
||||
int(last_frame)
|
||||
)
|
||||
|
||||
# copy data to correct dir
|
||||
if not os.path.exists(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
self.log.info("output dir has been created")
|
||||
|
||||
for f in os.listdir(temp_dir):
|
||||
self.log.info(f)
|
||||
shutil.copy(os.path.join(temp_dir, os.path.basename(f)),
|
||||
os.path.join(output_dir, os.path.basename(f)))
|
||||
|
||||
# swap path back to publish path
|
||||
path = node['file'].value()
|
||||
node['file'].setValue(path.replace(temp_dir, output_dir))
|
||||
|
||||
# swith to prerendered.frames
|
||||
instance[0]["render"].setValue(False)
|
||||
|
||||
self.log.info('Finished render')
|
||||
|
|
|
|||
17
pype/plugins/nuke/publish/write_next_render.py
Normal file
17
pype/plugins/nuke/publish/write_next_render.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import pyblish.api
|
||||
|
||||
|
||||
class WriteToRender(pyblish.api.InstancePlugin):
|
||||
"""Swith Render knob on write instance to on,
|
||||
so next time publish will be set to render
|
||||
"""
|
||||
|
||||
order = pyblish.api.IntegratorOrder + 11
|
||||
label = "Write to render next"
|
||||
optional = True
|
||||
hosts = ["nuke", "nukeassist"]
|
||||
families = ["render.frames", "still.frames", "prerender.frames"]
|
||||
|
||||
def process(self, instance):
|
||||
instance[0]["render"].setValue(True)
|
||||
self.log.info("Swith write node render to `on`")
|
||||
Loading…
Add table
Add a link
Reference in a new issue