== Multires ==
authorNicholas Bishop <nicholasbishop@gmail.com>
Wed, 21 Mar 2007 06:33:04 +0000 (06:33 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Wed, 21 Mar 2007 06:33:04 +0000 (06:33 +0000)
Added an option to choose between Catmull-Clark and simple subdivision when adding a level. This setting applies only to how the level is created; any changes to lower levels are still propagated to the top level using Catmull-Clark.

source/blender/makesdna/DNA_scene_types.h
source/blender/src/buttons_editing.c
source/blender/src/multires.c

index e61f08c5836c4d4c974ef5b17447560bcba9c6b0..24e7e548017f0b97aa8a42f7b319b614ae6c4862 100644 (file)
@@ -348,8 +348,11 @@ typedef struct ToolSettings {
        char retopo_mode;
        char retopo_paint_tool;
        char line_div, ellipse_div, retopo_hotspot;
+
+       /* Multires */
+       char multires_subdiv_type;
        
-       char  pad4[3];
+       char  pad4[2];
 } ToolSettings;
 
 /* Used by all brushes to store their properties, which can be directly set
index 4413c82e16dc9be10ab42c0f75ff1f33916c5c13..fb6768739f59f1bb36e3546605befe904db5c1e8 100644 (file)
@@ -5255,30 +5255,33 @@ void editing_panel_mesh_multires()
        if(uiNewPanel(curarea, block, "Multires", "Editing", 500, 0, 318, 204)==0) return;
 
        if(!me->mr) {
-               but= uiDefBut(block,BUT,B_NOP,"Add Multires", cx,cy,120,19,0,0,0,0,0,"");
+               but= uiDefBut(block,BUT,B_NOP,"Add Multires", cx,cy,268,19,0,0,0,0,0,"");
                uiButSetFunc(but,multires_make,ob,me);
        } else {
-               but= uiDefBut(block,BUT,B_NOP,"Apply Multires", cx,cy,120,19,0,0,0,0,0,"Apply current multires level to mesh and the delete other levels");
+               char subsurfmenu[]= "Subsurf Type%t|Catmull-Clark%x0|Simple Subdiv.%x1";
+
+               but= uiDefBut(block,BUT,B_NOP,"Apply Multires", cx,cy,268,19,0,0,0,0,0,"Apply current multires level to mesh and the delete other levels");
                uiButSetFunc(but,multires_delete,ob,me);
                cy-= 24;
 
                uiBlockBeginAlign(block);
-               but= uiDefBut(block,BUT,B_NOP,"Add Level", cx,cy,200,19,0,0,0,0,0,"Add a new level of subdivision at the end of the chain");
+               but= uiDefBut(block,BUT,B_NOP,"Add Level", cx,cy,134,19,0,0,0,0,0,"Add a new level of subdivision at the end of the chain");
                uiButSetFunc(but,multires_add_level,ob,me);
+               uiDefButC(block, MENU, B_NOP, subsurfmenu, cx + 134, cy, 134, 19, &G.scene->toolsettings->multires_subdiv_type, 0, 0, 0, 0, "Selects type of subdivision algorithm.");
                cy-= 20;
 
                if(me->mr->level_count>1) {
-                       but= uiDefBut(block,BUT,B_NOP,"Del Lower", cx,cy,100,19,0,0,0,0,0,"Remove all levels of subdivision below the current one");
+                       but= uiDefBut(block,BUT,B_NOP,"Del Lower", cx,cy,134,19,0,0,0,0,0,"Remove all levels of subdivision below the current one");
                        uiButSetFunc(but,multires_del_lower,ob,me);
-                       but= uiDefBut(block,BUT,B_NOP,"Del Higher", cx+100,cy,100,19,0,0,0,0,0,"Remove all levels of subdivision above the current one");
+                       but= uiDefBut(block,BUT,B_NOP,"Del Higher", cx+134,cy,134,19,0,0,0,0,0,"Remove all levels of subdivision above the current one");
                        uiButSetFunc(but,multires_del_higher,ob,me);
                        cy-= 20;
                
-                       but= uiDefButC(block,NUM,B_NOP,"Level: ",cx,cy,200,19,(char *)&me->mr->newlvl,1.0,me->mr->level_count,0,0,"");
+                       but= uiDefButC(block,NUM,B_NOP,"Level: ",cx,cy,268,19,(char *)&me->mr->newlvl,1.0,me->mr->level_count,0,0,"");
                        uiButSetFunc(but,multires_set_level_cb, ob, me);
                        cy-= 20;
 
-                       but= uiDefButC(block,NUM,B_NOP,"Edges: ",cx,cy,200,19,(char *)&me->mr->edgelvl,1.0,me->mr->level_count,0,0,"Set level of edges to display");
+                       but= uiDefButC(block,NUM,B_NOP,"Edges: ",cx,cy,268,19,(char *)&me->mr->edgelvl,1.0,me->mr->level_count,0,0,"Set level of edges to display");
                        uiButSetFunc(but,multires_edge_level_update,ob,me);
                        cy-= 20;
                        uiBlockEndAlign(block);
@@ -5288,10 +5291,10 @@ void editing_panel_mesh_multires()
                        cy-= 20;
 
                        uiBlockBeginAlign(block);
-                       uiDefButC(block,NUM,B_NOP,"Pin: ",cx,cy,200,19,(char *)&me->mr->pinlvl,1.0,me->mr->level_count,0,0,"Set level to apply modifiers to during render");
+                       uiDefButC(block,NUM,B_NOP,"Pin: ",cx,cy,268,19,(char *)&me->mr->pinlvl,1.0,me->mr->level_count,0,0,"Set level to apply modifiers to during render");
                        cy-= 20;
 
-                       uiDefButC(block,NUM,B_NOP,"Render: ",cx,cy,200,19,(char *)&me->mr->renderlvl,1.0,me->mr->level_count,0,0,"Set level to render");
+                       uiDefButC(block,NUM,B_NOP,"Render: ",cx,cy,268,19,(char *)&me->mr->renderlvl,1.0,me->mr->level_count,0,0,"Set level to render");
                        cy-= 20;
                        
                        if(multires_modifier_warning()) {
index 6f1d0fd82ddb825810dd2fc8478ff302c2e1b4e0..ff583d1361068ffff9c4321e2bdf4b7ea3aee06b 100644 (file)
@@ -944,26 +944,28 @@ void multires_add_level(void *ob, void *me_v)
                multi_apply(lvl->verts[f->mid].co, &data, 3, catmullclark_smooth_face);
        }
 
-       for(i=0; i<lvl->prev->totedge; ++i) {
-               const MultiresEdge *e= &lvl->prev->edges[i];
-               data.boundary= multires_edge_is_boundary(lvl->prev,i);
-               edge_face_neighbor_midpoints_accum(&data,lvl->prev,lvl->verts,sizeof(MVert),e);
-               data.endpoint1= lvl->prev->verts[e->v[0]].co;
-               data.endpoint2= lvl->prev->verts[e->v[1]].co;
-               multi_apply(lvl->verts[e->mid].co, &data, 3, catmullclark_smooth_edge);
-       }
-       
-       for(i=0; i<lvl->prev->totvert; ++i) {
-               data.boundary= multires_vert_is_boundary(lvl->prev,i);
-               data.original= lvl->verts[i].co;
-               data.edge_count= BLI_countlist(&lvl->prev->vert_edge_map[i]);
-               if(data.boundary)
-                       boundary_edges_average(&data,lvl->prev,lvl->prev->verts,sizeof(MVert),i);
-               else {
-                       vert_face_neighbor_midpoints_average(&data,lvl->prev,lvl->verts,sizeof(MVert),i);
-                       vert_edge_neighbor_midpoints_average(&data,lvl->prev,lvl->prev->verts,sizeof(MVert),i);
+       if(G.scene->toolsettings->multires_subdiv_type == 0) {
+               for(i=0; i<lvl->prev->totedge; ++i) {
+                       const MultiresEdge *e= &lvl->prev->edges[i];
+                       data.boundary= multires_edge_is_boundary(lvl->prev,i);
+                       edge_face_neighbor_midpoints_accum(&data,lvl->prev,lvl->verts,sizeof(MVert),e);
+                       data.endpoint1= lvl->prev->verts[e->v[0]].co;
+                       data.endpoint2= lvl->prev->verts[e->v[1]].co;
+                       multi_apply(lvl->verts[e->mid].co, &data, 3, catmullclark_smooth_edge);
+               }
+               
+               for(i=0; i<lvl->prev->totvert; ++i) {
+                       data.boundary= multires_vert_is_boundary(lvl->prev,i);
+                       data.original= lvl->verts[i].co;
+                       data.edge_count= BLI_countlist(&lvl->prev->vert_edge_map[i]);
+                       if(data.boundary)
+                               boundary_edges_average(&data,lvl->prev,lvl->prev->verts,sizeof(MVert),i);
+                       else {
+                               vert_face_neighbor_midpoints_average(&data,lvl->prev,lvl->verts,sizeof(MVert),i);
+                               vert_edge_neighbor_midpoints_average(&data,lvl->prev,lvl->prev->verts,sizeof(MVert),i);
+                       }
+                       multi_apply(lvl->verts[i].co, &data, 3, catmullclark_smooth_vert);
                }
-               multi_apply(lvl->verts[i].co, &data, 3, catmullclark_smooth_vert);
        }
 
        /* Vertex Colors