diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-11-21 07:33:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-11-21 07:33:34 +0400 |
commit | f68b5505878d5ae63c83943ed29f04e89b64ea80 (patch) | |
tree | 126ead1cf9c4cf19553bb3f18cc2b6bf01bd8e9b /source/blender/editors/screen | |
parent | 3fd388fb06e474a4e9e2f6816eb0a0b95ab433e7 (diff) |
Fix #33241: can't exit edit mode when object gets hidden via animation.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 6a9c24d2913..67d4af916aa 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -293,29 +293,35 @@ int ED_operator_console_active(bContext *C) return ed_spacetype_test(C, SPACE_CONSOLE); } +static int ed_object_hidden(Object *ob) +{ + /* if hidden but in edit mode, we still display, can happen with animation */ + return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT)); +} + int ED_operator_object_active(bContext *C) { Object *ob = ED_object_active_context(C); - return ((ob != NULL) && !(ob->restrictflag & OB_RESTRICT_VIEW)); + return ((ob != NULL) && !ed_object_hidden(ob)); } int ED_operator_object_active_editable(bContext *C) { Object *ob = ED_object_active_context(C); - return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW)); + return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob)); } int ED_operator_object_active_editable_mesh(bContext *C) { Object *ob = ED_object_active_context(C); - return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && + return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) && (ob->type == OB_MESH) && !(((ID *)ob->data)->lib)); } int ED_operator_object_active_editable_font(bContext *C) { Object *ob = ED_object_active_context(C); - return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && + return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) && (ob->type == OB_FONT)); } |