diff options
Diffstat (limited to 'source/blender/src/editmesh_lib.c')
-rw-r--r-- | source/blender/src/editmesh_lib.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/source/blender/src/editmesh_lib.c b/source/blender/src/editmesh_lib.c index fecd6efecce..8c57120021b 100644 --- a/source/blender/src/editmesh_lib.c +++ b/source/blender/src/editmesh_lib.c @@ -392,6 +392,70 @@ void EM_selectmode_flush(void) } +void EM_convertsel(short oldmode, short selectmode) +{ + EditMesh *em = G.editMesh; + EditVert *eve; + EditEdge *eed; + EditFace *efa; + /*clear flags*/ + for(eve= em->verts.first; eve; eve= eve->next) eve->f1 = 0; + for(eed= em->edges.first; eed; eed= eed->next) eed->f1 = 0; + for(efa= em->faces.first; efa; efa= efa->next) efa->f1 = 0; + + /*have to find out what the selectionmode was previously*/ + if(oldmode == SCE_SELECT_VERTEX) { + if(selectmode == SCE_SELECT_EDGE){ + /*select all edges associated with every selected vertex*/ + for(eed= em->edges.first; eed; eed= eed->next){ + if(eed->v1->f&SELECT) eed->f1 = 1; + else if(eed->v2->f&SELECT) eed->f1 = 1; + } + + for(eed= em->edges.first; eed; eed= eed->next){ + if(eed->f1 == 1) EM_select_edge(eed,1); + } + } + else if(selectmode == SCE_SELECT_FACE){ + /*select all faces associated with every selected vertex*/ + for(efa= em->faces.first; efa; efa= efa->next){ + if(efa->v1->f&SELECT) efa->f1 = 1; + else if(efa->v2->f&SELECT) efa->f1 = 1; + else if(efa->v3->f&SELECT) efa->f1 = 1; + else{ + if(efa->v4){ + if(efa->v4->f&SELECT) efa->f1 =1; + } + } + + } + for(efa= em->faces.first; efa; efa= efa->next){ + if(efa->f1 == 1) EM_select_face(efa,1); + } + check_fgons_selection(); + countall(); + } + } + + if(oldmode == SCE_SELECT_EDGE){ + if(selectmode == SCE_SELECT_FACE){ + for(efa= em->faces.first; efa; efa= efa->next){ + if(efa->e1->f&SELECT) efa->f1 = 1; + else if(efa->e2->f&SELECT) efa->f1 = 1; + else if(efa->e3->f&SELECT) efa->f1 = 1; + else if(efa->e4){ + if(efa->e4->f&SELECT) efa->f1 = 1; + } + } + for(efa= em->faces.first; efa; efa= efa->next){ + if(efa->f1 == 1) EM_select_face(efa,1); + } + check_fgons_selection(); + countall(); + } + } +} + /* when switching select mode, makes sure selection is consistant for editing */ /* also for paranoia checks to make sure edge or face mode works */ void EM_selectmode_set(void) @@ -424,6 +488,7 @@ void EM_selectmode_set(void) for(efa= em->faces.first; efa; efa= efa->next) if(efa->f & SELECT) EM_select_face(efa, 1); } + BIF_undo_push("Selectmode Set"); } /* paranoia check, actually only for entering editmode. rule: |