forked from bartvdbraak/blender
Subdivide recode assistance!
- Added subdivide sck upport for vertex groups - Brought back subdivide-smooth, but it doesn't work as good as before yet, it used to catch an exception for subdividing the middle vertex of a quad, with edge-based subdivide it's not that simple. Will check later. - made "number of cuts" a static variable, so it doesn't jump back to 2 all the time Coder level notes: - removed the old subdivide code (yay, over 30k code less!) - did some minor layout cleanups in the new code (just consistant syntax) - removed redundant code parts, to enable smooth & vgroup subdiv - subdivide smooth can do multiple cuts too, but i like to see that only as option when our smooth formula is good! Compliment: I think Johnny really made comprehensible design and nice code here. Was a joy to work with. :)
This commit is contained in:
parent
d21d255389
commit
6894526265
@ -171,8 +171,9 @@ extern void convert_to_triface(int direction);
|
|||||||
extern int removedoublesflag(short flag, float limit);
|
extern int removedoublesflag(short flag, float limit);
|
||||||
extern void xsortvert_flag(int flag);
|
extern void xsortvert_flag(int flag);
|
||||||
extern void hashvert_flag(int flag);
|
extern void hashvert_flag(int flag);
|
||||||
extern void subdivideflag(int flag, float rad, int beauty);
|
|
||||||
extern void esubdivideflag(int flag, float rad, int beauty, int numcuts, int selecttype);
|
extern void esubdivideflag(int flag, float rad, int beauty, int numcuts, int selecttype);
|
||||||
|
|
||||||
extern void extrude_mesh(void);
|
extern void extrude_mesh(void);
|
||||||
extern void split_mesh(void);
|
extern void split_mesh(void);
|
||||||
extern void extrude_repeat_mesh(int steps, float offs);
|
extern void extrude_repeat_mesh(int steps, float offs);
|
||||||
|
@ -102,12 +102,13 @@ void sel_verts_defgroup (int select)
|
|||||||
else EM_deselect_flush();
|
else EM_deselect_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
MDeformWeight *verify_defweight (MDeformVert *dv, int defgroup)
|
|
||||||
/* Ensures that mv has a deform weight entry for
|
/* Ensures that mv has a deform weight entry for
|
||||||
the specified defweight group */
|
the specified defweight group */
|
||||||
|
/* Note this function is mirrored in editmesh_tools.c, for use for editvertices */
|
||||||
|
MDeformWeight *verify_defweight (MDeformVert *dv, int defgroup)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
MDeformWeight *newdw;
|
MDeformWeight *newdw;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!dv || defgroup<0)
|
if (!dv || defgroup<0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -133,7 +134,8 @@ the specified defweight group */
|
|||||||
return dv->dw+(dv->totweight-1);
|
return dv->dw+(dv->totweight-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_defgroup (Object *ob) {
|
void add_defgroup (Object *ob)
|
||||||
|
{
|
||||||
add_defgroup_name (ob, "Group");
|
add_defgroup_name (ob, "Group");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1928,10 +1928,11 @@ void split_font()
|
|||||||
|
|
||||||
void special_editmenu(void)
|
void special_editmenu(void)
|
||||||
{
|
{
|
||||||
|
static short numcuts= 2;
|
||||||
Object *ob= OBACT;
|
Object *ob= OBACT;
|
||||||
float fac;
|
float fac;
|
||||||
int nr,ret;
|
int nr,ret;
|
||||||
short randfac,numcuts;
|
short randfac;
|
||||||
|
|
||||||
if(ob==NULL) return;
|
if(ob==NULL) return;
|
||||||
|
|
||||||
@ -2084,25 +2085,22 @@ void special_editmenu(void)
|
|||||||
}
|
}
|
||||||
else if(G.obedit->type==OB_MESH) {
|
else if(G.obedit->type==OB_MESH) {
|
||||||
|
|
||||||
nr= pupmenu("Specials%t|Subdivide%x1|Subdivide Multi%x2|Subdivide Multi Fractal%x3|Subdivide Multi Smooth - WIP%x12|Subdivide Smooth Old%x13|Merge%x4|Remove Doubles%x5|Hide%x6|Reveal%x7|Select Swap%x8|Flip Normals %x9|Smooth %x10|Bevel %x11|Set Smooth %x14|Set Solid %x15");
|
nr= pupmenu("Specials%t|Subdivide%x1|Subdivide Multi%x2|Subdivide Multi Fractal%x3|Subdivide Smooth%x12|Merge%x4|Remove Doubles%x5|Hide%x6|Reveal%x7|Select Swap%x8|Flip Normals %x9|Smooth %x10|Bevel %x11|Set Smooth %x14|Set Solid %x15");
|
||||||
|
|
||||||
switch(nr) {
|
switch(nr) {
|
||||||
case 1:
|
case 1:
|
||||||
numcuts = 1;
|
|
||||||
waitcursor(1);
|
waitcursor(1);
|
||||||
esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag,numcuts,0);
|
esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag, 1, 0);
|
||||||
|
|
||||||
BIF_undo_push("ESubdivide Single");
|
BIF_undo_push("ESubdivide Single");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
numcuts = 2;
|
|
||||||
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
||||||
waitcursor(1);
|
waitcursor(1);
|
||||||
esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag, numcuts, 0);
|
esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag, numcuts, 0);
|
||||||
BIF_undo_push("ESubdivide");
|
BIF_undo_push("ESubdivide");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
numcuts = 2;
|
|
||||||
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
||||||
waitcursor(1);
|
waitcursor(1);
|
||||||
randfac= 10;
|
randfac= 10;
|
||||||
@ -2112,6 +2110,17 @@ void special_editmenu(void)
|
|||||||
BIF_undo_push("Subdivide Fractal");
|
BIF_undo_push("Subdivide Fractal");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 12: /* smooth */
|
||||||
|
//if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
||||||
|
fac= 1.0f;
|
||||||
|
if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return;
|
||||||
|
fac= 0.292f*fac;
|
||||||
|
|
||||||
|
waitcursor(1);
|
||||||
|
esubdivideflag(1, fac, G.scene->toolsettings->editbutflag | B_SMOOTH, 1, 0);
|
||||||
|
BIF_undo_push("Subdivide Smooth");
|
||||||
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
mergemenu();
|
mergemenu();
|
||||||
break;
|
break;
|
||||||
@ -2138,18 +2147,6 @@ void special_editmenu(void)
|
|||||||
case 11:
|
case 11:
|
||||||
bevel_menu();
|
bevel_menu();
|
||||||
break;
|
break;
|
||||||
case 12:
|
|
||||||
numcuts = 2;
|
|
||||||
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
|
||||||
waitcursor(1);
|
|
||||||
esubdivideflag(1, 0.0, G.scene->toolsettings->editbutflag | B_SMOOTH,numcuts,0);
|
|
||||||
BIF_undo_push("Subdivide Smooth");
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
waitcursor(1);
|
|
||||||
subdivideflag(1, 0.0, G.scene->toolsettings->editbutflag | B_SMOOTH);
|
|
||||||
BIF_undo_push("Subdivide Smooth");
|
|
||||||
break;
|
|
||||||
case 14:
|
case 14:
|
||||||
mesh_set_smooth_faces(1);
|
mesh_set_smooth_faces(1);
|
||||||
break;
|
break;
|
||||||
|
@ -1181,8 +1181,7 @@ short sbutton(char *var, float min, float max, char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
short fbutton(float *var, float min, float max, float a1, float a2,
|
short fbutton(float *var, float min, float max, float a1, float a2, char *str)
|
||||||
char *str)
|
|
||||||
{
|
{
|
||||||
uiBlock *block;
|
uiBlock *block;
|
||||||
ListBase listb={0, 0};
|
ListBase listb={0, 0};
|
||||||
|
Loading…
Reference in New Issue
Block a user