def add_mesh_from_points_tf(points, name="Scan", world_transformation = Matrix()): mesh = bpy.data.meshes.new(name+"_mesh") mesh.vertices.add(len(points)) mesh.vertices.foreach_set("co", tuples_to_list(points)) mesh.update() mesh_object = bpy.data.objects.new("{0}.{1}".format(name,bpy.context.scene.frame_current), mesh) bpy.context.scene.objects.link(mesh_object) blensor.show_in_frame(mesh_object, bpy.context.scene.frame_current) if world_transformation == Matrix(): mesh_object.matrix_world = bpy.context.object.matrix_world
def add_mesh_from_points_tf(points, name="Scan", world_transformation=Matrix()): mesh = bpy.data.meshes.new(name + "_mesh") mesh.vertices.add(len(points)) mesh.vertices.foreach_set("co", tuples_to_list(points)) mesh.update() mesh_object = bpy.data.objects.new( "{0}.{1}".format(name, bpy.context.scene.frame_current), mesh) bpy.context.scene.objects.link(mesh_object) blensor.show_in_frame(mesh_object, bpy.context.scene.frame_current) if world_transformation == Matrix(): mesh_object.matrix_world = bpy.context.object.matrix_world
def add_mesh_from_points(points, name="mesh"): flattened = points if len(points) > 0: if type(points[0]) == type([]) or type(points[0]) == type(()): flattened = tuples_to_list(points) mesh = bpy.data.meshes.new(name + "_mesh") mesh.vertices.add(len(flattened) // 3) mesh.vertices.foreach_set("co", flattened) mesh.update() obj = bpy.data.objects.new(name, mesh) bpy.context.scene.objects.link(obj) scanner = bpy.context.object if scanner.show_in_frame: blensor.show_in_frame(obj, bpy.context.scene.frame_current)
def add_mesh_from_points(points, name="mesh"): flattened = points if len(points) > 0: if type(points[0]) == type([]) or type(points[0]) == type(()): flattened = tuples_to_list(points) mesh = bpy.data.meshes.new(name+"_mesh") mesh.vertices.add(len(flattened)//3) mesh.vertices.foreach_set("co",flattened) mesh.update() obj = bpy.data.objects.new(name, mesh) bpy.context.scene.objects.link(obj) scanner = bpy.context.object if scanner.show_in_frame: blensor.show_in_frame(obj, bpy.context.scene.frame_current)