diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-13 16:51:40 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-13 16:51:40 +0400 |
commit | 50d05a2a584d13883568fa9b79922e87cc6b9359 (patch) | |
tree | a3cf7f410c638faad8cdab73ca4c8bedc6005b37 | |
parent | 5466befb38cf4ba21e4cf97f0318aaa7f2b10938 (diff) |
Disallow link/append when in edit mode
Linking changes active object which is pretty useful in general,
but which totally confuses edit mode (i.e. it becoming not so obvious
to leave from edit mode and inwalid tools in toolbar might be displayed)
so disable link/append when in edit mode
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 004b71307df..b6f59418f0a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1634,6 +1634,22 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) /* **************** link/append *************** */ +int wm_link_append_poll(bContext *C) +{ + if(WM_operator_winactive(C)) { + /* linking changes active object which is pretty useful in general, + but which totally confuses edit mode (i.e. it becoming not so obvious + to leave from edit mode and inwalid tools in toolbar might be displayed) + so disable link/append when in edit mode (sergey) */ + if(CTX_data_edit_object(C)) + return 0; + + return 1; + } + + return 0; +} + static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(RNA_property_is_set(op->ptr, "filepath")) { @@ -1796,7 +1812,7 @@ static void WM_OT_link_append(wmOperatorType *ot) ot->invoke= wm_link_append_invoke; ot->exec= wm_link_append_exec; - ot->poll= WM_operator_winactive; + ot->poll= wm_link_append_poll; ot->flag |= OPTYPE_UNDO; |