mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #18 from pypeclub/feature/PYPE-712-nuke-bookmarks-context
nuke bookmarks context
This commit is contained in:
commit
f7e01dee85
6 changed files with 41 additions and 5 deletions
|
|
@ -93,11 +93,11 @@ def install():
|
|||
|
||||
# Set context settings.
|
||||
nuke.addOnCreate(workfile_settings.set_context_settings, nodeClass="Root")
|
||||
nuke.addOnCreate(workfile_settings.set_favorites, nodeClass="Root")
|
||||
|
||||
menu.install()
|
||||
|
||||
|
||||
|
||||
def launch_workfiles_app():
|
||||
'''Function letting start workfiles after start of host
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -15,13 +15,12 @@ import nuke
|
|||
from .presets import (
|
||||
get_colorspace_preset,
|
||||
get_node_dataflow_preset,
|
||||
get_node_colorspace_preset
|
||||
)
|
||||
|
||||
from .presets import (
|
||||
get_node_colorspace_preset,
|
||||
get_anatomy
|
||||
)
|
||||
|
||||
from .utils import set_context_favorites
|
||||
|
||||
from pypeapp import Logger
|
||||
log = Logger().get_logger(__name__, "nuke")
|
||||
|
||||
|
|
@ -944,6 +943,26 @@ class WorkfileSettings(object):
|
|||
# add colorspace menu item
|
||||
self.set_colorspace()
|
||||
|
||||
def set_favorites(self):
|
||||
projects_root = os.getenv("AVALON_PROJECTS")
|
||||
work_dir = os.getenv("AVALON_WORKDIR")
|
||||
asset = os.getenv("AVALON_ASSET")
|
||||
project = os.getenv("AVALON_PROJECT")
|
||||
hierarchy = os.getenv("AVALON_HIERARCHY")
|
||||
favorite_items = OrderedDict()
|
||||
|
||||
# project
|
||||
favorite_items.update({"Project dir": os.path.join(
|
||||
projects_root, project).replace("\\", "/")})
|
||||
# shot
|
||||
favorite_items.update({"Shot dir": os.path.join(
|
||||
projects_root, project,
|
||||
hierarchy, asset).replace("\\", "/")})
|
||||
# workdir
|
||||
favorite_items.update({"Work dir": work_dir})
|
||||
|
||||
set_context_favorites(favorite_items)
|
||||
|
||||
|
||||
def get_hierarchical_attr(entity, attr, default=None):
|
||||
attr_parts = attr.split('.')
|
||||
|
|
|
|||
|
|
@ -3,6 +3,23 @@ import nuke
|
|||
from avalon.nuke import lib as anlib
|
||||
|
||||
|
||||
def set_context_favorites(favorites={}):
|
||||
""" Addig favorite folders to nuke's browser
|
||||
|
||||
Argumets:
|
||||
favorites (dict): couples of {name:path}
|
||||
"""
|
||||
dir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
icon_path = os.path.join(dir, 'res', 'icons', 'folder-favorite3.png')
|
||||
|
||||
for name, path in favorites.items():
|
||||
nuke.addFavoriteDir(
|
||||
name,
|
||||
path,
|
||||
nuke.IMAGE | nuke.SCRIPT | nuke.GEO,
|
||||
icon=icon_path)
|
||||
|
||||
|
||||
def get_node_outputs(node):
|
||||
'''
|
||||
Return a dictionary of the nodes and pipes that are connected to node
|
||||
|
|
|
|||
BIN
res/icons/folder-favorite.png
Normal file
BIN
res/icons/folder-favorite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
res/icons/folder-favorite2.png
Normal file
BIN
res/icons/folder-favorite2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
res/icons/folder-favorite3.png
Normal file
BIN
res/icons/folder-favorite3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
Loading…
Add table
Add a link
Reference in a new issue