mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
Merged in bugfix/PYPE-418-handles-validation-not-working (pull request #201)
Bugfix/PYPE-418 handles validation not working Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
commit
305771ae2b
6 changed files with 136 additions and 36 deletions
|
|
@ -17,14 +17,6 @@ log = Logger().get_logger(__name__, "nuke")
|
|||
self = sys.modules[__name__]
|
||||
self._project = None
|
||||
|
||||
|
||||
for path in sys.path:
|
||||
log.info(os.path.normpath(path))
|
||||
if "C:\\Users\\Public" in os.path.normpath(path):
|
||||
log.info("_ removing from sys.path: `{}`".format(path))
|
||||
sys.path.remove(path)
|
||||
|
||||
|
||||
def onScriptLoad():
|
||||
if nuke.env['LINUX']:
|
||||
nuke.tcl('load ffmpegReader')
|
||||
|
|
@ -350,8 +342,9 @@ def set_colorspace():
|
|||
def reset_frame_range_handles():
|
||||
"""Set frame range to current asset"""
|
||||
|
||||
root = nuke.root()
|
||||
fps = float(api.Session.get("AVALON_FPS", 25))
|
||||
nuke.root()["fps"].setValue(fps)
|
||||
root["fps"].setValue(fps)
|
||||
name = api.Session["AVALON_ASSET"]
|
||||
asset = io.find_one({"name": name, "type": "asset"})
|
||||
|
||||
|
|
@ -387,8 +380,8 @@ def reset_frame_range_handles():
|
|||
edit_in = int(asset["data"]["fstart"]) - handle_start
|
||||
edit_out = int(asset["data"]["fend"]) + handle_end
|
||||
|
||||
nuke.root()["first_frame"].setValue(edit_in)
|
||||
nuke.root()["last_frame"].setValue(edit_out)
|
||||
root["first_frame"].setValue(edit_in)
|
||||
root["last_frame"].setValue(edit_out)
|
||||
|
||||
# setting active viewers
|
||||
nuke.frame(int(asset["data"]["fstart"]))
|
||||
|
|
@ -408,6 +401,13 @@ def reset_frame_range_handles():
|
|||
vv['frame_range'].setValue(range)
|
||||
vv['frame_range_lock'].setValue(True)
|
||||
|
||||
# adding handle_start/end to root avalon knob
|
||||
if not avalon.nuke.set_avalon_knob_data(root, {
|
||||
"handle_start": handle_start,
|
||||
"handle_end": handle_end
|
||||
}):
|
||||
log.warning("Cannot set Avalon knob to Root node!")
|
||||
|
||||
|
||||
def get_avalon_knob_data(node):
|
||||
import toml
|
||||
|
|
@ -560,8 +560,8 @@ def get_hierarchical_attr(entity, attr, default=None):
|
|||
|
||||
parent_id = entity['parent']
|
||||
if (
|
||||
entity['type'].lower() == 'asset' and
|
||||
entity.get('data', {}).get('visualParent')
|
||||
entity['type'].lower() == 'asset'
|
||||
and entity.get('data', {}).get('visualParent')
|
||||
):
|
||||
parent_id = entity['data']['visualParent']
|
||||
|
||||
|
|
|
|||
92
pype/plugins/global/_publish_unused/extract_review.py
Normal file
92
pype/plugins/global/_publish_unused/extract_review.py
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# import os
|
||||
# import pyblish.api
|
||||
# import subprocess
|
||||
# from pype.vendor import clique
|
||||
# from pypeapp import config
|
||||
#
|
||||
#
|
||||
# class ExtractReview(pyblish.api.InstancePlugin):
|
||||
# """Resolve any dependency issies
|
||||
#
|
||||
# This plug-in resolves any paths which, if not updated might break
|
||||
# the published file.
|
||||
#
|
||||
# The order of families is important, when working with lookdev you want to
|
||||
# first publish the texture, update the texture paths in the nodes and then
|
||||
# publish the shading network. Same goes for file dependent assets.
|
||||
# """
|
||||
#
|
||||
# label = "Extract Review"
|
||||
# order = pyblish.api.ExtractorOrder
|
||||
# # families = ["imagesequence", "render", "write", "source"]
|
||||
# # hosts = ["shell"]
|
||||
#
|
||||
# def process(self, instance):
|
||||
# # adding plugin attributes from presets
|
||||
# publish_presets = config.get_presets()["plugins"]["global"]["publish"]
|
||||
# plugin_attrs = publish_presets[self.__class__.__name__]
|
||||
#
|
||||
#
|
||||
# fps = instance.data.get("fps")
|
||||
# start = instance.data.get("startFrame")
|
||||
# stagingdir = os.path.normpath(instance.data.get("stagingDir"))
|
||||
#
|
||||
# collected_frames = os.listdir(stagingdir)
|
||||
# collections, remainder = clique.assemble(collected_frames)
|
||||
#
|
||||
# full_input_path = os.path.join(
|
||||
# stagingdir, collections[0].format('{head}{padding}{tail}')
|
||||
# )
|
||||
# self.log.info("input {}".format(full_input_path))
|
||||
#
|
||||
# filename = collections[0].format('{head}')
|
||||
# if not filename.endswith('.'):
|
||||
# filename += "."
|
||||
# movFile = filename + "mov"
|
||||
# full_output_path = os.path.join(stagingdir, movFile)
|
||||
#
|
||||
# self.log.info("output {}".format(full_output_path))
|
||||
#
|
||||
# config_data = instance.context.data['output_repre_config']
|
||||
#
|
||||
# proj_name = os.environ.get('AVALON_PROJECT', '__default__')
|
||||
# profile = config_data.get(proj_name, config_data['__default__'])
|
||||
#
|
||||
# input_args = []
|
||||
# # overrides output file
|
||||
# input_args.append("-y")
|
||||
# # preset's input data
|
||||
# input_args.extend(profile.get('input', []))
|
||||
# # necessary input data
|
||||
# input_args.append("-start_number {}".format(start))
|
||||
# input_args.append("-i {}".format(full_input_path))
|
||||
# input_args.append("-framerate {}".format(fps))
|
||||
#
|
||||
# output_args = []
|
||||
# # preset's output data
|
||||
# output_args.extend(profile.get('output', []))
|
||||
# # output filename
|
||||
# output_args.append(full_output_path)
|
||||
# mov_args = [
|
||||
# "ffmpeg",
|
||||
# " ".join(input_args),
|
||||
# " ".join(output_args)
|
||||
# ]
|
||||
# subprocess_mov = " ".join(mov_args)
|
||||
# sub_proc = subprocess.Popen(subprocess_mov)
|
||||
# sub_proc.wait()
|
||||
#
|
||||
# if not os.path.isfile(full_output_path):
|
||||
# raise("Quicktime wasn't created succesfully")
|
||||
#
|
||||
# if "representations" not in instance.data:
|
||||
# instance.data["representations"] = []
|
||||
#
|
||||
# representation = {
|
||||
# 'name': 'mov',
|
||||
# 'ext': 'mov',
|
||||
# 'files': movFile,
|
||||
# "stagingDir": stagingdir,
|
||||
# "preview": True
|
||||
# }
|
||||
# instance.data["representations"].append(representation)
|
||||
|
|
@ -4,7 +4,6 @@ import logging
|
|||
import speedcopy
|
||||
import clique
|
||||
import traceback
|
||||
import sys
|
||||
import errno
|
||||
import pyblish.api
|
||||
from avalon import api, io
|
||||
|
|
@ -59,7 +58,6 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
"render",
|
||||
"imagesequence",
|
||||
"review",
|
||||
"nukescript",
|
||||
"render",
|
||||
"rendersetup",
|
||||
"rig",
|
||||
|
|
|
|||
|
|
@ -1,26 +1,28 @@
|
|||
from avalon import api, io
|
||||
import nuke
|
||||
import pyblish.api
|
||||
import os
|
||||
from avalon.nuke.lib import (
|
||||
add_publish_knob,
|
||||
add_avalon_tab_knob
|
||||
|
||||
from avalon.nuke import (
|
||||
get_avalon_knob_data,
|
||||
add_publish_knob
|
||||
)
|
||||
|
||||
|
||||
class CollectScript(pyblish.api.ContextPlugin):
|
||||
class CollectWorkfile(pyblish.api.ContextPlugin):
|
||||
"""Publish current script version."""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.1
|
||||
label = "Collect Script to publish"
|
||||
label = "Collect Workfile"
|
||||
hosts = ['nuke']
|
||||
|
||||
def process(self, context):
|
||||
root = nuke.root()
|
||||
add_avalon_tab_knob(root)
|
||||
|
||||
knob_data = get_avalon_knob_data(root)
|
||||
|
||||
add_publish_knob(root)
|
||||
|
||||
family = "nukescript"
|
||||
family = "workfile"
|
||||
# creating instances per write node
|
||||
file_path = root['name'].value()
|
||||
base_name = os.path.basename(file_path)
|
||||
|
|
@ -30,6 +32,9 @@ class CollectScript(pyblish.api.ContextPlugin):
|
|||
first_frame = int(root["first_frame"].getValue())
|
||||
last_frame = int(root["last_frame"].getValue())
|
||||
|
||||
handle_start = int(knob_data["handle_start"])
|
||||
handle_end = int(knob_data["handle_end"])
|
||||
|
||||
# Get format
|
||||
format = root['format'].value()
|
||||
resolution_width = format.width()
|
||||
|
|
@ -53,7 +58,8 @@ class CollectScript(pyblish.api.ContextPlugin):
|
|||
"publish": root.knob('publish').value(),
|
||||
"family": family,
|
||||
"representation": "nk",
|
||||
"handles": context.data['handles'],
|
||||
"handle_start": handle_start,
|
||||
"handle_end": handle_end,
|
||||
"step": 1,
|
||||
"fps": int(root['fps'].value()),
|
||||
})
|
||||
|
|
@ -12,7 +12,7 @@ class ExtractScript(pype.api.Extractor):
|
|||
order = pyblish.api.ExtractorOrder - 0.05
|
||||
optional = True
|
||||
hosts = ['nuke']
|
||||
families = ["nukescript"]
|
||||
families = ["workfile"]
|
||||
|
||||
def process(self, instance):
|
||||
self.log.debug("instance extracting: {}".format(instance.data))
|
||||
|
|
@ -28,7 +28,7 @@ class ExtractScript(pype.api.Extractor):
|
|||
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
|
||||
representation = {
|
||||
'name': 'nk',
|
||||
'ext': '.nk',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class ValidateScript(pyblish.api.InstancePlugin):
|
|||
""" Validates file output. """
|
||||
|
||||
order = pyblish.api.ValidatorOrder + 0.1
|
||||
families = ["nukescript"]
|
||||
families = ["workfile"]
|
||||
label = "Check script settings"
|
||||
hosts = ["nuke"]
|
||||
|
||||
|
|
@ -24,11 +24,11 @@ class ValidateScript(pyblish.api.InstancePlugin):
|
|||
# These attributes will be checked
|
||||
attributes = [
|
||||
"fps", "fstart", "fend",
|
||||
"resolution_width", "resolution_height", "pixel_aspect", "handles"
|
||||
"resolution_width", "resolution_height", "pixel_aspect", "handle_start", "handle_end"
|
||||
]
|
||||
|
||||
# Value of these attributes can be found on parents
|
||||
hierarchical_attributes = ["fps", "resolution_width", "resolution_height", "pixel_aspect", "handles"]
|
||||
hierarchical_attributes = ["fps", "resolution_width", "resolution_height", "pixel_aspect", "handle_start", "handle_end"]
|
||||
|
||||
missing_attributes = []
|
||||
asset_attributes = {}
|
||||
|
|
@ -58,17 +58,21 @@ class ValidateScript(pyblish.api.InstancePlugin):
|
|||
raise ValueError(message)
|
||||
|
||||
# Get handles from database, Default is 0 (if not found)
|
||||
handles = 0
|
||||
if "handles" in asset_attributes:
|
||||
handles = asset_attributes["handles"]
|
||||
handle_start = 0
|
||||
handle_end = 0
|
||||
if "handle_start" in asset_attributes:
|
||||
handle_start = asset_attributes["handle_start"]
|
||||
if "handle_end" in asset_attributes:
|
||||
handle_end = asset_attributes["handle_end"]
|
||||
|
||||
# Set frame range with handles
|
||||
asset_attributes["fstart"] -= handles
|
||||
asset_attributes["fend"] += handles
|
||||
asset_attributes["fstart"] -= handle_start
|
||||
asset_attributes["fend"] += handle_end
|
||||
|
||||
# Get values from nukescript
|
||||
script_attributes = {
|
||||
"handles": handles,
|
||||
"handle_start": instance_data["handle_start"],
|
||||
"handle_end": instance_data["handle_end"],
|
||||
"fps": instance_data["fps"],
|
||||
"fstart": instance_data["startFrame"],
|
||||
"fend": instance_data["endFrame"],
|
||||
|
|
@ -87,7 +91,7 @@ class ValidateScript(pyblish.api.InstancePlugin):
|
|||
|
||||
# Raise error if not matching
|
||||
if len(not_matching) > 0:
|
||||
msg = "Attributes '{}' aro not set correctly"
|
||||
msg = "Attributes '{}' are not set correctly"
|
||||
# Alert user that handles are set if Frame start/end not match
|
||||
if (
|
||||
(("fstart" in not_matching) or ("fend" in not_matching)) and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue