1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Populate a blender PointCloud via python API with numpy data

Discussão em 'Python' iniciado por Stack, Setembro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I can create a PointCloud object in the blender python API via

    pc_data = bpy.data.pointclouds.new(name)
    pc_obj = bpy.data.objects.new(name, pc_data)
    bpy.context.collection.objects.link(pc_obj)


    Problem is, that does not give me any points to work with. There is stuff like pc_data.points.foreach_set("vector", my_np_array.ravel()) and pc_data.attributes.new(name='position', type='FLOAT_VECTOR', domain='POINT').foreach_set("vector", my_np_array.ravel()), which all seems like a working API but fails because the PointCloud is empty and I somehow need to resize it to the size that I need it. But how?

    I have also looked into hacks, for example using the operators/OPS/UI API. The irony is that I haven't even found a way to spawn points in the UI. The only thing I can do is to select some points and then duplicate or delete them.

    Continue reading...

Compartilhe esta Página