Check if the object is in editmode with (ob->mode==OB_MODE_EDIT) rather then (ob...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Oct 2009 11:36:29 +0000 (11:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Oct 2009 11:36:29 +0000 (11:36 +0000)
Was trying to fix a hard to redo crash with custom bone shapes in editmode but cant redo. still, will help with future multi-editmode.

source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/object.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c

index 5cd901066f89f793e7a7392cce7696f6bd669bbe..bb7a792943ee648fbd5ceeeb1dcee3ef6787fcf7 100644 (file)
@@ -549,7 +549,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
                                        /* mballs have a different dupli handling */
                                        if(ob->type!=OB_MBALL) ob->flag |= OB_DONE;     /* doesnt render */
 
-                                       if(par==scene->obedit) {
+                                       if(par->mode==OB_MODE_EDIT) {
                                                dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void*) &vdd);
                                        }
                                        else {
@@ -760,7 +760,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
                else            go= go->next;           /* group loop */
        }
        
-       if(par==scene->obedit) {
+       if(par->mode==OB_MODE_EDIT) {
                MEM_freeN(mface);
                MEM_freeN(mvert);
        }
index 55fb9f45bb36eb9fe4cb0510ad78100f7bfbef4b..f36713dd8a965e95842d01cb75be97dcc6187091 100644 (file)
@@ -9137,7 +9137,7 @@ int modifiers_isDeformed(Scene *scene, Object *ob)
        ModifierData *md = modifiers_getVirtualModifierList(ob);
        
        for (; md; md=md->next) {
-               if(ob==scene->obedit && (md->mode & eModifierMode_Editmode)==0);
+               if(ob->mode==OB_MODE_EDIT && (md->mode & eModifierMode_Editmode)==0);
                else 
                        if(modifier_isDeformer(md))
                                return 1;
index 579466ea6266dfdde7e52bc5ed20091f64942c08..ddf7e7ff4a3ef3b0e41aafbfc932f05e5c967ed4 100644 (file)
@@ -2367,7 +2367,7 @@ void object_handle_update(Scene *scene, Object *ob)
                                EditMesh *em = BKE_mesh_get_editmesh(ob->data);
 
                                        // here was vieweditdatamask? XXX
-                               if(ob==scene->obedit) {
+                               if(ob->mode==OB_MODE_EDIT) {
                                        makeDerivedMesh(scene, ob, em, CD_MASK_BAREMESH);
                                        BKE_mesh_end_editmesh(ob->data, em);
                                } else
index a4d7ae802f622d33e2f4639d075b0ae8db6dd831..dbe0844cbe55ad6d99c5f770fa4acce6166cd0c7 100644 (file)
@@ -350,7 +350,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
        int istex, solidtex= 0;
 
        // XXX scene->obedit warning
-       if(v3d->drawtype==OB_SOLID || (ob==scene->obedit && v3d->drawtype!=OB_TEXTURE)) {
+       if(v3d->drawtype==OB_SOLID || (ob->mode==OB_MODE_EDIT && v3d->drawtype!=OB_TEXTURE)) {
                /* draw with default lights in solid draw mode and edit mode */
                solidtex= 1;
                Gtexdraw.islit= -1;
@@ -561,7 +561,7 @@ void draw_mesh_text(Scene *scene, Object *ob, int glsl)
                return;
 
        /* don't draw when editing */
-       if(ob == scene->obedit)
+       if(ob->mode==OB_MODE_EDIT)
                return;
        else if(ob==OBACT)
                if(paint_facesel_test(ob))
@@ -641,7 +641,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
        /* draw the textured mesh */
        draw_textured_begin(scene, v3d, rv3d, ob);
 
-       if(ob == scene->obedit) {
+       if(ob->mode==OB_MODE_EDIT) {
                glColor4f(1.0f,1.0f,1.0f,1.0f);
                dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh);
        } else if(faceselect) {
index 1bad1b3215c1a8279d543b452135a8158010f47f..2d998c5ed5e65ed48a2f8404a423b5d9fc47c67c 100644 (file)
@@ -5512,7 +5512,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        if(ob==OBACT && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
                if(ob->type==OB_MESH) {
 
-                       if(ob==scene->obedit);
+                       if(ob->mode==OB_MODE_EDIT);
                        else {
                                if(dt<OB_SOLID)
                                        zbufoff= 1;
@@ -5534,7 +5534,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        if(dt>=OB_BOUNDBOX ) {
 
                dtx= ob->dtx;
-               if(scene->obedit==ob) {
+               if(ob->mode==OB_MODE_EDIT) {
                        // the only 2 extra drawtypes alowed in editmode
                        dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE);
                }
@@ -5550,7 +5550,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        
        /* draw outline for selected solid objects, mesh does itself */
        if((v3d->flag & V3D_SELECT_OUTLINE) && ob->type!=OB_MESH) {
-               if(dt>OB_WIRE && dt<OB_TEXTURE && ob!=scene->obedit && (flag && DRAW_SCENESET)==0) {
+               if(dt>OB_WIRE && dt<OB_TEXTURE && ob->mode!=OB_MODE_EDIT && (flag && DRAW_SCENESET)==0) {
                        if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) {
                                
                                drawSolidSelect(scene, v3d, ar, base);
@@ -6159,7 +6159,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
        switch( ob->type) {
        case OB_MESH:
        {
-               if(ob == scene->obedit) {
+               if(ob->mode==OB_MODE_EDIT) {
                        Mesh *me= ob->data;
                        EditMesh *em= me->edit_mesh;
 
@@ -6215,7 +6215,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
        DerivedMesh *dm=NULL, *edm=NULL;
        int glsl;
        
-       if(ob == scene->obedit)
+       if(ob->mode == OB_MODE_EDIT)
                edm= editmesh_get_derived_base(ob, me->edit_mesh);
        else 
                dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);