Page MenuHome

Add "Delete All" function to outliner context menu
Closed, ResolvedPublicPATCH


The attached patch add a "Delete All" function parallel to the already existing "Delete" function in the outliner context menu. "Delete All" delete the object and all child-objects of this object.

If you think this additional function is useful, please review it.


Event Timeline

I changed the text "Delete All" into "Delete Hierarchy" as requested.

I fixed a bug in this patch: when in edit mode and the parent object of the object which is currently edited is deleted, a SigSegV occured.

The modified patch check if the current edit object is part of the object hierarchy to delete. If this is the case, leave edit mode first, before starting to delete objects.

Updated to recent trunk, r46710

This patch add an additional context menu entry "Delete hierarchy" right after the normal "Delete" in the outliner to delete an object and all connected sub-objects. This is a "convenciene" function. E. g. when a complex object which contain a lot of sub-objects is loaded and should later be deleted "Delete hierarchy" can be used.

It would be nice if this patch could finally be integrated, though I can close it on my side and I do not have to keep it up-to-date manually.

Is this patch still maintained/alive?

Yes, the patch is alive. If you think it is useful I can renew the patch to the latest source version.

Let’s ask Joshua, he’s the maintainer of this area iirc. ;)


can i suggest a delete function which parents children of the deleted object to the upper next object:

This would help the reorganization/reordering in the same easy way.
Currently "delete" resolves the relationship completely - a bit strange.

Currently I'm renewing the patch with the current version of Blender (I still fight a little bit with building Blender, but I hope I can solve this soon)

I will also check if I can extend the patch to delete an object below some parent object.

Thank you, would be really nice.
But its just a suggestion, dont push yourself.

Dear Karja, dear Bastien, dear Joshua

I'm sorry for the long delay for creating an updated patch. I struggled for some time to get Blender compile again on my Ubuntu 12.04. Now it works again.

I updated the proposed patch for a function to delete a complete object hierarchy to the most recent revision of Blender (last commit 20aed660f5d852ea81ff42d1e998ebc74374900b).

I also added another delete function to the context menu which I named "Delete level". This delete function remove the selected object and re-add the children to the parent of the deleted object.
It would be nice if someone would be able to review the proposed patch. I'm looking forward that the patch will be accepted and finally can be closed.

@Torsten Rupp (rupp) thanks for the update. Aside from some minor style issues (which I will handle before final commit, but please try to follow, the 'delete hierarchy' part is OK. Can you please give me a (public) email address, so that I can commit it on your behalf?

The 'delete level' however is a nice idea, but is not so simple to implement correctly. Thing is, parenting in Blender is quite complex, with things like inverse parent matrix, parenting to curve/vertex(-tices)/armature/bone/… Simply re-affecting parent itself is not enough, we probably need a new ED_object_reparent() or something like that. So for now, I would just keep simple behavior of 'Delete' code (i.e. drop parenting all together).

Dear Bastien,

Thank you very much for the commit.

I'm sorry for my late answer.
If you still need a public email address:

I will check the coding styles again to create a better patch next time.