Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-09 01:31:28 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-09 01:31:28 +0400
commit51ae88aa3b84565d79ab8819807f90aa3844479a (patch)
tree355d3ef7ac873c259321c574e6fcea82b4585087 /source/blender/editors/mesh
parent288bfeea1ed8435cfa22938346afbabb7e91bdbb (diff)
2.5: Mesh and Various Fixes
* 3D view Mesh menu works again, but incomplete. * Add Properties and Toolbar to 3D View menu. * Added "specials" menus back, vertex/edge/face and general. * Various fixes in existing mesh operators, some were not working. * Add MESH_OT_merge. * Merge all subdivide ops into MESH_OT_subdivide, subdivide code changes to make smooth + multi give good results. * Rename all select inverse ops to *_OT_select_inverse. * Fix "search for unknown operator" prints at startup, and some warnings in py code. * Don't run .pyc files on startup. * Remove unused image window header C code.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh.c2
-rw-r--r--source/blender/editors/mesh/editmesh_add.c19
-rw-r--r--source/blender/editors/mesh/editmesh_loop.c10
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c213
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c566
-rw-r--r--source/blender/editors/mesh/mesh_intern.h13
-rw-r--r--source/blender/editors/mesh/mesh_ops.c206
7 files changed, 490 insertions, 539 deletions
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index e2ccd0976d2..a680fb5d07a 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -1625,7 +1625,7 @@ static int mesh_separate_exec(bContext *C, wmOperator *op)
void MESH_OT_separate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mesh Separate";
+ ot->name= "Separate";
ot->idname= "MESH_OT_separate";
/* api callbacks */
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 942ad657992..c24670aa856 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -1104,7 +1104,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
}
dia*=200;
- for(a=1; a<subdiv; a++) esubdivideflag(obedit, em, 2, dia, 0,1,0);
+ for(a=1; a<subdiv; a++) esubdivideflag(obedit, em, 2, dia, 0, B_SPHERE,1,0);
/* and now do imat */
eve= em->verts.first;
while(eve) {
@@ -1661,7 +1661,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
/****************** add duplicate operator ***************/
-static int mesh_add_duplicate_exec(bContext *C, wmOperator *op)
+static int mesh_duplicate_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_edit_object(C);
@@ -1677,10 +1677,10 @@ static int mesh_add_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
WM_cursor_wait(1);
- mesh_add_duplicate_exec(C, op);
+ mesh_duplicate_exec(C, op);
WM_cursor_wait(0);
RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
@@ -1689,16 +1689,15 @@ static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event
return OPERATOR_FINISHED;
}
-void MESH_OT_duplicate_add(wmOperatorType *ot)
+void MESH_OT_duplicate(wmOperatorType *ot)
{
-
/* identifiers */
- ot->name= "Add Duplicate";
- ot->idname= "MESH_OT_duplicate_add";
+ ot->name= "Duplicate";
+ ot->idname= "MESH_OT_duplicate";
/* api callbacks */
- ot->invoke= mesh_add_duplicate_invoke;
- ot->exec= mesh_add_duplicate_exec;
+ ot->invoke= mesh_duplicate_invoke;
+ ot->exec= mesh_duplicate_exec;
ot->poll= ED_operator_editmesh;
diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c
index 9f804ee8553..7fc3753eefb 100644
--- a/source/blender/editors/mesh/editmesh_loop.c
+++ b/source/blender/editors/mesh/editmesh_loop.c
@@ -369,9 +369,9 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts)
fac= 1.0f;
// XXX if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return;
fac= 0.292f*fac;
- esubdivideflag(obedit, em, SELECT,fac,B_SMOOTH,numcuts,SUBDIV_SELECT_LOOPCUT);
+ esubdivideflag(obedit, em, SELECT,fac,0,B_SMOOTH,numcuts,SUBDIV_SELECT_LOOPCUT);
} else {
- esubdivideflag(obedit, em, SELECT,0,0,numcuts,SUBDIV_SELECT_LOOPCUT);
+ esubdivideflag(obedit, em, SELECT,0,0,0,numcuts,SUBDIV_SELECT_LOOPCUT);
}
/* if this was a single cut, enter edgeslide mode */
if(numcuts == 1 && hasHidden == 0){
@@ -690,9 +690,9 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
eed= eed->next;
}
- if (mode==KNIFE_MIDPOINT) esubdivideflag(obedit, em, SELECT, 0, B_KNIFE, 1, SUBDIV_SELECT_ORIG);
- else if (mode==KNIFE_MULTICUT) esubdivideflag(obedit, em, SELECT, 0, B_KNIFE, numcuts, SUBDIV_SELECT_ORIG);
- else esubdivideflag(obedit, em, SELECT, 0, B_KNIFE|B_PERCENTSUBD, 1, SUBDIV_SELECT_ORIG);
+ if (mode==KNIFE_MIDPOINT) esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE, 1, SUBDIV_SELECT_ORIG);
+ else if (mode==KNIFE_MULTICUT) esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE, numcuts, SUBDIV_SELECT_ORIG);
+ else esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE|B_PERCENTSUBD, 1, SUBDIV_SELECT_ORIG);
eed=em->edges.first;
while(eed){
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 67886ee8df5..ca0f73ece68 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -1412,7 +1412,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
break;
case 2: /* copy image */
if (!tf_act) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1433,7 +1433,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
case 3: /* copy UV's */
if (!tf_act) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1446,7 +1446,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
break;
case 4: /* mode's */
if (!tf_act) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1459,7 +1459,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
break;
case 5: /* copy transp's */
if (!tf_act) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
return;
}
for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1473,7 +1473,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
case 6: /* copy vcols's */
if (!mcol_act) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no color layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers.");
return;
} else {
/* guess the 4th color if needs be */
@@ -3207,7 +3207,7 @@ void EM_select_swap(EditMesh *em) /* exported for UV */
}
-static int select_invert_mesh_exec(bContext *C, wmOperator *op)
+static int select_inverse_mesh_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
@@ -3220,14 +3220,14 @@ static int select_invert_mesh_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void MESH_OT_select_invert(wmOperatorType *ot)
+void MESH_OT_select_inverse(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Select Invert";
- ot->idname= "MESH_OT_select_invert";
+ ot->name= "Select Inverse";
+ ot->idname= "MESH_OT_select_inverse";
/* api callbacks */
- ot->exec= select_invert_mesh_exec;
+ ot->exec= select_inverse_mesh_exec;
ot->poll= ED_operator_editmesh;
/* flags */
@@ -3641,7 +3641,7 @@ static int editmesh_mark_seam(bContext *C, wmOperator *op)
void MESH_OT_mark_seam(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mark seam";
+ ot->name= "Mark Seam";
ot->idname= "MESH_OT_mark_seam";
/* api callbacks */
@@ -3660,15 +3660,15 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
Mesh *me= ((Mesh *)obedit->data);
- int set = RNA_boolean_get(op->ptr, "set");
+ int clear = RNA_boolean_get(op->ptr, "clear");
EditEdge *eed;
/* auto-enable sharp edge drawing */
- if(set) {
+ if(clear == 0) {
me->drawflag |= ME_DRAWSHARP;
}
- if(set) {
+ if(!clear) {
eed= em->edges.first;
while(eed) {
if(!eed->h && (eed->f & SELECT)) eed->sharp = 1;
@@ -3693,7 +3693,7 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op)
void MESH_OT_mark_sharp(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Mark sharp";
+ ot->name= "Mark Sharp";
ot->idname= "MESH_OT_mark_sharp";
/* api callbacks */
@@ -3703,167 +3703,9 @@ void MESH_OT_mark_sharp(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_boolean(ot->srna, "set", 0, "Set", "");
-}
-
-void BME_Menu() {
- short ret;
- ret= pupmenu("BME modeller%t|Select Edges of Vert%x1");
-
- switch(ret)
- {
- case 1:
- //BME_edges_of_vert();
- break;
- }
-}
-
-
-
-void Vertex_Menu(EditMesh *em)
-{
- short ret;
- ret= pupmenu("Vertex Specials%t|Remove Doubles%x1|Merge%x2|Smooth %x3|Select Vertex Path%x4|Blend From Shape%x5|Propagate To All Shapes%x6");
-
- switch(ret)
- {
- case 1:
-// XXX notice("Removed %d Vertices", removedoublesflag(1, 0, scene->toolsettings->doublimit));
- break;
- case 2:
-// XXX mergemenu(em);
- break;
- case 3:
-// XXX vertexsmooth(em);
- break;
- case 4:
-// XXX pathselect(em);
- break;
- case 5:
-// XXX shape_copy_select_from(em);
- break;
- case 6:
-// XXX shape_propagate(em);
- break;
- }
- /* some items crashed because this is in the original W menu but not here. should really manage this better */
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-}
-
-
-void Edge_Menu(EditMesh *em)
-{
- short ret;
-
- ret= pupmenu("Edge Specials%t|Mark Seam %x1|Clear Seam %x2|Rotate Edge CW%x3|Rotate Edge CCW%x4|Loopcut%x6|Edge Slide%x5|Edge Loop Select%x7|Edge Ring Select%x8|Loop to Region%x9|Region to Loop%x10|Mark Sharp%x11|Clear Sharp%x12");
-
- switch(ret)
- {
- case 1:
- //editmesh_mark_seam(em, 0);
- break;
- case 2:
- //editmesh_mark_seam(em, 1);
- break;
- case 3:
-// edge_rotate_selected(em, 2);
- break;
- case 4:
-// edge_rotate_selected(em, 1);
- break;
- case 5:
-// EdgeSlide(em, 0,0.0);
- break;
- case 6:
-// CutEdgeloop(em, 1);
- break;
- case 7:
-// loop_multiselect(em, 0);
- break;
- case 8:
-// loop_multiselect(em, 1);
- break;
- case 9:
-// loop_to_region(em);
- break;
- case 10:
-// region_to_loop(em);
- break;
- case 11:
-// editmesh_mark_sharp(em, 1);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- break;
- case 12:
-// editmesh_mark_sharp(em, 0);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- break;
- }
- /* some items crashed because this is in the original W menu but not here. should really manage this better */
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-}
-
-void Face_Menu(EditMesh *em)
-{
- short ret;
- ret= pupmenu(
- "Face Specials%t|Flip Normals%x1|Bevel%x2|Shade Smooth%x3|Shade Flat%x4|"
- "Triangulate (Ctrl T)%x5|Quads from Triangles (Alt J)%x6|Flip Triangle Edges (Ctrl Shift F)%x7|%l|"
- "Face Mode Set%x8|Face Mode Clear%x9|%l|"
- "UV Rotate (Shift - CCW)%x10|UV Mirror (Shift - Switch Axis)%x11|"
- "Color Rotate (Shift - CCW)%x12|Color Mirror (Shift - Switch Axis)%x13");
-
- switch(ret)
- {
- case 1:
-// flip_editnormals(em);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- break;
- case 2:
-// bevel_menu(em);
- break;
- case 3:
-// mesh_set_smooth_faces(em, 1);
- break;
- case 4:
-// mesh_set_smooth_faces(em, 0);
- break;
-
- case 5: /* Quads to Tris */
-// convert_to_triface(em, 0);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- break;
- case 6: /* Tris to Quads */
-// join_triangles(em);
- break;
- case 7: /* Flip triangle edges */
-// edge_flip(em);
- break;
- case 8:
-// mesh_set_face_flags(em, 1);
- break;
- case 9:
-// mesh_set_face_flags(em, 0);
- break;
-
- /* uv texface options */
- case 10:
-// mesh_rotate_uvs(em);
- break;
- case 11:
-// mesh_mirror_uvs(em);
- break;
- case 12:
-// mesh_rotate_colors(em);
- break;
- case 13:
-// mesh_mirror_colors(em);
- break;
- }
- /* some items crashed because this is in the original W menu but not here. should really manage this better */
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
}
-
/* **************** NORMALS ************** */
/* XXX value of select is messed up, it means two things */
@@ -4293,20 +4135,13 @@ static int smooth_vertex(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
- Mesh *me= obedit->data;
- EditMesh *em= (EditMesh *)me;
-
+ EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
EditVert *eve, *eve_mir = NULL;
EditEdge *eed;
float *adror, *adr, fac;
float fvec[3];
int teller=0;
- ModifierData *md= obedit->modifiers.first;
-
- if(em==NULL) {
- BKE_mesh_end_editmesh(obedit->data, em);
- return OPERATOR_CANCELLED;
- }
+ ModifierData *md;
/* count */
eve= em->verts.first;
@@ -4334,8 +4169,8 @@ static int smooth_vertex(bContext *C, wmOperator *op)
/* if there is a mirror modifier with clipping, flag the verts that
* are within tolerance of the plane(s) of reflection
*/
- for (; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
+ for(md=obedit->modifiers.first; md; md=md->next) {
+ if(md->type==eModifierType_Mirror) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
if(mmd->flag & MOD_MIR_CLIPPING) {
@@ -4604,7 +4439,7 @@ void flipface(EditMesh *em, EditFace *efa)
}
-static int flip_editnormals(bContext *C, wmOperator *op)
+static int flip_normals(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
@@ -4630,14 +4465,14 @@ static int flip_editnormals(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void MESH_OT_flip_editnormals(wmOperatorType *ot)
+void MESH_OT_flip_normals(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Flip Normals";
- ot->idname= "MESH_OT_flip_editnormals";
+ ot->idname= "MESH_OT_flip_normals";
/* api callbacks */
- ot->exec= flip_editnormals;
+ ot->exec= flip_normals;
ot->poll= ED_operator_editmesh;
/* flags */
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 00cd187a23c..4377f459081 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -736,7 +736,7 @@ static int mesh_extrude_exec(bContext *C, wmOperator *op)
void MESH_OT_extrude(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Extrude Mesh";
+ ot->name= "Extrude";
ot->idname= "MESH_OT_extrude";
/* api callbacks */
@@ -777,7 +777,7 @@ static int split_mesh(bContext *C, wmOperator *op)
void MESH_OT_split(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Split Mesh";
+ ot->name= "Split";
ot->idname= "MESH_OT_split";
/* api callbacks */
@@ -1341,7 +1341,7 @@ void MESH_OT_delete(wmOperatorType *ot)
#define DOUBLEOPFILL 16
/* calculates offset for co, based on fractal, sphere or smooth settings */
-static void alter_co(float *co, EditEdge *edge, float rad, int beauty, float perc)
+static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int beauty, float perc)
{
float vec1[3], fac;
@@ -1368,37 +1368,38 @@ static void alter_co(float *co, EditEdge *edge, float rad, int beauty, float per
vec1[0]+= fac*nor2[0];
vec1[1]+= fac*nor2[1];
vec1[2]+= fac*nor2[2];
+
+ /* falloff for multi subdivide */
+ smooth *= sqrt(fabs(1.0f - 2.0f*fabs(0.5f-perc)));
- vec1[0]*= rad*len;
- vec1[1]*= rad*len;
- vec1[2]*= rad*len;
+ vec1[0]*= smooth*len;
+ vec1[1]*= smooth*len;
+ vec1[2]*= smooth*len;
co[0] += vec1[0];
co[1] += vec1[1];
co[2] += vec1[2];
}
- else {
- if(rad > 0.0) { /* subdivide sphere */
- Normalize(co);
- co[0]*= rad;
- co[1]*= rad;
- co[2]*= rad;
- }
- else if(rad< 0.0) { /* fractal subdivide */
- fac= rad* VecLenf(edge->v1->co, edge->v2->co);
- vec1[0]= fac*(float)(0.5-BLI_drand());
- vec1[1]= fac*(float)(0.5-BLI_drand());
- vec1[2]= fac*(float)(0.5-BLI_drand());
- VecAddf(co, co, vec1);
- }
+ else if(beauty & B_SPHERE) { /* subdivide sphere */
+ Normalize(co);
+ co[0]*= smooth;
+ co[1]*= smooth;
+ co[2]*= smooth;
+ }
+ if(beauty & B_FRACTAL) {
+ fac= fractal*VecLenf(edge->v1->co, edge->v2->co);
+ vec1[0]= fac*(float)(0.5-BLI_drand());
+ vec1[1]= fac*(float)(0.5-BLI_drand());
+ vec1[2]= fac*(float)(0.5-BLI_drand());
+ VecAddf(co, co, vec1);
}
}
/* assumes in the edge is the correct interpolated vertices already */
-/* percent defines the interpolation, rad and beauty are for special options */
+/* percent defines the interpolation, smooth, fractal and beauty are for special options */
/* results in new vertex with correct coordinate, vertex normal and weight group info */
-static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float rad, int beauty, float percent)
+static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smooth, float fractal, int beauty, float percent)
{
EditVert *ev;
float co[3];
@@ -1408,7 +1409,7 @@ static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float rad,
co[2] = (edge->v2->co[2]-edge->v1->co[2])*percent + edge->v1->co[2];
/* offset for smooth or sphere or fractal */
- alter_co(co, edge, rad, beauty, percent);
+ alter_co(co, edge, smooth, fractal, beauty, percent);
/* clip if needed by mirror modifier */
if (edge->v1->f2) {
@@ -2176,7 +2177,7 @@ static void fill_quad_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int
//EM_fgon_flags(em);
}
-static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float rad, int beauty)
+static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty)
{
EditVert **verts[4], ***innerverts;
EditFace *hold;
@@ -2246,7 +2247,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i
for(j=1;j<=numcuts;j++) {
float percent= (float)j/(float)(numcuts+1);
- innerverts[i][(numcuts+1)-j]= subdivide_edge_addvert(em, &temp, rad, beauty, percent);
+ innerverts[i][(numcuts+1)-j]= subdivide_edge_addvert(em, &temp, smooth, fractal, beauty, percent);
}
}
// Fill with faces
@@ -2273,7 +2274,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i
MEM_freeN(innerverts);
}
-static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float rad, int beauty)
+static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty)
{
EditVert **verts[3], ***innerverts;
short vertsize, i, j;
@@ -2344,7 +2345,7 @@ static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int n
for(j=1;j<(numcuts+1)-i;j++) {
float percent= (float)j/(float)((numcuts+1)-i);
- innerverts[i][((numcuts+1)-i)-j]= subdivide_edge_addvert(em, &temp, rad, beauty, 1-percent);
+ innerverts[i][((numcuts+1)-i)-j]= subdivide_edge_addvert(em, &temp, smooth, fractal, beauty, 1-percent);
}
}
@@ -2522,7 +2523,7 @@ static void fill_quad_singlevert(EditMesh *em, EditFace *efa, struct GHash *gh)
// This function takes an example edge, the current point to create and
// the total # of points to create, then creates the point and return the
// editvert pointer to it.
-static EditVert *subdivideedgenum(EditMesh *em, EditEdge *edge, int curpoint, int totpoint, float rad, int beauty)
+static EditVert *subdivideedgenum(EditMesh *em, EditEdge *edge, int curpoint, int totpoint, float smooth, float fractal, int beauty)
{
EditVert *ev;
float percent;
@@ -2533,13 +2534,13 @@ static EditVert *subdivideedgenum(EditMesh *em, EditEdge *edge, int curpoint, in
else
percent= (float)curpoint/(float)(totpoint+1);
- ev= subdivide_edge_addvert(em, edge, rad, beauty, percent);
+ ev= subdivide_edge_addvert(em, edge, smooth, fractal, beauty, percent);
ev->f = edge->v1->f;
return ev;
}
-void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beauty, int numcuts, int seltype)
+void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float fractal, int beauty, int numcuts, int seltype)
{
EditFace *ef;
EditEdge *eed, *cedge, *sort[4];
@@ -2692,7 +2693,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut
for(i=0;i<numcuts;i++) {
// This function creates the new vert and returns it back
// to the array
- templist[i+1] = subdivideedgenum(em, eed, i+1, numcuts, rad, beauty);
+ templist[i+1] = subdivideedgenum(em, eed, i+1, numcuts, smooth, fractal, beauty);
//while we are here, we can copy edge info from the original edge
cedge = addedgelist(em, templist[i],templist[i+1],eed);
// Also set the edge f2 to EDGENEW so that we can use this info later
@@ -2795,7 +2796,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut
fill_quad_triple(em, ef, gh, numcuts);
break;
case 4: ef->f1 = SELECT;
- fill_quad_quadruple(em, ef, gh, numcuts, rad, beauty);
+ fill_quad_quadruple(em, ef, gh, numcuts, smooth, fractal, beauty);
break;
}
} else {
@@ -2808,7 +2809,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut
fill_tri_double(em, ef, gh, numcuts);
break;
case 3: ef->f1 = SELECT;
- fill_tri_triple(em, ef, gh, numcuts, rad, beauty);
+ fill_tri_triple(em, ef, gh, numcuts, smooth, fractal, beauty);
break;
}
}
@@ -3487,7 +3488,23 @@ void edge_flip(EditMesh *em)
MEM_freeN(efaar);
}
-static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir)
+#define DIRECTION_CW 1
+#define DIRECTION_CCW 2
+
+static const EnumPropertyItem direction_items[]= {
+ {DIRECTION_CW, "CW", 0, "Clockwise", ""},
+ {DIRECTION_CCW, "CCW", 0, "Counter Clockwise", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+#define AXIS_X 1
+#define AXIS_Y 2
+
+static const EnumPropertyItem axis_items[]= {
+ {AXIS_X, "X", 0, "X", ""},
+ {AXIS_Y, "Y", 0, "Y", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir)
{
EditVert **verts[2];
EditFace *face[2], *efa, *newFace[2];
@@ -3585,10 +3602,10 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir)
newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
}
else if(fac1 == 4 && fac2 == 3) {
- if(dir == 1) {
+ if(dir == DIRECTION_CW) {
newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
- } else if (dir == 2) {
+ } else if (dir == DIRECTION_CCW) {
newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]);
newFace[1]= EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1);
@@ -3597,10 +3614,10 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir)
}
}
else if(fac1 == 3 && fac2 == 4) {
- if(dir == 1) {
+ if(dir == DIRECTION_CW) {
newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1);
newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
- } else if (dir == 2) {
+ } else if (dir == DIRECTION_CCW) {
newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1);
newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]);
@@ -3610,10 +3627,10 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir)
}
else if(fac1 == 4 && fac2 == 4) {
- if(dir == 1) {
+ if(dir == DIRECTION_CW) {
newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
- } else if (dir == 2) {
+ } else if (dir == DIRECTION_CCW) {
newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]);
newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]);
@@ -3624,7 +3641,7 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir)
else
return; /* This should never happen */
- if(dir == 1 || (fac1 == 3 && fac2 == 3)) {
+ if(dir == DIRECTION_CW || (fac1 == 3 && fac2 == 3)) {
verts[0][p[0][1]]->f |= SELECT;
verts[1][p[1][1]]->f |= SELECT;
}
@@ -3668,10 +3685,9 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
- int dir = RNA_int_get(op->ptr,"dir"); // dir == 2 when clockwise and ==1 for counter CW.
EditEdge *eed;
EditFace *efa;
+ int dir = RNA_int_get(op->ptr, "direction"); // dir == 2 when clockwise and ==1 for counter CW.
short edgeCount = 0;
/*clear new flag for new edges, count selected edges */
@@ -3719,23 +3735,21 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
}
}
}
- else
- {
+ else {
BKE_report(op->reports, RPT_ERROR, "Select one edge or two adjacent faces");
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_CANCELLED;
}
-
/* flush selected vertices (again) to edges/faces */
EM_select_flush(em);
+ BKE_mesh_end_editmesh(obedit->data, em);
+
DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
-
}
void MESH_OT_edge_rotate(wmOperatorType *ot)
@@ -3752,7 +3766,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_int(ot->srna, "dir", 1, 1, 2, "Direction", "Clockwise and Counter Clockwise", 1, 2);
+ RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "direction", "direction to rotate edge around.");
}
@@ -4726,23 +4740,7 @@ void mesh_set_face_flags(EditMesh *em, short mode)
}
#endif
-void mesh_set_smooth_faces(EditMesh *em, short event)
-{
- EditFace *efa;
-
- if(em==NULL) 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;
- }
-}
-
-/* ********************** mesh rip ********************** */
+/********************** Rip Operator *************************/
/* helper to find edge for edge_rip */
static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, short *mval)
@@ -5014,7 +5012,7 @@ void MESH_OT_rip(wmOperatorType *ot)
}
-/* ************************************** */
+/************************ Shape Operators *************************/
void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
{
@@ -5205,6 +5203,8 @@ void shape_copy_select_from(Object *obedit, EditMesh *em, wmOperator *op)
return;
}
+/************************ Merge Operator *************************/
+
/* Collection Routines|Currently used by the improved merge code*/
/* buildEdge_collection() creates a list of lists*/
/* these lists are filled with edges that are topologically connected.*/
@@ -5695,10 +5695,6 @@ int collapseEdges(EditMesh *em)
}
freecollections(&allcollections);
removedoublesflag(em, 1, 0, MERGELIMIT);
- /*get rid of this!*/
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
-// if (EM_texFaceCheck())
return mergecount;
}
@@ -5741,6 +5737,7 @@ int merge_target(EditMesh *em, int target, int uvmerge)
{
EditVert *eve;
+ // XXX not working
if(target) snap_sel_to_curs();
else snap_to_center();
@@ -5751,21 +5748,113 @@ int merge_target(EditMesh *em, int target, int uvmerge)
}
collapseuvs(em, NULL);
}
-
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
return removedoublesflag(em, 1, 0, MERGELIMIT);
-
}
#undef MERGELIMIT
-typedef struct PathNode{
+static int merge_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+ int count= 0, uvs= RNA_boolean_get(op->ptr, "uvs");
+
+ switch(RNA_enum_get(op->ptr, "type")) {
+ case 3:
+ count = merge_target(em, 0, uvs);
+ break;
+ case 4:
+ count = merge_target(em, 1, uvs);
+ break;
+ case 1:
+ count = merge_firstlast(em, 0, uvs);
+ break;
+ case 6:
+ count = merge_firstlast(em, 1, uvs);
+ break;
+ case 2:
+ count = collapseEdges(em);
+ break;
+ }
+
+ if(!count)
+ return OPERATOR_CANCELLED;
+
+ BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices.", count);
+
+ BKE_mesh_end_editmesh(obedit->data, em);
+
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
+ return OPERATOR_FINISHED;
+}
+
+static EnumPropertyItem merge_type_items[]= {
+ {6, "FIRST", 0, "At First", ""},
+ {1, "LAST", 0, "At Last", ""},
+ {3, "CENTER", 0, "At Center", ""},
+ {4, "CURSOR", 0, "At Cursor", ""},
+ {5, "COLLAPSE", 0, "Collapse", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+static EnumPropertyItem *merge_type_itemf(PointerRNA *ptr)
+{
+ /* XXX need context here */
+#if 0
+ Scene *scene= CTX_data_scene(C);
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+
+ if(em->selectmode & SCE_SELECT_VERTEX)
+ if(em->selected.first && em->selected.last &&
+ ((EditSelection*)em->selected.first)->type == EDITVERT && ((EditSelection*)em->selected.last)->type == EDITVERT)
+ event = pupmenu("Merge %t|At First %x6|At Last%x1|At Center%x3|At Cursor%x4|Collapse%x2");
+ else if (em->selected.first && ((EditSelection*)em->selected.first)->type == EDITVERT)
+ event = pupmenu("Merge %t|At First %x6|At Center%x3|At Cursor%x4|Collapse%x2");
+ else if (em->selected.last && ((EditSelection*)em->selected.last)->type == EDITVERT)
+ event = pupmenu("Merge %t|At Last %x1|At Center%x3|At Cursor%x4|Collapse%x2");
+ else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2");
+ else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2");
+
+ BKE_mesh_end_editmesh(obedit->data, em);
+#endif
+
+ return merge_type_items;
+}
+
+void MESH_OT_merge(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name= "Merge";
+ ot->idname= "MESH_OT_merge";
+
+ /* api callbacks */
+ ot->exec= merge_exec;
+ ot->invoke= WM_menu_invoke;
+ ot->poll= ED_operator_editmesh;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ prop= RNA_def_enum(ot->srna, "type", merge_type_items, 6, "Type", "Merge method to use.");
+ RNA_def_enum_funcs(prop, merge_type_itemf);
+ RNA_def_boolean(ot->srna, "uvs", 0, "UVs", "Move UVs according to merge.");
+}
+
+/************************ Vertex Path Operator *************************/
+
+typedef struct PathNode {
int u;
int visited;
ListBase edges;
} PathNode;
-typedef struct PathEdge{
+typedef struct PathEdge {
struct PathEdge *next, *prev;
int v;
float w;
@@ -5957,43 +6046,46 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", type_items, PATH_SELECT_EDGE_LENGTH, "Type", "Method to compute distance.");
}
+/********************** Region/Loop Operators *************************/
+
static int region_to_loop(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditEdge *eed;
EditFace *efa;
+ int selected= 0;
- if(em->totfacesel){
- for(eed=em->edges.first; eed; eed=eed->next) eed->f1 = 0;
-
- for(efa=em->faces.first; efa; efa=efa->next){
- if(efa->f&SELECT){
- efa->e1->f1++;
- efa->e2->f1++;
- efa->e3->f1++;
- if(efa->e4)
- efa->e4->f1++;
- }
- }
-
- EM_clear_flag_all(em, SELECT);
-
- for(eed=em->edges.first; eed; eed=eed->next){
- if(eed->f1 == 1) EM_select_edge(eed, 1);
- }
-
- em->selectmode = SCE_SELECT_EDGE;
- EM_selectmode_set(em);
- // DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+ for(eed=em->edges.first; eed; eed=eed->next) eed->f1 = 0;
+
+ for(efa=em->faces.first; efa; efa=efa->next){
+ if(efa->f&SELECT){
+ efa->e1->f1++;
+ efa->e2->f1++;
+ efa->e3->f1++;
+ if(efa->e4)
+ efa->e4->f1++;
-// if (EM_texFaceCheck())
+ selected= 1;
+ }
+ }
+ if(!selected)
+ return OPERATOR_CANCELLED;
+
+ EM_clear_flag_all(em, SELECT);
+
+ for(eed=em->edges.first; eed; eed=eed->next){
+ if(eed->f1 == 1) EM_select_edge(eed, 1);
}
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+ em->selectmode = SCE_SELECT_EDGE;
+ EM_selectmode_set(em);
BKE_mesh_end_editmesh(obedit->data, em);
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
return OPERATOR_FINISHED;
}
@@ -6165,12 +6257,10 @@ static int loop_to_region(bContext *C, wmOperator *op)
}
freecollections(&allcollections);
-// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
-// if (EM_texFaceCheck())
+ BKE_mesh_end_editmesh(obedit->data, em);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- BKE_mesh_end_editmesh(obedit->data, em);
+
return OPERATOR_FINISHED;
}
@@ -6188,6 +6278,7 @@ void MESH_OT_loop_to_region(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/********************** UV/Color Operators *************************/
// XXX please check if these functions do what you want them to
/* texface and vertex color editmode tools for the face menu */
@@ -6199,26 +6290,24 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditFace *efa;
- short change = 0, ccw;
+ short change = 0;
MTFace *tf;
float u1, v1;
- int shift = 0; // XXX
+ int dir= RNA_enum_get(op->ptr, "direction");
if (!EM_texFaceCheck(em)) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_CANCELLED;
}
- ccw = (shift);
-
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
u1= tf->uv[0][0];
v1= tf->uv[0][1];
- if (ccw) {
+ if (dir == DIRECTION_CCW) {
if(efa->v4) {
tf->uv[0][0]= tf->uv[3][0];
tf->uv[0][1]= tf->uv[3][1];
@@ -6276,23 +6365,21 @@ static int mesh_mirror_uvs(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditFace *efa;
- short change = 0, altaxis;
+ short change = 0;
MTFace *tf;
float u1, v1;
- int shift= 0; // XXX
+ int axis= RNA_enum_get(op->ptr, "axis");
if (!EM_texFaceCheck(em)) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_CANCELLED;
}
- altaxis = (shift);
-
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (altaxis) {
+ if (axis == AXIS_Y) {
u1= tf->uv[1][0];
v1= tf->uv[1][1];
if(efa->v4) {
@@ -6368,24 +6455,22 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditFace *efa;
- short change = 0, ccw;
+ short change = 0;
MCol tmpcol, *mcol;
- int shift= 0; // XXX
+ int dir= RNA_enum_get(op->ptr, "direction");
if (!EM_vertColorCheck(em)) {
- BKE_report(op->reports, RPT_ERROR, "mesh has no color layers");
+ BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers.");
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_CANCELLED;
}
- ccw = (shift);
-
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
tmpcol= mcol[0];
- if (ccw) {
+ if (dir == DIRECTION_CCW) {
if(efa->v4) {
mcol[0]= mcol[3];
mcol[3]= mcol[2];
@@ -6428,9 +6513,9 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditFace *efa;
- short change = 0, altaxis;
+ short change = 0;
MCol tmpcol, *mcol;
- int shift= 0; // XXX
+ int axis= RNA_enum_get(op->ptr, "axis");
if (!EM_vertColorCheck(em)) {
BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers");
@@ -6438,12 +6523,10 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- altaxis = (shift);
-
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
- if (altaxis) {
+ if (axis == AXIS_Y) {
tmpcol= mcol[1];
mcol[1]= mcol[2];
mcol[2]= tmpcol;
@@ -6491,6 +6574,9 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate UVs around.");
}
void MESH_OT_uvs_mirror(wmOperatorType *ot)
@@ -6505,6 +6591,9 @@ void MESH_OT_uvs_mirror(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_enum(ot->srna, "axis", axis_items, DIRECTION_CW, "Axis", "Axis to mirror UVs around.");
}
void MESH_OT_colors_rotate(wmOperatorType *ot)
@@ -6519,6 +6608,9 @@ void MESH_OT_colors_rotate(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate edge around.");
}
void MESH_OT_colors_mirror(wmOperatorType *ot)
@@ -6533,22 +6625,34 @@ void MESH_OT_colors_mirror(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_enum(ot->srna, "axis", axis_items, DIRECTION_CW, "Axis", "Axis to mirror colors around.");
}
+/********************** Subdivide Operator *************************/
+
static int subdivide_exec(bContext *C, wmOperator *op)
-{
+{
Scene *scene = CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
- esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, 1, 0);
-
- BKE_mesh_end_editmesh(obedit->data, em);
+ int cuts= RNA_int_get(op->ptr,"number_cuts");
+ float smooth= 0.292f*RNA_float_get(op->ptr, "smoothness");
+ float fractal= RNA_float_get(op->ptr, "fractal")/100;
+ int flag= 0;
+
+ if(smooth != 0.0f)
+ flag |= B_SMOOTH;
+ if(fractal != 0.0f)
+ flag |= B_FRACTAL;
+
+ esubdivideflag(obedit, em, 1, smooth, fractal, scene->toolsettings->editbutflag|flag, cuts, 0);
DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
- return OPERATOR_FINISHED;
+ return OPERATOR_FINISHED;
}
void MESH_OT_subdivide(wmOperatorType *ot)
@@ -6563,173 +6667,14 @@ void MESH_OT_subdivide(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int subdivide_multi_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
- esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"number_cuts"), 0);
-
- BKE_mesh_end_editmesh(obedit->data, em);
-
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivide_multi(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide Multi";
- ot->idname= "MESH_OT_subdivide_multi";
-
- /* api callbacks */
- ot->exec= subdivide_multi_exec;
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* props */
- RNA_def_int(ot->srna, "number_cuts", 4, 1, 100, "Number of Cuts", "", 1, INT_MAX);
-}
-
-static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
- esubdivideflag(obedit, em, 1, -(RNA_float_get(op->ptr, "random_factor")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr, "number_cuts"), 0);
-
- BKE_mesh_end_editmesh(obedit->data, em);
-
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivide_multi_fractal(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide Multi Fractal";
- ot->idname= "MESH_OT_subdivide_multi_fractal";
-
- /* api callbacks */
- ot->exec= subdivide_multi_fractal_exec;
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_int(ot->srna, "number_cuts", 4, 1, 100, "Number of Cuts", "", 1, INT_MAX);
- RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f);
+ RNA_def_int(ot->srna, "number_cuts", 1, 1, 10, "Number of Cuts", "", 1, INT_MAX);
+ RNA_def_float(ot->srna, "fractal", 0.0, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor.", 0.0f, 1000.0f);
+ RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1000.0f, "Smoothness", "Smoothness factor.", 0.0f, FLT_MAX);
}
-static int subdivide_smooth_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
- esubdivideflag(obedit, em, 1, 0.292f*RNA_float_get(op->ptr, "smoothness"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0);
-
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivide_smooth(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide Smooth";
- ot->idname= "MESH_OT_subdivide_smooth";
-
- /* api callbacks */
- ot->exec= subdivide_smooth_exec;
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* props */
- RNA_def_float(ot->srna, "smoothness", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
-}
-
-static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- uiPopupMenu *pup;
- uiLayout *layout;
-
- pup= uiPupMenuBegin(C, "Subdivision Type", 0);
- layout= uiPupMenuLayout(pup);
- uiItemsEnumO(layout, "MESH_OT_subdivs", "type");
- uiPupMenuEnd(C, pup);
-
- return OPERATOR_CANCELLED;
-}
-
-static int subdivs_exec(bContext *C, wmOperator *op)
-{
- switch(RNA_int_get(op->ptr, "type"))
- {
- case 0: // simple
- subdivide_exec(C,op);
- break;
- case 1: // multi
- subdivide_multi_exec(C,op);
- break;
- case 2: // fractal;
- subdivide_multi_fractal_exec(C,op);
- break;
- case 3: //smooth
- subdivide_smooth_exec(C,op);
- break;
- }
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivs(wmOperatorType *ot)
-{
- static EnumPropertyItem type_items[]= {
- {0, "SIMPLE", 0, "Simple", ""},
- {1, "MULTI", 0, "Multi", ""},
- {2, "FRACTAL", 0, "Fractal", ""},
- {3, "SMOOTH", 0, "Smooth", ""},
- {0, NULL, 0, NULL, NULL}};
-
- /* identifiers */
- ot->name= "subdivs";
- ot->idname= "MESH_OT_subdivs";
-
- /* api callbacks */
- ot->invoke= subdivs_invoke;
- ot->exec= subdivs_exec;
-
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /*props */
- RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
-
- /* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/
- RNA_def_int(ot->srna, "number_cuts", 4, 1, 10, "Number of Cuts", "", 1, INT_MAX);
- RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f);
- RNA_def_float(ot->srna, "smoothness", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
-
-}
-
-/* ************************************* */
+/********************** Fill Operators *************************/
/* note; the EM_selectmode_set() calls here illustrate how badly constructed it all is... from before the
edge/face flags, with very mixed results.... */
@@ -6975,7 +6920,6 @@ static void fill_mesh(EditMesh *em)
}
-
static int fill_mesh_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
@@ -6996,7 +6940,7 @@ static int fill_mesh_exec(bContext *C, wmOperator *op)
void MESH_OT_fill(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Fill Mesh";
+ ot->name= "Fill";
ot->idname= "MESH_OT_fill";
/* api callbacks */
@@ -7037,6 +6981,8 @@ void MESH_OT_beauty_fill(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/********************** Quad/Tri Operators *************************/
+
static int quads_convert_to_tris_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
@@ -7124,13 +7070,29 @@ void MESH_OT_edge_flip(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/********************** Smooth/Solid Operators *************************/
+
+void mesh_set_smooth_faces(EditMesh *em, short smooth)
+{
+ EditFace *efa;
+
+ if(em==NULL) return;
+
+ for(efa= em->faces.first; efa; efa=efa->next) {
+ if(efa->f & SELECT) {
+ if(smooth) efa->flag |= ME_SMOOTH;
+ else efa->flag &= ~ME_SMOOTH;
+ }
+ }
+}
+
static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
- mesh_set_smooth_faces(em,1);
+ mesh_set_smooth_faces(em, 1);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -7143,7 +7105,7 @@ static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op)
void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Smooth Face Shading";
+ ot->name= "Shade Smooth";
ot->idname= "MESH_OT_faces_shade_smooth";
/* api callbacks */
@@ -7160,7 +7122,7 @@ static int mesh_faces_shade_solid_exec(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
- mesh_set_smooth_faces(em,0);
+ mesh_set_smooth_faces(em, 0);
DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
@@ -7171,7 +7133,7 @@ static int mesh_faces_shade_solid_exec(bContext *C, wmOperator *op)
void MESH_OT_faces_shade_solid(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Flat Face Shading";
+ ot->name= "Shade Flat";
ot->idname= "MESH_OT_faces_shade_solid";
/* api callbacks */
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 4d71ddbd647..6e098e04a14 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -85,7 +85,7 @@ void MESH_OT_primitive_ico_sphere_add(struct wmOperatorType *ot);
void MESH_OT_edge_face_add(struct wmOperatorType *ot);
void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot);
-void MESH_OT_duplicate_add(struct wmOperatorType *ot);
+void MESH_OT_duplicate(struct wmOperatorType *ot);
void MESH_OT_fgon_make(struct wmOperatorType *ot);
void MESH_OT_fgon_clear(struct wmOperatorType *ot);
@@ -151,7 +151,7 @@ void MESH_OT_loop_select(struct wmOperatorType *ot);
void MESH_OT_select_all_toggle(struct wmOperatorType *ot);
void MESH_OT_select_more(struct wmOperatorType *ot);
void MESH_OT_select_less(struct wmOperatorType *ot);
-void MESH_OT_select_invert(struct wmOperatorType *ot);
+void MESH_OT_select_inverse(struct wmOperatorType *ot);
void MESH_OT_select_non_manifold(struct wmOperatorType *ot);
void MESH_OT_select_linked(struct wmOperatorType *ot);
void MESH_OT_select_linked_pick(struct wmOperatorType *ot);
@@ -170,7 +170,7 @@ void MESH_OT_loop_multi_select(struct wmOperatorType *ot);
void MESH_OT_mark_seam(struct wmOperatorType *ot);
void MESH_OT_mark_sharp(struct wmOperatorType *ot);
void MESH_OT_vertices_smooth(struct wmOperatorType *ot);
-void MESH_OT_flip_editnormals(struct wmOperatorType *ot);
+void MESH_OT_flip_normals(struct wmOperatorType *ot);
extern EditEdge *findnearestedge(ViewContext *vc, int *dist);
extern void EM_automerge(int update);
@@ -201,14 +201,11 @@ extern EditVert *findnearestvert(ViewContext *vc, int *dist, short sel, short st
void join_triangles(EditMesh *em);
int removedoublesflag(EditMesh *em, short flag, short automerge, float limit); /* return amount */
-void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beauty, int numcuts, int seltype);
+void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float fractal, int beauty, int numcuts, int seltype);
int EdgeSlide(EditMesh *em, wmOperator *op, short immediate, float imperc);
+void MESH_OT_merge(struct wmOperatorType *ot);
void MESH_OT_subdivide(struct wmOperatorType *ot);
-void MESH_OT_subdivs(struct wmOperatorType *ot);
-void MESH_OT_subdivide_multi(struct wmOperatorType *ot);
-void MESH_OT_subdivide_multi_fractal(struct wmOperatorType *ot);
-void MESH_OT_subdivide_smooth(struct wmOperatorType *ot);
void MESH_OT_remove_doubles(struct wmOperatorType *ot);
void MESH_OT_extrude(struct wmOperatorType *ot);
void MESH_OT_spin(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 64fcfb681ed..6bc2f240859 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -59,18 +59,181 @@
#include "ED_transform.h"
#include "ED_view3d.h"
+#include "UI_interface.h"
+
#include "mesh_intern.h"
+/******************************** menus *************************************/
+
+static int vertex_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ pup= uiPupMenuBegin(C, "Vertex Specials", 0);
+ layout= uiPupMenuLayout(pup);
+ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
+
+ uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
+ uiItemO(layout, "Merge...", 0, "MESH_OT_merge"); // mergmenu(em)
+ uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
+ uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path");
+ //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
+ //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
+
+ uiPupMenuEnd(C, pup);
+
+ return OPERATOR_CANCELLED;
+}
+
+static void MESH_OT_vertex_specials(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Vertex Specials";
+ ot->idname= "MESH_OT_vertex_specials";
+
+ /* api callbacks */
+ ot->invoke= vertex_specials_invoke;
+ ot->poll= ED_operator_editmesh;
+}
+
+static int edge_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ pup= uiPupMenuBegin(C, "Edge Specials", 0);
+ layout= uiPupMenuLayout(pup);
+ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
+
+ uiItemO(layout, "Mark Seam", 0, "MESH_OT_mark_seam");
+ uiItemBooleanO(layout, "Clear Seam", 0, "MESH_OT_mark_seam", "clear", 1);
+ uiItemEnumO(layout, "Rotate Edge CW", 0, "MESH_OT_edge_rotate", "direction", 1);
+ uiItemEnumO(layout, "Rotate Edge CCW", 0, "MESH_OT_edge_rotate", "direction", 2);
+ //uiItemO(layout, "Loopcut", 0, "MESH_OT_loop_cut"); // CutEdgeloop(em, 1);
+ //uiItemO(layout, "Edge Slide", 0, "MESH_OT_edge_slide"); // EdgeSlide(em, 0,0.0);
+ uiItemO(layout, "Edge Loop", 0, "MESH_OT_loop_multi_select");
+ uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1);
+ uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region");
+ uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop");
+ uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp");
+ uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1);
+
+ uiPupMenuEnd(C, pup);
+
+ return OPERATOR_CANCELLED;
+}
+
+static void MESH_OT_edge_specials(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Edge Specials";
+ ot->idname= "MESH_OT_edge_specials";
+
+ /* api callbacks */
+ ot->invoke= edge_specials_invoke;
+ ot->poll= ED_operator_editmesh;
+}
+
+static int face_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ pup= uiPupMenuBegin(C, "Face Specials", 0);
+ layout= uiPupMenuLayout(pup);
+ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
+
+ uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
+ // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
+ uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
+ uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_solid");
+ uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris");
+ uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads");
+ uiItemO(layout, NULL, 0, "MESH_OT_edge_flip");
+ uiItemS(layout);
-/* ************************** registration **********************************/
+ uiItemO(layout, NULL, 0, "MESH_OT_fill");
+ uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill");
+
+ uiItemS(layout);
+
+ // uiItemO(layout, NULL, 0, "MESH_OT_face_mode"); // mesh_set_face_flags(em, 1);
+ // uiItemBooleanO(layout, NULL, 0, "MESH_OT_face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
+ //
+ // uiItemS(layout);
+
+ uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_rotate", "direction");
+ uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_mirror", "axis");
+ uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_rotate", "direction");
+ uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_mirror", "axis");
+
+ uiPupMenuEnd(C, pup);
+
+ return OPERATOR_CANCELLED;
+}
+
+static void MESH_OT_face_specials(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Face Specials";
+ ot->idname= "MESH_OT_face_specials";
+
+ /* api callbacks */
+ ot->invoke= face_specials_invoke;
+ ot->poll= ED_operator_editmesh;
+}
+
+static int specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ pup= uiPupMenuBegin(C, "Specials", 0);
+ layout= uiPupMenuLayout(pup);
+ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
+
+ uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide");
+ uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f);
+ uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
+ uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
+ uiItemO(layout, "Hide", 0, "MESH_OT_hide");
+ uiItemO(layout, "Reveal", 0, "MESH_OT_reveal");
+ uiItemO(layout, "Select Inverse", 0, "MESH_OT_select_inverse");
+ uiItemO(layout, NULL, 0, "MESH_OT_flip_normals");
+ uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
+ // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em)
+ uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth");
+ uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_solid");
+ //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
+ //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all");
+ uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path");
+
+ uiPupMenuEnd(C, pup);
+
+ return OPERATOR_CANCELLED;
+}
+
+static void MESH_OT_specials(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Specials";
+ ot->idname= "MESH_OT_specials";
+
+ /* api callbacks */
+ ot->invoke= specials_invoke;
+ ot->poll= ED_operator_editmesh;
+}
+
+/**************************** registration **********************************/
void ED_operatortypes_mesh(void)
{
WM_operatortype_append(MESH_OT_select_all_toggle);
WM_operatortype_append(MESH_OT_select_more);
WM_operatortype_append(MESH_OT_select_less);
- WM_operatortype_append(MESH_OT_select_invert);
+ WM_operatortype_append(MESH_OT_select_inverse);
WM_operatortype_append(MESH_OT_select_non_manifold);
WM_operatortype_append(MESH_OT_select_linked);
WM_operatortype_append(MESH_OT_select_linked_pick);
@@ -80,11 +243,8 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_reveal);
WM_operatortype_append(MESH_OT_select_by_number_vertices);
WM_operatortype_append(MESH_OT_normals_make_consistent);
+ WM_operatortype_append(MESH_OT_merge);
WM_operatortype_append(MESH_OT_subdivide);
- WM_operatortype_append(MESH_OT_subdivide_multi);
- WM_operatortype_append(MESH_OT_subdivide_multi_fractal);
- WM_operatortype_append(MESH_OT_subdivide_smooth);
- WM_operatortype_append(MESH_OT_subdivs);
WM_operatortype_append(MESH_OT_faces_select_linked_flat);
WM_operatortype_append(MESH_OT_edges_select_sharp);
WM_operatortype_append(MESH_OT_primitive_plane_add);
@@ -99,7 +259,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
WM_operatortype_append(MESH_OT_fgon_clear);
WM_operatortype_append(MESH_OT_fgon_make);
- WM_operatortype_append(MESH_OT_duplicate_add);
+ WM_operatortype_append(MESH_OT_duplicate);
WM_operatortype_append(MESH_OT_remove_doubles);
WM_operatortype_append(MESH_OT_extrude);
WM_operatortype_append(MESH_OT_spin);
@@ -138,7 +298,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_mark_seam);
WM_operatortype_append(MESH_OT_mark_sharp);
WM_operatortype_append(MESH_OT_vertices_smooth);
- WM_operatortype_append(MESH_OT_flip_editnormals);
+ WM_operatortype_append(MESH_OT_flip_normals);
WM_operatortype_append(MESH_OT_knife_cut);
WM_operatortype_append(MESH_OT_rip);
@@ -148,6 +308,11 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_vertex_color_remove);
WM_operatortype_append(MESH_OT_sticky_add);
WM_operatortype_append(MESH_OT_sticky_remove);
+
+ WM_operatortype_append(MESH_OT_vertex_specials);
+ WM_operatortype_append(MESH_OT_edge_specials);
+ WM_operatortype_append(MESH_OT_face_specials);
+ WM_operatortype_append(MESH_OT_specials);
}
/* note mesh keymap also for other space? */
@@ -172,7 +337,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
WM_keymap_add_item(keymap, "MESH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "MESH_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
@@ -184,12 +349,6 @@ void ED_keymap_mesh(wmWindowManager *wm)
WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0);
- WM_keymap_add_item(keymap, "MESH_OT_mark_seam", ONEKEY, KM_PRESS, KM_CTRL , 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_mark_seam", ONEKEY, KM_PRESS, KM_ALT , 0)->ptr,"clear",1);
-
- WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_CTRL , 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_ALT , 0)->ptr,"set",1);
-
WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
/* selection mode */
@@ -203,24 +362,17 @@ void ED_keymap_mesh(wmWindowManager *wm)
/* tools */
WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1);
- WM_keymap_add_item(keymap, "MESH_OT_vertices_smooth", THREEKEY, KM_PRESS, KM_CTRL , 0);
- WM_keymap_add_item(keymap, "MESH_OT_flip_editnormals", THREEKEY, KM_PRESS, KM_ALT , 0);
- WM_keymap_add_item(keymap, "MESH_OT_subdivs", WKEY, KM_PRESS, 0, 0); // this is the menu
- /*WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi_fractal", WKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "MESH_OT_subdivide_smooth", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);*/
- WM_keymap_add_item(keymap, "MESH_OT_remove_doubles", VKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_extrude", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "MESH_OT_screw", NINEKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "VIEW3D_OT_editmesh_face_toolbox", FKEY, KM_PRESS, KM_CTRL, 0); /* operators below are in this toolbox */
WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "MESH_OT_beauty_fill", FKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_edge_flip", FKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_split", FOURKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_extrude_repeat", FOURKEY, KM_PRESS, KM_ALT, 0);
@@ -238,7 +390,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
/* add/remove */
WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "MESH_OT_duplicate_add", DKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, KM_SHIFT, 0);
/* use KM_RELEASE because same key is used for tweaks */
@@ -250,6 +402,12 @@ void ED_keymap_mesh(wmWindowManager *wm)
WM_keymap_add_item(keymap, "MESH_OT_fgon_clear", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
+
+ /* menus */
+ WM_keymap_add_item(keymap, "MESH_OT_vertex_specials", VKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_edge_specials", EKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_face_specials", FKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_specials", WKEY, KM_PRESS, 0, 0);
/* UV's */
WM_keymap_add_item(keymap, "UV_OT_mapping_menu", UKEY, KM_PRESS, 0, 0);