0
$\begingroup$

I am currently working on a project in Blender that requires appending objects through script. I understand how to do that and everything works fine if I am appending a smaller number of objects (approximately 1k in total). However, if I increase that number, for example to 10k or 20k, the program seems to run, but it isn't making any progress. My guess is that there is a number of objects in Blender after which the appending process becomes very slow. I should also note that the objects are very simple (i.e. do not have a great number of vertices). Does anybody know what could be the problem? Any help or info is much appreciated.

Edit: Here is the snippet of the code that appends:

map_name = "LP_models/"

tree_names = ["Oak_tree_LP_1", "Oak_tree_LP_2",
              "Oak_tree_LP_3", "Oak_tree_LP_4"]

file_name = map_name + rd.choice(tree_names)
        
oak = bpy.ops.wm.append(
directory = bpy.path.abspath("//"),
filename = file_name + ".blend/Object/oak_leaves"
)

This code is located in a for loop that goes through a csv file. If the value in that file is a certain number it then appends a certain object (in this case one of the four oak tree models) to a grid. This is done with a probability of 10% (that way around 10% of the area or grid will be covered in objects). If I change that number to a lower value, for example 1%, everything works fine and Blender makes a scene within few minutes. However, if I leave it at 10 percent, it gets stuck. I tried giving it about 8 hours to see if it will load anything, but it didn't.

I haven't heard about instances so I haven't tried them, but I will look into that.

Thanks for the info.

$\endgroup$
5
  • 1
    $\begingroup$ Hello, could you post a snippet of the code responsible for appending the objects ? $\endgroup$
    – Gorgious
    Commented Jul 4 at 11:18
  • 1
    $\begingroup$ Tens of thousands of objects definitely sound like something that could severly slow Blender down. Do you know instances? Can't you optimize your scene by using them? $\endgroup$ Commented Jul 4 at 11:30
  • 1
    $\begingroup$ "My guess is that there is a number of objects in Blender after which the appending process becomes very slow." That seems like a given, large numbers of objects, high poly counts, no instancing are all well known to cause slowdowns on any application. You did not post your script, so we assume you don't want help with coding. You didn't show us the scene or tell us your goals so we can recommend alternatives. What exactly is your question? Did blender get stuck? Did you wait long enough? $\endgroup$ Commented Jul 4 at 11:47
  • $\begingroup$ A simple print statement would make it clear (in the system console) if the script continues to work. $\endgroup$ Commented Jul 4 at 14:05
  • $\begingroup$ You might want to use bpy.data.load for batch loading elements $\endgroup$
    – Gorgious
    Commented Jul 4 at 15:14

0

You must log in to answer this question.

Browse other questions tagged .