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.

Perry Parks (scuey) added a comment.Via Old WorldJun 28 2011, 7:32 AM

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

Yousef Harfoush (bat3a) added a comment.Via Old WorldJul 5 2011, 10:17 PM

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

Joshua Leung (aligorith) added a comment.Via Old WorldJul 7 2011, 5:55 AM

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.

Perry Parks (scuey) added a comment.Via Old WorldJul 8 2011, 6:06 AM

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!

Perry Parks (scuey) added a comment.Via Old WorldJul 11 2011, 6:19 PM

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:


Yousef Harfoush (bat3a) added a comment.Via Old WorldAug 17 2011, 6:01 PM

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

Perry Parks (scuey) added a comment.Via Old WorldAug 18 2011, 8:34 PM

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

Yousef Harfoush (bat3a) added a comment.Via Old WorldAug 31 2011, 8:26 AM

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 :)

Perry Parks (scuey) added a comment.Via Old WorldSep 8 2011, 11:25 PM


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:

Yousef Harfoush (bat3a) added a comment.Via Old WorldNov 5 2011, 7:40 AM

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.

Yousef Harfoush (bat3a) added a comment.Via Old WorldDec 10 2011, 6:50 AM

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

Joshua Leung (aligorith) added a comment.Via Old WorldJan 22 2012, 11:21 AM

Congrats and thanks for the patch!

Committed to SVN r.43601 :)

Joshua Leung (aligorith) closed this task as "Archived".Via Old WorldJan 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.

Cenek Strichel (cenda) added a comment.Via WebFeb 10 2014, 8:38 AM

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

Add Comment