forked from lookbothways/vfxTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cutOut_SHR
79 lines (50 loc) · 2.16 KB
/
cutOut_SHR
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""
* assign rayswitches to all bits of geo
* set opacity off on geo
for shelf:
from creatureScripts import cutOut
reload(cutOut)
cutOut.doSomething()
"""
import maya.cmds as cmds
import maya.mel as mel
# gets creature namespace
# This won't work with multiple creatures!
nameSpacedGeo=cmds.namespaceInfo(listOnlyNamespaces=True)
creatureNS = ""
for x in nameSpacedGeo:
if "creature_adult" in x:
creatureNS = x
print "Found "+ creatureNS
def cutoutOn():
#sets opacity
cmds.setAttr( creatureNS+ ':body_geoShape.aiOpaque', 0 )
cmds.setAttr( creatureNS+ ':teeth_geoShape.aiOpaque', 0 )
cmds.setAttr( creatureNS+ ':gums_geoShape.aiOpaque', 0 )
# namespace assignments:
cmds.sets(creatureNS+ ":body_geoShape", forceElement=creatureNS+ ':aiWDBodyRayswitchSG')
cmds.sets(creatureNS+ ":teeth_geoShape", forceElement=creatureNS+ ':teeth_aiRaySwitchSG')
cmds.sets(creatureNS+ ":gums_geoShape", forceElement=creatureNS+ ':gums_aiRaySwitchSG')
def cutoutOff():
#sets opacity
cmds.setAttr( creatureNS+ ':body_geoShape.aiOpaque', 1 )
cmds.setAttr( creatureNS+ ':teeth_geoShape.aiOpaque', 1 )
#cmds.setAttr( creatureNS+ ':gums_geoShape.aiOpaque', 0 ) # Is off in original delivery
# namespace assignments:
cmds.sets(creatureNS+ ":body_geoShape", forceElement=creatureNS+ ':aiWDBody_SG' )
cmds.sets(creatureNS+ ":teeth_geoShape", forceElement=creatureNS+ ':aiWDTeeth_SG' )
cmds.sets(creatureNS+ ":gums_geoShape", forceElement=creatureNS+ ':aiWDGums_SG' )
def doSomething():
cutoutResult = cmds.confirmDialog( title='cutOut on/off', message='Apply cutOut shaders?', button=['On','Off','Cancel'], defaultButton='Yes', cancelButton='No', dismissString='No' )
if creatureNS:
if cutoutResult == "On":
cutoutOn()
print "Turned on cutOut shaders."
if cutoutResult == "Off":
cutoutOff()
print "Turned off cutOut shaders."
if cutoutResult == "Cancel":
print "cutOut cancelled, no changes made."
else:
print "No creature_adult found."
#END