Drag and drop parenting in outliner #27790

Closed
opened 2011-06-28 04:30:45 +02:00 by Perry Parks · 19 comments

%%%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.%%%

%%%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.%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

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

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

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

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

%%%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.%%%

%%%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.%%%
Author

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

http://dl.dropbox.com/u/1531862/drag_and_drop_v2.diff

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!%%%

%%%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: http://dl.dropbox.com/u/1531862/drag_and_drop_v2.diff 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!%%%
Author

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

http://dl.dropbox.com/u/1531862/drag_and_drop_v3.diff%%%

%%%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: http://dl.dropbox.com/u/1531862/drag_and_drop_v3.diff%%%

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

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

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

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

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

%%%hi 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 :)%%%
Author

%%%Yousef,

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:
http://dl.dropbox.com/u/1531862/Blender/drag_and_drop_v4.diff%%%

%%%Yousef, 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: http://dl.dropbox.com/u/1531862/Blender/drag_and_drop_v4.diff%%%

%%%thanks, for the last update, but know it gives this error:
http://www.pasteall.org/26094

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.%%%

%%%thanks, for the last update, but know it gives this error: http://www.pasteall.org/26094 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%%%

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

%%%Congrats and thanks for the patch!

Committed to SVN r.43601 :)%%%

%%%Congrats and thanks for the patch! Committed to SVN r.43601 :)%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Added subscriber: @Cenda

Added subscriber: @Cenda

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 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.

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

Added subscriber: @BDhanani

Added subscriber: @BDhanani

In #27790#201577, @Cenda wrote:
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.

Regards,
Bhadresh

> In #27790#201577, @Cenda wrote: > 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. Regards, Bhadresh
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#27790
No description provided.