avoid double ghash lookups
This commit is contained in:
parent
1b11428101
commit
85b0315b3b
@ -101,7 +101,7 @@ static void symm_verts_mirror(Symm *symm)
|
||||
BMOIter oiter;
|
||||
BMVert *src_v, *dst_v;
|
||||
|
||||
symm->vert_symm_map = BLI_ghash_ptr_new(AT);
|
||||
symm->vert_symm_map = BLI_ghash_ptr_new(__func__);
|
||||
|
||||
BMO_ITER (src_v, &oiter, symm->op->slots_in, "input", BM_VERT) {
|
||||
SymmSide side = symm_co_side(symm, src_v->co);
|
||||
@ -214,9 +214,8 @@ static void symm_mirror_edges(Symm *symm)
|
||||
BMO_elem_flag_enable(symm->bm, e_new, SYMM_OUTPUT_GEOM);
|
||||
}
|
||||
else if (v1 || v2) {
|
||||
if (BLI_ghash_haskey(symm->edge_split_map, e)) {
|
||||
BMVert *v_split = BLI_ghash_lookup(symm->edge_split_map, e);
|
||||
|
||||
BMVert *v_split = BLI_ghash_lookup(symm->edge_split_map, e);
|
||||
if (v_split) {
|
||||
/* Output the keep side of the split edge */
|
||||
if (!v1) {
|
||||
e_new = BM_edge_create(symm->bm, v_split, e->v2, e, BM_CREATE_NO_DOUBLE);
|
||||
@ -330,8 +329,9 @@ static BMVert *symm_poly_mirror_dst(const Symm *symm,
|
||||
if (sp->edge_verts[v])
|
||||
return sp->edge_verts[v];
|
||||
else if (sp->src_verts[v]) {
|
||||
if (BLI_ghash_haskey(symm->vert_symm_map, sp->src_verts[v]))
|
||||
return BLI_ghash_lookup(symm->vert_symm_map, sp->src_verts[v]);
|
||||
BMVert *v_src = BLI_ghash_lookup(symm->vert_symm_map, sp->src_verts[v]);
|
||||
if (v_src)
|
||||
return v_src;
|
||||
else
|
||||
return sp->src_verts[v];
|
||||
}
|
||||
|
@ -662,6 +662,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
|
||||
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
|
||||
int offset1, itmp1 = uv_element_offset_from_face_get(data->elementMap, efa, l, island_index, do_island_optimization);
|
||||
int offset2, itmp2 = uv_element_offset_from_face_get(data->elementMap, efa, l->next, island_index, do_island_optimization);
|
||||
char *flag;
|
||||
|
||||
/* Skip edge if not found(unlikely) or not on valid island */
|
||||
if (itmp1 == -1 || itmp2 == -1)
|
||||
@ -682,8 +683,8 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
|
||||
edges[counter].uv2 = offset1;
|
||||
}
|
||||
/* Hack! Set the value of the key to its flag. Now we can set the flag when an edge exists twice :) */
|
||||
if (BLI_ghash_haskey(edgeHash, &edges[counter])) {
|
||||
char *flag = BLI_ghash_lookup(edgeHash, &edges[counter]);
|
||||
flag = BLI_ghash_lookup(edgeHash, &edges[counter]);
|
||||
if (flag) {
|
||||
*flag = 1;
|
||||
}
|
||||
else {
|
||||
|
@ -1718,6 +1718,7 @@ static int stitch_init(bContext *C, wmOperator *op)
|
||||
UvElement *element = ED_uv_element_get(state->element_map, efa, l);
|
||||
int offset1, itmp1 = element - state->element_map->buf;
|
||||
int offset2, itmp2 = ED_uv_element_get(state->element_map, efa, l->next) - state->element_map->buf;
|
||||
UvEdge *edge;
|
||||
|
||||
offset1 = map[itmp1];
|
||||
offset2 = map[itmp2];
|
||||
@ -1737,8 +1738,8 @@ static int stitch_init(bContext *C, wmOperator *op)
|
||||
all_edges[counter].uv2 = offset1;
|
||||
}
|
||||
|
||||
if (BLI_ghash_haskey(edge_hash, &all_edges[counter])) {
|
||||
UvEdge *edge = BLI_ghash_lookup(edge_hash, &all_edges[counter]);
|
||||
edge = BLI_ghash_lookup(edge_hash, &all_edges[counter]);
|
||||
if (edge) {
|
||||
edge->flag = 0;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user