mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
Merge branch 'develop' into bugfix/PYPE-737_extract_hier_archived_ents
This commit is contained in:
commit
172e661c6c
8 changed files with 75 additions and 102 deletions
|
|
@ -19,7 +19,7 @@ class CreateProjectFolders(BaseAction):
|
|||
#: Action description.
|
||||
description = 'Creates folder structure'
|
||||
#: roles that are allowed to register this action
|
||||
role_list = ['Pypeclub', 'Administrator']
|
||||
role_list = ['Pypeclub', 'Administrator', 'Project Manager']
|
||||
icon = '{}/ftrack/action_icons/CreateProjectFolders.svg'.format(
|
||||
os.environ.get('PYPE_STATICS_SERVER', '')
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2067,9 +2067,10 @@ class SyncEntitiesFactory:
|
|||
# different hierarchy - can't recreate entity
|
||||
continue
|
||||
|
||||
_vis_parent = str(deleted_entity["data"]["visualParent"])
|
||||
_vis_parent = deleted_entity["data"]["visualParent"]
|
||||
if _vis_parent is None:
|
||||
_vis_parent = self.avalon_project_id
|
||||
_vis_parent = str(_vis_parent)
|
||||
ftrack_parent_id = self.avalon_ftrack_mapper[_vis_parent]
|
||||
self.create_ftrack_ent_from_avalon_ent(
|
||||
deleted_entity, ftrack_parent_id
|
||||
|
|
|
|||
|
|
@ -193,6 +193,8 @@ class AppAction(BaseHandler):
|
|||
if parents:
|
||||
hierarchy = os.path.join(*parents)
|
||||
|
||||
os.environ["AVALON_HIERARCHY"] = hierarchy
|
||||
|
||||
application = avalonlib.get_application(os.environ["AVALON_APP_NAME"])
|
||||
|
||||
data = {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,6 @@ from pypeapp import Logger
|
|||
from avalon.api import Session
|
||||
from hiero.ui import findMenuAction
|
||||
|
||||
# this way we secure compatibility between nuke 10 and 11
|
||||
try:
|
||||
from PySide.QtGui import *
|
||||
except Exception:
|
||||
from PySide2.QtGui import *
|
||||
from PySide2.QtWidgets import *
|
||||
|
||||
from .tags import add_tags_from_presets
|
||||
|
||||
from .lib import (
|
||||
|
|
@ -50,14 +43,8 @@ def install():
|
|||
"""
|
||||
|
||||
# here is the best place to add menu
|
||||
from avalon.tools import (
|
||||
creator,
|
||||
publish,
|
||||
cbloader,
|
||||
cbsceneinventory,
|
||||
contextmanager,
|
||||
libraryloader
|
||||
)
|
||||
from avalon.tools import publish
|
||||
from avalon.vendor.Qt import QtGui
|
||||
|
||||
menu_name = os.environ['AVALON_LABEL']
|
||||
|
||||
|
|
@ -67,94 +54,53 @@ def install():
|
|||
|
||||
self._change_context_menu = context_label
|
||||
|
||||
# Grab Hiero's MenuBar
|
||||
M = hiero.ui.menuBar()
|
||||
|
||||
try:
|
||||
check_made_menu = findMenuAction(menu_name)
|
||||
except Exception:
|
||||
pass
|
||||
check_made_menu = None
|
||||
|
||||
if not check_made_menu:
|
||||
menu = M.addMenu(menu_name)
|
||||
# Grab Hiero's MenuBar
|
||||
menu = hiero.ui.menuBar().addMenu(menu_name)
|
||||
else:
|
||||
menu = check_made_menu.menu()
|
||||
|
||||
actions = [
|
||||
{
|
||||
'parent': context_label,
|
||||
'action': QAction('Set Context', None),
|
||||
'function': contextmanager.show,
|
||||
'icon': QIcon('icons:Position.png')
|
||||
},
|
||||
"separator",
|
||||
{
|
||||
'action': QAction("Work Files...", None),
|
||||
'function': set_workfiles,
|
||||
'icon': QIcon('icons:Position.png')
|
||||
},
|
||||
{
|
||||
'action': QAction('Create Default Tags..', None),
|
||||
'function': add_tags_from_presets,
|
||||
'icon': QIcon('icons:Position.png')
|
||||
},
|
||||
"separator",
|
||||
# {
|
||||
# 'action': QAction('Create...', None),
|
||||
# 'function': creator.show,
|
||||
# 'icon': QIcon('icons:ColorAdd.png')
|
||||
# },
|
||||
# {
|
||||
# 'action': QAction('Load...', None),
|
||||
# 'function': cbloader.show,
|
||||
# 'icon': QIcon('icons:CopyRectangle.png')
|
||||
# },
|
||||
{
|
||||
'action': QAction('Publish...', None),
|
||||
'function': publish.show,
|
||||
'icon': QIcon('icons:Output.png')
|
||||
},
|
||||
# {
|
||||
# 'action': QAction('Manage...', None),
|
||||
# 'function': cbsceneinventory.show,
|
||||
# 'icon': QIcon('icons:ModifyMetaData.png')
|
||||
# },
|
||||
{
|
||||
'action': QAction('Library...', None),
|
||||
'function': libraryloader.show,
|
||||
'icon': QIcon('icons:ColorAdd.png')
|
||||
},
|
||||
"separator",
|
||||
{
|
||||
'action': QAction('Reload pipeline...', None),
|
||||
'function': reload_config,
|
||||
'icon': QIcon('icons:ColorAdd.png')
|
||||
}]
|
||||
context_label_action = menu.addAction(context_label)
|
||||
context_label_action.setEnabled(False)
|
||||
|
||||
# Create menu items
|
||||
for a in actions:
|
||||
add_to_menu = menu
|
||||
if isinstance(a, dict):
|
||||
# create action
|
||||
for k in a.keys():
|
||||
if 'parent' in k:
|
||||
submenus = [sm for sm in a[k].split('/')]
|
||||
submenu = None
|
||||
for sm in submenus:
|
||||
if submenu:
|
||||
submenu.addMenu(sm)
|
||||
else:
|
||||
submenu = menu.addMenu(sm)
|
||||
add_to_menu = submenu
|
||||
if 'action' in k:
|
||||
action = a[k]
|
||||
elif 'function' in k:
|
||||
action.triggered.connect(a[k])
|
||||
elif 'icon' in k:
|
||||
action.setIcon(a[k])
|
||||
menu.addSeparator()
|
||||
|
||||
# add action to menu
|
||||
add_to_menu.addAction(action)
|
||||
hiero.ui.registerAction(action)
|
||||
elif isinstance(a, str):
|
||||
add_to_menu.addSeparator()
|
||||
workfiles_action = menu.addAction("Work Files...")
|
||||
workfiles_action.setIcon(QtGui.QIcon("icons:Position.png"))
|
||||
workfiles_action.triggered.connect(set_workfiles)
|
||||
|
||||
default_tags_action = menu.addAction("Create Default Tags...")
|
||||
default_tags_action.setIcon(QtGui.QIcon("icons:Position.png"))
|
||||
default_tags_action.triggered.connect(add_tags_from_presets)
|
||||
|
||||
menu.addSeparator()
|
||||
|
||||
publish_action = menu.addAction("Publish...")
|
||||
publish_action.setIcon(QtGui.QIcon("icons:Output.png"))
|
||||
publish_action.triggered.connect(
|
||||
lambda *args: publish.show(hiero.ui.mainWindow())
|
||||
)
|
||||
|
||||
menu.addSeparator()
|
||||
|
||||
reload_action = menu.addAction("Reload pipeline...")
|
||||
reload_action.setIcon(QtGui.QIcon("icons:ColorAdd.png"))
|
||||
reload_action.triggered.connect(reload_config)
|
||||
|
||||
# Is this required?
|
||||
hiero.ui.registerAction(context_label_action)
|
||||
hiero.ui.registerAction(workfiles_action)
|
||||
hiero.ui.registerAction(default_tags_action)
|
||||
hiero.ui.registerAction(publish_action)
|
||||
hiero.ui.registerAction(reload_action)
|
||||
|
||||
self.context_label_action = context_label_action
|
||||
self.workfile_actions = workfiles_action
|
||||
self.default_tags_action = default_tags_action
|
||||
self.publish_action = publish_action
|
||||
self.reload_action = reload_action
|
||||
|
|
|
|||
|
|
@ -73,5 +73,5 @@ def current_file():
|
|||
return normalised
|
||||
|
||||
|
||||
def work_root():
|
||||
return os.path.normpath(api.Session["AVALON_WORKDIR"]).replace("\\", "/")
|
||||
def work_root(session):
|
||||
return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/")
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ class CollectClipHandles(api.ContextPlugin):
|
|||
# debug printing
|
||||
self.log.debug("_ s_asset_data: `{}`".format(
|
||||
s_asset_data))
|
||||
self.log.debug("_ instance.data[handles]: `{}`".format(
|
||||
instance.data["handles"]))
|
||||
self.log.debug("_ instance.data[handleStart]: `{}`".format(
|
||||
instance.data["handleStart"]))
|
||||
self.log.debug("_ instance.data[handleEnd]: `{}`".format(
|
||||
|
|
|
|||
|
|
@ -418,6 +418,13 @@ def burnins_from_data(
|
|||
if not value:
|
||||
continue
|
||||
|
||||
if isinstance(value, (dict, list, tuple)):
|
||||
raise TypeError((
|
||||
"Expected string or number type."
|
||||
" Got: {} - \"{}\""
|
||||
" (Make sure you have new burnin presets)."
|
||||
).format(str(type(value)), str(value)))
|
||||
|
||||
has_timecode = TIME_CODE_KEY in value
|
||||
|
||||
align = None
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import argparse
|
|||
import logging
|
||||
import subprocess
|
||||
import platform
|
||||
import json
|
||||
|
||||
try:
|
||||
from shutil import which
|
||||
|
|
@ -24,6 +25,18 @@ log.setLevel(logging.DEBUG)
|
|||
|
||||
error_format = "Failed {plugin.__name__}: {error} -- {error.traceback}"
|
||||
|
||||
def _load_json(path):
|
||||
assert os.path.isfile(path), ("path to json file doesn't exist")
|
||||
data = None
|
||||
with open(path, "r") as json_file:
|
||||
try:
|
||||
data = json.load(json_file)
|
||||
except Exception as exc:
|
||||
log.error(
|
||||
"Error loading json: "
|
||||
"{} - Exception: {}".format(path, exc)
|
||||
)
|
||||
return data
|
||||
|
||||
def __main__():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
|
@ -77,6 +90,12 @@ def __main__():
|
|||
|
||||
paths = kwargs.paths or [os.environ.get("PYPE_METADATA_FILE")] or [os.getcwd()] # noqa
|
||||
|
||||
for path in paths:
|
||||
data = _load_json(path)
|
||||
log.info("Setting session using data from file")
|
||||
os.environ["AVALON_PROJECT"] = data["session"]["AVALON_PROJECT"]
|
||||
break
|
||||
|
||||
args = [
|
||||
os.path.join(pype_root, pype_command),
|
||||
"publish",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue