diff options
author | Geoffrey Bantle <hairbat@yahoo.com> | 2006-03-27 09:19:14 +0400 |
---|---|---|
committer | Geoffrey Bantle <hairbat@yahoo.com> | 2006-03-27 09:19:14 +0400 |
commit | 7b1d69a35c80cffef4965616731deb68760b6fb2 (patch) | |
tree | 17a98ca3c76eeb3f3c790507bcff305520704db7 /source/blender/blenlib | |
parent | 07b88496e0a1bc1662eb8059c14e1fdf5d7d2584 (diff) |
-> Stored Selections
Previously Blender did not store the order in which vertices, edges
or faces were selected in edit mode. In many cases it is useful to
have this data, however it is not desirable to store every selection
made. Now blender stores selections in the order in which they were
made in a linked list called 'selected' in EditMesh. EditSelection structs
are created whenever 'EM_store_selection' from editmesh_lib.c is called
(currently only on user selection with mouse). There are several cases
in which they might be deallocated by calling the 'EM_remove_selection'
function however:
-When the user deselects something with the mouse ('mouse_mesh' in
editmesh_mods.c)
-When switching selection modes stored selections that are not relevant
to the new mode are removed by the 'EM_strip_selections' function
(multi-select mode is supported)
-When the vertex, edge or face pointed to by a certain stored selection is
deallocated
-When EM_clear_flag_all is called and where the flag passed to the function
contains the 'SELECT' bitmask.
-When leaving edit mode (making stored selection data persistent across
editing sessions will require modifications to mesh DNA later)
Todo:
There are a few cases still where you can temporarily end up with a stored
selection that points to an element that is no longer selected
(edge loop de-select can cause this for instance). The solution to this is to
add a call to EM_remove_selection from 'EM_select_edge' and 'EM_select_face' when
these functions are being used to deselect elements. For the sake of completeness
however this will also require that an 'EM_select_vert' function be coded and
called at all appropriate parts of the editmesh code. I will look into this
later in the week.
For now there are two tools that already take advantage of the stored selections.
The first one is 'merge at first or last vertex' in the merge menu (the 'firstvert' and
'lastvert' pointers are gone from EditMesh). The second tool is path select, which builds
a path between the last vert selected and the second to last vert selected. This allows you
to build complex path selections in a short amount of time like this
'select A, select B, path select. select C, path select. select D...'
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_editVert.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h index 7a75e605e6c..3dc6ebadb71 100644 --- a/source/blender/blenlib/BLI_editVert.h +++ b/source/blender/blenlib/BLI_editVert.h @@ -126,19 +126,30 @@ typedef struct EditFace unsigned char fgonf; /* flag for fgon options */ } EditFace; + +/*selection types*/ +#define EDITVERT 0 +#define EDITEDGE 1 +#define EDITFACE 2 + +typedef struct EditSelection +{ + struct EditSelection *next, *prev; + short type; + void *data; +} EditSelection; + + typedef struct EditMesh { ListBase verts, edges, faces; + ListBase selected; /*EditSelections. Used to store the order in which things are selected.*/ HashEdge *hashedgetab; /* this is for the editmesh_fastmalloc */ EditVert *allverts, *curvert; EditEdge *alledges, *curedge; EditFace *allfaces, *curface; - - /*for improved merge code*/ - EditVert *lastvert, *firstvert; - /* DerivedMesh caches... note that derived cage can be equivalent * to derived final, care should be taken on release. */ |