1
$\begingroup$

I'm working on an addon that adds or deletes objects. Sometimes this can be hundreds of objects. The problem is upon deleting 100 objects, the Info editor is filled with 100 lines of bpy.ops.object.delete() and the System Console is filled with 100 lines of "Info: Deleted 1 object(s)".

Is there any way to hide or silence this deletion?

if self.objects:
    for i in self.objects:
        ob = [self.scn.objects[i]]
        bpy.ops.object.delete({"selected_objects": ob})
        self.objects = []
$\endgroup$
2
$\begingroup$

Instead of using operator bpy.ops.object.delete(), you can try next code:

import bpy 
object_to_delete = bpy.data.objects['object_name_to_delete']
bpy.data.objects.remove(object_to_delete, do_unlink=True)

In this case, you get no messages about the object's deleting.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.