merge with 2.5 at r18865
This commit is contained in:
@@ -1895,42 +1895,7 @@ static int check_vnormal_flip(float *n, float *vnorm)
|
||||
}
|
||||
#endif
|
||||
|
||||
void flipface(EditMesh *em, EditFace *efa)
|
||||
{
|
||||
if(efa->v4) {
|
||||
SWAP(EditVert *, efa->v2, efa->v4);
|
||||
SWAP(EditEdge *, efa->e1, efa->e4);
|
||||
SWAP(EditEdge *, efa->e2, efa->e3);
|
||||
EM_data_interp_from_faces(em, efa, NULL, efa, 0, 3, 2, 1);
|
||||
}
|
||||
else {
|
||||
SWAP(EditVert *, efa->v2, efa->v3);
|
||||
SWAP(EditEdge *, efa->e1, efa->e3);
|
||||
efa->e2->dir= 1-efa->e2->dir;
|
||||
EM_data_interp_from_faces(em, efa, NULL, efa, 0, 2, 1, 3);
|
||||
}
|
||||
|
||||
if(efa->v4) CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
|
||||
else CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
|
||||
}
|
||||
|
||||
|
||||
void flip_editnormals(EditMesh *em)
|
||||
{
|
||||
EditFace *efa;
|
||||
|
||||
efa= em->faces.first;
|
||||
while(efa) {
|
||||
if( efa->f & SELECT ){
|
||||
flipface(em, efa);
|
||||
}
|
||||
efa= efa->next;
|
||||
}
|
||||
|
||||
/* update vertex normals too */
|
||||
recalc_editnormals(em);
|
||||
|
||||
}
|
||||
|
||||
/* does face centers too */
|
||||
void recalc_editnormals(EditMesh *em)
|
||||
|
||||
@@ -52,6 +52,7 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
|
||||
#include "BLI_editVert.h"
|
||||
#include "BLI_ghash.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_displist.h"
|
||||
#include "BKE_global.h"
|
||||
@@ -64,9 +65,14 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
|
||||
|
||||
#include "BIF_gl.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_mesh.h"
|
||||
#include "ED_screen.h"
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "mesh_intern.h"
|
||||
@@ -75,7 +81,6 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
|
||||
static void BIF_undo_push() {}
|
||||
static void BIF_undo() {}
|
||||
static void error() {}
|
||||
static int pupmenu() {return 0;}
|
||||
static int qtest() {return 0;}
|
||||
/* **** XXX ******** */
|
||||
|
||||
@@ -427,11 +432,6 @@ typedef struct CutCurve {
|
||||
float y;
|
||||
} CutCurve;
|
||||
|
||||
static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash *gh)
|
||||
{
|
||||
return NULL; // XXX
|
||||
}
|
||||
|
||||
|
||||
/* ******************************************************************** */
|
||||
/* Knife Subdivide Tool. Subdivides edges intersected by a mouse trail
|
||||
@@ -444,94 +444,24 @@ static CutCurve *get_mouse_trail(int *len, char mode, char cutmode, struct GHash
|
||||
ESC cancels as expected.
|
||||
|
||||
Contributed by Robert Wenzlaff (Det. Thorn).
|
||||
|
||||
2.5 revamp:
|
||||
- non modal (no menu before cutting)
|
||||
- exit on mouse release
|
||||
- polygon/segment drawing can become handled by WM cb later
|
||||
|
||||
*/
|
||||
|
||||
/* prototype */
|
||||
static float seg_intersect(struct EditEdge * e, CutCurve *c, int len, char mode, struct GHash *gh);
|
||||
#define KNIFE_EXACT 1
|
||||
#define KNIFE_MIDPOINT 2
|
||||
#define KNIFE_MULTICUT 3
|
||||
|
||||
void KnifeSubdivide(Object *obedit, EditMesh *em, char mode)
|
||||
{
|
||||
EditEdge *eed;
|
||||
EditVert *eve;
|
||||
CutCurve *curve;
|
||||
|
||||
struct GHash *gh;
|
||||
int len=0;
|
||||
float isect=0.0;
|
||||
short numcuts=1;
|
||||
float *scr, co[4];
|
||||
|
||||
if (em==NULL) return;
|
||||
|
||||
if (EM_nvertices_selected(em) < 2) {
|
||||
error("No edges are selected to operate on");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode==KNIFE_PROMPT) {
|
||||
short val= pupmenu("Cut Type %t|Exact Line%x1|Midpoints%x2|Multicut%x3");
|
||||
if(val<1) return;
|
||||
mode = val; // warning, mode is char, pupmenu returns -1 with ESC
|
||||
}
|
||||
|
||||
if(mode == KNIFE_MULTICUT) {
|
||||
// XXX if(button(&numcuts, 2, 128, "Number of Cuts:")==0) return;
|
||||
}
|
||||
|
||||
/* XXX Set a knife cursor here */
|
||||
|
||||
for(eed=em->edges.first; eed; eed= eed->next) eed->tmp.fp = 0.0; /*store percentage of edge cut for KNIFE_EXACT here.*/
|
||||
|
||||
/*the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer*/
|
||||
gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
|
||||
for(eve=em->verts.first; eve; eve=eve->next){
|
||||
scr = MEM_mallocN(sizeof(float)*2, "Vertex Screen Coordinates");
|
||||
VECCOPY(co, eve->co);
|
||||
co[3]= 1.0;
|
||||
// Mat4MulVec4fl(obedit->obmat, co);
|
||||
// XXX project_float(co,scr);
|
||||
BLI_ghash_insert(gh, eve, scr);
|
||||
eve->f1 = 0; /*store vertex intersection flag here*/
|
||||
|
||||
}
|
||||
|
||||
curve=get_mouse_trail(&len, TRAIL_MIXED, mode, gh);
|
||||
|
||||
if (curve && len && mode){
|
||||
eed= em->edges.first;
|
||||
while(eed) {
|
||||
if( eed->v1->f & eed->v2->f & SELECT ){ // NOTE: uses vertex select, subdiv doesnt do edges yet
|
||||
isect=seg_intersect(eed, curve, len, mode, gh);
|
||||
if (isect) eed->f2= 1;
|
||||
else eed->f2=0;
|
||||
eed->tmp.fp= isect;
|
||||
//printf("isect=%i\n", isect);
|
||||
}
|
||||
else {
|
||||
eed->f2=0;
|
||||
eed->f1=0;
|
||||
}
|
||||
eed= eed->next;
|
||||
}
|
||||
|
||||
if(mode==KNIFE_EXACT) esubdivideflag(obedit, em, SELECT, 0, B_KNIFE|B_PERCENTSUBD,1,SUBDIV_SELECT_ORIG);
|
||||
else 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);
|
||||
|
||||
eed=em->edges.first;
|
||||
while(eed){
|
||||
eed->f2=0;
|
||||
eed->f1=0;
|
||||
eed=eed->next;
|
||||
}
|
||||
}
|
||||
/* Return to old cursor and flags...*/
|
||||
|
||||
BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
if (curve) MEM_freeN(curve);
|
||||
|
||||
BIF_undo_push("Knife");
|
||||
}
|
||||
static EnumPropertyItem knife_items[]= {
|
||||
{KNIFE_EXACT, "EXACT", "Exact", ""},
|
||||
{KNIFE_MIDPOINT, "MIDPOINTS", "Midpoints", ""},
|
||||
{KNIFE_MULTICUT, "MULTICUT", "Multicut", ""},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
/* seg_intersect() Determines if and where a mouse trail intersects an EditEdge */
|
||||
|
||||
@@ -547,7 +477,7 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct
|
||||
int i;
|
||||
|
||||
//threshold = 0.000001; /*tolerance for vertex intersection*/
|
||||
// XXX threshold = scene->toolsettings->select_thresh / 100;
|
||||
// XXX threshold = scene->toolsettings->select_thresh / 100;
|
||||
|
||||
/* Get screen coords of verts */
|
||||
scr = BLI_ghash_lookup(gh, e->v1);
|
||||
@@ -612,7 +542,7 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct
|
||||
|
||||
/* Perp. Distance from point to line */
|
||||
if (m2!=MAXSLOPE) dist=(y12-m2*x12-b2);/* /sqrt(m2*m2+1); Only looking for */
|
||||
/* change in sign. Skip extra math */
|
||||
/* change in sign. Skip extra math */
|
||||
else dist=x22-x12;
|
||||
|
||||
if (i==0) lastdist=dist;
|
||||
@@ -635,7 +565,7 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct
|
||||
|
||||
/* Found an intersect, calc intersect point */
|
||||
if (m1==m2){ /* co-incident lines */
|
||||
/* cut at 50% of overlap area*/
|
||||
/* cut at 50% of overlap area*/
|
||||
x1max=MAX2(x11, x12);
|
||||
x1min=MIN2(x11, x12);
|
||||
xi= (MIN2(x2max,x1max)+MAX2(x2min,x1min))/2.0;
|
||||
@@ -679,6 +609,7 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct
|
||||
if ((m2<=1.0)&&(m2>=-1.0)) perc = (xi-x21)/(x22-x21);
|
||||
else perc=(yi-y21)/(y22-y21); /*lower slope more accurate*/
|
||||
//isect=32768.0*(perc+0.0000153); /* Percentage in 1/32768ths */
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -687,27 +618,112 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct
|
||||
return(perc);
|
||||
}
|
||||
|
||||
void LoopMenu(Object *obedit, EditMesh *em) /* Called by KKey */
|
||||
|
||||
#define MAX_CUTS 256
|
||||
|
||||
static int knife_cut_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
short ret;
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
EditEdge *eed;
|
||||
EditVert *eve;
|
||||
CutCurve curve[MAX_CUTS];
|
||||
struct GHash *gh;
|
||||
float isect=0.0;
|
||||
float *scr, co[4];
|
||||
int len=0;
|
||||
short numcuts=1, mode= RNA_int_get(op->ptr, "type");
|
||||
|
||||
ret=pupmenu("Loop/Cut Menu %t|Loop Cut (CTRL-R)%x2|"
|
||||
"Knife (Exact) %x3|Knife (Midpoints)%x4|Knife (Multicut)%x5");
|
||||
|
||||
switch (ret){
|
||||
case 2:
|
||||
CutEdgeloop(obedit, em, 1);
|
||||
break;
|
||||
case 3:
|
||||
KnifeSubdivide(obedit, em, KNIFE_EXACT);
|
||||
break;
|
||||
case 4:
|
||||
KnifeSubdivide(obedit, em, KNIFE_MIDPOINT);
|
||||
break;
|
||||
case 5:
|
||||
KnifeSubdivide(obedit, em, KNIFE_MULTICUT);
|
||||
break;
|
||||
if (EM_nvertices_selected(em) < 2) {
|
||||
error("No edges are selected to operate on");
|
||||
return OPERATOR_CANCELLED;;
|
||||
}
|
||||
|
||||
/* get the cut curve */
|
||||
RNA_BEGIN(op->ptr, itemptr, "path") {
|
||||
|
||||
RNA_float_get_array(&itemptr, "loc", (float *)&curve[len]);
|
||||
len++;
|
||||
if(len>= MAX_CUTS) break;
|
||||
}
|
||||
RNA_END;
|
||||
|
||||
if(len<2) return OPERATOR_CANCELLED;
|
||||
|
||||
/*store percentage of edge cut for KNIFE_EXACT here.*/
|
||||
for(eed=em->edges.first; eed; eed= eed->next)
|
||||
eed->tmp.fp = 0.0;
|
||||
|
||||
/*the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer*/
|
||||
gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
|
||||
for(eve=em->verts.first; eve; eve=eve->next){
|
||||
scr = MEM_mallocN(sizeof(float)*2, "Vertex Screen Coordinates");
|
||||
VECCOPY(co, eve->co);
|
||||
co[3]= 1.0;
|
||||
Mat4MulVec4fl(obedit->obmat, co);
|
||||
project_float(ar, co, scr);
|
||||
BLI_ghash_insert(gh, eve, scr);
|
||||
eve->f1 = 0; /*store vertex intersection flag here*/
|
||||
|
||||
}
|
||||
|
||||
eed= em->edges.first;
|
||||
while(eed) {
|
||||
if( eed->v1->f & eed->v2->f & SELECT ){ // NOTE: uses vertex select, subdiv doesnt do edges yet
|
||||
isect= seg_intersect(eed, curve, len, mode, gh);
|
||||
if (isect!=0.0f) eed->f2= 1;
|
||||
else eed->f2=0;
|
||||
eed->tmp.fp= isect;
|
||||
//printf("isect=%i\n", isect);
|
||||
}
|
||||
else {
|
||||
eed->f2=0;
|
||||
eed->f1=0;
|
||||
}
|
||||
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);
|
||||
|
||||
eed=em->edges.first;
|
||||
while(eed){
|
||||
eed->f2=0;
|
||||
eed->f1=0;
|
||||
eed=eed->next;
|
||||
}
|
||||
|
||||
BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
void MESH_OT_knife_cut(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
ot->name= "Knife Cut";
|
||||
ot->idname= "MESH_OT_knife_cut";
|
||||
|
||||
ot->invoke= WM_gesture_lines_invoke;
|
||||
ot->modal= WM_gesture_lines_modal;
|
||||
ot->exec= knife_cut_exec;
|
||||
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "type", knife_items, KNIFE_EXACT, "Type", "");
|
||||
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
|
||||
|
||||
/* internal */
|
||||
RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
|
||||
}
|
||||
|
||||
/* ******************************************************* */
|
||||
|
||||
|
||||
@@ -3355,7 +3355,7 @@ void MESH_OT_select_non_manifold(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static void selectswap_mesh(EditMesh *em) /* UI level */
|
||||
void EM_select_swap(EditMesh *em) /* exported for UV */
|
||||
{
|
||||
EditVert *eve;
|
||||
EditEdge *eed;
|
||||
@@ -3396,7 +3396,7 @@ static int selectswap_mesh_exec(bContext *C, wmOperator *op)
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
selectswap_mesh(em);
|
||||
EM_select_swap(em);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -3418,21 +3418,23 @@ void MESH_OT_select_invert(wmOperatorType *ot)
|
||||
|
||||
/* ******************** (de)select all operator **************** */
|
||||
|
||||
void EM_toggle_select_all(EditMesh *em) /* exported for UV */
|
||||
{
|
||||
if(EM_nvertices_selected(em))
|
||||
EM_clear_flag_all(em, SELECT);
|
||||
else
|
||||
EM_set_flag_all(em, SELECT);
|
||||
}
|
||||
|
||||
static int toggle_select_all_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
if( EM_nvertices_selected(em) ) {
|
||||
EM_clear_flag_all(em, SELECT);
|
||||
}
|
||||
else {
|
||||
EM_set_flag_all(em, SELECT);
|
||||
}
|
||||
|
||||
// if (EM_texFaceCheck())
|
||||
EM_toggle_select_all(em);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
@@ -3853,10 +3855,13 @@ void MESH_OT_selection_type(wmOperatorType *ot)
|
||||
}
|
||||
/* ************************* SEAMS AND EDGES **************** */
|
||||
|
||||
void editmesh_mark_seam(EditMesh *em, int clear)
|
||||
static int editmesh_mark_seam(bContext *C, wmOperator *op)
|
||||
{
|
||||
Mesh *me= NULL; // XXX
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
Mesh *me= ((Mesh *)obedit->data);
|
||||
EditEdge *eed;
|
||||
int clear = RNA_boolean_get(op->ptr, "clear");
|
||||
|
||||
/* auto-enable seams drawing */
|
||||
if(clear==0) {
|
||||
@@ -3882,11 +3887,33 @@ void editmesh_mark_seam(EditMesh *em, int clear)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void editmesh_mark_sharp(EditMesh *em, int set)
|
||||
void MESH_OT_mark_seam(wmOperatorType *ot)
|
||||
{
|
||||
Mesh *me= NULL;
|
||||
/* identifiers */
|
||||
ot->name= "Mark seam";
|
||||
ot->idname= "MESH_OT_mark_seam";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= editmesh_mark_seam;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
|
||||
}
|
||||
|
||||
static int editmesh_mark_sharp(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
Mesh *me= ((Mesh *)obedit->data);
|
||||
int set = RNA_boolean_get(op->ptr, "set");
|
||||
EditEdge *eed;
|
||||
|
||||
/* auto-enable sharp edge drawing */
|
||||
@@ -3908,6 +3935,25 @@ void editmesh_mark_sharp(EditMesh *em, int set)
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_mark_sharp(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Mark sharp";
|
||||
ot->idname= "MESH_OT_mark_sharp";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= editmesh_mark_sharp;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "set", 0, "Set", "");
|
||||
}
|
||||
|
||||
void BME_Menu() {
|
||||
@@ -3964,10 +4010,10 @@ void Edge_Menu(EditMesh *em)
|
||||
switch(ret)
|
||||
{
|
||||
case 1:
|
||||
editmesh_mark_seam(em, 0);
|
||||
//editmesh_mark_seam(em, 0);
|
||||
break;
|
||||
case 2:
|
||||
editmesh_mark_seam(em, 1);
|
||||
//editmesh_mark_seam(em, 1);
|
||||
break;
|
||||
case 3:
|
||||
// edge_rotate_selected(em, 2);
|
||||
@@ -4488,9 +4534,13 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, View3D *v3d,
|
||||
|
||||
/* **************** VERTEX DEFORMS *************** */
|
||||
|
||||
void vertexsmooth(Object *obedit, EditMesh *em)
|
||||
static int smooth_vertex(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= NULL; // XXX
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
Mesh *me= obedit->data;
|
||||
EditMesh *em= me->edit_mesh;
|
||||
|
||||
EditVert *eve, *eve_mir = NULL;
|
||||
EditEdge *eed;
|
||||
float *adror, *adr, fac;
|
||||
@@ -4498,7 +4548,7 @@ void vertexsmooth(Object *obedit, EditMesh *em)
|
||||
int teller=0;
|
||||
ModifierData *md= obedit->modifiers.first;
|
||||
|
||||
if(em==NULL) return;
|
||||
if(em==NULL) return OPERATOR_CANCELLED;
|
||||
|
||||
/* count */
|
||||
eve= em->verts.first;
|
||||
@@ -4506,7 +4556,7 @@ void vertexsmooth(Object *obedit, EditMesh *em)
|
||||
if(eve->f & SELECT) teller++;
|
||||
eve= eve->next;
|
||||
}
|
||||
if(teller==0) return;
|
||||
if(teller==0) return OPERATOR_CANCELLED;
|
||||
|
||||
adr=adror= (float *)MEM_callocN(3*sizeof(float *)*teller, "vertsmooth");
|
||||
eve= em->verts.first;
|
||||
@@ -4615,8 +4665,25 @@ void vertexsmooth(Object *obedit, EditMesh *em)
|
||||
|
||||
recalc_editnormals(em);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_smooth_vertex(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Smooth Vertex";
|
||||
ot->idname= "MESH_OT_smooth_vertex";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= smooth_vertex;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
void vertexnoise(Object *obedit, EditMesh *em)
|
||||
@@ -4751,3 +4818,57 @@ void MESH_OT_vertices_to_sphere(wmOperatorType *ot)
|
||||
/* props */
|
||||
RNA_def_float(ot->srna, "percent", 100.0f, 0.0f, 100.0f, "Percent", "DOC_BROKEN", 0.01f, 100.0f);
|
||||
}
|
||||
|
||||
void flipface(EditMesh *em, EditFace *efa)
|
||||
{
|
||||
if(efa->v4) {
|
||||
SWAP(EditVert *, efa->v2, efa->v4);
|
||||
SWAP(EditEdge *, efa->e1, efa->e4);
|
||||
SWAP(EditEdge *, efa->e2, efa->e3);
|
||||
EM_data_interp_from_faces(em, efa, NULL, efa, 0, 3, 2, 1);
|
||||
}
|
||||
else {
|
||||
SWAP(EditVert *, efa->v2, efa->v3);
|
||||
SWAP(EditEdge *, efa->e1, efa->e3);
|
||||
efa->e2->dir= 1-efa->e2->dir;
|
||||
EM_data_interp_from_faces(em, efa, NULL, efa, 0, 2, 1, 3);
|
||||
}
|
||||
|
||||
if(efa->v4) CalcNormFloat4(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co, efa->n);
|
||||
else CalcNormFloat(efa->v1->co, efa->v2->co, efa->v3->co, efa->n);
|
||||
}
|
||||
|
||||
|
||||
static int flip_editnormals(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
EditFace *efa;
|
||||
|
||||
efa= em->faces.first;
|
||||
while(efa) {
|
||||
if( efa->f & SELECT ){
|
||||
flipface(em, efa);
|
||||
}
|
||||
efa= efa->next;
|
||||
}
|
||||
|
||||
/* update vertex normals too */
|
||||
recalc_editnormals(em);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_flip_editnormals(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Flip Normals";
|
||||
ot->idname= "MESH_OT_flip_editnormals";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= flip_editnormals;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/**
|
||||
* $Id:
|
||||
/* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
@@ -717,10 +716,12 @@ void MESH_OT_extrude(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
void split_mesh(EditMesh *em)
|
||||
static int split_mesh(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
waitcursor(1);
|
||||
WM_cursor_wait(1);
|
||||
|
||||
/* make duplicate first */
|
||||
adduplicateflag(em, SELECT);
|
||||
@@ -728,14 +729,40 @@ void split_mesh(EditMesh *em)
|
||||
delfaceflag(em, 128);
|
||||
recalc_editnormals(em);
|
||||
|
||||
waitcursor(0);
|
||||
WM_cursor_wait(0);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void extrude_repeat_mesh(RegionView3D *rv3d, Object *obedit, EditMesh *em, int steps, float offs)
|
||||
void MESH_OT_split_mesh(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Split Mesh";
|
||||
ot->idname= "MESH_OT_split_mesh";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= split_mesh;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
static int extrude_repeat_mesh(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
|
||||
int steps = RNA_int_get(op->ptr,"steps");
|
||||
|
||||
float offs = RNA_float_get(op->ptr,"offset");
|
||||
|
||||
float dvec[3], tmat[3][3], bmat[3][3], nor[3]= {0.0, 0.0, 0.0};
|
||||
short a;
|
||||
|
||||
@@ -762,10 +789,30 @@ void extrude_repeat_mesh(RegionView3D *rv3d, Object *obedit, EditMesh *em, int s
|
||||
|
||||
EM_fgon_flags(em);
|
||||
|
||||
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_extrude_repeat(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Extrude Repeat Mesh";
|
||||
ot->idname= "MESH_OT_extrude_repeat";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= extrude_repeat_mesh;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, FLT_MAX);
|
||||
RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, INT_MAX);
|
||||
}
|
||||
|
||||
void spin_mesh(View3D *v3d, Object *obedit, EditMesh *em, int steps, float degr, float *dvec, int mode)
|
||||
{
|
||||
Scene *scene= NULL; // XXX from context!
|
||||
@@ -1215,11 +1262,12 @@ void fill_mesh(EditMesh *em)
|
||||
|
||||
// XXX option beautyfill */
|
||||
|
||||
waitcursor(0);
|
||||
WM_cursor_wait(0);
|
||||
EM_select_flush(em);
|
||||
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
|
||||
|
||||
}
|
||||
|
||||
/*GB*/
|
||||
/*-------------------------------------------------------------------------------*/
|
||||
/*--------------------------- Edge Based Subdivide ------------------------------*/
|
||||
@@ -3726,9 +3774,14 @@ static void edge_rotate(EditMesh *em, EditEdge *eed,int dir)
|
||||
free_editface(em, face[1]);
|
||||
}
|
||||
|
||||
// XXX ton please check
|
||||
/* only accepts 1 selected edge, or 2 selected faces */
|
||||
void edge_rotate_selected(EditMesh *em, int dir)
|
||||
static int edge_rotate_selected(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
int dir = RNA_int_get(op->ptr,"dir"); // dir == 2 when clockwise and ==1 for counter CW.
|
||||
EditEdge *eed;
|
||||
EditFace *efa;
|
||||
short edgeCount = 0;
|
||||
@@ -3762,7 +3815,11 @@ void edge_rotate_selected(EditMesh *em, int dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
else error("Select one edge or two adjacent faces");
|
||||
else
|
||||
{
|
||||
error("Select one edge or two adjacent faces");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
else if(edgeCount==1) {
|
||||
for(eed= em->edges.first; eed; eed= eed->next) {
|
||||
@@ -3773,16 +3830,43 @@ void edge_rotate_selected(EditMesh *em, int dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
else error("Select one edge or two adjacent faces");
|
||||
else
|
||||
{
|
||||
error("Select one edge or two adjacent faces");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
/* flush selected vertices (again) to edges/faces */
|
||||
EM_select_flush(em);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
|
||||
// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
}
|
||||
|
||||
void MESH_OT_edge_rotate_selected(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Rotate Selected Edge";
|
||||
ot->idname= "MESH_OT_edge_rotate_selected";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= edge_rotate_selected;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
RNA_def_int(ot->srna, "dir", 1, 1, 2, "Direction", "Clockwise and Counter Clockwise", 1, 2);
|
||||
}
|
||||
|
||||
|
||||
/******************* BEVEL CODE STARTS HERE ********************/
|
||||
|
||||
/* XXX old bevel not ported yet */
|
||||
@@ -5916,8 +6000,11 @@ void pathselect(EditMesh *em)
|
||||
}
|
||||
}
|
||||
|
||||
void region_to_loop(EditMesh *em)
|
||||
static int region_to_loop(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
EditEdge *eed;
|
||||
EditFace *efa;
|
||||
|
||||
@@ -5947,6 +6034,24 @@ void region_to_loop(EditMesh *em)
|
||||
// if (EM_texFaceCheck())
|
||||
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_region_to_loop(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Region to Loop";
|
||||
ot->idname= "MESH_OT_region_to_loop";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= region_to_loop;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int validate_loop(EditMesh *em, Collection *edgecollection)
|
||||
@@ -6073,8 +6178,12 @@ static int loop_bisect(EditMesh *em, Collection *edgecollection){
|
||||
else return(2);
|
||||
}
|
||||
|
||||
void loop_to_region(EditMesh *em)
|
||||
static int loop_to_region(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
|
||||
EditFace *efa;
|
||||
ListBase allcollections={NULL,NULL};
|
||||
Collection *edgecollection;
|
||||
@@ -6103,13 +6212,34 @@ void loop_to_region(EditMesh *em)
|
||||
|
||||
// if (EM_texFaceCheck())
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_loop_to_region(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Loop to Region";
|
||||
ot->idname= "MESH_OT_loop_to_region";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= loop_to_region;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
// XXX please check if these functions do what you want them to
|
||||
/* texface and vertex color editmode tools for the face menu */
|
||||
|
||||
void mesh_rotate_uvs(EditMesh *em)
|
||||
static int mesh_rotate_uvs(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
EditFace *efa;
|
||||
short change = 0, ccw;
|
||||
MTFace *tf;
|
||||
@@ -6118,7 +6248,7 @@ void mesh_rotate_uvs(EditMesh *em)
|
||||
|
||||
if (!EM_texFaceCheck(em)) {
|
||||
error("mesh has no uv/image layers");
|
||||
return;
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
ccw = (shift);
|
||||
@@ -6171,12 +6301,17 @@ void mesh_rotate_uvs(EditMesh *em)
|
||||
|
||||
if (change) {
|
||||
// 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_mirror_uvs(EditMesh *em)
|
||||
static int mesh_mirror_uvs(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
EditFace *efa;
|
||||
short change = 0, altaxis;
|
||||
MTFace *tf;
|
||||
@@ -6185,7 +6320,7 @@ void mesh_mirror_uvs(EditMesh *em)
|
||||
|
||||
if (!EM_texFaceCheck(em)) {
|
||||
error("mesh has no uv/image layers");
|
||||
return;
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
altaxis = (shift);
|
||||
@@ -6253,12 +6388,16 @@ void mesh_mirror_uvs(EditMesh *em)
|
||||
|
||||
if (change) {
|
||||
// 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_rotate_colors(EditMesh *em)
|
||||
static int mesh_rotate_colors(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
EditFace *efa;
|
||||
short change = 0, ccw;
|
||||
MCol tmpcol, *mcol;
|
||||
@@ -6266,7 +6405,7 @@ void mesh_rotate_colors(EditMesh *em)
|
||||
|
||||
if (!EM_vertColorCheck(em)) {
|
||||
error("mesh has no color layers");
|
||||
return;
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
ccw = (shift);
|
||||
@@ -6302,13 +6441,18 @@ void mesh_rotate_colors(EditMesh *em)
|
||||
|
||||
if (change) {
|
||||
// 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_mirror_colors(EditMesh *em)
|
||||
static int mesh_mirror_colors(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
EditFace *efa;
|
||||
short change = 0, altaxis;
|
||||
MCol tmpcol, *mcol;
|
||||
@@ -6316,7 +6460,7 @@ void mesh_mirror_colors(EditMesh *em)
|
||||
|
||||
if (!EM_vertColorCheck(em)) {
|
||||
error("mesh has no color layers");
|
||||
return;
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
altaxis = (shift);
|
||||
@@ -6351,7 +6495,66 @@ void mesh_mirror_colors(EditMesh *em)
|
||||
|
||||
if (change) {
|
||||
// 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_rotate_uvs(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Rotate UVs";
|
||||
ot->idname= "MESH_OT_rotate_uvs";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= mesh_rotate_uvs;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
void MESH_OT_mirror_uvs(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Mirror UVs";
|
||||
ot->idname= "MESH_OT_mirror_uvs";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= mesh_mirror_uvs;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
void MESH_OT_rotate_colors(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Rotate Colors";
|
||||
ot->idname= "MESH_OT_rotate_colors";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= mesh_rotate_colors;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
void MESH_OT_mirror_colors(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Mirror Colors";
|
||||
ot->idname= "MESH_OT_mirror_colors";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= mesh_mirror_colors;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int subdivide_exec(bContext *C, wmOperator *op)
|
||||
@@ -6474,39 +6677,29 @@ void MESH_OT_subdivide_smooth(wmOperatorType *ot)
|
||||
|
||||
static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
int items;
|
||||
char *menu, *p;
|
||||
uiMenuItem *head;
|
||||
|
||||
head= uiPupMenuBegin("Subdivision Type", 0);
|
||||
uiMenuItemsEnumO(head, "MESH_OT_subdivs", "type");
|
||||
uiPupMenuEnd(C, head);
|
||||
|
||||
items = 4;
|
||||
|
||||
menu= MEM_callocN(items * OP_MAX_TYPENAME, "string");
|
||||
|
||||
p= menu + sprintf(menu, "%s %%t", "subdiv");
|
||||
p+= sprintf(p, "|%s %%x%d", "simple", 3);
|
||||
p+= sprintf(p, "|%s %%x%d", "multi", 2);
|
||||
p+= sprintf(p, "|%s %%x%d", "fractal", 1);
|
||||
p+= sprintf(p, "|%s %%x%d", "smooth", 0);
|
||||
|
||||
uiPupMenuOperator(C, 20, op, "index", menu);
|
||||
MEM_freeN(menu);
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int subdivs_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
switch(RNA_int_get(op->ptr, "index"))
|
||||
switch(RNA_int_get(op->ptr, "type"))
|
||||
{
|
||||
case 3: // simple
|
||||
case 0: // simple
|
||||
subdivide_exec(C,op);
|
||||
break;
|
||||
case 2: // multi
|
||||
case 1: // multi
|
||||
subdivide_multi_exec(C,op);
|
||||
break;
|
||||
case 1: // fractal;
|
||||
case 2: // fractal;
|
||||
subdivide_multi_fractal_exec(C,op);
|
||||
break;
|
||||
case 0: //smooth
|
||||
case 3: //smooth
|
||||
subdivide_smooth_exec(C,op);
|
||||
break;
|
||||
}
|
||||
@@ -6516,6 +6709,13 @@ static int subdivs_exec(bContext *C, wmOperator *op)
|
||||
|
||||
void MESH_OT_subdivs(wmOperatorType *ot)
|
||||
{
|
||||
static EnumPropertyItem type_items[]= {
|
||||
{0, "SIMPLE", "Simple", ""},
|
||||
{1, "MULTI", "Multi", ""},
|
||||
{2, "FRACTAL", "Fractal", ""},
|
||||
{3, "SMOOTH", "Smooth", ""},
|
||||
{0, NULL, NULL}};
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "subdivs";
|
||||
ot->idname= "MESH_OT_subdivs";
|
||||
@@ -6530,7 +6730,7 @@ void MESH_OT_subdivs(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/*props */
|
||||
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
|
||||
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, 0, 100, "Number of Cuts", "", 0, INT_MAX);
|
||||
|
||||
@@ -168,14 +168,10 @@ extern struct EditFace *EM_face_from_faces(EditMesh *em, struct EditFace *efa1,
|
||||
|
||||
/* ******************* editmesh_loop.c */
|
||||
|
||||
#define KNIFE_PROMPT 0
|
||||
#define KNIFE_EXACT 1
|
||||
#define KNIFE_MIDPOINT 2
|
||||
#define KNIFE_MULTICUT 3
|
||||
|
||||
#define LOOP_SELECT 1
|
||||
#define LOOP_CUT 2
|
||||
|
||||
void MESH_OT_knife_cut(struct wmOperatorType *ot);
|
||||
|
||||
/* ******************* editmesh_mods.c */
|
||||
void MESH_OT_loop_select(struct wmOperatorType *ot);
|
||||
@@ -200,6 +196,10 @@ void MESH_OT_select_random(struct wmOperatorType *ot);
|
||||
void MESH_OT_vertices_to_sphere(struct wmOperatorType *ot);
|
||||
void MESH_OT_selection_type(struct wmOperatorType *ot);
|
||||
void MESH_OT_select_multi_loop(struct wmOperatorType *ot);
|
||||
void MESH_OT_mark_seam(struct wmOperatorType *ot);
|
||||
void MESH_OT_mark_sharp(struct wmOperatorType *ot);
|
||||
void MESH_OT_smooth_vertex(struct wmOperatorType *ot);
|
||||
void MESH_OT_flip_editnormals(struct wmOperatorType *ot);
|
||||
|
||||
extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist);
|
||||
extern void EM_automerge(int update);
|
||||
@@ -247,6 +247,16 @@ void MESH_OT_convert_tris_to_quads(struct wmOperatorType *ot);
|
||||
void MESH_OT_edge_flip(struct wmOperatorType *ot);
|
||||
void MESH_OT_faces_shade_smooth(struct wmOperatorType *ot);
|
||||
void MESH_OT_faces_shade_solid(struct wmOperatorType *ot);
|
||||
void MESH_OT_split_mesh(struct wmOperatorType *ot);
|
||||
void MESH_OT_extrude_repeat(struct wmOperatorType *ot);
|
||||
void MESH_OT_edge_rotate_selected(struct wmOperatorType *ot);
|
||||
void MESH_OT_loop_to_region(struct wmOperatorType *ot);
|
||||
void MESH_OT_region_to_loop(struct wmOperatorType *ot);
|
||||
|
||||
void MESH_OT_rotate_uvs(struct wmOperatorType *ot);
|
||||
void MESH_OT_mirror_uvs(struct wmOperatorType *ot);
|
||||
void MESH_OT_rotate_colors(struct wmOperatorType *ot);
|
||||
void MESH_OT_mirror_colors(struct wmOperatorType *ot);
|
||||
|
||||
void MESH_OT_delete(struct wmOperatorType *ot);
|
||||
|
||||
|
||||
@@ -107,7 +107,6 @@ static void MESH_OT_add_duplicate(wmOperatorType *ot)
|
||||
void ED_operatortypes_mesh(void)
|
||||
{
|
||||
WM_operatortype_append(MESH_OT_de_select_all);
|
||||
WM_operatortype_append(MESH_OT_bmesh_test);
|
||||
WM_operatortype_append(MESH_OT_select_more);
|
||||
WM_operatortype_append(MESH_OT_select_less);
|
||||
WM_operatortype_append(MESH_OT_select_invert);
|
||||
@@ -142,7 +141,17 @@ void ED_operatortypes_mesh(void)
|
||||
WM_operatortype_append(MESH_OT_removedoublesflag);
|
||||
WM_operatortype_append(MESH_OT_extrude);
|
||||
WM_operatortype_append(MESH_OT_vertices_to_sphere);
|
||||
|
||||
WM_operatortype_append(MESH_OT_split_mesh);
|
||||
WM_operatortype_append(MESH_OT_extrude_repeat);
|
||||
WM_operatortype_append(MESH_OT_edge_rotate_selected);
|
||||
WM_operatortype_append(MESH_OT_loop_to_region);
|
||||
WM_operatortype_append(MESH_OT_region_to_loop);
|
||||
|
||||
WM_operatortype_append(MESH_OT_rotate_uvs);
|
||||
WM_operatortype_append(MESH_OT_mirror_uvs);
|
||||
WM_operatortype_append(MESH_OT_rotate_colors);
|
||||
WM_operatortype_append(MESH_OT_mirror_colors);
|
||||
|
||||
WM_operatortype_append(MESH_OT_fill);
|
||||
WM_operatortype_append(MESH_OT_beauty_fill);
|
||||
WM_operatortype_append(MESH_OT_convert_quads_to_tris);
|
||||
@@ -162,7 +171,11 @@ void ED_operatortypes_mesh(void)
|
||||
WM_operatortype_append(MESH_OT_similar_edge_select);
|
||||
WM_operatortype_append(MESH_OT_similar_face_select);
|
||||
WM_operatortype_append(MESH_OT_select_multi_loop);
|
||||
WM_operatortype_append(MESH_OT_separate);
|
||||
WM_operatortype_append(MESH_OT_mark_seam);
|
||||
WM_operatortype_append(MESH_OT_mark_sharp);
|
||||
WM_operatortype_append(MESH_OT_smooth_vertex);
|
||||
WM_operatortype_append(MESH_OT_flip_editnormals);
|
||||
WM_operatortype_append(MESH_OT_knife_cut);
|
||||
|
||||
}
|
||||
|
||||
@@ -186,7 +199,6 @@ void ED_keymap_mesh(wmWindowManager *wm)
|
||||
WM_keymap_add_item(keymap, "MESH_OT_shortest_path_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_de_select_all", AKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_bmesh_test", JKEY, 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);
|
||||
@@ -201,7 +213,17 @@ void ED_keymap_mesh(wmWindowManager *wm)
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_select_random", SPACEKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_vertices_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_smooth_vertex", THREEKEY, KM_PRESS, KM_CTRL , 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_flip_editnormals", THREEKEY, KM_PRESS, KM_ALT , 0);
|
||||
|
||||
/* temp hotkeys! */
|
||||
WM_keymap_add_item(keymap, "MESH_OT_similar_vertex_select", GKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_similar_edge_select", GKEY, KM_PRESS, KM_SHIFT2|KM_CTRL, 0);
|
||||
@@ -233,6 +255,21 @@ void ED_keymap_mesh(wmWindowManager *wm)
|
||||
WM_keymap_add_item(keymap, "MESH_OT_convert_quads_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_convert_tris_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_split_mesh", FOURKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_extrude_repeat", FOURKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_edge_rotate_selected", FIVEKEY, KM_PRESS, KM_CTRL, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_loop_to_region",SIXKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_region_to_loop",SIXKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_rotate_uvs",SEVENKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_mirror_uvs",SEVENKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_rotate_colors",EIGHTKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_mirror_colors",EIGHTKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
/* add/remove */
|
||||
WM_keymap_add_item(keymap, "MESH_OT_add_edge_face", FKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_add_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
@@ -246,6 +283,9 @@ void ED_keymap_mesh(wmWindowManager *wm)
|
||||
WM_keymap_add_item(keymap, "MESH_OT_make_fgon", FKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_clear_fgon", 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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user