From c74ace03e025b9ee94664f2ec8291279effb3500 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Apr 2012 07:40:47 +0000 Subject: fix [#30907] Inset tool with Select Outer disabled does not allow translation of new faces inset with select-inner faces gave invalid selection. also correct spelling in some comments. --- source/blender/blenkernel/intern/depsgraph.c | 4 +-- source/blender/bmesh/intern/bmesh_marking.c | 43 +++++++++++++++++++++++++- source/blender/bmesh/intern/bmesh_marking.h | 4 ++- source/blender/editors/mesh/editmesh_tools.c | 5 ++- source/blender/makesdna/DNA_armature_types.h | 2 +- source/blender/makesdna/intern/makesdna.c | 2 +- source/blender/modifiers/intern/MOD_fluidsim.c | 2 +- 7 files changed, 54 insertions(+), 8 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index dd8471f0a1f..39fa5d2f7e7 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1795,7 +1795,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce) } } - // temporal correction for circular dependancies + /* temporal correction for circular dependencies */ base = sce->base.first; while (base) { BLI_remlink(&sce->base,base); @@ -2913,7 +2913,7 @@ void DAG_pose_sort(Object *ob) } } - // temporal correction for circular dependancies + /* temporal correction for circular dependencies */ while (pose->chanbase.first) { pchan= pose->chanbase.first; BLI_remlink(&pose->chanbase, pchan); diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 03c4d3c9cbb..a83987be94c 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -395,7 +395,7 @@ void BM_face_select_set(BMesh *bm, BMFace *f, int select) * Sets the selection mode for the bmesh, * updating the selection state. */ -void BM_select_mode_set(BMesh *bm, int selectmode) +void BM_mesh_select_mode_set(BMesh *bm, int selectmode) { BMIter iter; BMElem *ele; @@ -445,6 +445,47 @@ void BM_select_mode_set(BMesh *bm, int selectmode) } } +/** + * \brief De-Select, Re-Select elements + * Awkwardly named function + * + * Deselect's one type of elements then re-selects another, + * Use case is to de-select stray edges or verts. + */ +void BM_mesh_select_flush_strip(BMesh *bm, const char htype_desel, const char htype_sel) +{ + const char iter_types[3] = {BM_VERTS_OF_MESH, + BM_EDGES_OF_MESH, + BM_FACES_OF_MESH}; + + const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE}; + + BMIter iter; + BMElem *ele; + int i; + + for (i = 0; i < 3; i++) { + if (htype_desel & flag_types[i]) { + ele = BM_iter_new(&iter, bm, iter_types[i], NULL); + for ( ; ele; ele = BM_iter_step(&iter)) { + BM_elem_flag_disable(ele, BM_ELEM_SELECT); + } + } + } + + for (i = 0; i < 3; i++) { + if (htype_sel & flag_types[i]) { + ele = BM_iter_new(&iter, bm, iter_types[i], NULL); + for ( ; ele; ele = BM_iter_step(&iter)) { + if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { + BM_elem_select_set(bm, ele, TRUE); + } + } + } + } + +} + /** * counts number of elements with flag enabled/disabled */ diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index fa078c74b2e..b981f917df6 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -54,12 +54,14 @@ void BM_vert_select_set(BMesh *bm, BMVert *v, int select); void BM_edge_select_set(BMesh *bm, BMEdge *e, int select); void BM_face_select_set(BMesh *bm, BMFace *f, int select); -void BM_select_mode_set(BMesh *bm, int selectmode); +void BM_mesh_select_mode_set(BMesh *bm, int selectmode); void BM_mesh_select_mode_flush(BMesh *bm); void BM_mesh_deselect_flush(BMesh *bm); void BM_mesh_select_flush(BMesh *bm); +void BM_mesh_select_flush_strip(BMesh *bm, const char htype_desel, const char htype_sel); + int BM_mesh_enabled_flag_count(BMesh *bm, const char htype, const char hflag, int respecthide); int BM_mesh_disabled_flag_count(BMesh *bm, const char htype, const char hflag, int respecthide); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 20c1f0e4223..9ceb30267d1 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4531,7 +4531,10 @@ static int edbm_inset_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE); } else { - BMO_slot_buffer_hflag_disable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE); + BM_mesh_elem_flag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, FALSE); + BMO_slot_buffer_hflag_disable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, FALSE); + /* so selected faces verts & edges get selected */ + BM_mesh_select_flush_strip(em->bm, BM_VERT | BM_EDGE, BM_FACE); } if (!EDBM_op_finish(em, &bmop, op, TRUE)) { diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 8b254b3b044..ea564e8c499 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -182,7 +182,7 @@ typedef enum eBone_Flag { BONE_CONNECTED = (1<<4), /* when bone has a parent, connect head of bone to parent's tail*/ /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */ BONE_HIDDEN_P = (1<<6), /* hidden Bones when drawing PoseChannels */ - BONE_DONE = (1<<7), /* For detecting cyclic dependancies */ + BONE_DONE = (1<<7), /* For detecting cyclic dependencies */ BONE_DRAW_ACTIVE = (1<<8), /* active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */ BONE_HINGE = (1<<9), /* No parent rotation or scale */ BONE_HIDDEN_A = (1<<10), /* hidden Bones when drawing Armature Editmode */ diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index ae6432dcbe4..deb3b88a910 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -1179,7 +1179,7 @@ int main(int argc, char ** argv) return(return_status); } -// include files for automatic dependancies +/* include files for automatic dependencies */ #include "DNA_listBase.h" #include "DNA_vec_types.h" #include "DNA_ID.h" diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 9a80f241a00..55182578938 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -112,7 +112,7 @@ static void updateDepgraph( if (ob1 != ob) { FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim); - // only put dependancies from NON-DOMAIN fluids in here + /* only put dependencies from NON-DOMAIN fluids in here */ if (fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) { DagNode *curNode = dag_get_node(forest, ob1); dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Fluidsim Object"); -- cgit v1.2.3