2 Lists all of the notification codes broadcast by 3ds Max,
3 and registers a callback function for each and every one.
15 if not name.startswith(
'_'):
19 if ((type(val) == int)
and (val <= 0xFFFF)):
20 print "Notification code ", name,
" = ", val
21 codelookup[val] = name
23 print "Number Notifications registered: ", count
26 def handleNotification(code):
27 print "Notification handled: ", codelookup[code]
32 for code
in codelookup.iterkeys():
33 MaxPlus.NotificationManager.Register(code, handleNotification)
36 print "Creating sphere"
38 print "Setting radius for sphere 1"
39 sphere1.ParameterBlock.Radius.Value = 2.0
40 print "Creating node for the sphere"
42 print "Creating sphere 2"
44 print "Setting radius on sphere 2"
45 sphere2.ParameterBlock.Radius.Value = 2.0
46 print "Creating node for sphere 2"
48 print "Setting parent of node 2 to node 1"
49 sphere2node.Parent = sphere1node
54 print "Deleting node 1"
56 print "Deleting node 2"
61 except Exception, err:
62 print 'ERROR: %s\n' % str(err)
64 except MaxBaseException
as e:
65 print 'MaxBaseException occured'
68 print "Unexpected error:", sys.exc_info()[0]
71 print 'unregistering notification handlers'
72 for h
in list(MaxPlus.NotificationManager.Handlers):
73 MaxPlus.NotificationManager.Unregister(h)