demoGetRenderedNormals.py
2 An example of how to populate RNormals and get them with GetRenderedVertexNormals()
9 print "node name: %s" % n.Name
10 n.Convert(MaxPlus.ClassIds.TriMeshGeometry)
11 object_state = n.EvalWorldState()
12 obj_original = object_state.Getobj()
13 tri_obj = MaxPlus.TriObject._CastFrom(obj_original)
14 tri_mesh = tri_obj.GetMesh()
15 print "normals built? ", tri_mesh.GetNormalsBuilt()
16 tri_mesh.CheckNormals(
True)
18 print "normals built? ", tri_mesh.GetNormalsBuilt()
20 normal_count = tri_mesh.GetNormalCount()
21 vertex_count = tri_mesh.GetNumVertices()
22 print " normals: ", normal_count
23 print " verts: ", vertex_count
25 for i
in range(0, vertex_count):
26 print "vertex: " , tri_mesh.GetVertex(i)
27 print "RNormal: ", tri_mesh.GetRenderedVertexNormal(i)