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.
245 lines
6.6 KiB
C++
245 lines
6.6 KiB
C++
/**
|
|
* blenlib/BKE_global.h (mar-2001 nzc)
|
|
*
|
|
* Global settings, handles, pointers. This is the root for finding
|
|
* any data in Blender. This block is not serialized, but built anew
|
|
* for every fresh Blender run.
|
|
*
|
|
* $Id$
|
|
*
|
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version. The Blender
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
|
* about this.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
* All rights reserved.
|
|
*
|
|
* The Original Code is: all of this file.
|
|
*
|
|
* Contributor(s): none yet.
|
|
*
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
*/
|
|
#ifndef BKE_GLOBAL_H
|
|
#define BKE_GLOBAL_H
|
|
|
|
#include "DNA_listBase.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* forwards */
|
|
struct View3D;
|
|
struct View2D;
|
|
struct SpaceIpo;
|
|
struct SpaceButs;
|
|
struct SpaceImage;
|
|
struct SpaceOops;
|
|
struct SpaceText;
|
|
struct SpaceSound;
|
|
struct SpaceAction;
|
|
struct SpaceNla;
|
|
struct Main;
|
|
struct Scene;
|
|
struct bScreen;
|
|
struct Object;
|
|
struct bSoundListener;
|
|
struct BMF_Font;
|
|
struct EditMesh;
|
|
|
|
|
|
typedef struct Global {
|
|
|
|
/* active pointers */
|
|
struct View3D *vd;
|
|
struct View2D *v2d;
|
|
struct SpaceIpo *sipo;
|
|
struct SpaceButs *buts;
|
|
struct SpaceImage *sima;
|
|
struct SpaceOops *soops;
|
|
struct SpaceSound *ssound;
|
|
struct SpaceAction *saction; /* __NLA */
|
|
struct SpaceNla *snla;
|
|
struct Main *main;
|
|
struct Scene *scene; /* denk aan file.c */
|
|
struct bScreen *curscreen;
|
|
struct Object *obedit;
|
|
|
|
/* fonts, allocated global data */
|
|
struct BMF_Font *font, *fonts, *fontss;
|
|
|
|
/* strings: lastsaved */
|
|
char ima[160], sce[160], lib[160];
|
|
|
|
/* totalen */
|
|
short totobj, totlamp, totobjsel, totcurve, totmesh, totmat;
|
|
int totvert, totface, totvertsel, totfacesel;
|
|
|
|
short machine, afbreek, moving, colact, zbuf;
|
|
short qual, background, imagewin, animspeed;
|
|
/**
|
|
* The current version of Blender.
|
|
*/
|
|
short version;
|
|
short simulf, fields, order, rt;
|
|
int f;
|
|
|
|
/* Editmode lists */
|
|
struct EditMesh *editMesh;
|
|
|
|
float textcurs[4][2];
|
|
|
|
/* Frank's variables */
|
|
int renderd;
|
|
int real_sfra, real_efra;
|
|
int save_over;
|
|
|
|
/* Reevan's __NLA variables */
|
|
struct Object *obpose; /* Current posable object */
|
|
struct ListBase edbo; /* Armature Editmode bones */
|
|
|
|
/* Rob's variables */
|
|
int have_quicktime;
|
|
int ui_international;
|
|
|
|
/* this variable is written to / read from FileGlobal->fileflags */
|
|
int fileflags;
|
|
|
|
/* save the allowed windowstate of blender when using -W or -w */
|
|
int windowstate;
|
|
|
|
/* Janco's playing ground */
|
|
struct bSoundListener* listener;
|
|
|
|
/* Test thingy for Nzc */
|
|
int magic; /* toggle use of experimental render pipe */
|
|
int compat; /* toggle compatibility mode for edge rendering */
|
|
int notonlysolid;/* T-> also edge-render transparent faces */
|
|
int useRscale; /* bitflag for using colour scaling */
|
|
int useGscale; /* bitflag for using colour scaling */
|
|
int useBscale; /* bitflag for using colour scaling */
|
|
float cscale[4]; /* sliders for colour scaling */
|
|
int Rhisto; /* flags for making histograms */
|
|
int Ghisto;
|
|
int Bhisto;
|
|
|
|
/* special versions */
|
|
short special1, special2;
|
|
|
|
int flags;
|
|
|
|
} Global;
|
|
|
|
/* **************** GLOBAL ********************* */
|
|
|
|
/* G.f */
|
|
#define G_DISABLE_OK 1
|
|
#define G_PLAYANIM 2
|
|
#define G_TEST_DUPLI 4
|
|
#define G_SIMULATION 8
|
|
#define G_BACKBUFSEL 16
|
|
#define G_PICKSEL 32
|
|
#define G_DRAWNORMALS 64
|
|
#define G_DRAWFACES 128
|
|
#define G_FACESELECT 256
|
|
#define G_DRAW_EXT 512
|
|
#define G_VERTEXPAINT 1024
|
|
#define G_ALLEDGES 2048
|
|
#define G_DEBUG 4096
|
|
#define G_SCENESCRIPT 8192
|
|
#define G_PROPORTIONAL 16384
|
|
#define G_WEIGHTPAINT 32768 /* __NLA */
|
|
#define G_TEXTUREPAINT 65536
|
|
#define G_NOFROZEN (1 << 17) // frozen modules inactive
|
|
#define G_DRAWEDGES (1 << 18)
|
|
#define G_DRAWCREASES (1 << 19)
|
|
#define G_DRAWSEAMS (1 << 20)
|
|
#define G_HIDDENEDGES (1 << 21)
|
|
|
|
/* G.fileflags */
|
|
|
|
#define G_AUTOPACK_BIT 0
|
|
#define G_FILE_COMPRESS_BIT 1
|
|
#define G_FILE_AUTOPLAY_BIT 2
|
|
#define G_FILE_ENABLE_ALL_FRAMES_BIT 3
|
|
#define G_FILE_SHOW_DEBUG_PROPS_BIT 4
|
|
#define G_FILE_SHOW_FRAMERATE_BIT 5
|
|
#define G_FILE_SHOW_PROFILE_BIT 6
|
|
#define G_FILE_LOCK_BIT 7
|
|
#define G_FILE_SIGN_BIT 8
|
|
#define G_FILE_PUBLISH_BIT 9
|
|
#define G_FILE_NO_UI_BIT 10
|
|
|
|
|
|
#define G_AUTOPACK (1 << G_AUTOPACK_BIT)
|
|
#define G_FILE_COMPRESS (1 << G_FILE_COMPRESS_BIT)
|
|
#define G_FILE_AUTOPLAY (1 << G_FILE_AUTOPLAY_BIT)
|
|
#define G_FILE_ENABLE_ALL_FRAMES (1 << G_FILE_ENABLE_ALL_FRAMES_BIT)
|
|
#define G_FILE_SHOW_DEBUG_PROPS (1 << G_FILE_SHOW_DEBUG_PROPS_BIT)
|
|
#define G_FILE_SHOW_FRAMERATE (1 << G_FILE_SHOW_FRAMERATE_BIT)
|
|
#define G_FILE_SHOW_PROFILE (1 << G_FILE_SHOW_PROFILE_BIT)
|
|
#define G_FILE_LOCK (1 << G_FILE_LOCK_BIT)
|
|
#define G_FILE_SIGN (1 << G_FILE_SIGN_BIT)
|
|
#define G_FILE_PUBLISH (1 << G_FILE_PUBLISH_BIT)
|
|
#define G_FILE_NO_UI (1 << G_FILE_NO_UI_BIT)
|
|
|
|
/* G.windowstate */
|
|
#define G_WINDOWSTATE_USERDEF 0
|
|
#define G_WINDOWSTATE_BORDER 1
|
|
#define G_WINDOWSTATE_FULLSCREEN 2
|
|
|
|
/* G.simulf */
|
|
#define G_LOADFILE 2
|
|
#define G_RESTART 4
|
|
#define G_QUIT 8
|
|
#define G_SETSCENE 16
|
|
|
|
/* G.flags: double? */
|
|
#define G_FLAGS_AUTOPLAY_BIT 2
|
|
#define G_FLAGS_AUTOPLAY (1 << G_FLAGS_AUTOPLAY_BIT)
|
|
|
|
/* G.qual */
|
|
#define R_SHIFTKEY 1
|
|
#define L_SHIFTKEY 2
|
|
#define LR_SHIFTKEY 3
|
|
#define R_ALTKEY 4
|
|
#define L_ALTKEY 8
|
|
#define LR_ALTKEY 12
|
|
#define R_CTRLKEY 16
|
|
#define L_CTRLKEY 32
|
|
#define LR_CTRLKEY 48
|
|
#define LR_COMMANDKEY 64
|
|
|
|
/* G.order: indicates what endianness the platform where the file was
|
|
* written had. */
|
|
#define L_ENDIAN 1
|
|
#define B_ENDIAN 0
|
|
|
|
/* G.special1 */
|
|
|
|
/* Memory is allocated where? blender.c */
|
|
extern Global G;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|