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 void xsortvert_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 extrude_mesh(void);
|
||||
extern void split_mesh(void);
|
||||
extern void extrude_repeat_mesh(int steps, float offs);
|
||||
|
@ -102,12 +102,13 @@ void sel_verts_defgroup (int select)
|
||||
else EM_deselect_flush();
|
||||
}
|
||||
|
||||
MDeformWeight *verify_defweight (MDeformVert *dv, int defgroup)
|
||||
/* 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;
|
||||
int i;
|
||||
|
||||
if (!dv || defgroup<0)
|
||||
return NULL;
|
||||
@ -133,7 +134,8 @@ the specified defweight group */
|
||||
return dv->dw+(dv->totweight-1);
|
||||
}
|
||||
|
||||
void add_defgroup (Object *ob) {
|
||||
void add_defgroup (Object *ob)
|
||||
{
|
||||
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)
|
||||
{
|
||||
static short numcuts= 2;
|
||||
Object *ob= OBACT;
|
||||
float fac;
|
||||
int nr,ret;
|
||||
short randfac,numcuts;
|
||||
short randfac;
|
||||
|
||||
if(ob==NULL) return;
|
||||
|
||||
@ -2084,34 +2085,42 @@ void special_editmenu(void)
|
||||
}
|
||||
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) {
|
||||
case 1:
|
||||
numcuts = 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");
|
||||
break;
|
||||
case 2:
|
||||
numcuts = 2;
|
||||
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
||||
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");
|
||||
break;
|
||||
case 3:
|
||||
numcuts = 2;
|
||||
if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
||||
waitcursor(1);
|
||||
randfac= 10;
|
||||
if(button(&randfac, 1, 100, "Rand fac:")==0) return;
|
||||
fac= -( (float)randfac )/100;
|
||||
esubdivideflag(1, fac, G.scene->toolsettings->editbutflag,numcuts,0);
|
||||
esubdivideflag(1, fac, G.scene->toolsettings->editbutflag, numcuts, 0);
|
||||
BIF_undo_push("Subdivide Fractal");
|
||||
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:
|
||||
mergemenu();
|
||||
break;
|
||||
@ -2138,18 +2147,6 @@ void special_editmenu(void)
|
||||
case 11:
|
||||
bevel_menu();
|
||||
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:
|
||||
mesh_set_smooth_faces(1);
|
||||
break;
|
||||
|
@ -1181,8 +1181,7 @@ short sbutton(char *var, float min, float max, char *str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
short fbutton(float *var, float min, float max, float a1, float a2,
|
||||
char *str)
|
||||
short fbutton(float *var, float min, float max, float a1, float a2, char *str)
|
||||
{
|
||||
uiBlock *block;
|
||||
ListBase listb={0, 0};
|
||||
|
Loading…
Reference in New Issue
Block a user