-Changed "Simple" button to pulldown menu or subsurf type.
authorRobert Wenzlaff <rwenzlaff@soylent-green.com>
Sat, 10 Jan 2004 01:22:07 +0000 (01:22 +0000)
committerRobert Wenzlaff <rwenzlaff@soylent-green.com>
Sat, 10 Jan 2004 01:22:07 +0000 (01:22 +0000)
Paves way for additional subsurf types, and avoids confusion
where Simple is on, but Subsurf is off.

source/blender/blenkernel/BKE_subsurf.h
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/subsurf.c
source/blender/makesdna/DNA_mesh_types.h
source/blender/src/buttons_editing.c

index 1d65015448a223b5aa894242a8d77f5147559906..837ccf01f2290364e0253bcf8dba5e5975f6856e 100644 (file)
@@ -37,8 +37,10 @@ struct Displist;
 struct DispListMesh;
 struct ListBase;
 
-struct DispListMesh *subsurf_make_dispListMesh_from_editmesh(struct ListBase *verts, struct ListBase *edges, struct ListBase *faces, int subdivLevels, int flags);
-struct DispListMesh *subsurf_make_dispListMesh_from_mesh(struct Mesh *me, float *extverts, int subdivLevels, int flags);
+struct DispListMesh *subsurf_make_dispListMesh_from_editmesh(struct ListBase *verts, struct ListBase *edges, 
+                                                                               struct ListBase *faces, int subdivLevels, int flags, short type);
+struct DispListMesh *subsurf_make_dispListMesh_from_mesh(struct Mesh *me, 
+                                                                               float *extverts, int subdivLevels, int flags);
 
 void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]);
 
index 51c24d5d469ae86d2b2e518d67273647b66fbf26..89183656bcc4e813465da11d81fdd29635451a74 100644 (file)
@@ -1650,10 +1650,12 @@ void makeDispList(Object *ob)
                        DispListMesh *dlm;
 
                        if (ob==G.obedit) {
-                               dlm= subsurf_make_dispListMesh_from_editmesh(&G.edve, &G.eded, &G.edvl, me->subdiv, me->flag);
+                               dlm= subsurf_make_dispListMesh_from_editmesh(&G.edve, &G.eded, &G.edvl, 
+                                                                                                       me->subdiv, me->flag, me->subsurftype);
                        } else {
                                DispList *dlVerts= find_displist(&ob->disp, DL_VERTS);
-                               dlm= subsurf_make_dispListMesh_from_mesh(me, dlVerts?dlVerts->verts:NULL, me->subdiv, me->flag);
+                               dlm= subsurf_make_dispListMesh_from_mesh(me, dlVerts?dlVerts->verts:NULL, 
+                                                                                                       me->subdiv, me->flag);
                        }
 
                        dl= MEM_callocN(sizeof(*dl), "dl");
index 4aab0fb6d8f028737c6dea02099b2bb92891e97c..96e3c090b694038ff094f77a69217adee31c97dd 100644 (file)
@@ -919,7 +919,8 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
 }
 
 /* flag is me->flag, for handles and 'optim' */
-static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short subdiv, short flag) {
+static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short subdiv,
+                                                                                               short flag, short type) {
        DispListMesh *dlm;
        int i;
 
@@ -929,7 +930,7 @@ static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short sub
                tmp->hasuvco= hme->hasuvco;
                tmp->orig_me= hme->orig_me;
                
-               if (flag & ME_SIMPLE_DIV) hypermesh_simple_subdivide(hme, tmp);
+               if (type & ME_SIMPLE_SUBSURF) hypermesh_simple_subdivide(hme, tmp);
                else hypermesh_subdivide(hme, tmp);      /* default to CC subdiv. */
                
                hypermesh_free(hme);
@@ -942,22 +943,24 @@ static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short sub
        return dlm;
 }
 
-DispListMesh *subsurf_make_dispListMesh_from_editmesh(ListBase *verts, ListBase *edges, ListBase *faces, int subdivLevels, int flags) {
+DispListMesh *subsurf_make_dispListMesh_from_editmesh(ListBase *verts, ListBase *edges, 
+                                                                                       ListBase *faces, int subdivLevels, int flags, short type) {
        if (subdivLevels<1) {
                return displistmesh_from_editmesh(verts, edges, faces);
        } else {
                HyperMesh *hme= hypermesh_from_editmesh(verts->first, edges->first, faces->first);
        
-               return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags);
+               return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, type);
        }
 }
+
 DispListMesh *subsurf_make_dispListMesh_from_mesh(Mesh *me, float *extverts, int subdivLevels, int flags) {
        if (subdivLevels<1) {
                return displistmesh_from_mesh(me, extverts);
        } else {
                HyperMesh *hme= hypermesh_from_mesh(me, extverts);
 
-               return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags);
+               return subsurf_subdivide_to_displistmesh(hme, subdivLevels, flags, me->subsurftype);
        }
 }
 
index 71c65d450bf3d4e4bad23d87007d747c598639fe..6a4f5260b580b1fd0917e94ef64356d7563ca075 100644 (file)
@@ -142,7 +142,8 @@ typedef struct Mesh {
        short smoothresh, flag;
        short subdiv, subdivr, subdivdone;
        short totcol;
-       short reserved1, reserved2;     /* Padding */
+       short subsurftype; 
+       short reserved1;        /* Padding */
 
        float cubemapsize, rtf;
 
@@ -165,7 +166,10 @@ typedef struct Mesh {
 #define ME_SMESH               64
 #define ME_SUBSURF             128
 #define ME_OPT_EDGES   256
-#define ME_SIMPLE_DIV   512
+
+/* Subsurf Type */
+#define ME_CC_SUBSURF          0
+#define ME_SIMPLE_SUBSURF      1
 
 /* puno = vertexnormal (mface) */
 #define ME_FLIPV1              1
index ee7679a478bd68e855637b51db56af91ee1dc3ca..d85fd3841651034626b340ea4d2bb1335b4cd7d2 100644 (file)
@@ -369,6 +369,8 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
 {
        uiBlock *block;
        float val;
+       /* Hope to support more than two subsurf algorithms */
+       char subsurfmenu[]="Subsurf Type%t|Catmul Clark%x0|Simple Subdiv.%x1";
        
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_type", UI_EMBOSS, UI_HELV, curarea->win);
        if( uiNewPanel(curarea, block, "Mesh", "Editing", 320, 0, 318, 204)==0) return;
@@ -379,8 +381,8 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
        
        uiBlockBeginAlign(block);
        uiBlockSetCol(block, TH_BUT_SETTING1);
-       uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf",              10,124,90,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Catmull-Clark Subdivision Surface");
-       uiDefButS(block, TOG|BIT|9, B_MAKEDISP, "Simple",               100,124,64,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Simple Subdivision Surface for Radio/Displacement");
+       uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf",              10,124,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Subdivision Surface");
+       uiDefButS(block, MENU, B_MAKEDISP, subsurfmenu,         80,124,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
        uiBlockSetCol(block, TH_AUTO);
        uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:",                    10,104,110,19, &me->subdiv, 0, 6, 0, 0, "Defines the level of subdivision to display in real time interactively");
        uiDefButS(block, NUM, B_MAKEDISP, "",                                   120, 104, 44, 19, &me->subdivr, 0, 6, 0, 0, "Defines the level of subdivision to apply during rendering");