-
Notifications
You must be signed in to change notification settings - Fork 13
/
twClothSolverBlockoutPlugins.py
51 lines (35 loc) · 2.06 KB
/
twClothSolverBlockoutPlugins.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
#Import
#-------------------------------------------------------------------------------------
import maya.OpenMayaMPx as OpenMayaMPx
#PlugIns
import twClothSolverIOPaperBlockout
import twMeshInfoCmd
import twCheckCollision
import twDrawBB
#reload
doReload = True
if(doReload): reload(twClothSolverIOPaperBlockout),reload(twMeshInfoCmd), reload(twCheckCollision), reload(twDrawBB)
#Plugin Registration
#-------------------------------------------------------------------------------------
def initializePlugin(mobject):
'''Register Plugin'''
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.registerCommand('MeshInfo', twMeshInfoCmd.createTwMeshInfoCmd)
mplugin.registerNode( twCheckCollision.TwCheckCollision.kPluginNodeName, twCheckCollision.TwCheckCollision.kPluginNodeId, twCheckCollision.createTwCheckCollision, twCheckCollision.initializeTwCheckCollision, OpenMayaMPx.MPxNode.kLocatorNode)
mplugin.registerNode( twDrawBB.TwDrawBB.kPluginNodeName, twDrawBB.TwDrawBB.kPluginNodeId, twDrawBB.createTwDrawBB, twDrawBB.initializeTwDrawBB, OpenMayaMPx.MPxNode.kLocatorNode)
mplugin.registerNode( twClothSolverIOPaperBlockout.TwClothSolverIOPaperBlockout.kPluginNodeName, twClothSolverIOPaperBlockout.TwClothSolverIOPaperBlockout.kPluginNodeId, twClothSolverIOPaperBlockout.createTwClothSolverIOPaperBlockout, twClothSolverIOPaperBlockout.initializeTwClothSolverIOPaperBlockout, OpenMayaMPx.MPxNode.kLocatorNode)
except:
sys.stderr.write( "Failed to register node: %s" % kPluginNodeName )
raise
def uninitializePlugin(mobject):
'''Deregister Plugin'''
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.deregisterCommand('MeshInfo')
mplugin.deregisterNode( twCheckCollision.TwCheckCollision.kPluginNodeId )
mplugin.deregisterNode( twDrawBB.TwDrawBB.kPluginNodeId )
mplugin.deregisterNode( twClothSolverIOPaperBlockout.TwClothSolverIOPaperBlockout.kPluginNodeId )
except:
sys.stderr.write( "Failed to deregister node: %s" % kPluginNodeName )
raise