-
Notifications
You must be signed in to change notification settings - Fork 47
/
menu.py
53 lines (46 loc) · 2.08 KB
/
menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'''
Notes
=====
This file is meant to be deployed alongside the included `init.py`, and invokes
the automatic menu item creation on the default `GizmoPathManager` instance.
Please see the docstring of the `init.py` for installation instructions and
further information.
Once installed, this script uses the default ``GizmoPathManager`` instance to
automatically build hierarchical menu structures and commands for any gizmo
files it locates by recursively searching its defined path(s). These menu
hierarchies will be structured to match the layout of the gizmo files on disk,
allowing for easy menu reorganization without any code changes.
Sample Folder Structure
-----------------------
$HOME
.nuke
Gizmos <- $NUKE_GIZMO_PATH environment variable points here.
Channel <- Each directory will generate a submenu
BumpNormals.gizmo <- .gizmo files generate menu commands
Colormatte.gizmo
FacingRatio_v02.gizmo <- '_v02' will be stripped
Color
ColorAnalyses.gizmo
Draw
AdvancedGrain.gizmo
Transform
ITransform.gizmo
...
...
This will produce a menu structure with menu commands generated from the gizmo
file names minus the extension and, if present, a version suffix matching the
form '_vxx'. So in the above example tree, the file 'FacingRatio_v02.gizmo'
will generate a menu command simply labeled 'FacingRatio'.
If directory names found in the search tree match any of Nuke's built-in menu
names (e.g. Color, Filter, Draw, etc.), the gizmo menu commands will be added
to them. Please note that currently, if the menu command matches the name of a
command that already exists, it will replace the existing item.
*Example gizmo names taken from Nukepedia.com
'''
if __name__ == '__main__':
gizManager = globals().get('gizManager', None)
if gizManager is None:
print 'Problem finding GizmoPathManager - check that init.py was setup correctly'
else:
gizManager.addGizmoMenuItems()
del gizManager