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:
authorCampbell Barton <ideasman42@gmail.com>2012-04-09 09:17:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-09 09:17:07 +0400
commitf5bb4635c6d023775689450c453cb76f917f2ee3 (patch)
tree882bc9d1cff937f958d7087fa045796a3d7f0c2e /source/blender/bmesh
parent9a6a791ff0c9b32f66831f5e09d7c283ac309b95 (diff)
fix [#30852] Wrong Material ID applied for the new faces
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c2
-rw-r--r--source/blender/bmesh/operators/bmo_create.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 8853771ed58..3352df71414 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -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,
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index a39389f3d62..bf34806ee26 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -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);