- subsurf creation no longer needs extverts argument... removed
authorDaniel Dunbar <daniel@zuster.org>
Mon, 28 Mar 2005 08:43:24 +0000 (08:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 28 Mar 2005 08:43:24 +0000 (08:43 +0000)
source/blender/blenkernel/BKE_subsurf.h
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/subsurf.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/renderconverter/intern/convertBlenderScene.c
source/blender/src/editobject.c

index e675082182078a15e19772a10c39884e3822f871..a23cd5755d1a615db1ca698c3ab0100cf8dcb933 100644 (file)
@@ -38,11 +38,11 @@ struct DispListMesh;
 struct EditMesh;
 
 struct DispListMesh *subsurf_make_dispListMesh_from_editmesh(struct EditMesh *em, int subdivLevels, int flags, short type);
-struct DispListMesh *subsurf_make_dispListMesh_from_mesh(struct Mesh *me, float *extverts, int subdivLevels, int flags);
+struct DispListMesh *subsurf_make_dispListMesh_from_mesh(struct Mesh *me, int subdivLevels, int flags);
 
 #ifdef USE_CCGSUBSURFLIB
 struct DispListMesh *subsurf_ccg_make_dispListMesh_from_editmesh(struct EditMesh *em, int subdivLevels, int flags);
-struct DispListMesh *subsurf_ccg_make_dispListMesh_from_mesh(struct Mesh *me, float *extverts, int subdivLevels, int flags);
+struct DispListMesh *subsurf_ccg_make_dispListMesh_from_mesh(struct Mesh *me, int subdivLevels, int flags);
 #endif
 
 void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]);
index d348777bd0b338a7025ca5e04ece8bb47d0f8019..e4e8e3a72c6d0a0e8adcc511d197a685227baaca 100644 (file)
@@ -1757,20 +1757,15 @@ void makeDispList(Object *ob)
 
                tex_space_mesh(ob->data);
                
-               if(ob!=G.obedit) {
-                       mesh_modifier(ob, 's');
-               }
-               
                if (mesh_uses_displist(me)) {  /* subsurf */
                        DispListMesh *dlm;
 
                        if (ob==G.obedit) {
                                dlm= subsurf_make_dispListMesh_from_editmesh(em, me->subdiv, me->flag, me->subsurftype);
                        } else {
-                               DispList *dlVerts= find_displist(&ob->disp, DL_VERTS);
-                               // dl->verts should not be needed anymore, recode it in modifier (ton)
-                               dlm= subsurf_make_dispListMesh_from_mesh(me, dlVerts?dlVerts->verts:NULL, 
-                                                                                                       me->subdiv, me->flag);
+                               mesh_modifier(ob, 's');
+                               dlm= subsurf_make_dispListMesh_from_mesh(me, me->subdiv, me->flag);
+                               mesh_modifier(ob, 'e');
                        }
 
                        dl= MEM_callocN(sizeof(*dl), "dl");
@@ -1780,9 +1775,6 @@ void makeDispList(Object *ob)
                        free_displist_by_type(&me->disp, DL_MESH);
                        BLI_addtail(&me->disp, dl);
                }
-               
-               if(ob!=G.obedit) mesh_modifier(ob, 'e');
-               
        }
        else if(ob->type==OB_MBALL) {
                ob= find_basis_mball(ob);
index 99f9175d53bf6b5db4ca537f4008268c4904c577..039ce481a7618a8be6db4187f5fdee55568f3566 100644 (file)
@@ -432,7 +432,7 @@ void make_orco_displist_mesh(Object *ob, int subdivlvl)
                cp_key(0, me->totvert, me->totvert, (char*) me->mvert->co, me->key, me->key->refkey, 0);
        }
 
-       dlm= subsurf_make_dispListMesh_from_mesh(me, NULL, subdivlvl, me->flag);
+       dlm= subsurf_make_dispListMesh_from_mesh(me, subdivlvl, me->flag);
        
                /* Restore correct key */
        do_ob_key(ob);
index 84588342f6b514d52cc44ee564e86bbb3b688556..6baba62053a84e93ad6a6a73ea57f4b313e78f0a 100644 (file)
@@ -341,7 +341,7 @@ static HyperMesh *hypermesh_new(void) {
        return hme;
 }
 
-static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts, int subdivLevels) {
+static HyperMesh *hypermesh_from_mesh(Mesh *me, int subdivLevels) {
        HyperMesh *hme= hypermesh_new();
        HyperVert **vert_tbl;
        MFace *mface= me->mface;
@@ -358,10 +358,7 @@ static HyperMesh *hypermesh_from_mesh(Mesh *me, float *extverts, int subdivLevel
        vert_tbl= MEM_mallocN(sizeof(*vert_tbl)*me->totvert, "vert_tbl");
        
        for (i= 0; i<me->totvert; i++) {
-               if (extverts)
-                       vert_tbl[i]= hypermesh_add_vert(hme, &extverts[i*3], NULL);
-               else
-                       vert_tbl[i]= hypermesh_add_vert(hme, me->mvert[i].co, NULL);
+               vert_tbl[i]= hypermesh_add_vert(hme, me->mvert[i].co, NULL);
        }
 
        if(medge) {
@@ -1111,15 +1108,15 @@ DispListMesh *subsurf_make_dispListMesh_from_editmesh(EditMesh *em, int subdivLe
        }
 }
 
-DispListMesh *subsurf_make_dispListMesh_from_mesh(Mesh *me, float *extverts, int subdivLevels, int flags) {
+DispListMesh *subsurf_make_dispListMesh_from_mesh(Mesh *me, int subdivLevels, int flags) {
        if (subdivLevels<1) {
-               return displistmesh_from_mesh(me, extverts);
+               return displistmesh_from_mesh(me, NULL);
 #ifdef USE_CCGSUBSURFLIB
        } else if (me->subsurftype==ME_CCG_SUBSURF) {
-               return subsurf_ccg_make_dispListMesh_from_mesh(me, extverts, subdivLevels, flags);
+               return subsurf_ccg_make_dispListMesh_from_mesh(me, subdivLevels, flags);
 #endif
        } else {
-               HyperMesh *hme= hypermesh_from_mesh(me, extverts, subdivLevels);
+               HyperMesh *hme= hypermesh_from_mesh(me, subdivLevels);
 
                return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, me->subsurftype);
        }
@@ -1133,7 +1130,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
         * calculated vert positions is incorrect for the verts 
         * on the boundary of the mesh.
         */
-       HyperMesh *hme= hypermesh_from_mesh(me, NULL, 1);       // 1=subdivlevel
+       HyperMesh *hme= hypermesh_from_mesh(me, 1);     // 1=subdivlevel
        HyperMesh *nme= hypermesh_new();
        float edge_sum[3], face_sum[3];
        HyperVert *hv;
index e21b38716b72c13ed0eaeaf1195cb2016ca2bc46..88b2eecf89198bcd06333d8c94ecd28220e2f55c 100644 (file)
@@ -38,7 +38,6 @@ typedef struct _SubSurf {
 
                /* used by mesh control type */
        Mesh *me;
-       float *extverts;
 } SubSurf;
 
 static void _subsurfNew_meshIFC_vertDataCopy(CCGMeshHDL mv, void *tv, void *av) {
@@ -135,13 +134,12 @@ static SubSurf *subSurf_fromEditmesh(EditMesh *em, int subdivLevels) {
        return ss;
 }
 
-static SubSurf *subSurf_fromMesh(Mesh *me, float *extverts, int subdivLevels) {
+static SubSurf *subSurf_fromMesh(Mesh *me, int subdivLevels) {
        SubSurf *ss= MEM_mallocN(sizeof(*ss), "ss");
 
        ss->controlType= SUBSURF_CONTROLTYPE_MESH;
        ss->subSurf= _getSubSurf(ss, subdivLevels);
        ss->me= me;
-       ss->extverts= extverts;
 
        ccgSubSurf_setAllowEdgeCreation(ss->subSurf, 1);
 
@@ -528,11 +526,7 @@ static void subSurf_sync(SubSurf *ss) {
                int i, fVerts[4];
 
                for (i=0; i<ss->me->totvert; i++) {
-                       if (ss->extverts) {
-                               ccgSubSurf_syncVert(ss->subSurf, (CCGVertHDL) i, &ss->extverts[i*3]);
-                       } else {
-                               ccgSubSurf_syncVert(ss->subSurf, (CCGVertHDL) i, ss->me->mvert[i].co);
-                       }
+                       ccgSubSurf_syncVert(ss->subSurf, (CCGVertHDL) i, ss->me->mvert[i].co);
                }
 
                if (ss->me->medge) {
@@ -620,8 +614,8 @@ DispListMesh *subsurf_ccg_make_dispListMesh_from_editmesh(EditMesh *em, int subd
        return dlm;
 }
 
-DispListMesh *subsurf_ccg_make_dispListMesh_from_mesh(Mesh *me, float *extverts, int subdivLevels, int flags) {
-       SubSurf *ss= subSurf_fromMesh(me, extverts, subdivLevels);
+DispListMesh *subsurf_ccg_make_dispListMesh_from_mesh(Mesh *me, int subdivLevels, int flags) {
+       SubSurf *ss= subSurf_fromMesh(me, subdivLevels);
        DispListMesh *dlm;
 
        subSurf_sync(ss);
index 60eaadf29fe0ba22fdb92c1c514294e25aa7c2eb..ec3de83d1b4a0ed2e3a695fb1099231b74bf991f 100644 (file)
@@ -1359,13 +1359,10 @@ static void init_render_mesh(Object *ob)
                /* Force a displist rebuild if this is a subsurf and we have a different subdiv level */
                /* also when object is in editmode, displist ordering for editmode is different, giving orco probs */
                
-               if((dl==NULL) || ((me->subdiv != me->subdivr)) || (ob==G.obedit)) {
+               if((dl==NULL) || ((me->subdiv != me->subdivr)) || (G.obedit && me==G.obedit->data)) {
                        /* prevent subsurf called again for duplicate use of mesh, tface pointers change */
                        if(dl==NULL || (me->subdivdone-1)!=me->subdivr) {
-                               DispList *dlVerts;
-
-                               dlVerts= find_displist(&ob->disp, DL_VERTS);
-                               dlm= subsurf_make_dispListMesh_from_mesh(me, dlVerts?dlVerts->verts:NULL, me->subdivr, me->flag);
+                               dlm= subsurf_make_dispListMesh_from_mesh(me, me->subdivr, me->flag);
                                dl= MEM_callocN(sizeof(*dl), "dl");
                                dl->type= DL_MESH;
                                dl->mesh= dlm;
index 78d50143575745e5e3028c3d3acbc1212242e93f..d139b05a6f8a79e88d550cfd4d474c1bc1066ca6 100644 (file)
@@ -2178,7 +2178,7 @@ void convertmenu(void)
                                                for(a=0; a<ob1->totcol; a++) id_us_plus((ID *)me->mat[a]);
                                        }
                                                
-                                       dlm= subsurf_make_dispListMesh_from_mesh(oldme, NULL, oldme->subdiv, oldme->flag);
+                                       dlm= subsurf_make_dispListMesh_from_mesh(oldme, oldme->subdiv, oldme->flag);
                                        displistmesh_to_mesh(dlm, ob1->data);
                                        displistmesh_free(dlm);