diff options
-rw-r--r-- | source/blender/editors/object/object_edit.c | 3 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 13 |
3 files changed, 21 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 4d6b9ed10bb..d39e34824b9 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -550,7 +550,8 @@ static int editmode_toggle_poll(bContext *C) if (ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib) return 0; - if (ob->restrictflag & OB_RESTRICT_VIEW) + /* if hidden but in edit mode, we still display */ + if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT)) return 0; return (ob->type == OB_MESH || ob->type == OB_ARMATURE || 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)); } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index ec564e95c65..4964c0054ac 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1119,16 +1119,21 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return 1; } else if (CTX_data_equals(member, "active_base")) { - if (scene->basact && (scene->basact->lay & lay)) - if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0) + if (scene->basact && (scene->basact->lay & lay)) { + Object *ob = scene->basact->object; + /* if hidden but in edit mode, we still display, can happen with animation */ + if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT)) CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, scene->basact); + } return 1; } else if (CTX_data_equals(member, "active_object")) { - if (scene->basact && (scene->basact->lay & lay)) - if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0) + if (scene->basact && (scene->basact->lay & lay)) { + Object *ob = scene->basact->object; + if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT)) CTX_data_id_pointer_set(result, &scene->basact->object->id); + } return 1; } |