Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __del__(self):
pyassimp.release(self.model)
def __del__(self):
pyassimp.release(self.model)
properties = pyassimp.GetMaterialProperties(material)
for key in properties:
print " %s: %s" % (key, properties[key])
print
print "TEXTURES:"
if scene.textures != None:
for index, texture in enumerate(scene.textures):
print " TEXTURE", index+1
print " width:", texture.mWidth
print " height:", texture.mHeight
print " hint:", texture.achFormatHint
print " data (size):", texture.mWidth*texture.mHeight
# Finally release the model
pyassimp.release(scene)
# clear the existing display lists
self.displayList = None
self.displayList = glGenLists( 1 )
glNewList( self.displayList, GL_COMPILE )
glEnable( GL_TEXTURE_2D )
# render the meshes
self.recursive_render( scene, scene.mRootNode.contents )
glEndList()
# release the model
pyassimp.release(scene)
mesh = Mesh()
for face in scene.meshes[0].faces:
triangle = MeshTriangle()
if len(face.indices) == 3:
triangle.vertex_indices = [face.indices[0],
face.indices[1],
face.indices[2]]
mesh.triangles.append(triangle)
for vertex in scene.meshes[0].vertices:
point = Point()
point.x = vertex[0]
point.y = vertex[1]
point.z = vertex[2]
mesh.vertices.append(point)
pyassimp.release(scene)
o = CollisionObject()
o.header.stamp = rospy.Time.now()
o.header.frame_id = ps.header.frame_id
o.id = name
o.meshes.append(mesh)
o.mesh_poses.append(ps.pose)
o.operation = o.ADD
return o