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-11-20 17:29:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-20 17:29:27 +0400
commitebaf1306b8167ea28be61980305a53b3c54cc4dc (patch)
treec4bcb52ec0fbc33d72e88bffd8df63f65155c377 /source/blender/modifiers/intern/MOD_array.c
parent1dd5a89c87563d077f016fc38894c5195f6f03b0 (diff)
bmesh operator api:
avoid per vert/edge/face string lookups in BMO_slot_map_* functions --- used in array modifier, subdivide, remove doubles and other tools.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_array.c')
-rw-r--r--source/blender/modifiers/intern/MOD_array.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 4921c5e3585..d03298991d6 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -235,6 +235,7 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
BMOIter oiter;
BMOperator find_op;
+ BMOpSlot *slot_targetmap;
BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
is_input ? /* ugh */
@@ -266,15 +267,17 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
BMO_op_exec(bm, &find_op);
+ slot_targetmap = BMO_slot_get(weld_op->slots_in, "targetmap");
+
/* add new merge targets to weld operator */
BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
v2 = BMO_iter_map_value_p(&oiter);
/* check in case the target vertex (v2) is already marked
* for merging */
- while ((v3 = BMO_slot_map_ptr_get(weld_op->slots_in, "targetmap", v2))) {
+ while ((v3 = BMO_slot_map_ptr_get(slot_targetmap, v2))) {
v2 = v3;
}
- BMO_slot_map_ptr_insert(weld_op, weld_op->slots_in, "targetmap", v, v2);
+ BMO_slot_map_ptr_insert(weld_op, slot_targetmap, v, v2);
}
BMO_op_finish(bm, &find_op);
@@ -299,6 +302,7 @@ static void merge_first_last(BMesh *bm,
BMOperator find_op;
BMOIter oiter;
BMVert *v, *v2;
+ BMOpSlot *slot_targetmap;
BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"find_doubles verts=%s dist=%f keep_verts=%s",
@@ -312,9 +316,10 @@ static void merge_first_last(BMesh *bm,
BMO_op_exec(bm, &find_op);
/* add new merge targets to weld operator */
+ slot_targetmap = BMO_slot_get(weld_op->slots_out, "targetmap");
BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
v2 = BMO_iter_map_value_p(&oiter);
- BMO_slot_map_ptr_insert(weld_op, weld_op->slots_in, "targetmap", v, v2);
+ BMO_slot_map_ptr_insert(weld_op, slot_targetmap, v, v2);
}
BMO_op_finish(bm, &find_op);
@@ -339,6 +344,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
int *indexMap = NULL;
DerivedMesh *start_cap = NULL, *end_cap = NULL;
MVert *src_mvert;
+ BMOpSlot *slot_targetmap = NULL; /* for weldop */
/* need to avoid infinite recursion here */
if (amd->start_cap && amd->start_cap != ob)
@@ -426,10 +432,13 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
BMO_push(bm, NULL);
bmesh_edit_begin(bm, 0);
- if (amd->flags & MOD_ARR_MERGE)
+ if (amd->flags & MOD_ARR_MERGE) {
BMO_op_init(bm, &weld_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"weld_verts");
+ slot_targetmap = BMO_slot_get(weld_op.slots_in, "targetmap");
+ }
+
BMO_op_initf(bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"duplicate geom=%avef");
first_dupe_op = dupe_op;
@@ -485,11 +494,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
/* check in case the target vertex (v2) is already marked
* for merging */
- while ((v3 = BMO_slot_map_ptr_get(weld_op.slots_in, "targetmap", v2))) {
+ while ((v3 = BMO_slot_map_ptr_get(slot_targetmap, v2))) {
v2 = v3;
}
- BMO_slot_map_ptr_insert(&weld_op, weld_op.slots_in, "targetmap", v, v2);
+ BMO_slot_map_ptr_insert(&weld_op, slot_targetmap, v, v2);
}
#undef _E