Hello Blenderartist Community,
I’m new to blender and python and trying to create and modify about 1M cubes via a script but ran into performance problems.
First I tried to add 1M cubes in phython in a for loop. It seems that adding a single cube gets slower the more cubes are already added (in fact it’s worse than O(n), where n is # of objects in the scene). After inserting about 1-10k cubes it becomes way too slow to ever reach 1M.
Then I created the cubes from within blender using an array modifier. Having 1M cubes in the editor is very slow (but understandably so). For the scripting I have to split the cubes into separate objects (using [P] -> separate by loose parts), which I cancel after 10 minutes with only 100k cubes.
Lastly I tried to create the cubes with a particle system using a grid with 1000x1000 faces and spawn one particle per face. However when converting the particles to objects, there are only a thousand of them, not the million that I would have expected.
How would you approach generating 1M cubes?
In the end I need to be able to modify the position, rotation, scale and color of each cube via a script.
BTW: The search didn’t show up what I was looking for, but I guess I don’t have the right keywords for this…
Thanks in advance,
-Gregor