2 Demonstrates how to manage user specified data for any object derived from Animatable.
9 for c
in node.Children:
11 for d
in descendants(c):
19 def CreatSceneWithAppChunk():
28 node.SetName(
"MyTeapot123")
31 teapot.SetAppData(1234,
"I'm a teapot!")
32 teapot.SetAppData(2345,
u"我是一个茶壶!")
34 node.SetAppData(5678,
"Node of teapot")
35 node.SetAppData(7890,
"This is to be removed")
36 node.DeleteAppData(7890)
38 mtl.SetAppData(4567,
"Material of teapot")
39 pymxs.runtime.saveMaxFile(
"scene_with_app_chunk.max")
40 print "scene with AppChunk is saved."
43 def LoadAndCheckSceneWithAppChunk():
45 pymxs.runtime.loadMaxFile(
"scene_with_app_chunk.max")
46 print "scene with AppChunk is loaded."
51 if n.GetName() ==
"MyTeapot123":
54 if teapotNode
is None:
55 print "Error: Incorrect saved scene."
57 print teapotNode.GetAppData(5678)
58 obj = teapotNode.GetObject()
59 print obj.GetAppData(1234)
60 print obj.GetAppData(2345)
67 print "this is expected."
71 teapotNode.GetAppData(7890)
74 print "this is expected."
77 print teapotNode.Material.GetAppData(4567)
79 CreatSceneWithAppChunk()
80 LoadAndCheckSceneWithAppChunk()