diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-03 13:16:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-03 13:16:12 +0300 |
commit | 2745609ffd30f731d5146bd6c6940b34bae8d1ba (patch) | |
tree | c9ef8e2e77186a9c3b64bc2c204ef2ba70fb366f /source/blender | |
parent | ffc1bdca3b695e0538d3fbf79bf82c64a0a13427 (diff) |
[#20905] Blender 2.5 - Crash on drag an drop
Only allow dnd' adding objects in object mode.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/object/object_add.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index c60c7e4eac2..4830096cb61 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1695,6 +1695,20 @@ void OBJECT_OT_duplicate(wmOperatorType *ot) /* **************** add named object, for dragdrop ************* */ /* contextual operator dupli */ + +static int add_named_poll(bContext *C) +{ + if(!ED_operator_scene_editable(C)) { + return 0; + } else { + Object *ob= CTX_data_active_object(C); + if(ob && ob->mode != OB_MODE_OBJECT) + return 0; + else + return 1; + } +} + static int add_named_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -1745,7 +1759,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot) /* api callbacks */ ot->exec= add_named_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= add_named_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; |