Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Patches: Browse

[#27790] Drag and drop parenting in outliner

Date:
2011-06-28 04:30
Priority:
3
State:
Closed
Submitted by:
Perry Parks (scuey)
Assigned to:
Nobody (None)
Category:
Interface
Group:
None
Resolution(Old, use status):
Approved
Resolution:
Patch for:
 
Summary:
Drag and drop parenting in outliner
Detailed description
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.

Followup

Message
  • Date: 2011-07-05 22:17
  • Sender: yousef harfoush
  • this does not compile with blender player on windows, i didn't check the other OS's
  • Date: 2011-07-07 05:55
  • Sender: Joshua Leung
  • 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.
  • Date: 2011-07-08 06:06
  • Sender: Perry Parks
  • 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!
  • Date: 2011-08-17 18:01
  • Sender: yousef harfoush
  • hi, there have been split in the outliner space files could you update your patches, thanks.
  • Date: 2011-08-18 20:34
  • Sender: Perry Parks
  • Yes, I know there have been changes. I can update soon.
  • Date: 2011-08-31 08:26
  • Sender: yousef harfoush
  • 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 :)
  • Date: 2011-09-08 23:25
  • Sender: Perry Parks
  • 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
  • Date: 2011-11-05 07:40
  • Sender: yousef harfoush
  • 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.
  • Date: 2011-12-10 06:50
  • Sender: yousef harfoush
  • updated to svn 42546, tested with scons and msvcsp1 on windows, file name -> outliner-drag_and_drop_v4_42546
  • Date: 2012-01-22 11:21
  • Sender: Joshua Leung
  • Congrats and thanks for the patch!

    Committed to SVN r.43601 :)
 

Attached Files:

Name Date Download
dragndrop_parenting.diff 2011-06-28 04:30 Download
outliner-drag_and_drop_v4_42546.patch 2011-12-10 06:50 Download

Changes:

Field Old Value Date By
ResolutionNew2012-01-22 11:21aligorith
status_idOpen2012-01-22 11:21aligorith
close_dateNone2012-01-22 11:21aligorith
File Added18700: outliner-drag_and_drop_v4_42546.patch2011-12-10 06:50bat3a
File Added16883: dragndrop_parenting.diff2011-06-28 04:30scuey