Consider the following scenario:
You have your group consisting of a very simple mesh of around 100 triangles.
Now run the following script
import bpy
import os
for i in range(0, 10000):
bpy.ops.object.group_instance_add(group='Group')
#print(str(i))
This goes very quick with 10, 100 and relatively okay with 1000 instances. But the larger the amount of instances you want to create, the slower is the addition of new instances.
I assume this is because for each iteration the call has to go through every single object (group instance or group or whatever) in the scene and check its name to see if it matches the groups name. A quick look at the api didn’t let me find a solution where I can get the group directly as a variable and use it as a non-lookup-needed reference in a call like this.
Unfortunately the way it is now, runtime is horrible as I have to add objects/instances in the tens of thousands. I previously used actual copies where I could just use object references and copy over mesh data etc. which was somewhat fast (at least only a fraction of what it takes now) but eats a ton of RAM.
I’m hoping you guys can help me find a way to make the use of group instances feasible in this situation.
Thanks in advance
Cyba_Mephisto