diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-02 22:10:35 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-02 22:10:35 +0300 |
commit | a6721c60d9bc0897e3ce0dc87264fbc705284397 (patch) | |
tree | 12dd77160bcfaa4b37e85a5e8ed29496bb6c0705 /source/blender/editors/space_view3d | |
parent | 16ca4b572e07aa0f83158c187a7c64b27675d4c9 (diff) |
2.5
From the anti-globalization department:
G.obedit terminated!
Wherever possible, use CTX_data_edit_object(C) to get this
now. It's stored in scene now, and the screen context has
it defined.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 122 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 39 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 14 |
9 files changed, 126 insertions, 117 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index c9307f8e1fb..b1b1f504920 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2516,8 +2516,8 @@ int draw_armature(Scene *scene, View3D *v3d, Base *base, int dt, int flag) /* arm->flag is being used to detect mode... */ /* editmode? */ - if(ob==G.obedit || (G.obedit && ob->data==G.obedit->data)) { - if(ob==G.obedit) arm->flag |= ARM_EDITMODE; + if(arm->edbo) { + arm->flag |= ARM_EDITMODE; draw_ebones(v3d, ob, dt); arm->flag &= ~ARM_EDITMODE; } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 53487ca79ff..ad62329f8fc 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -340,7 +340,8 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, Object *ob) unsigned char obcol[4]; int istex, solidtex= 0; - if(v3d->drawtype==OB_SOLID || (ob==G.obedit && v3d->drawtype!=OB_TEXTURE)) { + // XXX scene->obedit warning + if(v3d->drawtype==OB_SOLID || (ob==scene->obedit && v3d->drawtype!=OB_TEXTURE)) { /* draw with default lights in solid draw mode and edit mode */ solidtex= 1; Gtexdraw.islit= -1; @@ -470,7 +471,7 @@ void draw_mesh_text(Scene *scene, Object *ob, int glsl) return; /* don't draw when editing */ - if(ob==G.obedit) + if(me->edit_mesh) return; else if(ob==OBACT) if(FACESEL_PAINT_TEST) @@ -568,7 +569,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, Object *ob, DerivedMesh *dm, draw_textured_end(); /* draw edges and selected faces over textured mesh */ - if(!G.obedit && faceselect) + if(!me->edit_mesh && faceselect) draw_tfaces3D(v3d, ob, me, dm); /* reset from negative scale correction */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 70435e54e9d..963eaf15c48 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -144,7 +144,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt) (G.fileflags & G_FILE_GAME_MAT_GLSL) && (dt >= OB_SHADED)); } -static int check_material_alpha(Base *base, Object *ob, int glsl) +static int check_material_alpha(Base *base, Mesh *me, int glsl) { if(base->flag & OB_FROMDUPLI) return 0; @@ -152,10 +152,10 @@ static int check_material_alpha(Base *base, Object *ob, int glsl) if(G.f & G_PICKSEL) return 0; - if(G.obedit && G.obedit->data==ob->data) + if(me->edit_mesh) return 0; - return (glsl || (ob->dtx & OB_DRAWTRANSP)); + return (glsl || (base->object->dtx & OB_DRAWTRANSP)); } /***/ @@ -1084,7 +1084,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel) void lattice_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BPoint *bp, int x, int y), void *userData) { BPoint *bp = editLatt->def; - DispList *dl = find_displist(&G.obedit->disp, DL_VERTS); + DispList *dl = find_displist(&vc->obedit->disp, DL_VERTS); float *co = dl?dl->verts:NULL; float pmat[4][4], vmat[4][4]; int i, N = editLatt->pntsu*editLatt->pntsv*editLatt->pntsw; @@ -1125,19 +1125,17 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i /* lattice color is hardcoded, now also shows weightgroup values in edit mode */ static void drawlattice(View3D *v3d, Object *ob) { - Lattice *lt; + Lattice *lt= ob->data; DispList *dl; int u, v, w; int use_wcol= 0; - lt= (ob==G.obedit)?editLatt:ob->data; - /* now we default make displist, this will modifiers work for non animated case */ if(ob->disp.first==NULL) lattice_calc_modifiers(ob); dl= find_displist(&ob->disp, DL_VERTS); - if(ob==G.obedit) { + if(lt->editlatt) { cpack(0x004000); if(ob->defbase.first && lt->dvert) { @@ -1146,6 +1144,8 @@ static void drawlattice(View3D *v3d, Object *ob) } } + if(lt->editlatt) lt= lt->editlatt; + glBegin(GL_LINES); for(w=0; w<lt->pntsw; w++) { int wxt = (w==0 || w==lt->pntsw-1); @@ -1175,7 +1175,7 @@ static void drawlattice(View3D *v3d, Object *ob) if(use_wcol) glShadeModel(GL_FLAT); - if(ob==G.obedit) { + if( ((Lattice *)ob->data)->editlatt ) { if(v3d->zbuf) glDisable(GL_DEPTH_TEST); lattice_draw_verts(lt, dl, 0); @@ -1207,7 +1207,7 @@ static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co void mesh_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, EditVert *eve, int x, int y, int index), void *userData, int clipVerts) { struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } data; - DerivedMesh *dm = editmesh_get_derived_cage(vc->em, CD_MASK_BAREMESH); + DerivedMesh *dm = editmesh_get_derived_cage(vc->obedit, vc->em, CD_MASK_BAREMESH); data.vc= *vc; data.func = func; @@ -1251,7 +1251,7 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0 void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts) { struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } data; - DerivedMesh *dm = editmesh_get_derived_cage(vc->em, CD_MASK_BAREMESH); + DerivedMesh *dm = editmesh_get_derived_cage(vc->obedit, vc->em, CD_MASK_BAREMESH); data.vc= *vc; data.func = func; @@ -1283,7 +1283,7 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *ce void mesh_foreachScreenFace(ViewContext *vc, void (*func)(void *userData, EditFace *efa, int x, int y, int index), void *userData) { struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; ViewContext vc; float pmat[4][4], vmat[4][4]; } data; - DerivedMesh *dm = editmesh_get_derived_cage(vc->em, CD_MASK_BAREMESH); + DerivedMesh *dm = editmesh_get_derived_cage(vc->obedit, vc->em, CD_MASK_BAREMESH); data.vc= *vc; data.func = func; @@ -1648,7 +1648,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm) /* EditMesh drawing routines*/ -static void draw_em_fancy_verts(Scene *scene, View3D *v3d, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act) +static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act) { int sel; @@ -1687,7 +1687,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, EditMesh *em, Derived draw_dm_verts(cageDM, sel, eve_act); } - if( CHECK_OB_DRAWFACEDOT(scene, v3d, G.obedit->dt) ) { + if( CHECK_OB_DRAWFACEDOT(scene, v3d, obedit->dt) ) { glPointSize(fsize); glColor4ubv((GLubyte *)fcol); draw_dm_face_centers(cageDM, sel); @@ -2083,10 +2083,10 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, Object *ob, EditMesh *em, D draw_em_fancy_edges(scene, v3d, cageDM, 0, eed_act); } - if(ob==G.obedit) { + if(em) { // XXX retopo_matrix_update(v3d); - draw_em_fancy_verts(scene, v3d, em, cageDM, eve_act); + draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act); if(G.f & G_DRAWNORMALS) { UI_ThemeColor(TH_NORMAL); @@ -2354,22 +2354,23 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, Base *base, int dt, int f static int draw_mesh_object(Scene *scene, View3D *v3d, Base *base, int dt, int flag) { Object *ob= base->object; + Object *obedit= scene->obedit; // XXX hrumf, see below Mesh *me= ob->data; EditMesh *em= me->edit_mesh; int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha; - if(G.obedit && ob!=G.obedit && ob->data==G.obedit->data) { + if(obedit && ob!=obedit && ob->data==obedit->data) { if(ob_get_key(ob)); else drawlinked= 1; } - if(ob==G.obedit || drawlinked) { + if(ob==obedit || drawlinked) { DerivedMesh *finalDM, *cageDM; - if (G.obedit!=ob) - finalDM = cageDM = editmesh_get_derived_base(em); + if (obedit!=ob) + finalDM = cageDM = editmesh_get_derived_base(ob, em); else - cageDM = editmesh_get_derived_cage_and_final(em, &finalDM, + cageDM = editmesh_get_derived_cage_and_final(ob, em, &finalDM, get_viewedit_datamask()); if(dt>OB_WIRE) { @@ -2380,10 +2381,10 @@ static int draw_mesh_object(Scene *scene, View3D *v3d, Base *base, int dt, int f draw_em_fancy(scene, v3d, ob, em, cageDM, finalDM, dt); - if (G.obedit!=ob && finalDM) + if (obedit!=ob && finalDM) finalDM->release(finalDM); } -// else if(!G.obedit && (G.f & G_SCULPTMODE) &&(scene->sculptdata.flags & SCULPT_DRAW_FAST) && +// else if(!em && (G.f & G_SCULPTMODE) &&(scene->sculptdata.flags & SCULPT_DRAW_FAST) && // OBACT==ob && !sculpt_modifiers_active(ob)) { // XXX sculptmode_draw_mesh(0); // } @@ -2391,7 +2392,7 @@ static int draw_mesh_object(Scene *scene, View3D *v3d, Base *base, int dt, int f /* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */ if(me->totface<=4 || boundbox_clip(v3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) { glsl = draw_glsl_material(scene, ob, v3d, dt); - check_alpha = check_material_alpha(base, ob, glsl); + check_alpha = check_material_alpha(base, me, glsl); if(dt==OB_SOLID || glsl) { GPU_set_object_materials(v3d, scene, ob, glsl, @@ -2721,7 +2722,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt) glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); } - if(ob==G.obedit && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0 && cu->ext2 == 0.0) { + if(cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0 && cu->ext2 == 0.0) { cpack(0); draw_index_wire= 0; drawDispListwire(lb); @@ -2844,7 +2845,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, Base *base, Part if(pars==0) return; - if(!G.obedit && psys_in_edit_mode(psys) + // XXX what logic is this? + if(!scene->obedit && psys_in_edit_mode(psys) && psys->flag & PSYS_HAIR_DONE && part->draw_as==PART_DRAW_PATH) return; @@ -4175,10 +4177,10 @@ static int drawmball(Scene *scene, View3D *v3d, Base *base, int dt) mb= ob->data; - if(ob==G.obedit) { + if(mb->editelems) { UI_ThemeColor(TH_WIRE); if((G.f & G_PICKSEL)==0 ) drawDispList(scene, v3d, base, dt); - ml= editelems.first; + ml= mb->editelems->first; } else { if((base->flag & OB_FROMDUPLI)==0) @@ -4189,7 +4191,7 @@ static int drawmball(Scene *scene, View3D *v3d, Base *base, int dt) if(ml==NULL) return 1; /* in case solid draw, reset wire colors */ - if(ob!=G.obedit && (ob->flag & SELECT)) { + if(mb->editelems && (ob->flag & SELECT)) { if(ob==OBACT) UI_ThemeColor(TH_ACTIVE); else UI_ThemeColor(TH_SELECT); } @@ -4203,7 +4205,7 @@ static int drawmball(Scene *scene, View3D *v3d, Base *base, int dt) while(ml) { /* draw radius */ - if(ob==G.obedit) { + if(mb->editelems) { if((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0); else cpack(0x3030A0); @@ -4215,7 +4217,7 @@ static int drawmball(Scene *scene, View3D *v3d, Base *base, int dt) drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad, imat); /* draw stiffness */ - if(ob==G.obedit) { + if(mb->editelems) { if((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0); else cpack(0x30A030); @@ -4242,7 +4244,8 @@ static void draw_forcefield(Scene *scene, Object *ob) if(G.f & G_RENDER_SHADOW) return; - if(ob!=G.obedit && (ob->flag & SELECT)) { + /* XXX why? */ + if(ob!=scene->obedit && (ob->flag & SELECT)) { if(ob==OBACT) curcol= TH_ACTIVE; else curcol= TH_SELECT; } @@ -4575,7 +4578,8 @@ static void drawSolidSelect(Scene *scene, View3D *v3d, Base *base) static void drawWireExtra(Scene *scene, View3D *v3d, Object *ob) { - if(ob!=G.obedit && (ob->flag & SELECT)) { + // XXX scene->obedit warning + if(ob!=scene->obedit && (ob->flag & SELECT)) { if(ob==OBACT) { if(ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP_ACTIVE); else UI_ThemeColor(TH_ACTIVE); @@ -4705,7 +4709,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) ob= base->object; - if (ob!=G.obedit) { + /* XXX ermfh... */ + if (ob!=scene->obedit) { if (ob->restrictflag & OB_RESTRICT_VIEW) return; } @@ -4724,7 +4729,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* draw keys? */ if(base==(scene->basact) || (base->flag & (SELECT+BA_WAS_SEL))) { - if(flag==0 && warning_recursive==0 && ob!=G.obedit) { + if(flag==0 && warning_recursive==0 && ob!=scene->obedit) { if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { ListBase elems; CfraElem *ce; @@ -4856,7 +4861,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(ob==OBACT && (G.f & (G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) { if(ob->type==OB_MESH) { - if(ob==G.obedit); + if(ob==scene->obedit); else { if(dt<OB_SOLID) zbufoff= 1; @@ -4878,7 +4883,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dt>=OB_BOUNDBOX ) { dtx= ob->dtx; - if(G.obedit==ob) { + if(scene->obedit==ob) { // the only 2 extra drawtypes alowed in editmode dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE); } @@ -4890,7 +4895,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!=G.obedit && (flag && DRAW_SCENESET)==0) { + if(dt>OB_WIRE && dt<OB_TEXTURE && ob!=scene->obedit && (flag && DRAW_SCENESET)==0) { if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) { drawSolidSelect(scene, v3d, base); } @@ -4908,7 +4913,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) case OB_FONT: cu= ob->data; if (cu->disp.first==NULL) makeDispListCurveTypes(ob, 0); - if(ob==G.obedit) { + if(cu->editstr) { tekentextcurs(); if (cu->flag & CU_FAST) { @@ -4963,7 +4968,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) setlinestyle(0); - if (getselection(&selstart, &selend) && selboxes) { + if (getselection(ob, &selstart, &selend) && selboxes) { float selboxw; cpack(0xffffff); @@ -5002,8 +5007,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* still needed for curves hidden in other layers. depgraph doesnt handle that yet */ if (cu->disp.first==NULL) makeDispListCurveTypes(ob, 0); - if(ob==G.obedit) { - drawnurb(scene, v3d, base, editNurb.first, dt); + if(cu->editnurb) { + drawnurb(scene, v3d, base, cu->editnurb->first, dt); } else if(dt==OB_BOUNDBOX) draw_bounding_volume(ob); @@ -5015,13 +5020,17 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } break; case OB_MBALL: - if(ob==G.obedit) + { + MetaBall *mb= ob->data; + + if(mb->editelems) drawmball(scene, v3d, base, dt); else if(dt==OB_BOUNDBOX) draw_bounding_volume(ob); else empty_object= drawmball(scene, v3d, base, dt); break; + } case OB_EMPTY: drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); break; @@ -5049,7 +5058,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if( (warning_recursive==0) && (ob->particlesystem.first) && (flag & DRAW_PICKING)==0 && - (ob!=G.obedit) + (ob!=scene->obedit) ) { ParticleSystem *psys; if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */ @@ -5060,7 +5069,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(G.f & G_PARTICLEEDIT && ob==OBACT) { psys= NULL; // XXX PE_get_current(ob); - if(psys && !G.obedit && psys_in_edit_mode(psys)) + if(psys && !scene->obedit && psys_in_edit_mode(psys)) draw_particle_edit(scene, v3d, ob, psys, dt); } glDepthMask(GL_TRUE); @@ -5156,10 +5165,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) ListBase *list; /* draw hook center and offset line */ - if(ob!=G.obedit) draw_hooks(ob); + if(ob!=scene->obedit) draw_hooks(ob); /* help lines and so */ - if(ob!=G.obedit && ob->parent && (ob->parent->lay & v3d->lay)) { + if(ob!=scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) { setlinestyle(3); glBegin(GL_LINES); glVertex3fv(ob->obmat[3]); @@ -5317,14 +5326,14 @@ static void bbs_mesh_solid__drawCenter(void *userData, int index, float *cent, f } /* two options, facecolors or black */ -static int bbs_mesh_solid_EM(Scene *scene, View3D *v3d, DerivedMesh *dm, int facecol) +static int bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh *dm, int facecol) { cpack(0); if (facecol) { dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0); - if( CHECK_OB_DRAWFACEDOT(scene, v3d, G.obedit->dt) ) { + if( CHECK_OB_DRAWFACEDOT(scene, v3d, ob->dt) ) { glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); bglBegin(GL_POINTS); @@ -5373,14 +5382,15 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, Object *ob) switch( ob->type) { case OB_MESH: - if(ob==G.obedit) { - Mesh *me= ob->data; - EditMesh *em= me->edit_mesh; - DerivedMesh *dm = editmesh_get_derived_cage(em, CD_MASK_BAREMESH); + { + Mesh *me= ob->data; + EditMesh *em= me->edit_mesh; + if(em) { + DerivedMesh *dm = editmesh_get_derived_cage(ob, em, CD_MASK_BAREMESH); EM_init_index_arrays(em, 1, 1, 1); - em_solidoffs= bbs_mesh_solid_EM(scene, v3d, dm, scene->selectmode & SCE_SELECT_FACE); + em_solidoffs= bbs_mesh_solid_EM(scene, v3d, ob, dm, scene->selectmode & SCE_SELECT_FACE); bglPolygonOffset(v3d->dist, 1.0); @@ -5399,7 +5409,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, Object *ob) EM_free_index_arrays(); } else bbs_mesh_solid(ob); - + } break; case OB_CURVE: case OB_SURF: @@ -5421,7 +5431,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, Object *ob, int int glsl; if(me->edit_mesh) - edm= editmesh_get_derived_base(me->edit_mesh); + edm= editmesh_get_derived_base(ob, me->edit_mesh); else dm = mesh_get_derived_final(ob, CD_MASK_BAREMESH); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 232b9d9d974..a70a6ab8fd8 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -351,10 +351,6 @@ static int view3d_context(const bContext *C, const bContextDataMember *member, b return 1; } - else if(member == CTX_data_edit_object) { - CTX_data_pointer_set(result, G.obedit); - return 1; - } return 0; } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index ad18f6675a3..90840533d55 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -370,7 +370,7 @@ static void drawgrid(ARegion *ar, View3D *v3d) } -static void drawfloor(View3D *v3d) +static void drawfloor(Scene *scene, View3D *v3d) { float vert[3], grid; int a, gridlines, emphasise; @@ -381,7 +381,7 @@ static void drawfloor(View3D *v3d) if(v3d->gridlines<3) return; - if(v3d->zbuf && G.obedit) glDepthMask(0); // for zbuffer-select + if(v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select gridlines= v3d->gridlines/2; grid= gridlines*v3d->grid; @@ -489,7 +489,7 @@ static void drawfloor(View3D *v3d) glEnd(); } - if(v3d->zbuf && G.obedit) glDepthMask(1); + if(v3d->zbuf && scene->obedit) glDepthMask(1); } @@ -740,7 +740,7 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d) char *name= NULL; /* show name of active bone too (if possible) */ - if(ob==G.obedit) { + if(arm->edbo) { // XXX EditBone *ebo; // for (ebo=G.edbo.first; ebo; ebo=ebo->next){ // if ((ebo->flag & BONE_ACTIVE) && (ebo->layer & arm->layer)) { @@ -1055,7 +1055,7 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) #endif if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT); - else if(G.obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); + else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); else { v3d->flag &= ~V3D_NEEDBACKBUFDRAW; return; @@ -1081,7 +1081,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) #endif if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE; -// ar->win_swap &= ~WIN_BACK_OK; glDisable(GL_DITHER); @@ -1872,7 +1871,7 @@ void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d) v3d->gridview= v3d->grid; if(v3d->view==0 || v3d->persp!=0) { - drawfloor(v3d); + drawfloor(scene, v3d); if(v3d->persp==2) { if(scene->world) { if(scene->world->mode & WO_STARS) { @@ -1927,21 +1926,21 @@ void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d) draw_dupli_objects(scene, ar, v3d, base); } if((base->flag & SELECT)==0) { - if(base->object!=G.obedit) + if(base->object!=scene->obedit) draw_object(scene, ar, v3d, base, 0); } } } // retopo= retopo_mesh_check() || retopo_curve_check(); -// sculptparticle= (G.f & (G_SCULPTMODE|G_PARTICLEEDIT)) && !G.obedit; +// sculptparticle= (G.f & (G_SCULPTMODE|G_PARTICLEEDIT)) && !obedit; if(retopo) view3d_update_depths(ar, v3d); /* draw selected and editmode */ for(base= scene->base.first; base; base= base->next) { if(v3d->lay & base->lay) { - if (base->object==G.obedit || ( base->flag & SELECT) ) + if (base->object==scene->obedit || ( base->flag & SELECT) ) draw_object(scene, ar, v3d, base, 0); } } @@ -1954,7 +1953,7 @@ void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d) if(G.moving) { // BIF_drawConstraint(); -// if(G.obedit || (G.f & G_PARTICLEEDIT)) +// if(obedit || (G.f & G_PARTICLEEDIT)) // BIF_drawPropCircle(); // only editmode and particles have proportional edit // BIF_drawSnap(); } @@ -2025,7 +2024,7 @@ void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d) // XXX addafterqueue(ar->win, BACKBUFDRAW, 1); } // test for backbuf select - if(G.obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) { + if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) { v3d->flag |= V3D_NEEDBACKBUFDRAW; // XXX if(afterqtest(ar->win, BACKBUFDRAW)==0) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index a5b9e483201..a5ea2a83b77 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -755,6 +755,7 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with View3D *v3d= sa->spacedata.first; Scene *scene= CTX_data_scene(C); Object *ob= OBACT; + Object *obedit= CTX_data_edit_object(C); float size, min[3], max[3], afm[3]; int ok=0; @@ -780,7 +781,7 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with } - if(G.obedit) { + if(obedit) { // XXX ok = minmax_verts(min, max); /* only selected */ } else if(ob && (ob->flag & OB_POSEMODE)) { @@ -1452,12 +1453,12 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event) ARegion *ar= CTX_wm_region(C); View3D *v3d= (View3D *)CTX_wm_space_data(C); float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3]; - short mx, my, lr_click=0, mval[2]; - short ctrl= 0; // XXX + short mx, my, mval[2]; +// short ctrl= 0; // XXX fp= give_cursor(scene, v3d); - if(G.obedit && ctrl) lr_click= 1; +// if(obedit && ctrl) lr_click= 1; VECCOPY(oldcurs, fp); mx= event->x - ar->winrct.xmin; @@ -1484,12 +1485,12 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event) fp[2]= (v3d->persinv[0][2]*dx + v3d->persinv[1][2]*dy+ v3d->persinv[2][2]*fz)-v3d->ofs[2]; } - if(lr_click) { - // XXX if(G.obedit->type==OB_MESH) add_click_mesh(); - // else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) addvert_Nurb(0); - // else if (G.obedit->type==OB_ARMATURE) addvert_armature(); - VECCOPY(fp, oldcurs); - } +// if(lr_click) { + // XXX if(obedit->type==OB_MESH) add_click_mesh(); + // else if ELEM(obedit->type, OB_CURVE, OB_SURF) addvert_Nurb(0); + // else if (obedit->type==OB_ARMATURE) addvert_armature(); +// VECCOPY(fp, oldcurs); +// } // XXX notifier for scene */ ED_region_tag_redraw(ar); @@ -1812,7 +1813,7 @@ void viewmoveNDOF(Scene *scene, View3D *v3d, int mode) v3d->view = 0; //printf("passing here \n"); // - if (G.obedit==NULL && ob && !(ob->flag & OB_POSEMODE)) { + if (scene->obedit==NULL && ob && !(ob->flag & OB_POSEMODE)) { use_sel = 1; } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 06eb00d75c8..3de551a516a 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -73,6 +73,7 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "BIF_transform.h" #include "BLI_arithb.h" #include "BLI_blenlib.h" @@ -5445,7 +5446,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event) em->selectmode= SCE_SELECT_VERTEX; scene->selectmode= em->selectmode; EM_selectmode_set(em); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, G.obedit); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Vertex"); } break; @@ -5459,7 +5460,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event) } scene->selectmode= em->selectmode; EM_selectmode_set(em); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, G.obedit); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Edge"); } break; @@ -5473,7 +5474,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event) } scene->selectmode= em->selectmode; EM_selectmode_set(em); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, G.obedit); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Face"); } break; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 33ac9a64968..8fa54c7c7ad 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -569,10 +569,10 @@ static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short m for (ebone=G.edbo.first; ebone; ebone=ebone->next) { VECCOPY(vec, ebone->head); - Mat4MulVecfl(G.obedit->obmat, vec); + Mat4MulVecfl(vc->obedit->obmat, vec); project_short(vc->ar, vc->v3d, vec, sco1); VECCOPY(vec, ebone->tail); - Mat4MulVecfl(G.obedit->obmat, vec); + Mat4MulVecfl(vc->obedit->obmat, vec); project_short(vc->ar, vc->v3d, vec, sco2); didpoint= 0; @@ -649,7 +649,7 @@ static void do_lasso_select_node(short mcords[][2], short moves, short select) void view3d_lasso_select(ViewContext *vc, short mcords[][2], short moves, short select) { - if(G.obedit==NULL) { + if(vc->obedit==NULL) { if(FACESEL_PAINT_TEST) do_lasso_select_facemode(vc, mcords, moves, select); else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) @@ -659,13 +659,13 @@ void view3d_lasso_select(ViewContext *vc, short mcords[][2], short moves, short else do_lasso_select_objects(vc, mcords, moves, select); } - else if(G.obedit->type==OB_MESH) { + else if(vc->obedit->type==OB_MESH) { do_lasso_select_mesh(vc, mcords, moves, select); - } else if(G.obedit->type==OB_CURVE || G.obedit->type==OB_SURF) + } else if(vc->obedit->type==OB_CURVE || vc->obedit->type==OB_SURF) do_lasso_select_curve(vc, mcords, moves, select); - else if(G.obedit->type==OB_LATTICE) + else if(vc->obedit->type==OB_LATTICE) do_lasso_select_lattice(vc, mcords, moves, select); - else if(G.obedit->type==OB_ARMATURE) + else if(vc->obedit->type==OB_ARMATURE) do_lasso_select_armature(vc, mcords, moves, select); BIF_undo_push("Lasso select"); @@ -934,7 +934,7 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter) /* This block uses the control key to make the object selected by its center point rather then its contents */ /* XXX later on, in editmode do not activate */ - if(G.obedit==NULL && obcenter) { + if(vc.obedit==NULL && obcenter) { /* note; shift+alt goes to group-flush-selecting */ /* XXX solve */ @@ -1088,7 +1088,7 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter) /* so, do we have something selected? */ if(basact) { - if(G.obedit) { + if(vc.obedit) { /* only do select */ deselectall_except(scene, basact); ED_base_object_select(basact, BA_SELECT); @@ -1287,6 +1287,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; + Object *obedit= CTX_data_edit_object(C); rcti rect; Base *base; MetaElem *ml; @@ -1305,29 +1306,29 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) rect.xmax= RNA_int_get(op->ptr, "xmax"); rect.ymax= RNA_int_get(op->ptr, "ymax"); - if(G.obedit==NULL && (FACESEL_PAINT_TEST)) { + if(obedit==NULL && (FACESEL_PAINT_TEST)) { // XXX face_borderselect(); return OPERATOR_FINISHED; } - else if(G.obedit==NULL && (G.f & G_PARTICLEEDIT)) { + else if(obedit==NULL && (G.f & G_PARTICLEEDIT)) { // XXX PE_borderselect(); return OPERATOR_FINISHED; } - if(G.obedit) { - if(G.obedit->type==OB_MESH) { - Mesh *me= G.obedit->data; + if(obedit) { + if(obedit->type==OB_MESH) { + Mesh *me= obedit->data; vc.em= me->edit_mesh; do_mesh_box_select(&vc, &rect, (val==LEFTMOUSE)); // if (EM_texFaceCheck()) - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, G.obedit); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); } - else if(ELEM(G.obedit->type, OB_CURVE, OB_SURF)) { + else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) { do_nurbs_box_select(&vc, &rect, val==LEFTMOUSE); // allqueue(REDRAWVIEW3D, 0); } - else if(G.obedit->type==OB_MBALL) { + else if(obedit->type==OB_MBALL) { hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect); ml= NULL; // XXX editelems.first; @@ -1350,7 +1351,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) ml= ml->next; } } - else if(G.obedit->type==OB_ARMATURE) { + else if(obedit->type==OB_ARMATURE) { EditBone *ebone; /* clear flag we use to detect point was affected */ @@ -1403,7 +1404,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) } } - else if(G.obedit->type==OB_LATTICE) { + else if(obedit->type==OB_LATTICE) { do_lattice_box_select(&vc, &rect, val==LEFTMOUSE); } } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 1949db88d28..1986203f839 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1018,10 +1018,10 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b glPushName(-1); code= 1; - if(G.obedit && G.obedit->type==OB_MBALL) { + if(vc->obedit && vc->obedit->type==OB_MBALL) { draw_object(scene, ar, v3d, BASACT, DRAW_PICKING|DRAW_CONSTCOLOR); } - else if ((G.obedit && G.obedit->type==OB_ARMATURE)) { + else if ((vc->obedit && vc->obedit->type==OB_ARMATURE)) { draw_object(scene, ar, v3d, BASACT, DRAW_PICKING|DRAW_CONSTCOLOR); } else { @@ -1139,13 +1139,13 @@ void initlocalview(Scene *scene, ARegion *ar, View3D *v3d) ok= 0; } else { - if(G.obedit) { - minmax_object(G.obedit, min, max); + if(scene->obedit) { + minmax_object(scene->obedit, min, max); ok= 1; BASACT->lay |= locallay; - G.obedit->lay= BASACT->lay; + scene->obedit->lay= BASACT->lay; } else { base= FIRSTBASE; @@ -1203,7 +1203,7 @@ void initlocalview(Scene *scene, ARegion *ar, View3D *v3d) if( base->lay & locallay ) { base->lay-= locallay; if(base->lay==0) base->lay= v3d->layact; - if(base->object != G.obedit) base->flag |= SELECT; + if(base->object != scene->obedit) base->flag |= SELECT; base->object->lay= base->lay; } base= base->next; @@ -1260,7 +1260,7 @@ void endlocalview(Scene *scene, ScrArea *sa) if( base->lay & locallay ) { base->lay-= locallay; if(base->lay==0) base->lay= v3d->layact; - if(base->object != G.obedit) { + if(base->object != scene->obedit) { base->flag |= SELECT; base->object->flag |= SELECT; } |