diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-03-12 12:51:49 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-03-20 15:24:05 +0300 |
commit | 36b55bee4247565b3e5a7237672bbdc2237447f0 (patch) | |
tree | f405ab688c46473b0e8a747ca8dc455a7e6d35df /source/blender/editors/space_outliner/outliner_dragdrop.c | |
parent | 27553a2e4e03f6f7dfbb91bdeeffb108b9a05f1b (diff) |
Fix T74649: Outliner: Cannot set/clear parent with 'Keep Transforms'
Parenting in the outliner via drang and drop would always happen without
the 'Keep Transforms' option. Since this is often desired, this adds the
ability to hold Alt for doing this to the drop action.
Adding the hint to hold Alt to the operator name is not nice, but since
the operator name is used for the UI, there doesnt seem to be a nicer
way of doing this.
If modifier keys are needed back for other actions, spawning a menu
instead could be an alternative for the future.
Maniphest Tasks: T74649
Differential Revision: https://developer.blender.org/D7120
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_dragdrop.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_dragdrop.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 32ead9e8c3f..8aeeef277f7 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -325,8 +325,12 @@ static bool parent_drop_poll(bContext *C, return false; } -static void parent_drop_set_parents( - bContext *C, ReportList *reports, wmDragID *drag, Object *parent, short parent_type) +static void parent_drop_set_parents(bContext *C, + ReportList *reports, + wmDragID *drag, + Object *parent, + short parent_type, + const bool keep_transform) { Main *bmain = CTX_data_main(C); SpaceOutliner *soops = CTX_wm_space_outliner(C); @@ -357,7 +361,7 @@ static void parent_drop_set_parents( } if (ED_object_parent_set( - reports, C, scene, object, parent, parent_type, false, false, NULL)) { + reports, C, scene, object, parent, parent_type, false, keep_transform, NULL)) { parent_set = true; } } @@ -400,7 +404,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) ListBase *lb = event->customdata; wmDrag *drag = lb->first; - parent_drop_set_parents(C, op->reports, drag->ids.first, par, PAR_OBJECT); + parent_drop_set_parents(C, op->reports, drag->ids.first, par, PAR_OBJECT, event->alt); return OPERATOR_FINISHED; } @@ -408,7 +412,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event) void OUTLINER_OT_parent_drop(wmOperatorType *ot) { /* identifiers */ - ot->name = "Drop to Set Parent"; + ot->name = "Drop to Set Parent [+Alt keeps transforms]"; ot->description = "Drag to parent in Outliner"; ot->idname = "OUTLINER_OT_parent_drop"; @@ -481,7 +485,7 @@ static int parent_clear_invoke(bContext *C, wmOperator *UNUSED(op), const wmEven if (GS(drag_id->id->name) == ID_OB) { Object *object = (Object *)drag_id->id; - ED_object_parent_clear(object, 0); + ED_object_parent_clear(object, event->alt ? CLEAR_PARENT_KEEP_TRANSFORM : CLEAR_PARENT_ALL); } } @@ -494,7 +498,7 @@ static int parent_clear_invoke(bContext *C, wmOperator *UNUSED(op), const wmEven void OUTLINER_OT_parent_clear(wmOperatorType *ot) { /* identifiers */ - ot->name = "Drop to Clear Parent"; + ot->name = "Drop to Clear Parent [+Alt keeps transforms]"; ot->description = "Drag to clear parent in Outliner"; ot->idname = "OUTLINER_OT_parent_clear"; |