2
$\begingroup$

After importing objects from 3DS Max (via fbx), I have a scene with

  • 60M tris, 40M faces
  • 4K objects (of which many empties, some without any children)
  • Around 2.5 gig, without any textures
  • Quite a few linked objects (i.e. repeating structures)

There are no subdivisions or other modifiers active, and adding / editing / navigating are all quite responsive. However, Undo, Merging objects and especially Deleting objects is incredibly slow. For example: now I've been waiting 20 minutes for the scene to delete 150 objects!

What am I doing wrong? How could I improve this situation?

I understand that undo will remain slow because of the file size.. It's mainly the deleting and merging that is annoying me.

$\endgroup$
4
  • 1
    $\begingroup$ Yes undo will be a killer. An oft posted link I'd Suggest creating a script Do the objects to be deleted has some naming convention, or another way they can be searched for? $\endgroup$
    – batFINGER
    Commented May 24, 2018 at 11:21
  • 2
    $\begingroup$ Split your scene into manageable chunks, save them in separate files. Use linking in a master file as much as possible $\endgroup$ Commented May 24, 2018 at 12:08
  • $\begingroup$ but would you say the problem is caused mostly by having many polygons, or by having many objects? $\endgroup$
    – Warner
    Commented May 24, 2018 at 14:06
  • 1
    $\begingroup$ Large amounts of objects cause severe slowdowns probably faster than high poly counts $\endgroup$ Commented May 24, 2018 at 18:01

1 Answer 1

1
$\begingroup$

Deleting objects in blender can be extremely slow depending on how you do it. I was writing a python script with over 10,000 objects and had to wait multiple minutes for blender to delete everything until I updated my code.

Originally, I was iterating over every object I wanted to delete, then calling unlink and delete on this object. A significantly faster way to do this is to just unlink every object. Even faster if you can just do it by an entire collection.

Bad Code (bottleneck):

def delete_cubeboard():
    # Flush any preexisting objects from collection
    # Extreme bottleneck
    start = time.time()
    for obj in bpy.data.collections.get('animatedcubes').objects:
        bpy.data.objects.remove(obj, do_unlink=True)
    end = time.time()
    print(f'Execute fn> delete_cubeboard:           {end-start}s', flush=True)

Good Code (faster)

def delete_cubeboard():
    start = time.time()
    
    scene = bpy.data.scenes['Scene']
    collection = bpy.data.collections['animatedcubes']
    scene.collection.children.unlink(collection)
    bpy.data.collections.remove(collection)
    
    targetcollection = bpy.data.collections.new("animatedcubes")
    bpy.context.scene.collection.children.link(targetcollection)
    
    # this deletes orphaned data    
    bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)
  
    end = time.time()
    print(f'Execute fn> delete_cubeboard:           {end-start}s', flush=True)

Time reduction: 390s -> 0.96s

Once you're sure it's been unlinked from every scene, it becomes orphaned data. Orphaned data automatically gets deleted by blender on exit. You can clear it manually with the function bpy.ops.outliner.orphans_purge

If you're not using python, you should also be able to apply this method in the GUI (outliner) as well. Unlink the objects you want to delete in the outliner, then purge orphan data (go to the orphan data section on your outliner, and press the button 'purge')

$\endgroup$
1
  • $\begingroup$ So cool to have an anwer to this.. after 5 years :D. Thanks Ioannis! $\endgroup$
    – Warner
    Commented Jul 21, 2023 at 7:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .