Blender Git Commit Log

Git Commits -> Revision a2e918d

Revision a2e918d by Ton Roosendaal (master)
September 23, 2004, 20:52 (GMT)
EditMesh refactory + undo recode

The changelog is very long... it's on the web too:
http://www.blender3d.org/cms/Mesh_editing_rewrite.425.0.html

EditMesh refactor notes (user)

**** New selection modes

When entering Edit Mode for a Mesh, you now have the choice for three selection modes. These are shown as icons in the 3D header (hotkey is being searched for!).

- Vertex Select
Select vertices as usual, fully compatible with how previous version work

- Edge Select
Vertices are not drawn anymore, and selections happen by default on the edges. It is a true edge select, meaning that you can select three out of four edges in a face, without automatic having the 4th edge selected.

- Face Select
Instead of vertices, now selection 'points' are drawn in the face centers. Selected faces also get a colored outline, like for edges. This also is true face select, for each face individual regardless selection status of its vertices or edges.

While holding SHIFT, and press a selection mode, you can also combine the above choices. Now selection becomes mixed, and will behave as expected.
For example; in Edge+Face select mode, selecting the 4 edges of a face will select the face too.

The selection modes and optional drawing modes (like transparant faces, normals, or solid drawing) all work together. All of Blender's mesh editing tools now react to the correct selection mode as well.
Most noticeable it's in:

**** Extrude

Extruding in Edge or Face Select mode allows much more precise control over what's extruded and what should be excluded. Try for example a checker pattern selection, and extrude it.

New is the fixed translation when faces are extruded. This always follows the (averaged) face normal(s) of the old face(s), enabling much easier working in 3D views . A single 'G' (Grab) or 'R' (Rotate) or 'S' (Scale) will change transform modus as usual.

**** Other things to note

- Hiding edges/faces will also behave different based on Select Mode.
- while editing, normals of faces are updated always now
- Border select (BKEY) has 2 different rules for edges; when one edge is fully inside of the border, it will only select edges that are fully inside. Otherwise it selects each edge intersecting with the border.
- in face mode, adding vertices, edges or a circle is invisible...
- "Add monkey" now works as a normal primitive (rotated and on 3d cursor)
- Mesh undo was fully recoded, hopefully solving issues now with Vertex Keys and Groups
- Going in and out of editmode was fully recoded. Especially on larger models you'll notice substantial speed gain.

**** Todo

Add 'FaceSelect mode' functionality in EditMode, including zbuffered selection, display and editing of UV texture.


EditMesh refactor notes (coder)

**** Usage of flags in general
The "->f" flags are reserved for the editmesh.c and editmesh_lib.c core functions. Actually only selection status is there now.
The "->f1" and "->f2" flags are free to use. They're available in vertex/edge/face structs. Since they're free, check carefully when calling other functions that use these flags... for example extrude() or subdivide() use them.

**** Selection flags
EditVert: eve->f & SELECT
EditEdge: eed->f & SELECT
EditFace: efa->f & SELECT

- Selection is only possible when not-hidden!
- Selection flags are always up-to-date, BUT:
if selection mode >= SELECT_EDGE vertex selection flags can be incorrect
if selection mode == SELECT_FACE vertex/edge selection flags can be incorrect
This because of shared vertices or edges.

- use for selecting vertices:
eve->f &= SELECT
- use for selecting edges always:
void EM_select_edge(eed, 1) // 1 = select, 0 = deselect
- use for selecting faces always:
void EM_select_face(efa, 1) // 1 = select, 0 = deselect

- To set the 'f' flags in all of the data:
void EM_set_flag_all(int flag);
void EM_clear_flag_all(int flag);

- the old faceselectedOR() and faceselectedAND() are still there, but only
to be used for evaluating its vertices

**** Code hints for handling selection

If the selectmode is 'face'; vertex or edge selections need to be flushed upward. Same is true for 'edge' selection mode. This means that you'll have to keep track of all selections while coding... selecting the four vertices in a face doesn't automatically select the face anymore.

However, by using the above calls, at least selections flush downward (to vertex level). You then can call:

void EM_selectmode_flush(void);

Which flushes selections back upward, based on the selectmode setting. This function does the following:

- if selectmode 'vertex': select edges/faces based on its selected vertices
- if selectmode 'edge': select faces based its selected edges

This works fine in nice controlled situations.

However, only changing the vertex selections then still doesn't select a face in face mode! If you really can't avoid only working with vertex selections, you can use this call:

void EM_select_flush(void);

Now selection is flushed upward regardless current selectmode. That can be destructive for special cases however, like checkerboard selected faces. So use this only when you know everything else was deselected (or deselect it). Example: adding primitives.


**** Hide flags
EditVert: eve->h
EditEdge: eed->h
EditFace: efa->h

- all hide flags are always up-to-date
- hidden vertices/edges/faces are always deselected. so when you operate on selection only, there's no need to check for hide flag.

**** Unified undo for editmode

New file: editmode_undo.h
A pretty nice function pointer handler style undo. Just code three functions, and your undo will fly! The c file has a good reference.

Also note that the old undo system has been replaced. It currently uses minimal dependencies on Meshes themselves (no abuse of going in/out editmode), and is restricted nicely to editmode functions.

**** Going in/out editmode

As speedup now all vertices/faces/edges are allocated in three big chunks. In vertices/faces/edges now tags are set to denote such data cannot be freed.

ALso the hashtable (lookup) for edges uses no mallocs at all anymore, but is part of the EditEdge itself.

Commit Details:

Full Hash: a2e918d831fb1c7fd4da8b2f56a24aad75479627
SVN Revision: 3100
Parent Commit: 4b5203e
Lines Changed: +4868, -3589

2 Added Paths:

/source/blender/include/BIF_editmode_undo.h (+55, -0) (View)
/source/blender/src/editmode_undo.c (+329, -0) (View)

38 Modified Paths:

/source/blender/blenkernel/bad_level_call_stubs/stubs.c (+1, -1) (Diff)
/source/blender/blenkernel/BKE_bad_level_calls.h (+2, -1) (Diff)
/source/blender/blenkernel/BKE_global.h (+0, -18) (Diff)
/source/blender/blenkernel/intern/blender.c (+1, -1) (Diff)
/source/blender/blenkernel/intern/exotic.c (+10, -29) (Diff)
/source/blender/blenkernel/intern/scene.c (+2, -2) (Diff)
/source/blender/blenlib/BLI_editVert.h (+27, -11) (Diff)
/source/blender/blenloader/intern/readfile.c (+7, -1) (Diff)
/source/blender/blenloader/intern/writefile.c (+0, -1) (Diff)
/source/blender/include/BDR_drawobject.h (+2, -1) (Diff)
/source/blender/include/BDR_editcurve.h (+0, -2) (Diff)
/source/blender/include/BIF_editmesh.h (+17, -7) (Diff)
/source/blender/include/BIF_resources.h (+10, -4) (Diff)
/source/blender/include/blendef.h (+7, -4) (Diff)
/source/blender/include/editmesh.h (+6, -5) (Diff)
/source/blender/makesdna/DNA_meshdata_types.h (+2, -0) (Diff)
/source/blender/makesdna/DNA_scene_types.h (+7, -4) (Diff)
/source/blender/makesdna/DNA_userdef_types.h (+5, -4) (Diff)
/source/blender/src/blenderbuttons.c (+1431, -1331) (Diff)
/source/blender/src/buttons_editing.c (+10, -9) (Diff)
/source/blender/src/drawobject.c (+171, -80) (Diff)
/source/blender/src/edit.c (+5, -15) (Diff)
/source/blender/src/editcurve.c (+76, -186) (Diff)
/source/blender/src/editmesh.c (+483, -376) (Diff)
/source/blender/src/editmesh_add.c (+60, -96) (Diff)
/source/blender/src/editmesh_lib.c (+572, -125) (Diff)
/source/blender/src/editmesh_loop.c (+44, -23) (Diff)
/source/blender/src/editmesh_mods.c (+1105, -940) (Diff)
/source/blender/src/editmesh_tools.c (+191, -184) (Diff)
/source/blender/src/editobject.c (+38, -31) (Diff)
/source/blender/src/editview.c (+91, -14) (Diff)
/source/blender/src/header_view3d.c (+47, -43) (Diff)
/source/blender/src/interface.c (+3, -1) (Diff)
/source/blender/src/resources.c (+12, -4) (Diff)
/source/blender/src/SConscript (+1, -0) (Diff)
/source/blender/src/space.c (+16, -29) (Diff)
/source/blender/src/toets.c (+11, -3) (Diff)
/source/blender/src/usiblender.c (+11, -3) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021