use clearer names for 'single' bmesh operator args & add '%e' to BMO_op_vinitf comments.

This commit is contained in:
Campbell Barton 2012-11-27 09:41:08 +00:00
parent a9855c227e
commit c00a1b7493
7 changed files with 30 additions and 28 deletions

@ -356,7 +356,7 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
"pointmerge_facedata",
/* slots_in */
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
{"snapv", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */
{"vert_snap", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* snap vertex */
{{'\0'}},
},
{{{'\0'}}}, /* no output */
@ -1209,8 +1209,8 @@ static BMOpDefine bmo_reverse_colors_def = {
static BMOpDefine bmo_shortest_path_def = {
"shortest_path",
/* slots_in */
{{"startv", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* start vertex */
{"endv", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* end vertex */
{{"vert_start", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* start vertex */
{"vert_end", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* end vertex */
{"type", BMO_OP_SLOT_INT}, /* type of selection */
{{'\0'}},
},
@ -1547,7 +1547,7 @@ static BMOpDefine bmo_slide_vert_def = {
/* slots_in */
{{"vert", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}},
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
{"distance_t", BMO_OP_SLOT_FLT},
{"factor", BMO_OP_SLOT_FLT},
{{'\0'}},
},
/* slots_out */

@ -1490,6 +1490,7 @@ static int bmo_opname_to_opcode(const char *opname)
* f - float
* s - slot_in
* S - slot_out
* e - single vert/edge/face
* hv - header flagged verts (hflag)
* he - header flagged edges (hflag)
* hf - header flagged faces (hflag)
@ -1601,9 +1602,8 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
state = 1;
break;
}
case 'e':
case 'e': /* single vert/edge/face */
{
/* XXX we have 'e' but no equivalent for verts/faces - why? we could use (V/E/P)*/
BMHeader *ele = va_arg(vlist, void *);
BMOpSlot *slot = BMO_slot_get(op->slots_in, slot_name);

@ -258,19 +258,19 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
{
BMOIter siter;
BMIter iter;
BMVert *v, *snapv;
BMVert *v, *vert_snap;
BMLoop *l, *firstl = NULL;
float fac;
int i, tot;
snapv = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "snapv"));
tot = BM_vert_face_count(snapv);
vert_snap = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_snap"));
tot = BM_vert_face_count(vert_snap);
if (!tot)
return;
fac = 1.0f / tot;
BM_ITER_ELEM (l, &iter, snapv, BM_LOOPS_OF_VERT) {
BM_ITER_ELEM (l, &iter, vert_snap, BM_LOOPS_OF_VERT) {
if (!firstl) {
firstl = l;
}
@ -343,7 +343,7 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
{
BMOperator weldop;
BMOIter siter;
BMVert *v, *snapv = NULL;
BMVert *v, *vert_snap = NULL;
float vec[3];
BMOpSlot *slot_targetmap;
@ -355,12 +355,12 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
if (!snapv) {
snapv = v;
copy_v3_v3(snapv->co, vec);
if (!vert_snap) {
vert_snap = v;
copy_v3_v3(vert_snap->co, vec);
}
else {
BMO_slot_map_elem_insert(&weldop, slot_targetmap, v, snapv);
BMO_slot_map_elem_insert(&weldop, slot_targetmap, v, vert_snap);
}
}

@ -53,7 +53,7 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
int selected_edges = 0;
/* Get slide amount */
const float distance_t = BMO_slot_float_get(op->slots_in, "distance_t");
const float factor = BMO_slot_float_get(op->slots_in, "factor");
/* Get start vertex */
vertex = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert"));
@ -101,7 +101,7 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, vertex, VERT_MARK);
/* Interpolate */
interp_v3_v3v3(vertex->co, vertex->co, other->co, distance_t);
interp_v3_v3v3(vertex->co, vertex->co, other->co, factor);
}
/* Return the new edge. The same previously marked with VERT_MARK */

@ -711,8 +711,8 @@ void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
int num_total = 0 /*, num_sels = 0 */, i = 0;
const int type = BMO_slot_int_get(op->slots_in, "type");
sv = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "startv"));
ev = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "endv"));
sv = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_start"));
ev = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_end"));
num_total = BM_mesh_elem_count(bm, BM_VERT);

@ -695,7 +695,7 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
BMOperator bmop;
BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last;
float distance_t = 0.0f;
float factor = 0.0f;
/* Invoked modally? */
if (op->type->modal == edbm_vertex_slide_modal && op->customdata) {
@ -711,12 +711,12 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
BM_select_history_store(em->bm, vso->start_vtx);
ese = (BMEditSelection *)em->bm->selected.last;
}
distance_t = vso->distance;
RNA_float_set(op->ptr, "distance_t", distance_t);
factor = vso->distance;
RNA_float_set(op->ptr, "factor", factor);
}
else {
/* Get Properties */
distance_t = RNA_float_get(op->ptr, "distance_t");
factor = RNA_float_get(op->ptr, "factor");
}
/* Is there a starting vertex ? */
@ -729,8 +729,8 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
/* Prepare operator */
if (!EDBM_op_init(em, &bmop, op,
"slide_vert vert=%e edges=%he distance_t=%f",
start_vert, BM_ELEM_SELECT, distance_t))
"slide_vert vert=%e edges=%he factor=%f",
start_vert, BM_ELEM_SELECT, factor))
{
return OPERATOR_CANCELLED;
}
@ -787,7 +787,7 @@ void MESH_OT_vert_slide(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* Properties for vertex slide */
prop = RNA_def_float(ot->srna, "distance_t", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "Distance", -5.0f, 5.0f);
prop = RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "Distance", -5.0f, 5.0f);
RNA_def_property_ui_range(prop, -5.0f, 5.0f, 0.1, 4);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}

@ -2018,7 +2018,7 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w
return OPERATOR_CANCELLED;
if (uvmerge) {
if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv snapv=%e", BM_ELEM_SELECT, mergevert))
if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv vert_snap=%e", BM_ELEM_SELECT, mergevert))
return OPERATOR_CANCELLED;
}
@ -2308,7 +2308,9 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
}
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
EDBM_op_init(em, &bmop, op, "shortest_path startv=%e endv=%e type=%i", svert, evert, type);
EDBM_op_init(em, &bmop, op,
"shortest_path vert_start=%e vert_end=%e type=%i",
svert, evert, type);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);