diff options
author | Ton Roosendaal <ton@blender.org> | 2005-09-22 21:52:41 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-09-22 21:52:41 +0400 |
commit | d9fa984f35b7e2e103f3a6592853a83cd4217559 (patch) | |
tree | 6773982636a75f0bb80d49450ce969775feed874 | |
parent | 0f6194e5bcf14a098e2e0fef8d8cb22bd2066eda (diff) |
More properly coded version for adding edges... now only do_versions()
reads from the old mface->edcode flag to set edge drawing.
ALso; added a pointer check in draw_mesh_object(), here the derivedmesh
gives NULL on reading regression file lostride.blend. Zr needs to check!
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/exotic.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/NMesh.c | 2 | ||||
-rw-r--r-- | source/blender/radiosity/intern/source/radpostprocess.c | 2 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 2 |
8 files changed, 16 insertions, 26 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 998f3fda59d..9f8ee3c6127 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -79,7 +79,8 @@ void mesh_set_smooth_flag(struct Object *meshOb, int enableSmooth); struct BoundBox *mesh_get_bb(struct Mesh *me); void mesh_get_texspace(struct Mesh *me, float *loc_r, float *rot_r, float *size_r); -void make_edges(struct Mesh *me); +/* if old, it converts mface->edcode to edge drawflags */ +void make_edges(struct Mesh *me, int old); void mesh_strip_loose_faces(struct Mesh *me); /* Calculate vertex and face normals, face normals are returned in *faceNors_r if non-NULL diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 5d83bb42753..f09a906986f 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2027,12 +2027,7 @@ DerivedMesh *getFluidsimDerivedMesh(Object *srcob, int useRenderParams, float *e return getMeshDerivedMesh(mesh , srcob, NULL); } if((mesh)&&(mesh->totvert>0)) { - make_edges(mesh); - for(i=0;i<mesh->totedge;i++) { - // force all edge draw - mesh->medge[i].flag |= ME_EDGEDRAW; - //fprintf(stderr,"INI %d a%d f%d\n",fsdm->fsmesh->totedge,i, (fsdm->fsmesh->medge[i].flag & ME_EDGEDRAW) ); - } + make_edges(mesh, 0); // 0 = make all edges draw } // WARNING copied from getMeshDerivedMesh diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 063ee717df7..8da938f8a1f 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -302,8 +302,7 @@ static void read_stl_mesh_binary(char *str) me->totvert = totvert; mesh_add_normals_flags(me); - make_edges(me); - mesh_strip_loose_faces(me); + make_edges(me, 0); } waitcursor(1); } @@ -468,8 +467,7 @@ static void read_stl_mesh_ascii(char *str) free(vertdata); mesh_add_normals_flags(me); - make_edges(me); - mesh_strip_loose_faces(me); + make_edges(me, 0); waitcursor(1); } @@ -679,8 +677,7 @@ static void read_videoscape_mesh(char *str) MEM_freeN(vertdata); mesh_add_normals_flags(me); - make_edges(me); - mesh_strip_loose_faces(me); + make_edges(me, 0); waitcursor(1); } @@ -860,8 +857,7 @@ static void read_radiogour(char *str) MEM_freeN(vertdata); mesh_add_normals_flags(me); - make_edges(me); - mesh_strip_loose_faces(me); + make_edges(me, 0); waitcursor(1); } @@ -2230,8 +2226,7 @@ static void displist_to_mesh(DispList *dlfirst) } mesh_add_normals_flags(me); - make_edges(me); - mesh_strip_loose_faces(me); + make_edges(me, 0); } static void displist_to_objects(ListBase *lbase) @@ -4971,7 +4966,6 @@ static void dxf_read(char *filename) } for (; lastMe; lastMe=lastMe->id.next) { mesh_add_normals_flags(lastMe); - make_edges(lastMe); - mesh_strip_loose_faces(lastMe); + make_edges(lastMe, 0); } } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index e532930dee3..ab213f78200 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -607,7 +607,7 @@ static int vergedgesort(const void *v1, const void *v2) } -void make_edges(Mesh *me) +void make_edges(Mesh *me, int old) { MFace *mface; MEdge *medge; @@ -661,7 +661,7 @@ void make_edges(Mesh *me) if(ed->v1 != (ed+1)->v1 || ed->v2 != (ed+1)->v2) { medge->v1= ed->v1; medge->v2= ed->v2; - if(ed->is_draw) medge->flag= ME_EDGEDRAW|ME_EDGERENDER; + if(old==0 || ed->is_draw) medge->flag= ME_EDGEDRAW|ME_EDGERENDER; if(ed->is_loose) medge->flag|= ME_LOOSEEDGE; medge++; } @@ -933,7 +933,7 @@ void nurbs_to_mesh(Object *ob) dl= dl->next; } - make_edges(me); + make_edges(me, 0); // all edges mesh_strip_loose_faces(me); if(ob->data) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d11bb9ed563..26adb6cf169 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4934,7 +4934,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(me=main->mesh.first; me; me= me->id.next) { if (!me->medge) { - make_edges(me); + make_edges(me, 1); /* 1 = use mface->edcode */ } else { mesh_strip_loose_faces(me); } diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c index b073bb949da..53a3271aa5f 100644 --- a/source/blender/python/api2_2x/NMesh.c +++ b/source/blender/python/api2_2x/NMesh.c @@ -2818,7 +2818,7 @@ static void fill_medge_from_nmesh(Mesh * mesh, BPy_NMesh * nmesh) valid_nmedges=MEM_callocN(nmeshtotedges*sizeof(BPy_NMEdge *), "make BPy_NMEdge"); /* First compute the list of edges that exists because faces exists */ - make_edges(mesh); + make_edges(mesh, 0); /* 0 = draw all edges */ faces_edges=mesh->medge; tot_faces_edges=mesh->totedge; diff --git a/source/blender/radiosity/intern/source/radpostprocess.c b/source/blender/radiosity/intern/source/radpostprocess.c index 22b091a67a5..ff1f57b6021 100644 --- a/source/blender/radiosity/intern/source/radpostprocess.c +++ b/source/blender/radiosity/intern/source/radpostprocess.c @@ -1029,7 +1029,7 @@ void rad_addmesh(void) } } /* by default, meshes need edge list */ - make_edges(me); + make_edges(me, 0); } MEM_freeN(coldata); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index b50d156278a..80a9bcbbe03 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -1790,7 +1790,7 @@ static void draw_mesh_object(Base *base, int dt) DerivedMesh *realDM = mesh_get_derived_final(ob, &realDMneedsFree); if(dt==OB_SOLID) has_alpha= init_gl_materials(ob); - draw_mesh_fancy(ob, baseDM, realDM, dt); + if(baseDM && realDM) draw_mesh_fancy(ob, baseDM, realDM, dt); if (baseDMneedsFree) baseDM->release(baseDM); if (realDMneedsFree) realDM->release(realDM); |