-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrigPrimitives.py
63 lines (44 loc) · 1.38 KB
/
rigPrimitives.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
54
55
56
57
58
59
60
61
62
63
import sys
import skeletonBuilder
import baseRigPrimitive
from filesystem import Path
from skeletonBuilder import *
from baseRigPrimitive import *
__author__ = '[email protected]'
RIG_PART_SCRIPT_PREFIX = 'rigPrim_'
### !!! DO NOT IMPORT RIG SCRIPTS BELOW THIS LINE !!! ###
def _iterRigPartScripts():
for p in sys.path:
p = Path( p )
if 'maya' in p: #
for f in p.files():
if f.hasExtension( 'py' ):
if f.name().startswith( RIG_PART_SCRIPT_PREFIX ):
yield f
for f in _iterRigPartScripts():
__import__( f.name() )
def _setupSkeletonPartRigMethods():
'''
sets up the rig method associations on the skeleton parts. This is a list on each skeleton part containing
the rigging methods that are compatible with that skeleton part
'''
_rigMethodDict = {}
for cls in RigPart.GetSubclasses():
try:
assoc = cls.SKELETON_PRIM_ASSOC
except AttributeError: continue
if assoc is None:
continue
for partCls in assoc:
if partCls is None:
continue
try:
_rigMethodDict[ partCls ].append( (cls.PRIORITY, cls) )
except KeyError:
_rigMethodDict[ partCls ] = [ (cls.PRIORITY, cls) ]
for partCls, rigTypes in _rigMethodDict.iteritems():
rigTypes.sort()
rigTypes = [ rigType for priority, rigType in rigTypes ]
partCls.RigTypes = rigTypes
_setupSkeletonPartRigMethods()
#end