diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-07 17:46:50 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-07 17:46:50 +0300 |
commit | bf9080d9c15e2afdff8344b37fc0d89d84b559f7 (patch) | |
tree | be6f1fa5fd561176ab8877bf6cc5d463d693fa1a /source/blender | |
parent | 1ff595a28e541de9cf71708bb7327b8deb0598ac (diff) |
2.5
Finished a couple of XXX todo's in drawing code,
attempt to fix subsurf crash... didnt work yet!
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_customdata.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 41 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 64 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 5 |
13 files changed, 77 insertions, 76 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 3e03ac3fb9f..1c5cc2ff311 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -459,9 +459,6 @@ int editmesh_get_first_deform_matrices(struct Object *, struct EditMesh *em, flo void weight_to_rgb(float input, float *fr, float *fg, float *fb); -/* determines required DerivedMesh data according to view and edit modes */ -CustomDataMask get_viewedit_datamask(); - /* convert layers requested by a GLSL material to actually available layers in * the DerivedMesh, with both a pointer for arrays and an offset for editmesh */ typedef struct DMVertexAttribs { diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 10791968f79..95ee918a888 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -32,11 +32,9 @@ #ifndef BKE_CUSTOMDATA_H #define BKE_CUSTOMDATA_H -#include "BLO_sys_types.h" // for intptr_t support - struct CustomData; struct CustomDataLayer; -typedef intptr_t CustomDataMask; +typedef unsigned int CustomDataMask; extern const CustomDataMask CD_MASK_BAREMESH; extern const CustomDataMask CD_MASK_MESH; diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index d486a5dc665..c37b200d38b 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -291,7 +291,7 @@ int modifiers_isParticleEnabled(struct Object *ob); struct Object *modifiers_isDeformedByArmature(struct Object *ob); struct Object *modifiers_isDeformedByLattice(struct Object *ob); int modifiers_usesArmature(struct Object *ob, struct bArmature *arm); -int modifiers_isDeformed(struct Object *ob); +int modifiers_isDeformed(struct Scene *scene, struct Object *ob); void modifier_freeTemporaryData(struct ModifierData *md); int modifiers_indexInObject(struct Object *ob, struct ModifierData *md); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 2c8a013c5ee..d160c75a03b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1412,47 +1412,6 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, Modifier return dm; } -CustomDataMask get_viewedit_datamask() -{ -#if 0 - XXX - CustomDataMask mask = CD_MASK_BAREMESH; - ScrArea *sa; - /* check if we need tfaces & mcols due to face select or texture paint */ - if(FACESEL_PAINT_TEST || G.f & G_TEXTUREPAINT) - mask |= CD_MASK_MTFACE | CD_MASK_MCOL; - - /* check if we need tfaces & mcols due to view mode */ - for(sa = G.curscreen->areabase.first; sa; sa = sa->next) { - if(sa->spacetype == SPACE_VIEW3D) { - View3D *view = sa->spacedata.first; - if(view->drawtype == OB_SHADED) { - /* this includes normals for mesh_create_shadedColors */ - mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO; - } - if((view->drawtype == OB_TEXTURE) || ((view->drawtype == OB_SOLID) && (view->flag2 & V3D_SOLID_TEX))) { - mask |= CD_MASK_MTFACE | CD_MASK_MCOL; - - if((G.fileflags & G_FILE_GAME_MAT) && - (G.fileflags & G_FILE_GAME_MAT_GLSL)) { - mask |= CD_MASK_ORCO; - } - } - } - } - - /* check if we need mcols due to vertex paint or weightpaint */ - if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT) - mask |= CD_MASK_MCOL; - - if(G.f & G_SCULPTMODE) - mask |= CD_MASK_MDISPS; - - return mask; -#endif - return 0; -} - static float *get_editmesh_orco_verts(EditMesh *em) { EditVert *eve; diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 737361c34c4..069f909289d 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -8471,8 +8471,6 @@ void modifiers_clearErrors(Object *ob) qRedraw = 1; } } - -// XXX if (qRedraw) allqueue(REDRAWBUTSEDIT, 0); } void modifiers_foreachObjectLink(Object *ob, ObjectWalkFunc walk, @@ -8538,7 +8536,6 @@ void modifier_setError(ModifierData *md, char *format, ...) md->error = BLI_strdup(buffer); -// XXX allqueue(REDRAWBUTSEDIT, 0); } /* used for buttons, to find out if the 'draw deformed in editmode' option is @@ -8766,15 +8763,15 @@ int modifier_isDeformer(ModifierData *md) return 0; } -int modifiers_isDeformed(Object *ob) +int modifiers_isDeformed(Scene *scene, Object *ob) { ModifierData *md = modifiers_getVirtualModifierList(ob); for (; md; md=md->next) { - // XXX if(ob==obedit && (md->mode & eModifierMode_Editmode)==0); - // else + if(ob==scene->obedit && (md->mode & eModifierMode_Editmode)==0); + else if(modifier_isDeformer(md)) - return 1; + return 1; } return 0; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6dc791ab18a..ef48714b7c3 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2273,7 +2273,7 @@ void object_handle_update(Scene *scene, Object *ob) /* includes all keys and modifiers */ if(ob->type==OB_MESH) { - makeDerivedMesh(scene, ob, NULL, get_viewedit_datamask()); + makeDerivedMesh(scene, ob, NULL, CD_MASK_BAREMESH); // here was vieweditdatamask? XXX } else if(ob->type==OB_MBALL) { makeDispListMBall(scene, ob); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 4f57470a586..15969fc9ab9 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2108,7 +2108,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u if (draw) { if (draw==2) { glEnable(GL_POLYGON_STIPPLE); - glPolygonStipple(0); //XXX stipple_quarttone); + glPolygonStipple(stipple_quarttone); } for (S=0; S<numVerts; S++) { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index a58100e2b00..ccd6e52f577 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2151,7 +2151,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, Base *base, int dt, int f int draw_wire = 0; int totvert, totedge, totface; DispList *dl; - DerivedMesh *dm= mesh_get_derived_final(scene, ob, get_viewedit_datamask()); + DerivedMesh *dm= mesh_get_derived_final(scene, ob, v3d->customdata_mask); if(!dm) return; @@ -2278,7 +2278,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, Base *base, int dt, int f dm->release(dm); shadeDispList(scene, base); dl = find_displist(&ob->disp, DL_VERTCOL); - dm= mesh_get_derived_final(scene, ob, get_viewedit_datamask()); + dm= mesh_get_derived_final(scene, ob, v3d->customdata_mask); } if ((v3d->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire) { @@ -2371,7 +2371,7 @@ static int draw_mesh_object(Scene *scene, View3D *v3d, Base *base, int dt, int f finalDM = cageDM = editmesh_get_derived_base(ob, em); else cageDM = editmesh_get_derived_cage_and_final(scene, ob, em, &finalDM, - get_viewedit_datamask()); + v3d->customdata_mask); if(dt>OB_WIRE) { // no transp in editmode, the fancy draw over goes bad then @@ -5361,9 +5361,9 @@ static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmoot } /* TODO remove this - since face select mode now only works with painting */ -static void bbs_mesh_solid(Scene *scene, Object *ob) +static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob) { - DerivedMesh *dm = mesh_get_derived_final(scene, ob, get_viewedit_datamask()); + DerivedMesh *dm = mesh_get_derived_final(scene, ob, v3d->customdata_mask); Mesh *me = (Mesh*)ob->data; glColor3ub(0, 0, 0); @@ -5408,7 +5408,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, Object *ob) EM_free_index_arrays(); } - else bbs_mesh_solid(scene, ob); + else bbs_mesh_solid(scene, v3d, ob); } break; case OB_CURVE: diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 507a4d9735f..8ac672eb260 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -187,7 +187,7 @@ static void view3d_main_area_draw(const bContext *C, ARegion *ar) ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; /* XXX get from region */ - drawview3dspace(CTX_data_scene(C), ar, v3d); + drawview3dspace(CTX_wm_screen(C), CTX_data_scene(C), ar, v3d); } /* add handlers, stuff you only do once or on area/region changes */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 655bd164758..48fb6d76703 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -33,6 +33,7 @@ #include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" +#include "DNA_customdata_types.h" #include "DNA_group_types.h" #include "DNA_key_types.h" #include "DNA_object_types.h" @@ -50,6 +51,7 @@ #include "BLI_rand.h" #include "BKE_anim.h" +#include "BKE_customdata.h" #include "BKE_image.h" #include "BKE_ipo.h" #include "BKE_key.h" @@ -70,6 +72,7 @@ #include "WM_api.h" +#include "ED_armature.h" #include "ED_keyframing.h" #include "ED_mesh.h" #include "ED_screen.h" @@ -741,13 +744,13 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d) /* show name of active bone too (if possible) */ if(arm->edbo) { -// XXX EditBone *ebo; -// for (ebo=G.edbo.first; ebo; ebo=ebo->next){ -// if ((ebo->flag & BONE_ACTIVE) && (ebo->layer & arm->layer)) { -// name= ebo->name; -// break; -// } -// } + EditBone *ebo; + for (ebo=arm->edbo->first; ebo; ebo=ebo->next){ + if ((ebo->flag & BONE_ACTIVE) && (ebo->layer & arm->layer)) { + name= ebo->name; + break; + } + } } else if(ob->pose && (ob->flag & OB_POSEMODE)) { bPoseChannel *pchan; @@ -1791,8 +1794,50 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) BLI_freelistN(&shadows); } +/* *********************** customdata **************** */ + +/* goes over all modes and view3d settings */ +static CustomDataMask get_viewedit_datamask(bScreen *screen) +{ + CustomDataMask mask = CD_MASK_BAREMESH; + ScrArea *sa; + + /* check if we need tfaces & mcols due to face select or texture paint */ + if(FACESEL_PAINT_TEST || G.f & G_TEXTUREPAINT) + mask |= CD_MASK_MTFACE | CD_MASK_MCOL; + + /* check if we need tfaces & mcols due to view mode */ + for(sa = screen->areabase.first; sa; sa = sa->next) { + if(sa->spacetype == SPACE_VIEW3D) { + View3D *view = sa->spacedata.first; + if(view->drawtype == OB_SHADED) { + /* this includes normals for mesh_create_shadedColors */ + mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO; + } + if((view->drawtype == OB_TEXTURE) || ((view->drawtype == OB_SOLID) && (view->flag2 & V3D_SOLID_TEX))) { + mask |= CD_MASK_MTFACE | CD_MASK_MCOL; + + if((G.fileflags & G_FILE_GAME_MAT) && + (G.fileflags & G_FILE_GAME_MAT_GLSL)) { + mask |= CD_MASK_ORCO; + } + } + } + } + + /* check if we need mcols due to vertex paint or weightpaint */ + if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT) + mask |= CD_MASK_MCOL; + + if(G.f & G_SCULPTMODE) + mask |= CD_MASK_MDISPS; + + return mask; +} + -void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d) + +void drawview3dspace(bScreen *screen, Scene *scene, ARegion *ar, View3D *v3d) { Scene *sce; Base *base; @@ -1800,6 +1845,9 @@ void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d) char retopo= 0, sculptparticle= 0; Object *obact = OBACT; + /* from now on all object derived meshes check this */ + v3d->customdata_mask= get_viewedit_datamask(screen); + /* update all objects, ipos, matrices, displists, etc. Flags set by depgraph or manual, no layer check here, gets correct flushed */ /* sets first, we allow per definition current scene to have dependencies on sets */ diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index fc8fa49821e..d9d58b188ea 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -32,6 +32,7 @@ /* internal exports only */ +struct bScreen; struct BoundBox; struct Object; struct DerivedMesh; @@ -96,7 +97,7 @@ int draw_armature(Scene *scene, View3D *v3d, Base *base, int dt, int flag); void draw_mesh_textured(Scene *scene, View3D *v3d, Object *ob, struct DerivedMesh *dm, int faceselect); /* view3d_draw.c */ -void drawview3dspace(Scene *scene, ARegion *ar, View3D *v3d); +void drawview3dspace(struct bScreen *screen, Scene *scene, ARegion *ar, View3D *v3d); void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *)); void view3d_clr_clipping(void); void view3d_set_clipping(View3D *v3d); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index e81f153c516..974c02c89e4 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2167,7 +2167,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) /* detect CrazySpace [tm] */ if(propmode==0) { if(modifiers_getCageIndex(t->obedit, NULL)>=0) { - if(modifiers_isDeformed(t->obedit)) { + if(modifiers_isDeformed(t->scene, t->obedit)) { /* check if we can use deform matrices for modifier from the start up to stack, they are more accurate than quats */ totleft= editmesh_get_first_deform_matrices(t->obedit, em, &defmats, &defcos); diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index e819ce8a7cd..4f6d8989f9d 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -152,8 +152,9 @@ typedef struct View3D { /* last view */ float lviewquat[4]; short lpersp, lview; - - short pad5, pad6; + + /* customdata flags from modes */ + unsigned int customdata_mask; } View3D; |