forked from bartvdbraak/blender
use clearer names for 'single' bmesh operator args & add '%e' to BMO_op_vinitf comments.
This commit is contained in:
parent
a9855c227e
commit
c00a1b7493
@ -356,7 +356,7 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
|
|||||||
"pointmerge_facedata",
|
"pointmerge_facedata",
|
||||||
/* slots_in */
|
/* slots_in */
|
||||||
{{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */
|
{{"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'}},
|
||||||
},
|
},
|
||||||
{{{'\0'}}}, /* no output */
|
{{{'\0'}}}, /* no output */
|
||||||
@ -1209,8 +1209,8 @@ static BMOpDefine bmo_reverse_colors_def = {
|
|||||||
static BMOpDefine bmo_shortest_path_def = {
|
static BMOpDefine bmo_shortest_path_def = {
|
||||||
"shortest_path",
|
"shortest_path",
|
||||||
/* slots_in */
|
/* slots_in */
|
||||||
{{"startv", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}}, /* start vertex */
|
{{"vert_start", 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_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 */
|
{"type", BMO_OP_SLOT_INT}, /* type of selection */
|
||||||
{{'\0'}},
|
{{'\0'}},
|
||||||
},
|
},
|
||||||
@ -1547,7 +1547,7 @@ static BMOpDefine bmo_slide_vert_def = {
|
|||||||
/* slots_in */
|
/* slots_in */
|
||||||
{{"vert", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}},
|
{{"vert", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE}},
|
||||||
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
|
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
|
||||||
{"distance_t", BMO_OP_SLOT_FLT},
|
{"factor", BMO_OP_SLOT_FLT},
|
||||||
{{'\0'}},
|
{{'\0'}},
|
||||||
},
|
},
|
||||||
/* slots_out */
|
/* slots_out */
|
||||||
|
@ -1490,6 +1490,7 @@ static int bmo_opname_to_opcode(const char *opname)
|
|||||||
* f - float
|
* f - float
|
||||||
* s - slot_in
|
* s - slot_in
|
||||||
* S - slot_out
|
* S - slot_out
|
||||||
|
* e - single vert/edge/face
|
||||||
* hv - header flagged verts (hflag)
|
* hv - header flagged verts (hflag)
|
||||||
* he - header flagged edges (hflag)
|
* he - header flagged edges (hflag)
|
||||||
* hf - header flagged faces (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;
|
state = 1;
|
||||||
break;
|
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 *);
|
BMHeader *ele = va_arg(vlist, void *);
|
||||||
BMOpSlot *slot = BMO_slot_get(op->slots_in, slot_name);
|
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;
|
BMOIter siter;
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
BMVert *v, *snapv;
|
BMVert *v, *vert_snap;
|
||||||
BMLoop *l, *firstl = NULL;
|
BMLoop *l, *firstl = NULL;
|
||||||
float fac;
|
float fac;
|
||||||
int i, tot;
|
int i, tot;
|
||||||
|
|
||||||
snapv = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "snapv"));
|
vert_snap = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_snap"));
|
||||||
tot = BM_vert_face_count(snapv);
|
tot = BM_vert_face_count(vert_snap);
|
||||||
|
|
||||||
if (!tot)
|
if (!tot)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fac = 1.0f / tot;
|
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) {
|
if (!firstl) {
|
||||||
firstl = l;
|
firstl = l;
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
|
|||||||
{
|
{
|
||||||
BMOperator weldop;
|
BMOperator weldop;
|
||||||
BMOIter siter;
|
BMOIter siter;
|
||||||
BMVert *v, *snapv = NULL;
|
BMVert *v, *vert_snap = NULL;
|
||||||
float vec[3];
|
float vec[3];
|
||||||
BMOpSlot *slot_targetmap;
|
BMOpSlot *slot_targetmap;
|
||||||
|
|
||||||
@ -355,12 +355,12 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
|
|||||||
slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
|
slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
|
||||||
|
|
||||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||||
if (!snapv) {
|
if (!vert_snap) {
|
||||||
snapv = v;
|
vert_snap = v;
|
||||||
copy_v3_v3(snapv->co, vec);
|
copy_v3_v3(vert_snap->co, vec);
|
||||||
}
|
}
|
||||||
else {
|
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;
|
int selected_edges = 0;
|
||||||
|
|
||||||
/* Get slide amount */
|
/* 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 */
|
/* Get start vertex */
|
||||||
vertex = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert"));
|
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);
|
BMO_elem_flag_enable(bm, vertex, VERT_MARK);
|
||||||
|
|
||||||
/* Interpolate */
|
/* 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 */
|
/* 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;
|
int num_total = 0 /*, num_sels = 0 */, i = 0;
|
||||||
const int type = BMO_slot_int_get(op->slots_in, "type");
|
const int type = BMO_slot_int_get(op->slots_in, "type");
|
||||||
|
|
||||||
sv = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "startv"));
|
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, "endv"));
|
ev = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_end"));
|
||||||
|
|
||||||
num_total = BM_mesh_elem_count(bm, BM_VERT);
|
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;
|
BMOperator bmop;
|
||||||
BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last;
|
BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last;
|
||||||
|
|
||||||
float distance_t = 0.0f;
|
float factor = 0.0f;
|
||||||
|
|
||||||
/* Invoked modally? */
|
/* Invoked modally? */
|
||||||
if (op->type->modal == edbm_vertex_slide_modal && op->customdata) {
|
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);
|
BM_select_history_store(em->bm, vso->start_vtx);
|
||||||
ese = (BMEditSelection *)em->bm->selected.last;
|
ese = (BMEditSelection *)em->bm->selected.last;
|
||||||
}
|
}
|
||||||
distance_t = vso->distance;
|
factor = vso->distance;
|
||||||
RNA_float_set(op->ptr, "distance_t", distance_t);
|
RNA_float_set(op->ptr, "factor", factor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Get Properties */
|
/* Get Properties */
|
||||||
distance_t = RNA_float_get(op->ptr, "distance_t");
|
factor = RNA_float_get(op->ptr, "factor");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is there a starting vertex ? */
|
/* 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 */
|
/* Prepare operator */
|
||||||
if (!EDBM_op_init(em, &bmop, op,
|
if (!EDBM_op_init(em, &bmop, op,
|
||||||
"slide_vert vert=%e edges=%he distance_t=%f",
|
"slide_vert vert=%e edges=%he factor=%f",
|
||||||
start_vert, BM_ELEM_SELECT, distance_t))
|
start_vert, BM_ELEM_SELECT, factor))
|
||||||
{
|
{
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
@ -787,7 +787,7 @@ void MESH_OT_vert_slide(wmOperatorType *ot)
|
|||||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
|
|
||||||
/* Properties for vertex slide */
|
/* 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_ui_range(prop, -5.0f, 5.0f, 0.1, 4);
|
||||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
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;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
if (uvmerge) {
|
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;
|
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 */
|
/* 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 */
|
/* execute the operator */
|
||||||
BMO_op_exec(em->bm, &bmop);
|
BMO_op_exec(em->bm, &bmop);
|
||||||
|
Loading…
Reference in New Issue
Block a user