-Changed "Simple" button to pulldown menu or subsurf type.

Paves way for additional subsurf types, and avoids confusion
	where Simple is on, but Subsurf is off.
This commit is contained in:
Robert Wenzlaff 2004-01-10 01:22:07 +00:00
parent e3080c9580
commit 6a9d29d1db
5 changed files with 26 additions and 13 deletions

@ -37,8 +37,10 @@ struct Displist;
struct DispListMesh; struct DispListMesh;
struct ListBase; 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_editmesh(struct ListBase *verts, struct ListBase *edges,
struct DispListMesh *subsurf_make_dispListMesh_from_mesh(struct Mesh *me, float *extverts, int subdivLevels, int flags); 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]); void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]);

@ -1650,10 +1650,12 @@ void makeDispList(Object *ob)
DispListMesh *dlm; DispListMesh *dlm;
if (ob==G.obedit) { 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 { } else {
DispList *dlVerts= find_displist(&ob->disp, DL_VERTS); 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"); dl= MEM_callocN(sizeof(*dl), "dl");

@ -919,7 +919,8 @@ static DispListMesh *hypermesh_to_displistmesh(HyperMesh *hme, short flag) {
} }
/* flag is me->flag, for handles and 'optim' */ /* 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; DispListMesh *dlm;
int i; int i;
@ -929,7 +930,7 @@ static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short sub
tmp->hasuvco= hme->hasuvco; tmp->hasuvco= hme->hasuvco;
tmp->orig_me= hme->orig_me; 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. */ else hypermesh_subdivide(hme, tmp); /* default to CC subdiv. */
hypermesh_free(hme); hypermesh_free(hme);
@ -942,22 +943,24 @@ static DispListMesh *subsurf_subdivide_to_displistmesh(HyperMesh *hme, short sub
return dlm; 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) { if (subdivLevels<1) {
return displistmesh_from_editmesh(verts, edges, faces); return displistmesh_from_editmesh(verts, edges, faces);
} else { } else {
HyperMesh *hme= hypermesh_from_editmesh(verts->first, edges->first, faces->first); 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) { DispListMesh *subsurf_make_dispListMesh_from_mesh(Mesh *me, float *extverts, int subdivLevels, int flags) {
if (subdivLevels<1) { if (subdivLevels<1) {
return displistmesh_from_mesh(me, extverts); return displistmesh_from_mesh(me, extverts);
} else { } else {
HyperMesh *hme= hypermesh_from_mesh(me, extverts); 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);
} }
} }

@ -142,7 +142,8 @@ typedef struct Mesh {
short smoothresh, flag; short smoothresh, flag;
short subdiv, subdivr, subdivdone; short subdiv, subdivr, subdivdone;
short totcol; short totcol;
short reserved1, reserved2; /* Padding */ short subsurftype;
short reserved1; /* Padding */
float cubemapsize, rtf; float cubemapsize, rtf;
@ -165,7 +166,10 @@ typedef struct Mesh {
#define ME_SMESH 64 #define ME_SMESH 64
#define ME_SUBSURF 128 #define ME_SUBSURF 128
#define ME_OPT_EDGES 256 #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) */ /* puno = vertexnormal (mface) */
#define ME_FLIPV1 1 #define ME_FLIPV1 1

@ -369,6 +369,8 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
{ {
uiBlock *block; uiBlock *block;
float val; 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); 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; 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); uiBlockBeginAlign(block);
uiBlockSetCol(block, TH_BUT_SETTING1); 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|7, B_MAKEDISP, "SubSurf", 10,124,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a 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, MENU, B_MAKEDISP, subsurfmenu, 80,124,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
uiBlockSetCol(block, TH_AUTO); 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, "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"); uiDefButS(block, NUM, B_MAKEDISP, "", 120, 104, 44, 19, &me->subdivr, 0, 6, 0, 0, "Defines the level of subdivision to apply during rendering");