Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-21 07:33:34 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-21 07:33:34 +0400
commitf68b5505878d5ae63c83943ed29f04e89b64ea80 (patch)
tree126ead1cf9c4cf19553bb3f18cc2b6bf01bd8e9b /source/blender/editors
parent3fd388fb06e474a4e9e2f6816eb0a0b95ab433e7 (diff)
Fix #33241: can't exit edit mode when object gets hidden via animation.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_edit.c3
-rw-r--r--source/blender/editors/screen/screen_ops.c14
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c13
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;
}