hiero: rest of plugins and modules conversion

This commit is contained in:
Jakub Jezek 2021-01-22 15:58:43 +01:00
parent 7ab1a99e8d
commit 560bb58569
No known key found for this signature in database
GPG key ID: C4B96E101D2A47F3
12 changed files with 250 additions and 78 deletions

View file

@ -22,7 +22,8 @@ log = Logger().get_logger(__name__, "hiero")
AVALON_CONFIG = os.getenv("AVALON_CONFIG", "pype")
# plugin paths
HOST_DIR = os.path.dirname(os.path.abspath(pype.hosts.hiero.__file__))
API_DIR = os.path.dirname(os.path.abspath(__file__))
HOST_DIR = os.path.dirname(API_DIR)
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish").replace("\\", "/")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load").replace("\\", "/")

View file

@ -5,7 +5,6 @@ from Qt import QtWidgets, QtCore
from avalon.vendor import qargparse
import avalon.api as avalon
import pype.api as pype
from . import lib
log = pype.Logger().get_logger(__name__, "hiero")
@ -435,7 +434,7 @@ class ClipLoader:
representation = str(repr_cntx["representation"])
self.data["clip_name"] = "_".join([asset, subset, representation])
self.data["track_name"] = "_".join([subset, representation])
self.data["versionData"] = self.context["version"]["data"]
# gets file path
file = self.fname
if not file:
@ -497,7 +496,6 @@ class ClipLoader:
track_item.setTimelineIn(self.timeline_in)
track_item.setSourceOut(self.media_duration - self.handle_end)
track_item.setTimelineOut(self.timeline_out)
track_item.setPlaybackSpeed(1)
self.active_track.addTrackItem(track_item)
@ -512,8 +510,13 @@ class ClipLoader:
self.media = hiero.core.MediaSource(self.data["path"])
self.media_duration = int(self.media.duration())
self.handle_start = int(self.data["assetData"]["handleStart"])
self.handle_end = int(self.data["assetData"]["handleEnd"])
# get handles
self.handle_start = self.data["versionData"].get("handleStart")
self.handle_end = self.data["versionData"].get("handleEnd")
if self.handle_start is None:
self.handle_start = int(self.data["assetData"]["handleStart"])
if self.handle_end is None:
self.handle_end = int(self.data["assetData"]["handleEnd"])
if self.sequencial_load:
last_track_item = lib.get_track_items(
@ -546,9 +549,9 @@ class ClipLoader:
+ self.handle_start \
+ self.handle_end
# and compare it with meda duration
) - self.media_duration)
) > self.media_duration)
log.debug("__ slate_on: `{}`".format(slate_on))
print("__ slate_on: `{}`".format(slate_on))
# if slate is on then remove the slate frame from begining
if slate_on:
@ -596,10 +599,10 @@ class Creator(avalon.Creator):
rename_index = None
def __init__(self, *args, **kwargs):
from pype.hosts import hiero as phiero
import pype.hosts.hiero.api as phiero
super(Creator, self).__init__(*args, **kwargs)
self.presets = pype.config.get_presets(
)['plugins']["hiero"]["create"].get(self.__class__.__name__, {})
self.presets = pype.get_current_project_settings()[
"hiero"]["create"].get(self.__class__.__name__, {})
# adding basic current context resolve objects
self.project = phiero.get_current_project()
@ -833,8 +836,8 @@ class PublishClip:
hierarchy_formating_data
)
tag_hierarchy_data.update({"masterLayer": True})
if master_layer and self.vertical_sync:
tag_hierarchy_data.update({"masterLayer": True})
self.vertical_clip_match.update({
(self.clip_in, self.clip_out): tag_hierarchy_data
})
@ -842,11 +845,7 @@ class PublishClip:
if not master_layer and self.vertical_sync:
# driving layer is set as negative match
for (_in, _out), master_data in self.vertical_clip_match.items():
master_data.update({
"masterLayer": False,
"review": False,
"audio": False
})
master_data.update({"masterLayer": False})
if _in == self.clip_in and _out == self.clip_out:
data_subset = master_data["subset"]
# add track index in case duplicity of names in master data
@ -863,7 +862,7 @@ class PublishClip:
self.tag_data.update(tag_hierarchy_data)
if master_layer and self.review_layer:
self.tag_data.update({"review": self.review_layer})
self.tag_data.update({"reviewTrack": self.review_layer})
def _solve_tag_hierarchy_data(self, hierarchy_formating_data):
""" Solve tag data from hierarchy data and templates. """

View file

@ -1,8 +1,8 @@
import pype.hosts.hiero.api as phiero
# from pype.hosts.hiero.api import plugin, lib
# reload(lib)
# reload(plugin)
# reload(phiero)
from pype.hosts.hiero.api import plugin, lib
reload(lib)
reload(plugin)
reload(phiero)
class CreateShotClip(phiero.Creator):
@ -119,12 +119,12 @@ class CreateShotClip(phiero.Creator):
"order": 0},
"vSyncTrack": {
"value": gui_tracks, # noqa
"type": "QComboBox",
"label": "Master track",
"target": "ui",
"toolTip": "Select driving track name which should be mastering all others", # noqa
"order": 1}
}
"type": "QComboBox",
"label": "Master track",
"target": "ui",
"toolTip": "Select driving track name which should be mastering all others", # noqa
"order": 1}
}
},
"publishSettings": {
"type": "section",
@ -175,28 +175,31 @@ class CreateShotClip(phiero.Creator):
"target": "ui",
"order": 4,
"value": {
"workfileFrameStart": {
"value": 1001,
"type": "QSpinBox",
"label": "Workfiles Start Frame",
"target": "tag",
"toolTip": "Set workfile starting frame number", # noqa
"order": 0},
"handleStart": {
"value": 0,
"type": "QSpinBox",
"label": "Handle Start",
"target": "tag",
"toolTip": "Handle at start of clip", # noqa
"order": 1},
"handleEnd": {
"value": 0,
"type": "QSpinBox",
"label": "Handle End",
"target": "tag",
"toolTip": "Handle at end of clip", # noqa
"order": 2},
}
"workfileFrameStart": {
"value": 1001,
"type": "QSpinBox",
"label": "Workfiles Start Frame",
"target": "tag",
"toolTip": "Set workfile starting frame number", # noqa
"order": 0
},
"handleStart": {
"value": 0,
"type": "QSpinBox",
"label": "Handle Start",
"target": "tag",
"toolTip": "Handle at start of clip", # noqa
"order": 1
},
"handleEnd": {
"value": 0,
"type": "QSpinBox",
"label": "Handle End",
"target": "tag",
"toolTip": "Handle at end of clip", # noqa
"order": 2
}
}
}
}

View file

@ -1,6 +1,9 @@
from avalon import io, api
import pype.hosts.hiero.api as phiero
# reload(phiero)
from pype.hosts.hiero.api import plugin, lib
reload(lib)
reload(plugin)
reload(phiero)
class LoadClip(phiero.SequenceLoader):

View file

@ -19,6 +19,7 @@ class CollectPlates(api.InstancePlugin):
if not instance.data.get("representations"):
instance.data["representations"] = list()
self.main_clip = instance.data["item"]
# get plate source attributes
source_media = instance.data["sourceMedia"]
source_path = instance.data["sourcePath"]
@ -27,8 +28,10 @@ class CollectPlates(api.InstancePlugin):
frame_end = instance.data["frameEnd"]
handle_start = instance.data["handleStart"]
handle_end = instance.data["handleEnd"]
source_in_h = instance.data.get("sourceInH")
source_out_h = instance.data.get("sourceOutH")
source_in = instance.data["sourceIn"]
source_out = instance.data["sourceOut"]
source_in_h = instance.data["sourceInH"]
source_out_h = instance.data["sourceOutH"]
# define if review media is sequence
is_sequence = bool(not source_media.singleFile())
@ -65,9 +68,18 @@ class CollectPlates(api.InstancePlugin):
self.log.debug("_ real_files: {}".format(real_files))
# collect frames to repre files list
for item in collection:
self.handle_start_exclude = list()
self.handle_end_exclude = list()
for findex, item in enumerate(collection):
if item not in real_files:
self.log.debug("_ item: {}".format(item))
test_index = findex + int(source_first + source_in_h)
test_start = int(source_first + source_in)
test_end = int(source_first + source_out)
if (test_index < test_start):
self.handle_start_exclude.append(test_index)
elif (test_index > test_end):
self.handle_end_exclude.append(test_index)
continue
files.append(item)
@ -89,11 +101,15 @@ class CollectPlates(api.InstancePlugin):
}
instance.data["representations"].append(representation)
self.version_data(instance)
self.log.debug(
"Added representations: {}".format(
instance.data["representations"]))
self.log.debug(
"instance.data: {}".format(instance.data))
def version_data(self, instance):
transfer_data = [
"handleStart", "handleEnd", "sourceIn", "sourceOut",
@ -109,12 +125,23 @@ class CollectPlates(api.InstancePlugin):
if 'version' in instance.data:
version_data["version"] = instance.data["version"]
handle_start = instance.data["handleStart"]
handle_end = instance.data["handleEnd"]
if self.handle_start_exclude:
handle_start -= len(self.handle_start_exclude)
if self.handle_end_exclude:
handle_end -= len(self.handle_end_exclude)
# add to data of representation
version_data.update({
"colorspace": self.rw_clip.sourceMediaColourTransform(),
"colorspace": self.main_clip.sourceMediaColourTransform(),
"families": instance.data["families"],
"subset": instance.data["subset"],
"fps": instance.data["fps"]
"fps": instance.data["fps"],
"handleStart": handle_start,
"handleEnd": handle_end
})
instance.data["versionData"] = version_data

View file

@ -2,17 +2,17 @@ import re
import pyblish.api
class CollectClipEffects(pyblish.api.InstancePlugin):
class PreCollectClipEffects(pyblish.api.InstancePlugin):
"""Collect soft effects instances."""
order = pyblish.api.CollectorOrder - 0.508
label = "Collect Clip Effects Instances"
label = "Pre-collect Clip Effects Instances"
families = ["clip"]
def process(self, instance):
family = "effect"
effects = {}
review = instance.data["review"]
review = instance.data.get("review")
review_track_index = instance.context.data.get("reviewTrackIndex")
item = instance.data["item"]

View file

@ -1,17 +1,17 @@
from compiler.ast import flatten
from pyblish import api
from pype.hosts import hiero as phiero
from pype.hosts.hiero import api as phiero
import hiero
# from pype.hosts.hiero.api import lib
# reload(lib)
# reload(phiero)
class CollectInstances(api.ContextPlugin):
class PreCollectInstances(api.ContextPlugin):
"""Collect all Track items selection."""
order = api.CollectorOrder - 0.509
label = "Collect Instances"
label = "Pre-collect Instances"
hosts = ["hiero"]
def process(self, context):
@ -60,8 +60,8 @@ class CollectInstances(api.ContextPlugin):
asset = tag_parsed_data["asset"]
subset = tag_parsed_data["subset"]
review = tag_parsed_data["review"]
audio = tag_parsed_data["audio"]
review = tag_parsed_data.get("review")
audio = tag_parsed_data.get("audio")
# remove audio attribute from data
data.pop("audio")

View file

@ -1,13 +1,13 @@
import os
import pyblish.api
from pype.hosts import hiero as phiero
from pype.hosts.hiero import api as phiero
from avalon import api as avalon
class CollectWorkfile(pyblish.api.ContextPlugin):
class PreCollectWorkfile(pyblish.api.ContextPlugin):
"""Inject the current working file into context"""
label = "Collect Workfile"
label = "Pre-collect Workfile"
order = pyblish.api.CollectorOrder - 0.51
def process(self, context):

View file

@ -1,4 +1,22 @@
{
"create": {
"CreateShotClip": {
"hierarchy": "{folder}/{sequence}",
"clipRename": true,
"clipName": "{track}{sequence}{shot}",
"countFrom": 10,
"countSteps": 10,
"folder": "shots",
"episode": "ep01",
"sequence": "sq01",
"track": "{_track_}",
"shot": "sh###",
"vSyncOn": false,
"workfileFrameStart": 1001,
"handleStart": 10,
"handleEnd": 10
}
},
"publish": {
"CollectInstanceVersion": {
"enabled": false

View file

@ -36,7 +36,7 @@
}
},
"ValidateKnobs": {
"enabled": true,
"enabled": false,
"knobs": {
"render": {
"review": true
@ -44,7 +44,7 @@
}
},
"ExtractReviewDataLut": {
"enabled": true
"enabled": false
},
"ExtractReviewDataMov": {
"enabled": true,

View file

@ -235,17 +235,19 @@
"__environment_keys__": {
"nuke": [
"NUKE_PATH",
"PATH"
"PATH",
"LOGLEVEL"
]
},
"NUKE_PATH": [
"{PYPE_REPOS_ROOT}/avalon-core/setup/nuke/nuke_path",
"{PYPE_ROOT}/setup/nuke/nuke_path",
"{PYPE_ROOT}/repos/avalon-core/setup/nuke/nuke_path",
"{PYPE_ROOT}/pype/hosts/nuke/startup",
"{PYPE_STUDIO_PLUGINS}/nuke"
],
"PATH": {
"windows": "C:/Program Files (x86)/QuickTime/QTSystem/;{PATH}"
}
},
"LOGLEVEL": "DEBUG"
},
"variants": {
"nuke_12.2": {
@ -358,17 +360,19 @@
"__environment_keys__": {
"nukex": [
"NUKE_PATH",
"PATH"
"PATH",
"LOGLEVEL"
]
},
"NUKE_PATH": [
"{PYPE_REPOS_ROOT}/avalon-core/setup/nuke/nuke_path",
"{PYPE_ROOT}/setup/nuke/nuke_path",
"{PYPE_ROOT}/repos/avalon-core/setup/nuke/nuke_path",
"{PYPE_ROOT}/pype/hosts/nuke/startup",
"{PYPE_STUDIO_PLUGINS}/nuke"
],
"PATH": {
"windows": "C:/Program Files (x86)/QuickTime/QTSystem/;{PATH}"
}
},
"LOGLEVEL": "DEBUG"
},
"variants": {
"nukex_12.2": {
@ -809,6 +813,8 @@
},
"PYTHONPATH": [
"{PYTHON36_RESOLVE}/Lib/site-packages",
"{VIRTUAL_ENV}/Lib/site-packages",
"{PYTHONPATH}",
"{RESOLVE_SCRIPT_API}/Modules",
"{PYTHONPATH}"
],
@ -817,7 +823,7 @@
"{PYTHON36_RESOLVE}/Scripts",
"{PATH}"
],
"PRE_PYTHON_SCRIPT": "{PYPE_ROOT}/pype/resolve/preload_console.py",
"PRE_PYTHON_SCRIPT": "{PYPE_MODULE_ROOT}/pype/resolve/preload_console.py",
"PYPE_LOG_NO_COLORS": "True",
"RESOLVE_DEV": "True"
},

View file

@ -5,6 +5,121 @@
"label": "Hiero",
"is_file": true,
"children": [
{
"type": "dict",
"collapsable": true,
"key": "create",
"label": "Create plugins",
"children": [
{
"type": "dict",
"collapsable": true,
"key": "CreateShotClip",
"label": "Create Shot Clip",
"is_group": true,
"children": [
{
"type": "collapsible-wrap",
"label": "Shot Hierarchy And Rename Settings",
"collapsable": false,
"children": [
{
"type": "text",
"key": "hierarchy",
"label": "Shot parent hierarchy"
},
{
"type": "boolean",
"key": "clipRename",
"label": "Rename clips"
},
{
"type": "text",
"key": "clipName",
"label": "Clip name template"
},
{
"type": "number",
"key": "countFrom",
"label": "Count sequence from"
},
{
"type": "number",
"key": "countSteps",
"label": "Stepping number"
}
]
},
{
"type": "collapsible-wrap",
"label": "Shot Template Keywords",
"collapsable": false,
"children": [
{
"type": "text",
"key": "folder",
"label": "{folder}"
},
{
"type": "text",
"key": "episode",
"label": "{episode}"
},
{
"type": "text",
"key": "sequence",
"label": "{sequence}"
},
{
"type": "text",
"key": "track",
"label": "{track}"
},
{
"type": "text",
"key": "shot",
"label": "{shot}"
}
]
},
{
"type": "collapsible-wrap",
"label": "Vertical Synchronization Of Attributes",
"collapsable": false,
"children": [
{
"type": "boolean",
"key": "vSyncOn",
"label": "Enable Vertical Sync"
}
]
},
{
"type": "collapsible-wrap",
"label": "Shot Attributes",
"collapsable": false,
"children": [
{
"type": "number",
"key": "workfileFrameStart",
"label": "Workfiles Start Frame"
},
{
"type": "number",
"key": "handleStart",
"label": "Handle start (head)"
},
{
"type": "number",
"key": "handleEnd",
"label": "Handle end (tail)"
}
]
}
]
}
]
},
{
"type": "dict",
"collapsable": true,