diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 08:11:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 08:11:01 +0400 |
commit | f72c668c073ebb9f6c46511b4fcc6f61f6ae74ea (patch) | |
tree | 5267a2774c081fb275922c14bc237756936b7bb3 /source | |
parent | 502081879bee45d0def27e1290ffa45feb3fd6f3 (diff) |
add back feature from 2.4x - Shift+Del to delete objects from all scenes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/object/object_add.c | 21 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 3 |
2 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9b539871cbc..a6d3365ad8a 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -885,10 +885,11 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) MEM_freeN(base); } -static int object_delete_exec(bContext *C, wmOperator *UNUSED(op)) +static int object_delete_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + const short use_global= RNA_boolean_get(op->ptr, "global"); /* int islamp= 0; */ /* UNUSED */ if(CTX_data_edit_object(C)) @@ -903,6 +904,22 @@ static int object_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* remove from current scene only */ ED_base_object_free_and_unlink(bmain, scene, base); + + if (use_global) { + Scene *scene_iter; + Base *base_other; + + for (scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) { + if (scene_iter != scene && !(scene_iter->id.lib)) { + base_other= object_in_scene(base->object, scene_iter); + if (base_other) { + ED_base_object_free_and_unlink(bmain, scene_iter, base_other); + } + } + } + } + /* end global */ + } CTX_DATA_END; @@ -929,6 +946,8 @@ void OBJECT_OT_delete(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "global", 0, "Delete Globally", "Remove object from all scenes"); } /**************************** Copy Utilities ******************************/ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 56c75331d48..b7fe2d70b37 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -338,7 +338,10 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OBJECT_OT_move_to_layer", MKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "global", TRUE); WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "global", TRUE); + WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); |