* Added 'Set Smooth' and 'Set Solid' to the mesh edit mode specials menu/toolbox/3d view menu so you don't always have to keep switching back to edit buttons.

This commit is contained in:
2005-09-28 11:55:43 +00:00
parent 2a08be6e50
commit c1e8340638
6 changed files with 84 additions and 31 deletions

View File

@@ -547,27 +547,11 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
case B_SETSOLID:
if(G.obedit) {
if(G.obedit->type == OB_MESH) {
efa= em->faces.first;
while(efa) {
if(efa->f & SELECT) {
if(event==B_SETSMOOTH) efa->flag |= ME_SMOOTH;
else efa->flag &= ~ME_SMOOTH;
}
efa= efa->next;
}
mesh_set_smooth_faces((event==B_SETSMOOTH));
}
else {
nu= editNurb.first;
while(nu) {
if(isNurbsel(nu)) {
if(event==B_SETSMOOTH) nu->flag |= CU_SMOOTH;
else nu->flag &= ~CU_SMOOTH;
nurb_set_smooth((event==B_SETSMOOTH));
}
nu= nu->next;
}
}
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
else if(G.vd) {
base= FIRSTBASE;
@@ -590,10 +574,10 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
base= base->next;
}
allqueue(REDRAWVIEW3D, 0);
}
if(event == B_SETSMOOTH) BIF_undo_push("Set Smooth");
else BIF_undo_push("Set Solid");
}
break;
case B_CHANGEDEP:
DAG_scene_sort(G.scene); // makes new dag

View File

@@ -3256,6 +3256,29 @@ void delNurb()
}
void nurb_set_smooth(short event)
{
Nurb *nu;
if(G.obedit==0) return;
if(G.obedit->type != OB_CURVE) return;
nu= editNurb.first;
while(nu) {
if(isNurbsel(nu)) {
if(event==1) nu->flag |= CU_SMOOTH;
else if(event==0) nu->flag &= ~CU_SMOOTH;
}
nu= nu->next;
}
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
if(event==1) BIF_undo_push("Set Smooth");
else if(event==0) BIF_undo_push("Set Solid");
}
void join_curve(int type)
{

View File

@@ -5871,3 +5871,29 @@ void subdivideflag(int flag, float rad, int beauty)
allqueue(REDRAWVIEW3D, 0);
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
}
void mesh_set_smooth_faces(short event)
{
EditMesh *em = G.editMesh;
EditFace *efa;
if(G.obedit==0) return;
if(G.obedit->type != OB_MESH) return;
efa= em->faces.first;
while(efa) {
if(efa->f & SELECT) {
if(event==1) efa->flag |= ME_SMOOTH;
else if(event==0) efa->flag &= ~ME_SMOOTH;
}
efa= efa->next;
}
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
if(event==1) BIF_undo_push("Set Smooth");
else if(event==0) BIF_undo_push("Set Solid");
}

View File

@@ -2080,7 +2080,7 @@ 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");
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");
switch(nr) {
case 1:
@@ -2146,6 +2146,12 @@ void special_editmenu(void)
subdivideflag(1, 0.0, G.scene->toolsettings->editbutflag | B_SMOOTH);
BIF_undo_push("Subdivide Smooth");
break;
case 14:
mesh_set_smooth_faces(1);
break;
case 15:
mesh_set_smooth_faces(0);
break;
}
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);

View File

@@ -2203,7 +2203,7 @@ static uiBlock *view3d_edit_mesh_edgesmenu(void *arg_unused)
return block;
}
static void do_view3d_edit_mesh_facesmenu(void *arg, int event)
void do_view3d_edit_mesh_facesmenu(void *arg, int event)
{
switch(event) {
case 0: /* Fill Faces */
@@ -2227,6 +2227,13 @@ static void do_view3d_edit_mesh_facesmenu(void *arg, int event)
case 5: /* Make Edge/Face */
addedgeface_mesh();
break;
case 6: /* Set Smooth */
mesh_set_smooth_faces(1);
break;
case 7: /* Set Solid */
mesh_set_smooth_faces(0);
break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -2249,6 +2256,11 @@ static uiBlock *view3d_edit_mesh_facesmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Triangles to Quads|Alt J", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Flip Triangle Edges|Ctrl F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Smooth|W, Alt 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Solid|W, Alt 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
return block;

View File

@@ -1745,14 +1745,16 @@ static TBitem tb_mesh_edit_edge[]= {
{ -1, "", 0, do_view3d_edit_mesh_edgesmenu}};
static TBitem tb_mesh_edit_face[]= {
{ 0, "Make Edge/Face|F", 'f', NULL},
{ 0, "Fill|Shift F", 'F', NULL},
{ 0, "Beautify Fill|Alt F", TB_ALT|'f', NULL},
{ 0, "Make Edge/Face|F", 5, NULL},
{ 0, "Fill|Shift F", 0, NULL},
{ 0, "Beautify Fill|Alt F", 1, NULL},
{ 0, "SEPR", 0, NULL},
{ 0, "Convert to Triangles|Ctrl T", TB_CTRL|'t', NULL},
{ 0, "Convert to Quads|Alt J", TB_ALT|'j', NULL},
{ 0, "Flip Triangle Edges|Ctrl F", TB_CTRL|'f', NULL},
{ -1, "", 0, tb_do_hotkey}};
{ 0, "Convert to Triangles|Ctrl T", 2, NULL},
{ 0, "Convert to Quads|Alt J", 3, NULL},
{ 0, "Flip Triangle Edges|Ctrl F", 4, NULL},
{ 0, "Set Smooth|W, Alt 4", 6, NULL},
{ 0, "Set Solid|W, Alt 5", 7, NULL},
{ -1, "", 0, do_view3d_edit_mesh_facesmenu}};
static TBitem tb_mesh_edit_normal[]= {