2 This is example code demonstrating how to add and remove MCameraMessages using the
7 import maya.OpenMaya
as OpenMaya
10 def beginManipCB(node, clientData):
11 print(
"Inside beginManipCB, clientData is %s"%clientData)
12 def endManipCB(node, clientData):
13 print(
"Inside endManipCB, clientData is %s"%clientData)
18 addCallbacksToPerspCamera()
20 def addCallbacksToPerspCamera():
28 maya.cmds.select(
'perspShape')
36 print(
"List length is %d"%slist.length())
40 while not iter.isDone():
43 iter.getDependNode(dependNode)
44 iter.getDagPath(dagPath)
45 print(
"Node: %s"%dagPath.partialPathName())
46 if (dependNode.hasFn(OpenMaya.MFn.kCamera)):
47 print(
"This is a camera, adding manipulation callbacks with payloads")
48 payloadBegin =
"12345.5"
49 payloadEnd =
"54321.5"
60 print(
"This node is not a camera...")
64 def removeCallbacks():
66 for id
in callbackIDs:
71 import cameraMessageTest as cmt
73 maya.cmds.file(f=1,new=1)