fix [#30852] Wrong Material ID applied for the new faces
This commit is contained in:
parent
9a6a791ff0
commit
f5bb4635c6
|
@ -405,6 +405,7 @@ static BMOpDefine bmo_contextual_create_def = {
|
|||
"contextual_create",
|
||||
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, //input geometry.
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, //newly-made face(s)
|
||||
{BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
bmo_contextual_create_exec,
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES,
|
||||
|
@ -431,6 +432,7 @@ static BMOpDefine bmo_edgenet_fill_def = {
|
|||
{BMO_OP_SLOT_ELEMENT_BUF, "excludefaces"}, /* list of faces to ignore for manifold check */
|
||||
{BMO_OP_SLOT_MAPPING, "faceout_groupmap"}, /* maps new faces to the group numbers they came fro */
|
||||
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
|
||||
{BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
|
||||
{0, /* null-terminating sentinel */}},
|
||||
bmo_edgenet_fill_exec,
|
||||
0,
|
||||
|
|
|
@ -898,6 +898,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
|||
BLI_array_declare(edges);
|
||||
int use_restrict = BMO_slot_bool_get(op, "use_restrict");
|
||||
int use_fill_check = BMO_slot_bool_get(op, "use_fill_check");
|
||||
const short mat_nr = BMO_slot_int_get(op, "mat_nr");
|
||||
int i, j, group = 0;
|
||||
unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */
|
||||
|
||||
|
@ -1047,6 +1048,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
|
|||
f = BM_face_create_ngon(bm, v1, v2, edges, i, TRUE);
|
||||
if (f && !BMO_elem_flag_test(bm, f, ELE_ORIG)) {
|
||||
BMO_elem_flag_enable(bm, f, FACE_NEW);
|
||||
f->mat_nr = mat_nr;
|
||||
}
|
||||
|
||||
if (use_restrict) {
|
||||
|
@ -1275,6 +1277,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
|||
BMEdge *e;
|
||||
BMFace *f;
|
||||
int totv = 0, tote = 0, totf = 0, amount;
|
||||
const short mat_nr = BMO_slot_int_get(op, "mat_nr");
|
||||
|
||||
/* count number of each element type we were passe */
|
||||
BMO_ITER(h, &oiter, bm, op, "geom", BM_VERT|BM_EDGE|BM_FACE) {
|
||||
|
@ -1362,7 +1365,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
|||
BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW);
|
||||
BMO_op_finish(bm, &op2);
|
||||
|
||||
BMO_op_initf(bm, &op2, "edgenet_fill edges=%fe use_fill_check=%b", ELE_NEW, TRUE);
|
||||
BMO_op_initf(bm, &op2, "edgenet_fill edges=%fe use_fill_check=%b mat_nr=%i", ELE_NEW, TRUE, mat_nr);
|
||||
BMO_op_exec(bm, &op2);
|
||||
|
||||
/* return if edge net create did something */
|
||||
|
@ -1465,6 +1468,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
|
|||
|
||||
if (f) {
|
||||
BMO_elem_flag_enable(bm, f, ELE_OUT);
|
||||
f->mat_nr = mat_nr;
|
||||
}
|
||||
|
||||
MEM_freeN(vert_arr);
|
||||
|
|
|
@ -1022,7 +1022,7 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
|
|||
Object *obedit = CTX_data_edit_object(C);
|
||||
BMEditMesh *em = BMEdit_FromObject(obedit);
|
||||
|
||||
if (!EDBM_op_init(em, &bmop, op, "contextual_create geom=%hfev", BM_ELEM_SELECT))
|
||||
if (!EDBM_op_init(em, &bmop, op, "contextual_create geom=%hfev mat_nr=%i", BM_ELEM_SELECT, em->mat_nr))
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
BMO_op_exec(em->bm, &bmop);
|
||||
|
|
|
@ -297,6 +297,8 @@ void EDBM_mesh_make(ToolSettings *ts, Scene *UNUSED(scene), Object *ob)
|
|||
#endif
|
||||
|
||||
me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = ts->selectmode;
|
||||
me->edit_btmesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
|
||||
|
||||
me->edit_btmesh->me = me;
|
||||
me->edit_btmesh->ob = ob;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue