From e40f425619614ab3dae8544331f58b854031341d Mon Sep 17 00:00:00 2001 From: Diego Borghetti Date: Fri, 4 Jun 2010 19:31:14 +0000 Subject: Fix bug #22153 and #21609 Can't leave edit mode if you enter to edit mode and hide the object from the outliner. Also fix the problem if you hide the object and enter edit mode from the outliner. To avoid this problem you can't enter edit mode from the outliner if the object is not visible and also you can't hide the object from the outliner if the object is in edit mode. --- source/blender/editors/space_outliner/outliner.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_outliner') diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 6675b84b82b..235a5e00117 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -2457,7 +2457,13 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); else { - ED_object_enter_editmode(C, EM_WAITCURSOR); + Object *ob= CTX_data_active_object(C); + + /* Don't allow edit mode if the object is hide! + * check the bug #22153 and #21609 + */ + if (ob && (!(ob->restrictflag & OB_RESTRICT_VIEW))) + ED_object_enter_editmode(C, EM_WAITCURSOR); // XXX extern_set_butspace(F9KEY, 0); } } else { // rest of types @@ -4862,6 +4868,16 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) Base *base; Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; + Object *obedit= CTX_data_edit_object(C); + + /* Don't allow hide an objet in edit mode, + * check the bug #22153 and #21609 + */ + if (obedit && obedit == ob) { + if (ob->restrictflag & OB_RESTRICT_VIEW) + ob->restrictflag &= ~OB_RESTRICT_VIEW; + return; + } /* deselect objects that are invisible */ if (ob->restrictflag & OB_RESTRICT_VIEW) { -- cgit v1.2.3