diff options
author | Ton Roosendaal <ton@blender.org> | 2012-12-17 18:51:06 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2012-12-17 18:51:06 +0400 |
commit | 95225cf11057a985867f413f17871c53742eb5d0 (patch) | |
tree | 9c8ca685b210011cbad0900edc0c2ff36e8f724b /source/blender/blenkernel | |
parent | bf51b85871dd424d8481eb09a9fc217955ed35b1 (diff) |
Bug fix, IRC report.
With 2 windows, 2 scenes, linked objects:
- enter editmode in 1 window.
- the other window allowed to enter editmode too.
- and crash happened on exit editmode.
Since editmode is in Context (scene->obedit) a bad conflict arises.
New function BKE_object_is_in_editmode() returns this info outside of
context. Note I didn't use BMEdit_FromObject() because of the assert().
NOTE: contextual storage of editmode could need rework... five places:
- ob->mode / ob->restore_mode
- scene->object
- CTX_data_edit_object()
- BKE_object_is_in_editmode()
- view3d mode handling menu
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 44 |
2 files changed, 46 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 65b3b194553..885bb6f2a26 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -76,7 +76,8 @@ void BKE_object_copy_proxy_drivers(struct Object *ob, struct Object *target); void BKE_object_unlink(struct Object *ob); int BKE_object_exists_check(struct Object *obtest); - +int BKE_object_is_in_editmode(struct Object *ob); + struct Object *BKE_object_add_only_object(int type, const char *name); struct Object *BKE_object_add(struct Scene *scene, int type); void *BKE_object_obdata_add_from_type(int type); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 03f3fc13ce4..20a718e83cd 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -729,6 +729,50 @@ void BKE_object_unlink(Object *ob) } } +/* actual check for internal data, not context or flags */ +int BKE_object_is_in_editmode(Object *ob) +{ + if (ob->data == NULL) + return 0; + + if (ob->type == OB_MESH) { + Mesh *me = ob->data; + if (me->edit_btmesh) + return 1; + } + else if (ob->type == OB_ARMATURE) { + bArmature *arm = ob->data; + + if (arm->edbo) + return 1; + } + else if (ob->type == OB_FONT) { + Curve *cu = ob->data; + + if (cu->editfont) + return 1; + } + else if (ob->type == OB_MBALL) { + MetaBall *mb = ob->data; + + if (mb->editelems) + return 1; + } + else if (ob->type == OB_LATTICE) { + Lattice *lt = ob->data; + + if (lt->editlatt) + return 1; + } + else if (ob->type == OB_SURF || ob->type == OB_CURVE) { + Curve *cu = ob->data; + + if (cu->editnurb) + return 1; + } + return 0; +} + int BKE_object_exists_check(Object *obtest) { Object *ob; |