I have displayed a point cloud after writing the following code.

def point_cloud(ob_name, coords, edges=[], faces=[]):
    """Create point cloud object based on given coordinates and name.

    Keyword arguments:
    ob_name -- new object name
    coords -- float triplets eg: [(-1.0, 1.0, 0.0), (-1.0, -1.0, 0.0)]

    # Create new mesh and a new object
    me = bpy.data.meshes.new(ob_name + "Mesh")
    ob = bpy.data.objects.new(ob_name, me)

    # Make a mesh from a list of vertices/edges/faces
    me.from_pydata(coords, edges, faces)

    # Display name and update the mesh
    ob.show_name = False
    return ob

# Create the object
pc= point_cloud("point-cloud", points)

# Link object to the active collection

I have the color information in a numpy array. Now, how can I assign color to this point cloud and show this in the edit or object mode? The color will vary from vertex to vertex.



You must log in to answer this question.

Browse other questions tagged .