Drag and drop parenting in outliner
Closed, ArchivedPublic


This patch enables drag and drop parenting for objects in the outliner.

Drag and drop is supported for a selection of multiple objects as well. Also, all of the "special" parenting tasks (armature, curve, lattice) are possible through the usual parenting context menus. For example, drag a mesh object onto an armature and you are prompted for using bone envelopes, automatic weights, etc.

Note: exec function of the existing operator OBJECT_OT_parent_set are now API calls which take the parent object and parent type as arguments.



Demonstration on Vimeo: http://vimeo.com/25698606

this does not compile with blender player on windows, i didn't check the other OS's

Some comments:
- Code which depends deals with operators should generally be in editors NOT blenkernel. Operators are for UI editing operations, while blenkernel is more backend type stuff (including evaluation etc.).

Furthermore, you include headers for editors (ED_*.h) in blenkernel, which is bad coupling between these modules. Further evidence that this stuff is in the wrong place.

Probably the stuff in blenkernel/object.c could have gone into a relevant file in editors/object/, with the do_parent_set() method named something like ED_object_parent_set() and included in ED_object.h (and then make sure that outliner.c includes this header)

- You have two sets of #defines of the various parenting types defined twice in 2 places. I suggest placing this in an existing header file, perhaps ED_object.h, and making these defines an enum instead of individual macro-defines.

- Why are the forward defs needed in outliner.c? Unless I'm overlooking something, it should compile fine without.

Thanks for the comments Joshua! Yes, I should have realized this was the wrong place to put those methods. I guess I must not have fully understood the library layout at the time.

I've addressed all the points in your comments and have prepared another patch. This one also includes drag and drop parent clearing. Since I can't seem to be able to post an additional patch for this ticket (attachment submit gives errors), I'm temporarily linking to it on my Dropbox account:


Regarding the parent type #defines/enums, I've placed an enum (ParentType) in ED_object.h, then defined the operator properties in object_relations.c along with corresponding extern declarations in outliner.c. This seemed to be the only/best solution that I could see.

Let me know what you think!

I have a new patch which is current with svn r38308. Also updated the dropzone definition to include the (+) icon for clearing parents.

Patch is here:


hi, there have been split in the outliner space files could you update your patches, thanks.

Yes, I know there have been changes. I can update soon.

just wanting to know if you updated the patches else where, or if you didn't update them, lots of users want these you know :)


Yes, here is an updated patch for you. Sorry for the delay. I expected to get it done earlier but I had some other things to take care of.

Drag and drop operators now reside in outliner_edit.c. This seemed to me the most appropriate location since outliner_tools.c is primarily for right-click menu stuff.

At this point, one thing I was wondering about is my choice of tooltip on parenting and clear parent. Currently, I've left it as "Drop to Set Parent" and "Drop to Clear Parent." I'm thinking maybe it's just as well to simply use "Set Parent" and "Clear Parent."

Patch is here:

thanks, for the last update, but know it gives this error:

i tried to solve it, but the error happens on lines not changed from trunk!

i use window 7 scons, msvcp1 to build, svn of r41542.

updated to svn 42546, tested with scons and msvcsp1 on windows, file name -> outliner-drag_and_drop_v4_42546

Congrats and thanks for the patch!

Committed to SVN r.43601 :)

Joshua Leung (aligorith) closed this task as Archived.Jan 22 2012, 11:21 AM

is there any possibility select multiple objects in outliner by Border select and drag n drop for parent? Or how can I select multiple objects, without clicking on all with shift and parent.

I found that I can use border select for marking RMB and select. But it is time consuming.

is there any possibility select multiple objects in outliner by Border select and drag n drop for parent? Or how can I select multiple objects, without clicking on all with shift and parent.

Is it possible to select multiple objects and drag and drop for parent ?
If you know the trick, please let me know. I have started using blender recently and I need to know how to do it.