2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
|
* $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 *****
|
|
|
|
|
* cursor/gestures/selecteren
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <math.h>
|
2003-07-10 20:34:41 +00:00
|
|
|
#include <string.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2002-11-25 12:02:15 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
|
#include "BLI_winstuff.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "IMB_imbuf.h"
|
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
|
|
|
#include "PIL_time.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
|
#include "DNA_meta_types.h"
|
Fix for undo... it didn't do the UV coords (tface) nor the vertexpaint
colors. This because of the pretty weird (ab)use of load & make editmesh...
For each added undo step, the load_editmesh was fed with an empty mesh
to assign data to, without knowledge of what was in the original mesh.
That way UV and color data got lost.
Solved it in 2 steps:
1. removing the ->tface pointer from EditVlak, and make TFace a builtin
struct inside EditVlak. This didnt cost much extra mem, since it already
stored UV and color. This enabled some pretty cleanup in editmesh.c as
well, storing tface pointers was cumbersome.
2. for each undo step, it then generates always a tface and mcol block to
link to the undo Mesh.
Even when it wasn't in the actual Mesh, at exit editmode the original
Mesh is used as reference anyway, and undo-meshes are freed correctly.
The enormous commit is because I had to change the BLI_editVert.h file, and
found it was included in about every file unnecessary. I removed it there.
ALso found out that subsurf has code ready (unfinished) to make UV coords for
the displaylist in EditMode as well, nice to know for later...
2003-11-19 22:00:14 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_curve_types.h"
|
|
|
|
|
#include "DNA_lattice_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_view3d_types.h"
|
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Fix for undo... it didn't do the UV coords (tface) nor the vertexpaint
colors. This because of the pretty weird (ab)use of load & make editmesh...
For each added undo step, the load_editmesh was fed with an empty mesh
to assign data to, without knowledge of what was in the original mesh.
That way UV and color data got lost.
Solved it in 2 steps:
1. removing the ->tface pointer from EditVlak, and make TFace a builtin
struct inside EditVlak. This didnt cost much extra mem, since it already
stored UV and color. This enabled some pretty cleanup in editmesh.c as
well, storing tface pointers was cumbersome.
2. for each undo step, it then generates always a tface and mcol block to
link to the undo Mesh.
Even when it wasn't in the actual Mesh, at exit editmode the original
Mesh is used as reference anyway, and undo-meshes are freed correctly.
The enormous commit is because I had to change the BLI_editVert.h file, and
found it was included in about every file unnecessary. I removed it there.
ALso found out that subsurf has code ready (unfinished) to make UV coords for
the displaylist in EditMode as well, nice to know for later...
2003-11-19 22:00:14 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_arithb.h"
|
|
|
|
|
#include "BLI_editVert.h"
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
#include "BKE_global.h"
|
|
|
|
|
#include "BKE_armature.h"
|
|
|
|
|
#include "BKE_lattice.h"
|
|
|
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
|
#include "BIF_mywindow.h"
|
|
|
|
|
#include "BIF_space.h"
|
|
|
|
|
#include "BIF_screen.h"
|
2003-10-07 18:24:02 +00:00
|
|
|
#include "BIF_butspace.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_editgroup.h"
|
|
|
|
|
#include "BIF_editmesh.h"
|
|
|
|
|
#include "BIF_editoops.h"
|
|
|
|
|
#include "BIF_editsima.h"
|
|
|
|
|
#include "BIF_editview.h"
|
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
#include "BIF_editarmature.h"
|
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
|
|
|
#include "BIF_toolbox.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
#include "BDR_editobject.h" /* For headerprint */
|
|
|
|
|
#include "BDR_vpaint.h"
|
|
|
|
|
#include "BDR_editface.h"
|
|
|
|
|
#include "BDR_drawobject.h"
|
|
|
|
|
#include "BDR_editcurve.h"
|
|
|
|
|
|
|
|
|
|
#include "BSE_edit.h"
|
|
|
|
|
#include "BSE_view.h" /* give_cursor() */
|
|
|
|
|
#include "BSE_editipo.h"
|
|
|
|
|
#include "BSE_drawview.h"
|
|
|
|
|
#include "BSE_editaction.h"
|
|
|
|
|
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
#include "editmesh.h" // borderselect uses it...
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "blendef.h"
|
|
|
|
|
#include "mydevice.h"
|
|
|
|
|
|
|
|
|
|
extern ListBase editNurb; /* originally from exports.h, memory from editcurve.c*/
|
|
|
|
|
/* editmball.c */
|
|
|
|
|
extern ListBase editelems;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void arrows_move_cursor(unsigned short event)
|
|
|
|
|
{
|
|
|
|
|
short mval[2];
|
|
|
|
|
|
|
|
|
|
getmouseco_sc(mval);
|
|
|
|
|
|
|
|
|
|
if(event==UPARROWKEY) {
|
|
|
|
|
warp_pointer(mval[0], mval[1]+1);
|
|
|
|
|
} else if(event==DOWNARROWKEY) {
|
|
|
|
|
warp_pointer(mval[0], mval[1]-1);
|
|
|
|
|
} else if(event==LEFTARROWKEY) {
|
|
|
|
|
warp_pointer(mval[0]-1, mval[1]);
|
|
|
|
|
} else if(event==RIGHTARROWKEY) {
|
|
|
|
|
warp_pointer(mval[0]+1, mval[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define MOVES 50
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char interpret_move(short mcord[][2], int count)
|
|
|
|
|
{
|
|
|
|
|
float x1, x2, y1, y2, d1, d2, inp, sq, mouse[MOVES][2];
|
|
|
|
|
int i, j, dir = 0;
|
|
|
|
|
|
|
|
|
|
if (count <= 10) return ('g');
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* from short to float (drawing is with shorts) */
|
2002-10-12 11:37:38 +00:00
|
|
|
for(j=0; j<count; j++) {
|
|
|
|
|
mouse[j][0]= mcord[j][0];
|
|
|
|
|
mouse[j][1]= mcord[j][1];
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* new method:
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
2003-04-30 13:22:26 +00:00
|
|
|
* starting from end points, calculate centre with maximum distance
|
|
|
|
|
* dependant at the angle s / g / r is defined
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* filter */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
for( j = 3 ; j > 0; j--){
|
|
|
|
|
x1 = mouse[1][0];
|
|
|
|
|
y1 = mouse[1][1];
|
|
|
|
|
for (i = 2; i < count; i++){
|
|
|
|
|
x2 = mouse[i-1][0];
|
|
|
|
|
y2 = mouse[i-1][1];
|
|
|
|
|
mouse[i-1][0] = ((x1 + mouse[i][0]) /4.0) + (x2 / 2.0);
|
|
|
|
|
mouse[i-1][1] = ((y1 + mouse[i][1]) /4.0) + (y2 / 2.0);
|
|
|
|
|
x1 = x2;
|
|
|
|
|
y1 = y2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* make overview of directions */
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i = 0; i <= count - 2; i++){
|
|
|
|
|
x1 = mouse[i][0] - mouse[i + 1][0];
|
|
|
|
|
y1 = mouse[i][1] - mouse[i + 1][1];
|
|
|
|
|
|
|
|
|
|
if (x1 < -0.5){
|
|
|
|
|
if (y1 < -0.5) dir |= 32;
|
|
|
|
|
else if (y1 > 0.5) dir |= 128;
|
|
|
|
|
else dir |= 64;
|
|
|
|
|
} else if (x1 > 0.5){
|
|
|
|
|
if (y1 < -0.5) dir |= 8;
|
|
|
|
|
else if (y1 > 0.5) dir |= 2;
|
|
|
|
|
else dir |= 4;
|
|
|
|
|
} else{
|
|
|
|
|
if (y1 < -0.5) dir |= 16;
|
|
|
|
|
else if (y1 > 0.5) dir |= 1;
|
|
|
|
|
else dir |= 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* move all crosses to the right */
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i = 7; i>=0 ; i--){
|
|
|
|
|
if (dir & 128) dir = (dir << 1) + 1;
|
|
|
|
|
else break;
|
|
|
|
|
}
|
|
|
|
|
dir &= 255;
|
|
|
|
|
for (i = 7; i>=0 ; i--){
|
|
|
|
|
if ((dir & 1) == 0) dir >>= 1;
|
|
|
|
|
else break;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* in theory: 1 direction: straight line
|
|
|
|
|
* multiple sequential directions: circle
|
|
|
|
|
* non-sequential, and 1 bit set in upper 4 bits: size
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
switch(dir){
|
|
|
|
|
case 1:
|
|
|
|
|
return ('g');
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
case 7:
|
|
|
|
|
x1 = mouse[0][0] - mouse[count >> 1][0];
|
|
|
|
|
y1 = mouse[0][1] - mouse[count >> 1][1];
|
|
|
|
|
x2 = mouse[count >> 1][0] - mouse[count - 1][0];
|
|
|
|
|
y2 = mouse[count >> 1][1] - mouse[count - 1][1];
|
|
|
|
|
d1 = (x1 * x1) + (y1 * y1);
|
|
|
|
|
d2 = (x2 * x2) + (y2 * y2);
|
|
|
|
|
sq = sqrt(d1);
|
|
|
|
|
x1 /= sq;
|
|
|
|
|
y1 /= sq;
|
|
|
|
|
sq = sqrt(d2);
|
|
|
|
|
x2 /= sq;
|
|
|
|
|
y2 /= sq;
|
|
|
|
|
inp = (x1 * x2) + (y1 * y2);
|
|
|
|
|
/*printf("%f\n", inp);*/
|
|
|
|
|
if (inp > 0.9) return ('g');
|
|
|
|
|
else return ('r');
|
|
|
|
|
break;
|
|
|
|
|
case 15:
|
|
|
|
|
case 31:
|
|
|
|
|
case 63:
|
|
|
|
|
case 127:
|
|
|
|
|
case 255:
|
|
|
|
|
return ('r');
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2003-04-30 13:22:26 +00:00
|
|
|
/* for size at least one of the higher bits has to be set */
|
2002-10-12 11:37:38 +00:00
|
|
|
if (dir < 16) return ('r');
|
|
|
|
|
else return ('s');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int gesture(void)
|
|
|
|
|
{
|
|
|
|
|
short mcords[MOVES][2];
|
|
|
|
|
int i= 1, end= 0, a;
|
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
|
|
|
unsigned short event=0;
|
2004-07-16 01:34:19 +00:00
|
|
|
short mval[2], val, timer=0, mousebut;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
glDrawBuffer(GL_FRONT);
|
2003-04-30 13:22:26 +00:00
|
|
|
persp(0); /* ortho at pixel level */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
getmouseco_areawin(mval);
|
|
|
|
|
|
|
|
|
|
mcords[0][0] = mval[0];
|
|
|
|
|
mcords[0][1] = mval[1];
|
|
|
|
|
|
2004-07-16 01:34:19 +00:00
|
|
|
if (U.flag & USER_LMOUSESELECT) mousebut = R_MOUSE;
|
|
|
|
|
else mousebut = L_MOUSE;
|
|
|
|
|
|
|
|
|
|
while(get_mbut() & mousebut) {
|
2002-10-12 11:37:38 +00:00
|
|
|
|
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
|
|
|
if(qtest()) event= extern_qread(&val);
|
|
|
|
|
else if(i==1) {
|
|
|
|
|
/* not drawing yet... check for toolbox */
|
|
|
|
|
PIL_sleep_ms(10);
|
|
|
|
|
timer++;
|
2003-10-29 01:10:10 +00:00
|
|
|
if(timer>=10*U.tb_leftmouse) {
|
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
|
|
|
toolbox_n();
|
2003-10-28 18:43:55 +00:00
|
|
|
return 1;
|
First commit of a new toolbox system.
Aim was to find a simple & easy system, script alike, to add and configure
a toolbox system, so that others can experiment, but also of course Python.
Summary:
- spacebar calls it up. SHIFT+A still does old toolbox
- hold left or rightmouse for 0.4 second, and it pops up as well
this is experimental! Can be tweaked with Userdef var "ThresA"
- it is a little bit complete for Object mode only. Needs still work
at information desing/structure level
- the code works like an engine, interpreting structs like this:
static TBitem addmenu_curve[]= {
{ 0, "Bezier Curve", 0, NULL},
{ 0, "Bezier Circle", 1, NULL},
{ 0, "NURBS Curve", 2, NULL},
{ 0, "NURBS Circle", 3, NULL},
{ 0, "Path", 4, NULL},
{ -1, "", 0, do_info_add_curvemenu}};
- first value is ICON code,
- then name
- return value
- pointer to optional child
last row has -1 to indicate its the last...
plus a callback to event function.
I also built an old toolbox style callback for this:
static TBitem tb_object_select[]= {
{ 0, "Border Select|B", 'b', NULL},
{ 0, "(De)select All|A", 'a', NULL},
{ 0, "Linked...|Shift L", 'L', NULL},
{ 0, "Grouped...|Shift G", 'G', NULL},
{ -1, "", 0, tb_do_hotkey}};
here the return values are put back as hotkeys in mainqueue.
A mainloop can do all context switching, and build menus on the fly.
Meaning, it also allows other designs such as radials...
2003-10-25 00:08:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
switch (event) {
|
|
|
|
|
case MOUSEY:
|
|
|
|
|
getmouseco_areawin(mval);
|
|
|
|
|
if( abs(mval[0]-mcords[i-1][0])>3 || abs(mval[1]-mcords[i-1][1])>3 ) {
|
|
|
|
|
mcords[i][0] = mval[0];
|
|
|
|
|
mcords[i][1] = mval[1];
|
|
|
|
|
if(i) {
|
|
|
|
|
sdrawXORline(mcords[i-1][0], mcords[i-1][1], mcords[i][0], mcords[i][1]);
|
|
|
|
|
glFlush();
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case MOUSEX:
|
|
|
|
|
break;
|
|
|
|
|
case LEFTMOUSE:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if(event) end= 1; /* blender returns 0 */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (i == MOVES || end == 1) break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(a=1; a<i; a++) {
|
|
|
|
|
sdrawXORline(mcords[a-1][0], mcords[a-1][1], mcords[a][0], mcords[a][1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
persp(1);
|
|
|
|
|
glDrawBuffer(GL_BACK);
|
|
|
|
|
|
|
|
|
|
if (i > 2) {
|
|
|
|
|
i = interpret_move(mcords, i);
|
|
|
|
|
|
|
|
|
|
if(i) {
|
|
|
|
|
if(curarea->spacetype==SPACE_IPO) transform_ipo(i);
|
|
|
|
|
else if(curarea->spacetype==SPACE_IMAGE) transform_tface_uv(i);
|
|
|
|
|
else if(curarea->spacetype==SPACE_OOPS) transform_oops('g');
|
|
|
|
|
else transform(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2003-07-10 20:34:41 +00:00
|
|
|
else return 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mouse_cursor(void)
|
|
|
|
|
{
|
|
|
|
|
extern float zfac; /* view.c */
|
|
|
|
|
float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
|
|
|
|
|
short mval[2], mx, my, lr_click=0;
|
|
|
|
|
|
|
|
|
|
if(gesture()) return;
|
|
|
|
|
|
|
|
|
|
getmouseco_areawin(mval);
|
|
|
|
|
|
|
|
|
|
if(mval[0]!=G.vd->mx || mval[1]!=G.vd->my) {
|
|
|
|
|
|
|
|
|
|
mx= mval[0];
|
|
|
|
|
my= mval[1];
|
|
|
|
|
|
|
|
|
|
fp= give_cursor();
|
|
|
|
|
|
|
|
|
|
if(G.obedit && ((G.qual & LR_CTRLKEY) || get_mbut()&R_MOUSE )) lr_click= 1;
|
|
|
|
|
VECCOPY(oldcurs, fp);
|
|
|
|
|
|
|
|
|
|
project_short_noclip(fp, mval);
|
|
|
|
|
|
|
|
|
|
initgrabz(fp[0], fp[1], fp[2]);
|
|
|
|
|
|
|
|
|
|
if(mval[0]!=3200) {
|
|
|
|
|
|
|
|
|
|
window_to_3d(dvec, mval[0]-mx, mval[1]-my);
|
|
|
|
|
VecSubf(fp, fp, dvec);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
dx= ((float)(mx-(curarea->winx/2)))*zfac/(curarea->winx/2);
|
|
|
|
|
dy= ((float)(my-(curarea->winy/2)))*zfac/(curarea->winy/2);
|
|
|
|
|
|
|
|
|
|
fz= G.vd->persmat[0][3]*fp[0]+ G.vd->persmat[1][3]*fp[1]+ G.vd->persmat[2][3]*fp[2]+ G.vd->persmat[3][3];
|
|
|
|
|
fz= fz/zfac;
|
|
|
|
|
|
|
|
|
|
fp[0]= (G.vd->persinv[0][0]*dx + G.vd->persinv[1][0]*dy+ G.vd->persinv[2][0]*fz)-G.vd->ofs[0];
|
|
|
|
|
fp[1]= (G.vd->persinv[0][1]*dx + G.vd->persinv[1][1]*dy+ G.vd->persinv[2][1]*fz)-G.vd->ofs[1];
|
|
|
|
|
fp[2]= (G.vd->persinv[0][2]*dx + G.vd->persinv[1][2]*dy+ G.vd->persinv[2][2]*fz)-G.vd->ofs[2];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWVIEW3D, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(lr_click) {
|
|
|
|
|
if(G.obedit->type==OB_MESH) addvert_mesh();
|
|
|
|
|
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) addvert_Nurb(0);
|
|
|
|
|
else if (G.obedit->type==OB_ARMATURE) addvert_armature();
|
|
|
|
|
VECCOPY(fp, oldcurs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void deselectall(void) /* is toggle */
|
|
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
int a=0;
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
|
|
|
|
if TESTBASE(base) {
|
|
|
|
|
a= 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
|
|
|
|
if(base->lay & G.vd->lay) {
|
|
|
|
|
if(a) base->flag &= ~SELECT;
|
|
|
|
|
else base->flag |= SELECT;
|
|
|
|
|
base->object->flag= base->flag;
|
|
|
|
|
}
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
allqueue(REDRAWDATASELECT, 0);
|
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
|
|
|
|
|
|
countall();
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
BIF_undo_push("(De)select all");
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2003-10-20 02:19:17 +00:00
|
|
|
/* selects all objects of a particular type, on currently visible layers */
|
|
|
|
|
void selectall_type(short obtype)
|
|
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
|
|
|
|
if((base->lay & G.vd->lay) && (base->object->type == obtype)) {
|
|
|
|
|
base->flag |= SELECT;
|
|
|
|
|
base->object->flag= base->flag;
|
|
|
|
|
}
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
allqueue(REDRAWDATASELECT, 0);
|
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
|
|
|
|
|
|
countall();
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
BIF_undo_push("Select all per type");
|
2003-10-20 02:19:17 +00:00
|
|
|
}
|
|
|
|
|
/* selects all objects on a particular layer */
|
|
|
|
|
void selectall_layer(int layernum)
|
|
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
|
|
|
|
if (base->lay == (1<< (layernum -1))) {
|
|
|
|
|
base->flag |= SELECT;
|
|
|
|
|
base->object->flag= base->flag;
|
|
|
|
|
}
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
allqueue(REDRAWDATASELECT, 0);
|
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
|
|
|
|
|
|
countall();
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
BIF_undo_push("Select all per layer");
|
2003-10-20 02:19:17 +00:00
|
|
|
}
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
2003-07-11 20:02:52 +00:00
|
|
|
static void deselectall_except(Base *b) /* deselect all except b */
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
|
|
|
|
if (base->flag & SELECT) {
|
|
|
|
|
if(b!=base) {
|
|
|
|
|
base->flag &= ~SELECT;
|
|
|
|
|
base->object->flag= base->flag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-07 18:24:02 +00:00
|
|
|
#if 0
|
2003-07-10 20:34:41 +00:00
|
|
|
/* smart function to sample a rect spiralling outside, nice for backbuf selection */
|
2002-10-12 11:37:38 +00:00
|
|
|
static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
|
|
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
unsigned int *bufmin,*bufmax;
|
|
|
|
|
int a,b,rc,tel,aantal,dirvec[4][2],maxob;
|
|
|
|
|
unsigned int retval=0;
|
|
|
|
|
|
|
|
|
|
base= LASTBASE;
|
|
|
|
|
if(base==0) return 0;
|
|
|
|
|
maxob= base->selcol;
|
|
|
|
|
|
|
|
|
|
aantal= (size-1)/2;
|
|
|
|
|
rc= 0;
|
|
|
|
|
|
|
|
|
|
dirvec[0][0]= 1;
|
|
|
|
|
dirvec[0][1]= 0;
|
|
|
|
|
dirvec[1][0]= 0;
|
|
|
|
|
dirvec[1][1]= -size;
|
|
|
|
|
dirvec[2][0]= -1;
|
|
|
|
|
dirvec[2][1]= 0;
|
|
|
|
|
dirvec[3][0]= 0;
|
|
|
|
|
dirvec[3][1]= size;
|
|
|
|
|
|
|
|
|
|
bufmin= buf;
|
|
|
|
|
bufmax= buf+ size*size;
|
|
|
|
|
buf+= aantal*size+ aantal;
|
|
|
|
|
|
|
|
|
|
for(tel=1;tel<=size;tel++) {
|
|
|
|
|
|
|
|
|
|
for(a=0;a<2;a++) {
|
|
|
|
|
for(b=0;b<tel;b++) {
|
|
|
|
|
|
|
|
|
|
if(*buf && *buf<=maxob && *buf!=dontdo) return *buf;
|
2003-04-30 13:22:26 +00:00
|
|
|
if( *buf==dontdo ) retval= dontdo; /* if only color dontdo is available, still return dontdo */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
buf+= (dirvec[rc][0]+dirvec[rc][1]);
|
|
|
|
|
|
|
|
|
|
if(buf<bufmin || buf>=bufmax) return retval;
|
|
|
|
|
}
|
|
|
|
|
rc++;
|
|
|
|
|
rc &= 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
2003-10-07 18:24:02 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
#define SELECTSIZE 51
|
|
|
|
|
|
|
|
|
|
void set_active_base(Base *base)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BASACT= base;
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* signals to buttons */
|
2002-10-12 11:37:38 +00:00
|
|
|
redraw_test_buttons(base);
|
|
|
|
|
|
|
|
|
|
set_active_group();
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* signal to ipo */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
if (base) {
|
|
|
|
|
allqueue(REDRAWIPO, base->object->ipowin);
|
|
|
|
|
allqueue(REDRAWACTION, 0);
|
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_active_object(Object *ob)
|
|
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
|
|
|
|
if(base->object==ob) {
|
|
|
|
|
set_active_base(base);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mouse_select(void)
|
|
|
|
|
{
|
2003-07-11 20:02:52 +00:00
|
|
|
Base *base, *startbase=NULL, *basact=NULL, *oldbasact=NULL;
|
2003-07-10 20:34:41 +00:00
|
|
|
unsigned int buffer[MAXPICKBUF];
|
2002-10-12 11:37:38 +00:00
|
|
|
int temp, a, dist=100;
|
|
|
|
|
short hits, mval[2];
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* always start list from basact */
|
2002-10-12 11:37:38 +00:00
|
|
|
startbase= FIRSTBASE;
|
|
|
|
|
if(BASACT && BASACT->next) startbase= BASACT->next;
|
|
|
|
|
|
|
|
|
|
getmouseco_areawin(mval);
|
|
|
|
|
|
|
|
|
|
if(G.obedit==0 && (G.qual & LR_CTRLKEY)) {
|
|
|
|
|
|
|
|
|
|
base= startbase;
|
|
|
|
|
while(base) {
|
|
|
|
|
|
|
|
|
|
if(base->lay & G.vd->lay) {
|
|
|
|
|
|
|
|
|
|
project_short(base->object->obmat[3], &base->sx);
|
|
|
|
|
|
|
|
|
|
temp= abs(base->sx -mval[0]) + abs(base->sy -mval[1]);
|
|
|
|
|
if(base==BASACT) temp+=10;
|
|
|
|
|
if(temp<dist ) {
|
|
|
|
|
basact= base;
|
|
|
|
|
dist= temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
base= base->next;
|
|
|
|
|
|
|
|
|
|
if(base==0) base= FIRSTBASE;
|
|
|
|
|
if(base==startbase) break;
|
|
|
|
|
}
|
2003-04-30 13:22:26 +00:00
|
|
|
|
|
|
|
|
/* complete redraw when: */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(G.f & (G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT)) allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
hits= selectprojektie(buffer, mval[0]-7, mval[1]-7, mval[0]+7, mval[1]+7);
|
|
|
|
|
if(hits==0) hits= selectprojektie(buffer, mval[0]-21, mval[1]-21, mval[0]+21, mval[1]+21);
|
|
|
|
|
|
|
|
|
|
if(hits>0) {
|
|
|
|
|
|
|
|
|
|
base= startbase;
|
|
|
|
|
while(base) {
|
|
|
|
|
if(base->lay & G.vd->lay) {
|
|
|
|
|
for(a=0; a<hits; a++) {
|
|
|
|
|
/* index was converted */
|
|
|
|
|
if(base->selcol==buffer[ (4 * a) + 3 ]) basact= base;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(basact) break;
|
|
|
|
|
|
|
|
|
|
base= base->next;
|
|
|
|
|
if(base==0) base= FIRSTBASE;
|
|
|
|
|
if(base==startbase) break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(basact) {
|
|
|
|
|
if(G.obedit) {
|
2003-04-30 13:22:26 +00:00
|
|
|
/* only do select */
|
2003-07-21 17:46:55 +00:00
|
|
|
deselectall_except(basact);
|
2002-10-12 11:37:38 +00:00
|
|
|
basact->flag |= SELECT;
|
|
|
|
|
draw_object_ext(basact);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
oldbasact= BASACT;
|
|
|
|
|
BASACT= basact;
|
|
|
|
|
|
|
|
|
|
if((G.qual & LR_SHIFTKEY)==0) {
|
2003-07-11 20:02:52 +00:00
|
|
|
deselectall_except(basact);
|
2002-10-12 11:37:38 +00:00
|
|
|
basact->flag |= SELECT;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if(basact->flag & SELECT) {
|
|
|
|
|
if(basact==oldbasact)
|
|
|
|
|
basact->flag &= ~SELECT;
|
|
|
|
|
}
|
|
|
|
|
else basact->flag |= SELECT;
|
|
|
|
|
}
|
2003-07-11 20:02:52 +00:00
|
|
|
|
|
|
|
|
// copy
|
2002-10-12 11:37:38 +00:00
|
|
|
basact->object->flag= basact->flag;
|
|
|
|
|
|
|
|
|
|
if(oldbasact != basact) {
|
|
|
|
|
set_active_base(basact);
|
|
|
|
|
}
|
2003-11-10 15:28:48 +00:00
|
|
|
|
2004-06-19 17:35:37 +00:00
|
|
|
// for visual speed, only in wire mode
|
|
|
|
|
if(G.vd->drawtype==OB_WIRE) {
|
|
|
|
|
if(oldbasact && oldbasact != basact && (oldbasact->lay & G.vd->lay))
|
|
|
|
|
draw_object_ext(oldbasact);
|
|
|
|
|
draw_object_ext(basact);
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(basact->object->type!=OB_MESH) {
|
|
|
|
|
if(G.f & G_WEIGHTPAINT) {
|
|
|
|
|
set_wpaint(); /* toggle */
|
|
|
|
|
}
|
|
|
|
|
if(G.f & G_VERTEXPAINT) {
|
|
|
|
|
set_vpaint(); /* toggle */
|
|
|
|
|
}
|
|
|
|
|
if(G.f & G_FACESELECT) {
|
|
|
|
|
set_faceselect(); /* toggle */
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-11-10 15:28:48 +00:00
|
|
|
/* also because multiple 3d windows can be open */
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
|
2003-10-07 18:24:02 +00:00
|
|
|
allqueue(REDRAWBUTSLOGIC, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
allqueue(REDRAWDATASELECT, 0);
|
2003-10-07 18:24:02 +00:00
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
allqueue(REDRAWACTION, 0);
|
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
|
allqueue(REDRAWHEADERS, 0); /* To force display update for the posebutton */
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2003-07-21 17:46:55 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
countall();
|
|
|
|
|
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
rightmouse_transform(); // does undo push!
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
|
|
|
|
|
static int edge_fully_inside_rect(rcti rect, short x1, short y1, short x2, short y2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// check points in rect
|
|
|
|
|
if(rect.xmin<x1 && rect.xmax>x1 && rect.ymin<y1 && rect.ymax>y1)
|
|
|
|
|
if(rect.xmin<x2 && rect.xmax>x2 && rect.ymin<y2 && rect.ymax>y2) return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int edge_inside_rect(rcti rect, short x1, short y1, short x2, short y2)
|
|
|
|
|
{
|
|
|
|
|
int d1, d2, d3, d4;
|
|
|
|
|
|
|
|
|
|
// check points in rect
|
|
|
|
|
if(rect.xmin<x1 && rect.xmax>x1 && rect.ymin<y1 && rect.ymax>y1) return 1;
|
|
|
|
|
if(rect.xmin<x2 && rect.xmax>x2 && rect.ymin<y2 && rect.ymax>y2) return 1;
|
|
|
|
|
|
|
|
|
|
/* check points completely out rect */
|
|
|
|
|
if(x1<rect.xmin && x2<rect.xmin) return 0;
|
|
|
|
|
if(x1>rect.xmax && x2>rect.xmax) return 0;
|
|
|
|
|
if(y1<rect.ymin && y2<rect.ymin) return 0;
|
|
|
|
|
if(y1>rect.ymax && y2>rect.ymax) return 0;
|
|
|
|
|
|
|
|
|
|
// simple check lines intersecting.
|
|
|
|
|
d1= (y1-y2)*(x1- rect.xmin ) + (x2-x1)*(y1- rect.ymin );
|
|
|
|
|
d2= (y1-y2)*(x1- rect.xmin ) + (x2-x1)*(y1- rect.ymax );
|
|
|
|
|
d3= (y1-y2)*(x1- rect.xmax ) + (x2-x1)*(y1- rect.ymax );
|
|
|
|
|
d4= (y1-y2)*(x1- rect.xmax ) + (x2-x1)*(y1- rect.ymin );
|
|
|
|
|
|
|
|
|
|
if(d1<0 && d2<0 && d3<0 && d4<0) return 0;
|
|
|
|
|
if(d1>0 && d2>0 && d3>0 && d4>0) return 0;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-24 18:17:23 +00:00
|
|
|
static int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2)
|
|
|
|
|
{
|
|
|
|
|
int radsq= rad*rad;
|
|
|
|
|
float v1[2], v2[2], v3[2];
|
|
|
|
|
|
|
|
|
|
// check points in circle itself
|
|
|
|
|
if( (x1-centx)*(x1-centx) + (y1-centy)*(y1-centy) <= radsq ) return 1;
|
|
|
|
|
if( (x2-centx)*(x2-centx) + (y2-centy)*(y2-centy) <= radsq ) return 1;
|
|
|
|
|
|
|
|
|
|
// pointdistline
|
|
|
|
|
v3[0]= centx;
|
|
|
|
|
v3[1]= centy;
|
|
|
|
|
v1[0]= x1;
|
|
|
|
|
v1[1]= y1;
|
|
|
|
|
v2[0]= x2;
|
|
|
|
|
v2[1]= y2;
|
|
|
|
|
|
|
|
|
|
if( PdistVL2Dfl(v3, v1, v2) < (float)rad ) return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
|
* Does the 'borderselect' command. (Select verts based on selecting with a
|
|
|
|
|
* border: key 'b'). All selecting seems to be done in the get_border part.
|
|
|
|
|
*/
|
|
|
|
|
void borderselect(void)
|
|
|
|
|
{
|
|
|
|
|
rcti rect;
|
|
|
|
|
Base *base;
|
|
|
|
|
Nurb *nu;
|
|
|
|
|
BezTriple *bezt;
|
|
|
|
|
BPoint *bp;
|
|
|
|
|
MetaElem *ml;
|
2003-07-10 20:34:41 +00:00
|
|
|
unsigned int buffer[MAXPICKBUF];
|
2002-10-12 11:37:38 +00:00
|
|
|
int a, index;
|
|
|
|
|
short hits, val, tel;
|
|
|
|
|
|
|
|
|
|
if(G.obedit==0 && (G.f & G_FACESELECT)) {
|
|
|
|
|
face_borderselect();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val= get_border(&rect, 3);
|
|
|
|
|
if(val) {
|
|
|
|
|
if (G.obpose){
|
|
|
|
|
if(G.obpose->type==OB_ARMATURE) {
|
|
|
|
|
Bone *bone;
|
|
|
|
|
hits= selectprojektie(buffer, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
for (a=0; a<hits; a++){
|
|
|
|
|
index = buffer[(4*a)+3];
|
|
|
|
|
if (val==LEFTMOUSE){
|
|
|
|
|
if (index != -1){
|
|
|
|
|
bone = get_indexed_bone(G.obpose->data, index &~(BONESEL_TIP|BONESEL_ROOT));
|
|
|
|
|
bone->flag |= BONE_SELECTED;
|
|
|
|
|
select_actionchannel_by_name(G.obpose->action, bone->name, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if (index != -1){
|
|
|
|
|
bone = get_indexed_bone(G.obpose->data, index &~(BONESEL_TIP|BONESEL_ROOT));
|
|
|
|
|
bone->flag &= ~BONE_SELECTED;
|
|
|
|
|
select_actionchannel_by_name(G.obpose->action, bone->name, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWBUTSEDIT, 0);
|
2003-10-07 18:24:02 +00:00
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
allqueue(REDRAWACTION, 0);
|
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
else if(G.obedit) {
|
2002-10-12 11:37:38 +00:00
|
|
|
/* used to be a bigger test, also included sector and life */
|
|
|
|
|
if(G.obedit->type==OB_MESH) {
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
EditMesh *em = G.editMesh;
|
|
|
|
|
EditVert *eve;
|
|
|
|
|
EditEdge *eed;
|
|
|
|
|
EditFace *efa;
|
|
|
|
|
|
2004-09-25 13:42:31 +00:00
|
|
|
EM_zbuffer_visible(NULL, 0, 0); // init
|
|
|
|
|
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
if(G.scene->selectmode & SCE_SELECT_VERTEX) {
|
|
|
|
|
calc_meshverts_ext(); /* clips, drawobject.c */
|
|
|
|
|
for(eve= em->verts.first; eve; eve= eve->next) {
|
|
|
|
|
if(eve->h==0 && eve->xs>rect.xmin && eve->xs<rect.xmax) {
|
|
|
|
|
if(eve->ys>rect.ymin && eve->ys<rect.ymax) {
|
2004-09-25 13:42:31 +00:00
|
|
|
if(EM_zbuffer_visible(eve->co, eve->xs, eve->ys)) {
|
|
|
|
|
if(val==LEFTMOUSE) eve->f|= 1;
|
|
|
|
|
else eve->f&= 254;
|
|
|
|
|
}
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(G.scene->selectmode & SCE_SELECT_EDGE) {
|
|
|
|
|
short done= 0;
|
|
|
|
|
calc_meshverts_ext_f2(); /* doesnt clip, drawobject.c */
|
|
|
|
|
|
|
|
|
|
/* two stages, for nice edge select first do 'both points in rect' */
|
|
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
|
|
|
|
if(eed->h==0) {
|
|
|
|
|
if( edge_fully_inside_rect(rect, eed->v1->xs, eed->v1->ys, eed->v2->xs, eed->v2->ys)) {
|
2004-09-25 13:42:31 +00:00
|
|
|
if(EM_zbuffer_visible(eed->v1->co, eed->v1->xs, eed->v1->ys)) {
|
|
|
|
|
if(EM_zbuffer_visible(eed->v2->co, eed->v2->xs, eed->v2->ys)) {
|
|
|
|
|
EM_select_edge(eed, val==LEFTMOUSE);
|
|
|
|
|
done = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(done==0) {
|
|
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
|
|
|
|
if(eed->h==0) {
|
2004-09-25 13:42:31 +00:00
|
|
|
if( edge_inside_rect(rect, eed->v1->xs, eed->v1->ys, eed->v2->xs, eed->v2->ys)) {
|
|
|
|
|
if(EM_zbuffer_visible(eed->v1->co, eed->v1->xs, eed->v1->ys)) {
|
|
|
|
|
if(EM_zbuffer_visible(eed->v2->co, eed->v2->xs, eed->v2->ys)) {
|
|
|
|
|
EM_select_edge(eed, val==LEFTMOUSE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
if(G.scene->selectmode & SCE_SELECT_FACE) {
|
|
|
|
|
calc_mesh_facedots_ext();
|
|
|
|
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
|
|
|
|
if(efa->h==0 && efa->xs>rect.xmin && efa->xs<rect.xmax) {
|
|
|
|
|
if(efa->ys>rect.ymin && efa->ys<rect.ymax) {
|
2004-09-25 13:42:31 +00:00
|
|
|
if(EM_zbuffer_visible(efa->cent, efa->xs, efa->ys)) {
|
|
|
|
|
EM_select_face_fgon(efa, val==LEFTMOUSE);
|
|
|
|
|
}
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
|
|
|
|
|
EM_selectmode_flush();
|
2003-10-16 09:39:19 +00:00
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
|
|
|
|
|
|
|
|
|
|
calc_nurbverts_ext(); /* drawobject.c */
|
|
|
|
|
nu= editNurb.first;
|
|
|
|
|
while(nu) {
|
|
|
|
|
if((nu->type & 7)==CU_BEZIER) {
|
|
|
|
|
bezt= nu->bezt;
|
|
|
|
|
a= nu->pntsu;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bezt->hide==0) {
|
|
|
|
|
if(bezt->s[0][0]>rect.xmin && bezt->s[0][0]<rect.xmax) {
|
|
|
|
|
if(bezt->s[0][1]>rect.ymin && bezt->s[0][1]<rect.ymax) {
|
|
|
|
|
if(val==LEFTMOUSE) bezt->f1|= 1;
|
|
|
|
|
else bezt->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(bezt->s[1][0]>rect.xmin && bezt->s[1][0]<rect.xmax) {
|
|
|
|
|
if(bezt->s[1][1]>rect.ymin && bezt->s[1][1]<rect.ymax) {
|
|
|
|
|
if(val==LEFTMOUSE) {
|
|
|
|
|
bezt->f1|= 1; bezt->f2|= 1; bezt->f3|= 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bezt->f1 &= ~1; bezt->f2 &= ~1; bezt->f3 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(bezt->s[2][0]>rect.xmin && bezt->s[2][0]<rect.xmax) {
|
|
|
|
|
if(bezt->s[2][1]>rect.ymin && bezt->s[2][1]<rect.ymax) {
|
|
|
|
|
if(val==LEFTMOUSE) bezt->f3|= 1;
|
|
|
|
|
else bezt->f3 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bezt++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bp= nu->bp;
|
|
|
|
|
a= nu->pntsu*nu->pntsv;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bp->hide==0) {
|
|
|
|
|
if(bp->s[0]>rect.xmin && bp->s[0]<rect.xmax) {
|
|
|
|
|
if(bp->s[1]>rect.ymin && bp->s[1]<rect.ymax) {
|
|
|
|
|
if(val==LEFTMOUSE) bp->f1|= 1;
|
|
|
|
|
else bp->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bp++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
nu= nu->next;
|
|
|
|
|
}
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
}
|
|
|
|
|
else if(G.obedit->type==OB_MBALL) {
|
|
|
|
|
hits= selectprojektie(buffer, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
|
|
|
|
|
|
|
|
|
|
ml= editelems.first;
|
|
|
|
|
|
|
|
|
|
while(ml) {
|
|
|
|
|
for(a=0; a<hits; a++) {
|
|
|
|
|
if(ml->selcol==buffer[ (4 * a) + 3 ]) {
|
|
|
|
|
if(val==LEFTMOUSE) ml->flag |= SELECT;
|
|
|
|
|
else ml->flag &= ~SELECT;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ml= ml->next;
|
|
|
|
|
}
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
}
|
|
|
|
|
else if(G.obedit->type==OB_ARMATURE) {
|
|
|
|
|
EditBone *ebone;
|
|
|
|
|
|
|
|
|
|
hits= selectprojektie(buffer, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
for (a=0; a<hits; a++){
|
|
|
|
|
index = buffer[(4*a)+3];
|
|
|
|
|
if (val==LEFTMOUSE){
|
|
|
|
|
if (index!=-1){
|
|
|
|
|
ebone = BLI_findlink(&G.edbo, index & ~(BONESEL_TIP|BONESEL_ROOT));
|
|
|
|
|
if (index & BONESEL_TIP)
|
|
|
|
|
ebone->flag |= BONE_TIPSEL;
|
|
|
|
|
if (index & BONESEL_ROOT)
|
|
|
|
|
ebone->flag |= BONE_ROOTSEL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if (index!=-1){
|
|
|
|
|
ebone = BLI_findlink(&G.edbo, index & ~(BONESEL_TIP|BONESEL_ROOT));
|
|
|
|
|
if (index & BONESEL_TIP)
|
|
|
|
|
ebone->flag &= ~BONE_TIPSEL;
|
|
|
|
|
if (index & BONESEL_ROOT)
|
|
|
|
|
ebone->flag &= ~BONE_ROOTSEL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWBUTSEDIT, 0);
|
2003-10-07 18:24:02 +00:00
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
allqueue(REDRAWACTION, 0);
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
}
|
|
|
|
|
else if(G.obedit->type==OB_LATTICE) {
|
|
|
|
|
|
|
|
|
|
calc_lattverts_ext();
|
|
|
|
|
|
|
|
|
|
bp= editLatt->def;
|
|
|
|
|
|
|
|
|
|
a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bp->hide==0) {
|
|
|
|
|
if(bp->s[0]>rect.xmin && bp->s[0]<rect.xmax) {
|
|
|
|
|
if(bp->s[1]>rect.ymin && bp->s[1]<rect.ymax) {
|
|
|
|
|
if(val==LEFTMOUSE) bp->f1|= 1;
|
|
|
|
|
else bp->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bp++;
|
|
|
|
|
}
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
hits= selectprojektie(buffer, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
|
|
|
|
|
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
|
|
|
|
if(base->lay & G.vd->lay) {
|
|
|
|
|
for(a=0; a<hits; a++) {
|
|
|
|
|
/* converted index */
|
|
|
|
|
if(base->selcol==buffer[ (4 * a) + 3 ]) {
|
|
|
|
|
if(val==LEFTMOUSE) base->flag |= SELECT;
|
|
|
|
|
else base->flag &= ~SELECT;
|
|
|
|
|
base->object->flag= base->flag;
|
|
|
|
|
|
|
|
|
|
draw_object_ext(base);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
2003-07-21 17:46:55 +00:00
|
|
|
/* frontbuffer flush */
|
2004-06-16 11:34:45 +00:00
|
|
|
glFlush();
|
2003-07-21 17:46:55 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
allqueue(REDRAWDATASELECT, 0);
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* because backbuf drawing */
|
2002-10-12 11:37:38 +00:00
|
|
|
tel= 1;
|
|
|
|
|
base= FIRSTBASE;
|
|
|
|
|
while(base) {
|
2003-04-30 13:22:26 +00:00
|
|
|
/* each base because of multiple windows */
|
2002-10-12 11:37:38 +00:00
|
|
|
base->selcol = ((tel & 0xF00)<<12)
|
|
|
|
|
+ ((tel & 0xF0)<<8)
|
|
|
|
|
+ ((tel & 0xF)<<4);
|
|
|
|
|
tel++;
|
|
|
|
|
base= base->next;
|
|
|
|
|
}
|
|
|
|
|
/* new */
|
2003-10-07 18:24:02 +00:00
|
|
|
allqueue(REDRAWBUTSLOGIC, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
|
}
|
|
|
|
|
countall();
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWINFO, 0);
|
|
|
|
|
}
|
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.
2004-09-23 20:52:51 +00:00
|
|
|
|
2004-09-24 18:17:23 +00:00
|
|
|
if(val) BIF_undo_push("Border select");
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
} /* end of borderselect() */
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
/** The following functions are quick & dirty callback functions called
|
|
|
|
|
* on the Circle select function (press B twice in Editmode)
|
|
|
|
|
* They were torn out of the circle_select to make the latter more reusable
|
|
|
|
|
* The callback version of circle_select (called circle_selectCB) was moved
|
|
|
|
|
* to edit.c because of it's (wanted) generality.
|
|
|
|
|
|
|
|
|
|
XXX These callback functions are still dirty, because they call globals...
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void mesh_selectionCB(int selecting, Object *editobj, short *mval, float rad)
|
|
|
|
|
{
|
2004-03-28 08:46:35 +00:00
|
|
|
EditMesh *em = G.editMesh;
|
2002-10-12 11:37:38 +00:00
|
|
|
EditVert *eve;
|
2004-09-24 18:17:23 +00:00
|
|
|
EditEdge *eed;
|
|
|
|
|
EditFace *efa;
|
2002-10-12 11:37:38 +00:00
|
|
|
float x, y, r;
|
2004-09-25 13:42:31 +00:00
|
|
|
|
|
|
|
|
EM_zbuffer_visible(NULL, 0, 0); // init
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-09-24 18:17:23 +00:00
|
|
|
if(G.scene->selectmode & SCE_SELECT_VERTEX) {
|
|
|
|
|
calc_meshverts_ext(); /* drawobject.c */
|
|
|
|
|
eve= em->verts.first;
|
|
|
|
|
while(eve) {
|
|
|
|
|
if(eve->h==0) {
|
|
|
|
|
x= eve->xs-mval[0];
|
|
|
|
|
y= eve->ys-mval[1];
|
|
|
|
|
r= sqrt(x*x+y*y);
|
|
|
|
|
if(r<=rad) {
|
2004-09-25 13:42:31 +00:00
|
|
|
if(EM_zbuffer_visible(eve->co, eve->xs, eve->ys)) {
|
|
|
|
|
if(selecting==LEFTMOUSE) eve->f|= 1;
|
|
|
|
|
else eve->f&= 254;
|
|
|
|
|
}
|
2004-09-24 18:17:23 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-09-24 18:17:23 +00:00
|
|
|
eve= eve->next;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-10-21 16:41:28 +00:00
|
|
|
|
2004-09-24 18:17:23 +00:00
|
|
|
if(G.scene->selectmode & SCE_SELECT_EDGE) {
|
|
|
|
|
calc_meshverts_ext_f2(); /* doesnt clip, drawobject.c */
|
|
|
|
|
|
|
|
|
|
/* two stages, for nice edge select first do 'both points in rect' */
|
|
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
|
|
|
|
if(eed->h==0) {
|
|
|
|
|
if( edge_inside_circle(mval[0], mval[1], (short)rad, eed->v1->xs, eed->v1->ys, eed->v2->xs, eed->v2->ys)) {
|
2004-09-25 13:42:31 +00:00
|
|
|
if(EM_zbuffer_visible(eed->v1->co, eed->v1->xs, eed->v1->ys)) {
|
|
|
|
|
if(EM_zbuffer_visible(eed->v2->co, eed->v2->xs, eed->v2->ys)) {
|
|
|
|
|
EM_select_edge(eed, selecting==LEFTMOUSE);
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-09-24 18:17:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(G.scene->selectmode & SCE_SELECT_FACE) {
|
|
|
|
|
calc_mesh_facedots_ext();
|
|
|
|
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
|
|
|
|
if(efa->h==0) {
|
|
|
|
|
x= efa->xs-mval[0];
|
|
|
|
|
y= efa->ys-mval[1];
|
|
|
|
|
r= sqrt(x*x+y*y);
|
|
|
|
|
if(r<=rad) {
|
2004-09-25 13:42:31 +00:00
|
|
|
if(EM_zbuffer_visible(efa->cent, efa->xs, efa->ys)) {
|
|
|
|
|
EM_select_face_fgon(efa, selecting==LEFTMOUSE);
|
|
|
|
|
}
|
2004-09-24 18:17:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EM_selectmode_flush();
|
|
|
|
|
|
2003-10-21 16:41:28 +00:00
|
|
|
draw_sel_circle(0, 0, 0, 0, 0); /* signal */
|
|
|
|
|
force_draw();
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void nurbscurve_selectionCB(int selecting, Object *editobj, short *mval, float rad)
|
|
|
|
|
{
|
|
|
|
|
Nurb *nu;
|
|
|
|
|
BPoint *bp;
|
|
|
|
|
BezTriple *bezt;
|
|
|
|
|
float x, y, r;
|
|
|
|
|
int a;
|
|
|
|
|
|
|
|
|
|
calc_nurbverts_ext(); /* drawobject.c */
|
|
|
|
|
nu= editNurb.first;
|
|
|
|
|
while(nu) {
|
|
|
|
|
if((nu->type & 7)==CU_BEZIER) {
|
|
|
|
|
bezt= nu->bezt;
|
|
|
|
|
a= nu->pntsu;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bezt->hide==0) {
|
|
|
|
|
x= bezt->s[0][0]-mval[0];
|
|
|
|
|
y= bezt->s[0][1]-mval[1];
|
|
|
|
|
r= sqrt(x*x+y*y);
|
|
|
|
|
if(r<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bezt->f1|= 1;
|
|
|
|
|
else bezt->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
x= bezt->s[1][0]-mval[0];
|
|
|
|
|
y= bezt->s[1][1]-mval[1];
|
|
|
|
|
r= sqrt(x*x+y*y);
|
|
|
|
|
if(r<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bezt->f2|= 1;
|
|
|
|
|
else bezt->f2 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
x= bezt->s[2][0]-mval[0];
|
|
|
|
|
y= bezt->s[2][1]-mval[1];
|
|
|
|
|
r= sqrt(x*x+y*y);
|
|
|
|
|
if(r<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bezt->f3|= 1;
|
|
|
|
|
else bezt->f3 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
bezt++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bp= nu->bp;
|
|
|
|
|
a= nu->pntsu*nu->pntsv;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bp->hide==0) {
|
|
|
|
|
x= bp->s[0]-mval[0];
|
|
|
|
|
y= bp->s[1]-mval[1];
|
|
|
|
|
r= sqrt(x*x+y*y);
|
|
|
|
|
if(r<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bp->f1|= 1;
|
|
|
|
|
else bp->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bp++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
nu= nu->next;
|
|
|
|
|
}
|
|
|
|
|
draw_sel_circle(0, 0, 0, 0, 0); /* signal */
|
|
|
|
|
force_draw();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lattice_selectionCB(int selecting, Object *editobj, short *mval, float rad)
|
|
|
|
|
{
|
|
|
|
|
BPoint *bp;
|
|
|
|
|
float x, y, r;
|
|
|
|
|
int a;
|
|
|
|
|
|
|
|
|
|
calc_lattverts_ext();
|
|
|
|
|
|
|
|
|
|
bp= editLatt->def;
|
|
|
|
|
|
|
|
|
|
a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bp->hide==0) {
|
|
|
|
|
x= bp->s[0]-mval[0];
|
|
|
|
|
y= bp->s[1]-mval[1];
|
|
|
|
|
r= sqrt(x*x+y*y);
|
|
|
|
|
if(r<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bp->f1|= 1;
|
|
|
|
|
else bp->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bp++;
|
|
|
|
|
}
|
|
|
|
|
draw_sel_circle(0, 0, 0, 0, 0); /* signal */
|
|
|
|
|
force_draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Callbacks for selection in Editmode */
|
|
|
|
|
|
|
|
|
|
void obedit_selectionCB(short selecting, Object *editobj, short *mval, float rad)
|
|
|
|
|
{
|
|
|
|
|
switch(editobj->type) {
|
|
|
|
|
case OB_MESH:
|
|
|
|
|
mesh_selectionCB(selecting, editobj, mval, rad);
|
|
|
|
|
break;
|
|
|
|
|
case OB_CURVE:
|
|
|
|
|
case OB_SURF:
|
|
|
|
|
nurbscurve_selectionCB(selecting, editobj, mval, rad);
|
|
|
|
|
break;
|
|
|
|
|
case OB_LATTICE:
|
|
|
|
|
lattice_selectionCB(selecting, editobj, mval, rad);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** The circle select function - should be replaced by the callback
|
|
|
|
|
* version circle_selectCB(). Why ? Because it's not nice as it is!
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void circle_select(void)
|
|
|
|
|
{
|
2004-03-28 08:46:35 +00:00
|
|
|
EditMesh *em = G.editMesh;
|
2002-10-12 11:37:38 +00:00
|
|
|
Nurb *nu;
|
|
|
|
|
BPoint *bp;
|
|
|
|
|
BezTriple *bezt;
|
|
|
|
|
EditVert *eve;
|
|
|
|
|
static float rad= 40.0;
|
|
|
|
|
float rado, x, y, trad;
|
|
|
|
|
int a, firsttime=1;
|
|
|
|
|
unsigned short event;
|
|
|
|
|
short mvalo[2], mval[2], val;
|
|
|
|
|
short selecting=0;
|
|
|
|
|
|
|
|
|
|
if(G.obedit==0) return;
|
|
|
|
|
|
|
|
|
|
getmouseco_areawin(mvalo);
|
|
|
|
|
draw_sel_circle(mvalo, 0, rad, 0.0, selecting);
|
|
|
|
|
|
|
|
|
|
rado= rad;
|
|
|
|
|
|
|
|
|
|
while(TRUE) {
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* when a renderwindow is open and mouse enters it (activates sometimes) */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
mywinset(curarea->win);
|
|
|
|
|
|
|
|
|
|
getmouseco_areawin(mval);
|
|
|
|
|
|
|
|
|
|
if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1] || rado!=rad || firsttime) {
|
|
|
|
|
firsttime= 0;
|
|
|
|
|
|
|
|
|
|
draw_sel_circle(mval, mvalo, rad, rado, selecting);
|
|
|
|
|
|
|
|
|
|
mvalo[0]= mval[0];
|
|
|
|
|
mvalo[1]= mval[1];
|
|
|
|
|
rado= rad;
|
|
|
|
|
|
|
|
|
|
if(selecting) {
|
|
|
|
|
|
|
|
|
|
if(G.obedit->type==OB_MESH) {
|
|
|
|
|
|
|
|
|
|
calc_meshverts_ext(); /* drawobject.c */
|
2004-03-28 08:46:35 +00:00
|
|
|
eve= em->verts.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(eve) {
|
|
|
|
|
if(eve->h==0) {
|
|
|
|
|
x= eve->xs-mval[0];
|
|
|
|
|
y= eve->ys-mval[1];
|
|
|
|
|
trad= sqrt(x*x+y*y);
|
|
|
|
|
if(trad<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) eve->f|= 1;
|
|
|
|
|
else eve->f&= 254;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
eve= eve->next;
|
|
|
|
|
}
|
2003-10-21 16:41:28 +00:00
|
|
|
draw_sel_circle(0, 0, 0, 0, 0); /* signal */
|
|
|
|
|
force_draw();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
|
|
|
|
|
|
|
|
|
|
calc_nurbverts_ext(); /* drawobject.c */
|
|
|
|
|
nu= editNurb.first;
|
|
|
|
|
while(nu) {
|
|
|
|
|
if((nu->type & 7)==CU_BEZIER) {
|
|
|
|
|
bezt= nu->bezt;
|
|
|
|
|
a= nu->pntsu;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bezt->hide==0) {
|
|
|
|
|
x= bezt->s[0][0]-mval[0];
|
|
|
|
|
y= bezt->s[0][1]-mval[1];
|
|
|
|
|
trad= sqrt(x*x+y*y);
|
|
|
|
|
if(trad<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bezt->f1|= 1;
|
|
|
|
|
else bezt->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
x= bezt->s[1][0]-mval[0];
|
|
|
|
|
y= bezt->s[1][1]-mval[1];
|
|
|
|
|
trad= sqrt(x*x+y*y);
|
|
|
|
|
if(trad<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bezt->f2|= 1;
|
|
|
|
|
else bezt->f2 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
x= bezt->s[2][0]-mval[0];
|
|
|
|
|
y= bezt->s[2][1]-mval[1];
|
|
|
|
|
trad= sqrt(x*x+y*y);
|
|
|
|
|
if(trad<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bezt->f3|= 1;
|
|
|
|
|
else bezt->f3 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
bezt++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
bp= nu->bp;
|
|
|
|
|
a= nu->pntsu*nu->pntsv;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bp->hide==0) {
|
|
|
|
|
x= bp->s[0]-mval[0];
|
|
|
|
|
y= bp->s[1]-mval[1];
|
|
|
|
|
trad= sqrt(x*x+y*y);
|
|
|
|
|
if(trad<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bp->f1|= 1;
|
|
|
|
|
else bp->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bp++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
nu= nu->next;
|
|
|
|
|
}
|
|
|
|
|
draw_sel_circle(0, 0, 0, 0, 0); /* signal */
|
|
|
|
|
force_draw();
|
|
|
|
|
}
|
|
|
|
|
else if(G.obedit->type==OB_LATTICE) {
|
|
|
|
|
calc_lattverts_ext();
|
|
|
|
|
|
|
|
|
|
bp= editLatt->def;
|
|
|
|
|
|
|
|
|
|
a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
|
|
|
|
|
while(a--) {
|
|
|
|
|
if(bp->hide==0) {
|
|
|
|
|
x= bp->s[0]-mval[0];
|
|
|
|
|
y= bp->s[1]-mval[1];
|
|
|
|
|
trad= sqrt(x*x+y*y);
|
|
|
|
|
if(trad<=rad) {
|
|
|
|
|
if(selecting==LEFTMOUSE) bp->f1|= 1;
|
|
|
|
|
else bp->f1 &= ~1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bp++;
|
|
|
|
|
}
|
|
|
|
|
draw_sel_circle(0, 0, 0, 0, 0); /* signal */
|
|
|
|
|
force_draw();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event= extern_qread(&val);
|
|
|
|
|
if (event) {
|
|
|
|
|
int afbreek= 0;
|
|
|
|
|
|
|
|
|
|
switch(event) {
|
|
|
|
|
case LEFTMOUSE:
|
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
|
if(val) selecting= event;
|
|
|
|
|
else selecting= 0;
|
|
|
|
|
firsttime= 1;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case PADPLUSKEY:
|
|
|
|
|
if(val) if(rad<200.0) rad*= 1.2;
|
|
|
|
|
break;
|
|
|
|
|
case PADMINUS:
|
|
|
|
|
if(val) if(rad>5.0) rad/= 1.2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ESCKEY: case SPACEKEY: case RIGHTMOUSE:
|
|
|
|
|
case GKEY: case SKEY: case RKEY: case XKEY: case EKEY: case TABKEY:
|
|
|
|
|
afbreek= 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(afbreek) break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* clear circle */
|
2002-10-12 11:37:38 +00:00
|
|
|
draw_sel_circle(0, mvalo, 0, rad, 1);
|
|
|
|
|
|
|
|
|
|
countall();
|
|
|
|
|
allqueue(REDRAWINFO, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void set_render_border(void)
|
|
|
|
|
{
|
|
|
|
|
rcti rect;
|
|
|
|
|
short val;
|
|
|
|
|
|
|
|
|
|
if(G.vd->persp!=2) return;
|
|
|
|
|
|
|
|
|
|
val= get_border(&rect, 2);
|
|
|
|
|
if(val) {
|
|
|
|
|
rcti vb;
|
|
|
|
|
|
|
|
|
|
calc_viewborder(G.vd, &vb);
|
|
|
|
|
|
|
|
|
|
G.scene->r.border.xmin= (float) (rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
|
|
|
|
|
G.scene->r.border.ymin= (float) (rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
|
|
|
|
|
G.scene->r.border.xmax= (float) (rect.xmax-vb.xmin)/(vb.xmax-vb.xmin);
|
|
|
|
|
G.scene->r.border.ymax= (float) (rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
|
|
|
|
|
|
|
|
|
|
CLAMP(G.scene->r.border.xmin, 0.0, 1.0);
|
|
|
|
|
CLAMP(G.scene->r.border.ymin, 0.0, 1.0);
|
|
|
|
|
CLAMP(G.scene->r.border.xmax, 0.0, 1.0);
|
|
|
|
|
CLAMP(G.scene->r.border.ymax, 0.0, 1.0);
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWVIEWCAM, 1);
|
2003-11-08 12:50:40 +00:00
|
|
|
// if it was not set, we do this
|
|
|
|
|
G.scene->r.mode |= R_BORDER;
|
|
|
|
|
allqueue(REDRAWBUTSSCENE, 1);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void fly(void)
|
|
|
|
|
{
|
|
|
|
|
float speed=0.0, speedo=1.0, zspeed=0.0, dvec[3], *quat, mat[3][3];
|
|
|
|
|
float oldvec[3], oldrot[3];
|
|
|
|
|
int loop=1;
|
|
|
|
|
unsigned short toets;
|
|
|
|
|
short val, cent[2];
|
|
|
|
|
short mval[2];
|
|
|
|
|
|
|
|
|
|
if(curarea->spacetype!=SPACE_VIEW3D) return;
|
|
|
|
|
if(G.vd->camera == 0) return;
|
|
|
|
|
if(G.vd->persp<2) return;
|
|
|
|
|
|
|
|
|
|
VECCOPY(oldvec, G.vd->camera->loc);
|
|
|
|
|
VECCOPY(oldrot, G.vd->camera->rot);
|
|
|
|
|
|
|
|
|
|
cent[0]= curarea->winrct.xmin+(curarea->winx)/2;
|
|
|
|
|
cent[1]= curarea->winrct.ymin+(curarea->winy)/2;
|
|
|
|
|
|
|
|
|
|
warp_pointer(cent[0], cent[1]);
|
|
|
|
|
|
|
|
|
|
cent[0]= (curarea->winx)/2;
|
|
|
|
|
cent[1]= (curarea->winy)/2;
|
|
|
|
|
|
|
|
|
|
headerprint("Fly");
|
|
|
|
|
|
|
|
|
|
while(loop) {
|
|
|
|
|
getmouseco_areawin(mval);
|
|
|
|
|
|
|
|
|
|
while(qtest()) {
|
|
|
|
|
|
|
|
|
|
toets= extern_qread(&val);
|
|
|
|
|
|
|
|
|
|
if(val) {
|
|
|
|
|
if(toets==ESCKEY) {
|
|
|
|
|
VECCOPY(G.vd->camera->loc, oldvec);
|
|
|
|
|
VECCOPY(G.vd->camera->rot, oldrot);
|
|
|
|
|
loop= 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if(toets==SPACEKEY) {
|
|
|
|
|
loop= 0;
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
BIF_undo_push("Fly camera");
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if(toets==LEFTMOUSE) {
|
|
|
|
|
speed+= G.vd->grid/75.0;
|
|
|
|
|
if(get_mbut()&M_MOUSE) speed= 0.0;
|
|
|
|
|
}
|
|
|
|
|
else if(toets==MIDDLEMOUSE) {
|
|
|
|
|
speed-= G.vd->grid/75.0;
|
|
|
|
|
if(get_mbut()&L_MOUSE) speed= 0.0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(loop==0) break;
|
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* define dvec */
|
2002-10-12 11:37:38 +00:00
|
|
|
val= mval[0]-cent[0];
|
|
|
|
|
if(val>20) val-= 20; else if(val< -20) val+= 20; else val= 0;
|
|
|
|
|
dvec[0]= 0.000001*val*val;
|
|
|
|
|
if(val>0) dvec[0]= -dvec[0];
|
|
|
|
|
|
|
|
|
|
val= mval[1]-cent[1];
|
|
|
|
|
if(val>20) val-= 20; else if(val< -20) val+= 20; else val= 0;
|
|
|
|
|
dvec[1]= 0.000001*val*val;
|
|
|
|
|
if(val>0) dvec[1]= -dvec[1];
|
|
|
|
|
|
|
|
|
|
dvec[2]= 1.0;
|
|
|
|
|
|
|
|
|
|
zspeed= 0.0;
|
|
|
|
|
if(get_qual()&LR_CTRLKEY) zspeed= -G.vd->grid/25.0;
|
|
|
|
|
if(get_qual()&LR_ALTKEY) zspeed= G.vd->grid/25.0;
|
|
|
|
|
|
|
|
|
|
if(speedo!=0.0 || zspeed!=0.0 || dvec[0]!=0.0 || dvec[1]!=0.0) {
|
|
|
|
|
|
|
|
|
|
Normalise(dvec);
|
|
|
|
|
|
|
|
|
|
Mat3CpyMat4(mat, G.vd->viewinv);
|
|
|
|
|
Mat3MulVecfl(mat, dvec);
|
2003-04-30 13:22:26 +00:00
|
|
|
quat= vectoquat(dvec, 5, 1); /* track and upflag, not from the base: camera view calculation does not use that */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
QuatToEul(quat, G.vd->camera->rot);
|
|
|
|
|
|
|
|
|
|
compatible_eul(G.vd->camera->rot, oldrot);
|
|
|
|
|
|
|
|
|
|
VecMulf(dvec, speed);
|
|
|
|
|
G.vd->camera->loc[0]-= dvec[0];
|
|
|
|
|
G.vd->camera->loc[1]-= dvec[1];
|
|
|
|
|
G.vd->camera->loc[2]-= (dvec[2]-zspeed);
|
|
|
|
|
|
|
|
|
|
scrarea_do_windraw(curarea);
|
|
|
|
|
screen_swapbuffers();
|
|
|
|
|
}
|
|
|
|
|
speedo= speed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
|
scrarea_queue_headredraw(curarea);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|