mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Merge branch 'feature/develop/add_tags_on_project_load' into change/develop/nukestudio_improvements
This commit is contained in:
commit
00ebd6129f
2 changed files with 48 additions and 3 deletions
|
|
@ -1,17 +1,19 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
from avalon import api as avalon
|
||||
from pyblish import api as pyblish
|
||||
|
||||
from .. import api
|
||||
|
||||
from .menu import (
|
||||
install as menu_install,
|
||||
_update_menu_task_label
|
||||
)
|
||||
from .tags import add_tags_from_presets
|
||||
|
||||
from pypeapp import Logger
|
||||
|
||||
import hiero
|
||||
|
||||
log = Logger().get_logger(__name__, "nukestudio")
|
||||
|
||||
AVALON_CONFIG = os.getenv("AVALON_CONFIG", "pype")
|
||||
|
|
@ -55,6 +57,15 @@ def install(config):
|
|||
# load data from templates
|
||||
api.load_data_from_templates()
|
||||
|
||||
# Add tags on project load.
|
||||
hiero.core.events.registerInterest(
|
||||
"kAfterProjectLoad", add_tags
|
||||
)
|
||||
|
||||
|
||||
def add_tags(event):
|
||||
add_tags_from_presets()
|
||||
|
||||
|
||||
def uninstall():
|
||||
log.info("Deregistering NukeStudio plug-ins..")
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import hiero
|
||||
import re
|
||||
|
||||
from pypeapp import (
|
||||
config,
|
||||
Logger
|
||||
)
|
||||
from avalon import io
|
||||
|
||||
import hiero
|
||||
|
||||
log = Logger().get_logger(__name__, "nukestudio")
|
||||
|
||||
|
|
@ -59,6 +62,37 @@ def add_tags_from_presets():
|
|||
nks_pres = presets['nukestudio']
|
||||
nks_pres_tags = nks_pres.get("tags", None)
|
||||
|
||||
# Get project task types.
|
||||
tasks = io.find_one({"type": "project"})["config"]["tasks"]
|
||||
nks_pres_tags["[Tasks]"] = {}
|
||||
for task in tasks:
|
||||
nks_pres_tags["[Tasks]"][task["name"]] = {
|
||||
"editable": "1",
|
||||
"note": "",
|
||||
"icon": {
|
||||
"path": ""
|
||||
},
|
||||
"metadata": {
|
||||
"family": "task"
|
||||
}
|
||||
}
|
||||
|
||||
# Get project assets. Currently Ftrack specific to differentiate between
|
||||
# asset builds and shots.
|
||||
nks_pres_tags["[Assets]"] = {}
|
||||
for asset in io.find({"type": "asset"}):
|
||||
if asset["data"]["entityType"] == "AssetBuild":
|
||||
nks_pres_tags["[Assets]"][asset["name"]] = {
|
||||
"editable": "1",
|
||||
"note": "",
|
||||
"icon": {
|
||||
"path": ""
|
||||
},
|
||||
"metadata": {
|
||||
"family": "asset"
|
||||
}
|
||||
}
|
||||
|
||||
# get project and root bin object
|
||||
project = hiero.core.projects()[-1]
|
||||
root_bin = project.tagsBin()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue