diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-02 14:49:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-02 14:49:15 +0400 |
commit | cf927d3fd149cbbba4732c789ccbac239f4000f3 (patch) | |
tree | 30093c4368e56a45e3327896cbbfcef02a553f5d /source/blender | |
parent | 47a1c7e5aab44ce24814f0c421315a50ab7a6147 (diff) |
bmesh minor changes
* dont check selection and hiddent state (select + hide isnt allowed and api ensures this)
* MESH_OT_noise had incorrect check for texture (checked if slot [0] was filled but then used active texture)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/mesh/bmesh_select.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_tools.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_buttons.c | 44 |
3 files changed, 33 insertions, 31 deletions
diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 749ff66997b..ac658f242af 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -1894,7 +1894,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) } else { BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (BM_elem_flag_test(v, BM_ELEM_SELECT) && !BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { BM_elem_flag_enable(v, BM_ELEM_TAG); } else { @@ -2470,7 +2470,7 @@ static int select_next_loop(bContext *C, wmOperator *UNUSED(op)) BMIter liter; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, f) { - if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) && !BM_elem_flag_test(l->v, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) { BM_elem_flag_enable(l->next->v, BM_ELEM_TAG); BM_elem_select_set(em->bm, l->v, FALSE); } diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 4b053b21a8b..0a05d1b61e4 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -1372,7 +1372,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) if (!eed) { BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { /* de-select the edge before */ do_deselect = TRUE; break; @@ -4356,20 +4356,22 @@ static int mesh_noise_exec(bContext *C, wmOperator *op) BMIter iter; float fac = RNA_float_get(op->ptr, "factor"); - if (em == NULL) return OPERATOR_FINISHED; + if (em == NULL) { + return OPERATOR_FINISHED; + } - ma = give_current_material(obedit, obedit->actcol); - if (ma == 0 || ma->mtex[0] == 0 || ma->mtex[0]->tex == 0) { + if ((ma = give_current_material(obedit, obedit->actcol)) == NULL || + (tex = give_current_material_texture(ma)) == NULL) + { BKE_report(op->reports, RPT_WARNING, "Mesh has no material or texture assigned"); return OPERATOR_FINISHED; } - tex = give_current_material_texture(ma); if (tex->type == TEX_STUCCI) { float b2, vec[3]; float ofs = tex->turbul / 200.0; BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && !BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { b2 = BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]); if (tex->stype) ofs *= (b2 * b2); vec[0] = fac * (b2 - BLI_hnoise(tex->noisesize, eve->co[0] + ofs, eve->co[1], eve->co[2])); @@ -4382,7 +4384,7 @@ static int mesh_noise_exec(bContext *C, wmOperator *op) } else { BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { - if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && !BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { + if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { float tin, dum; externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0); eve->co[2] += fac * tin; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 6ac400b3e43..3e2979a7e88 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -436,9 +436,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); - if (!crease) - break; - *crease = sca; + if (crease) { + *crease = sca; + } } } } @@ -446,10 +446,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); - if (!crease) - break; - *crease *= sca; - CLAMP(*crease, 0.0f, 1.0f); + if (crease) { + *crease *= sca; + CLAMP(*crease, 0.0f, 1.0f); + } } } } @@ -457,10 +457,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE); - if (!crease) - break; - *crease = 1.0f + ((1.0f - *crease) * sca); - CLAMP(*crease, 0.0f, 1.0f); + if (crease) { + *crease = 1.0f + ((1.0f - *crease) * sca); + CLAMP(*crease, 0.0f, 1.0f); + } } } } @@ -474,9 +474,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); - if (!bweight) - break; - *bweight = sca; + if (bweight) { + *bweight = sca; + } } } } @@ -484,10 +484,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); - if (!bweight) - break; - *bweight *= sca; - CLAMP(*bweight, 0.0f, 1.0f); + if (bweight) { + *bweight *= sca; + CLAMP(*bweight, 0.0f, 1.0f); + } } } } @@ -495,10 +495,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT); - if (!bweight) - break; - *bweight = 1.0f + ((1.0f - *bweight) * sca); - CLAMP(*bweight, 0.0f, 1.0f); + if (bweight) { + *bweight = 1.0f + ((1.0f - *bweight) * sca); + CLAMP(*bweight, 0.0f, 1.0f); + } } } } |