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 *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2002-11-25 12:02:15 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "BMF_Api.h"
|
|
|
|
|
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "MTC_matrixops.h"
|
|
|
|
|
2005-07-12 15:47:53 +00:00
|
|
|
#include "DNA_armature_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_camera_types.h"
|
|
|
|
#include "DNA_curve_types.h"
|
2003-11-11 16:56:51 +00:00
|
|
|
#include "DNA_constraint_types.h" // for drawing constraint
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_effect_types.h"
|
|
|
|
#include "DNA_ipo_types.h"
|
|
|
|
#include "DNA_lamp_types.h"
|
|
|
|
#include "DNA_lattice_types.h"
|
|
|
|
#include "DNA_material_types.h"
|
|
|
|
#include "DNA_mesh_types.h"
|
2004-03-20 22:55:42 +00:00
|
|
|
#include "DNA_meshdata_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_meta_types.h"
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
#include "DNA_modifier_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_object_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_object_force.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
2005-11-19 10:55:07 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_world_types.h"
|
Sorry for the big commit, but I've been fixing many of these
issues in parallel... So this commit contains: an update of
the solver (e.g. moving objects), integration of blender IPOs,
improved rendering (motion blur, smoothed normals) and a first particle
test. In more detail:
Solver update:
- Moving objects using a relatively simple model, and not yet fully optimized - ok
for box falling into water, water in a moving glass might cause trouble. Simulation
times are influenced by overall no. of triangles of the mesh, scaling meshes up a lot
might also cause slowdowns.
- Additional obstacle settings: noslip (as before), free slip (move along wall freely)
and part slip (mix of both).
- Obstacle settings also added for domain boundaries now, the six walls of the domain are
obstacles after all as well
- Got rid of templates, should make compiling for e.g. macs more convenient,
for linux there's not much difference. Finally got rid of parser (and some other code
parts), the simulation now uses the internal API to transfer data.
- Some unnecessary file were removed, the GUI now needs 3 settings buttons...
This should still be changed (maybe by adding a new panel for domain objects).
IPOs:
- Animated params: viscosity, time and gravity for domains. In contrast
to normal time IPO for Blender objects, the fluidsim one scales the time
step size - so a constant 1 has no effect, values towards 0 slow it down,
larger ones speed the simulation up (-> longer time steps, more compuations).
The viscosity IPO is also only a factor for the selected viscosity (again, 1=no effect).
- For objects that are enabled for fluidsim, a new IPO type shows up. Inflow
objects can use the velocity channels to animate the inflow. Obstacles, in/outflow
objects can be switched on (Active IPO>0) and off (<0) during the simulation.
- Movement, rotation and scaling of those 3 types is exported from the normal
Blender channels (Loc,dLoc,etc.).
Particles:
- This is still experimental, so it might be deactivated for a
release... It should at some point be used to model smaller splashes,
depending on the the realworld size and the particle generation
settings particles are generated during simulation (stored in _particles_X.gz
files).
- These are loaded by enabling the particle field for an arbitrary object,
which should be given a halo material. For each frame, similar to the mesh
loading, the particle system them loads the simulated particle positions.
- For rendering, I "abused" the part->rt field - I couldnt find any use
for it in the code and it seems to work fine. The fluidsim particles
store their size there.
Rendering:
- The fluidims particles use scaled sizes and alpha values to give a more varied
appearance. In convertblender.c fluidsim particle systems use the p->rt field
to scale up the size and down the alpha of "smaller particles". Setting the
influence fields in the fluidims settings to 0 gives equally sized particles
with same alpha everywhere. Higher values cause larger differences.
- Smoothed normals: for unmodified fluid meshes (e.g. no subdivision) the normals
computed by the solver are used. This is basically done by switching off the
normal recalculation in convertblender.c (the function calc_fluidsimnormals
handles other mesh inits instead of calc_vertexnormals).
This could also be used to e.g. modify mesh normals in a modifier...
- Another change is that fluidsim meshes load the velocities computed
during the simulation for image based motion blur. This is inited in
load_fluidsimspeedvectors for the vector pass (they're loaded during the
normal load in DerivedMesh readBobjgz). Generation and loading can be switched
off in the settings. Vector pass currently loads the fluidism meshes 3 times,
so this should still be optimized.
Examples:
- smoothed normals versus normals from subdividing once:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_1smoothnorms.png
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_2subdivnorms.png
- fluidsim particles, size/alpha influence 0:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_3particlesnorm.png
size influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_4particlessize.png
size & alpha influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_5particlesalpha.png
- the standard drop with motion blur and particles:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t2new.mpg
(here's how it looks without
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t1old.mpg)
- another inflow animation (moving, switched on/off) with a moving obstacle
(and strong mblur :)
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t3ipos.mpg
Things still to fix:
- rotating & scaling domains causes wrong speed vectors
- get rid of SDL code for threading, use pthreads as well?
- update wiki documentation
- cool effects for rendering would be photon maps for caustics,
and motion blur for particles :)
2006-02-27 11:45:42 +00:00
|
|
|
// FSPARTICLE
|
|
|
|
#include "DNA_object_fluidsim.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"
|
2006-02-08 21:01:00 +00:00
|
|
|
#include "BLI_edgehash.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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
#include "BKE_curve.h"
|
2003-11-11 16:56:51 +00:00
|
|
|
#include "BKE_constraint.h" // for the get_constraint_target function
|
2005-03-27 20:39:28 +00:00
|
|
|
#include "BKE_DerivedMesh.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_displist.h"
|
|
|
|
#include "BKE_effect.h"
|
2005-06-17 21:04:27 +00:00
|
|
|
#include "BKE_font.h"
|
2004-09-14 19:03:11 +00:00
|
|
|
#include "BKE_global.h"
|
2005-07-09 18:04:53 +00:00
|
|
|
#include "BKE_image.h"
|
2004-09-14 19:03:11 +00:00
|
|
|
#include "BKE_ipo.h"
|
2005-08-14 06:08:41 +00:00
|
|
|
#include "BKE_key.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_lattice.h"
|
2004-09-14 19:03:11 +00:00
|
|
|
#include "BKE_mesh.h"
|
|
|
|
#include "BKE_material.h"
|
|
|
|
#include "BKE_mball.h"
|
|
|
|
#include "BKE_object.h"
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
#include "BKE_anim.h" //for the where_on_path function
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
#include "BKE_verse.h"
|
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-09-03 12:16:14 +00:00
|
|
|
#include "BIF_editarmature.h"
|
|
|
|
#include "BIF_editdeform.h"
|
|
|
|
#include "BIF_editmesh.h"
|
|
|
|
#include "BIF_glutil.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_gl.h"
|
2005-03-26 17:29:37 +00:00
|
|
|
#include "BIF_glutil.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_mywindow.h"
|
2006-09-03 12:16:14 +00:00
|
|
|
#include "BIF_resources.h"
|
2006-11-06 01:08:26 +00:00
|
|
|
#include "BIF_retopo.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_screen.h"
|
|
|
|
#include "BIF_space.h"
|
|
|
|
|
|
|
|
#include "BDR_drawmesh.h"
|
|
|
|
#include "BDR_drawobject.h"
|
|
|
|
#include "BDR_editobject.h"
|
2006-11-06 01:08:26 +00:00
|
|
|
#include "BDR_sculptmode.h"
|
2005-08-19 21:37:29 +00:00
|
|
|
#include "BDR_vpaint.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "BSE_drawview.h"
|
2006-06-27 12:19:32 +00:00
|
|
|
#include "BSE_node.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BSE_trans_types.h"
|
2006-06-27 12:19:32 +00:00
|
|
|
#include "BSE_view.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "blendef.h"
|
|
|
|
#include "mydevice.h"
|
|
|
|
#include "nla.h"
|
|
|
|
|
|
|
|
#include "BKE_deform.h"
|
|
|
|
|
|
|
|
/* pretty stupid */
|
|
|
|
/* extern Lattice *editLatt; already in BKE_lattice.h */
|
|
|
|
/* editcurve.c */
|
|
|
|
extern ListBase editNurb;
|
|
|
|
/* editmball.c */
|
|
|
|
extern ListBase editelems;
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
static void draw_bounding_volume(Object *ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
/* ************* Setting OpenGL Material ************ */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
// Materials start counting at # one....
|
|
|
|
#define MAXMATBUF (MAXMAT + 1)
|
|
|
|
static float matbuf[MAXMATBUF][2][4];
|
2006-04-08 15:58:49 +00:00
|
|
|
static int totmat_gl= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-11-06 01:08:26 +00:00
|
|
|
int set_gl_material(int nr)
|
2005-07-14 12:44:33 +00:00
|
|
|
{
|
|
|
|
static int last_gl_matnr= -1;
|
|
|
|
static int last_ret_val= 1;
|
|
|
|
|
2006-04-08 15:58:49 +00:00
|
|
|
/* prevent index to use un-initialized array items */
|
|
|
|
if(nr>totmat_gl) nr= totmat_gl;
|
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
if(nr<0) {
|
|
|
|
last_gl_matnr= -1;
|
|
|
|
last_ret_val= 1;
|
|
|
|
}
|
|
|
|
else if(nr<MAXMATBUF && nr!=last_gl_matnr) {
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matbuf[nr][0]);
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matbuf[nr][1]);
|
|
|
|
last_gl_matnr = nr;
|
|
|
|
last_ret_val= matbuf[nr][0][3]!=0.0;
|
|
|
|
|
|
|
|
/* matbuf alpha: 0.0 = skip draw, 1.0 = no blending, else blend */
|
|
|
|
if(matbuf[nr][0][3]!= 0.0 && matbuf[nr][0][3]!= 1.0) {
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return last_ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns 1: when there's alpha needed to be drawn in a 2nd pass */
|
2006-11-06 01:08:26 +00:00
|
|
|
int init_gl_materials(Object *ob, int check_alpha)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
extern Material defmaterial; // render module abuse...
|
2002-10-12 11:37:38 +00:00
|
|
|
Material *ma;
|
2005-07-14 12:44:33 +00:00
|
|
|
int a, has_alpha= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(ob->totcol==0) {
|
|
|
|
matbuf[0][0][0]= defmaterial.r;
|
|
|
|
matbuf[0][0][1]= defmaterial.g;
|
|
|
|
matbuf[0][0][2]= defmaterial.b;
|
|
|
|
matbuf[0][0][3]= 1.0;
|
|
|
|
|
|
|
|
matbuf[0][1][0]= defmaterial.specr;
|
|
|
|
matbuf[0][1][1]= defmaterial.specg;
|
|
|
|
matbuf[0][1][2]= defmaterial.specb;
|
|
|
|
matbuf[0][1][3]= 1.0;
|
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* do material 1 too, for displists! */
|
2005-07-14 12:44:33 +00:00
|
|
|
QUATCOPY(matbuf[1][0], matbuf[0][0]);
|
|
|
|
QUATCOPY(matbuf[1][1], matbuf[0][1]);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(a=1; a<=ob->totcol; a++) {
|
|
|
|
ma= give_current_material(ob, a);
|
2006-06-27 12:19:32 +00:00
|
|
|
ma= editnode_get_active_material(ma);
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ma==NULL) ma= &defmaterial;
|
|
|
|
if(a<MAXMATBUF) {
|
|
|
|
matbuf[a][0][0]= (ma->ref+ma->emit)*ma->r;
|
|
|
|
matbuf[a][0][1]= (ma->ref+ma->emit)*ma->g;
|
|
|
|
matbuf[a][0][2]= (ma->ref+ma->emit)*ma->b;
|
2005-07-14 12:44:33 +00:00
|
|
|
|
|
|
|
/* draw transparent, not in pick-select, nor editmode */
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(check_alpha && !(G.f & G_PICKSEL) && (ob->dtx & OB_DRAWTRANSP) && !(G.obedit && G.obedit->data==ob->data)) {
|
2005-07-14 12:44:33 +00:00
|
|
|
if(G.vd->transp) { // drawing the transparent pass
|
|
|
|
if(ma->alpha==1.0) matbuf[a][0][3]= 0.0; // means skip solid
|
|
|
|
else matbuf[a][0][3]= ma->alpha;
|
|
|
|
}
|
|
|
|
else { // normal pass
|
|
|
|
if(ma->alpha==1.0) matbuf[a][0][3]= 1.0;
|
|
|
|
else {
|
|
|
|
matbuf[a][0][3]= 0.0; // means skip transparent
|
|
|
|
has_alpha= 1; // return value, to indicate adding to after-draw queue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
matbuf[a][0][3]= 1.0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
matbuf[a][1][0]= ma->spec*ma->specr;
|
|
|
|
matbuf[a][1][1]= ma->spec*ma->specg;
|
|
|
|
matbuf[a][1][2]= ma->spec*ma->specb;
|
|
|
|
matbuf[a][1][3]= 1.0;
|
|
|
|
}
|
|
|
|
}
|
2005-03-27 20:39:28 +00:00
|
|
|
|
2006-04-08 15:58:49 +00:00
|
|
|
totmat_gl= ob->totcol;
|
2005-07-14 12:44:33 +00:00
|
|
|
set_gl_material(-1); // signal for static variable
|
|
|
|
return has_alpha;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***/
|
|
|
|
static unsigned int colortab[24]=
|
|
|
|
{0x0, 0xFF88FF, 0xFFBBFF,
|
|
|
|
0x403000, 0xFFFF88, 0xFFFFBB,
|
|
|
|
0x104040, 0x66CCCC, 0x77CCCC,
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
0x104010, 0x55BB55, 0x66FF66,
|
2002-10-12 11:37:38 +00:00
|
|
|
0xFFFFFF
|
2005-11-19 10:55:07 +00:00
|
|
|
};
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
static float cube[8][3] = {
|
|
|
|
{-1.0, -1.0, -1.0},
|
|
|
|
{-1.0, -1.0, 1.0},
|
|
|
|
{-1.0, 1.0, 1.0},
|
|
|
|
{-1.0, 1.0, -1.0},
|
|
|
|
{ 1.0, -1.0, -1.0},
|
|
|
|
{ 1.0, -1.0, 1.0},
|
|
|
|
{ 1.0, 1.0, 1.0},
|
|
|
|
{ 1.0, 1.0, -1.0},
|
|
|
|
};
|
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
/* flag is same as for draw_object */
|
2006-01-13 15:50:32 +00:00
|
|
|
void drawaxes(float size, int flag, char drawtype)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
int axis;
|
2006-10-12 07:54:32 +00:00
|
|
|
float v1[3]= {0.0, 0.0, 0.0};
|
|
|
|
float v2[3]= {0.0, 0.0, 0.0};
|
|
|
|
float v3[3]= {0.0, 0.0, 0.0};
|
2006-01-13 15:50:32 +00:00
|
|
|
|
|
|
|
switch(drawtype) {
|
|
|
|
|
|
|
|
case OB_PLAINAXES:
|
|
|
|
for (axis=0; axis<3; axis++) {
|
|
|
|
float v1[3]= {0.0, 0.0, 0.0};
|
|
|
|
float v2[3]= {0.0, 0.0, 0.0};
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-01-13 15:50:32 +00:00
|
|
|
v1[axis]= size;
|
|
|
|
v2[axis]= -size;
|
|
|
|
glVertex3fv(v1);
|
|
|
|
glVertex3fv(v2);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-01-13 15:50:32 +00:00
|
|
|
glEnd();
|
|
|
|
}
|
2006-10-12 07:54:32 +00:00
|
|
|
break;
|
|
|
|
case OB_SINGLE_ARROW:
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
/* in positive z direction only */
|
|
|
|
v1[2]= size;
|
|
|
|
glVertex3fv(v1);
|
|
|
|
glVertex3fv(v2);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
/* square pyramid */
|
|
|
|
glBegin(GL_TRIANGLES);
|
|
|
|
|
|
|
|
v2[0]= size*0.035; v2[1] = size*0.035;
|
|
|
|
v3[0]= size*-0.035; v3[1] = size*0.035;
|
|
|
|
v2[2]= v3[2]= size*0.75;
|
|
|
|
|
|
|
|
for (axis=0; axis<4; axis++) {
|
|
|
|
if (axis % 2 == 1) {
|
|
|
|
v2[0] *= -1;
|
|
|
|
v3[1] *= -1;
|
|
|
|
} else {
|
|
|
|
v2[1] *= -1;
|
|
|
|
v3[0] *= -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
glVertex3fv(v1);
|
|
|
|
glVertex3fv(v2);
|
|
|
|
glVertex3fv(v3);
|
|
|
|
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
|
2006-01-13 15:50:32 +00:00
|
|
|
break;
|
|
|
|
case OB_ARROWS:
|
|
|
|
default:
|
|
|
|
for (axis=0; axis<3; axis++) {
|
|
|
|
float v1[3]= {0.0, 0.0, 0.0};
|
|
|
|
float v2[3]= {0.0, 0.0, 0.0};
|
|
|
|
int arrow_axis= (axis==0)?1:0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-01-13 15:50:32 +00:00
|
|
|
glBegin(GL_LINES);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-01-13 15:50:32 +00:00
|
|
|
v2[axis]= size;
|
|
|
|
glVertex3fv(v1);
|
|
|
|
glVertex3fv(v2);
|
|
|
|
|
|
|
|
v1[axis]= size*0.8;
|
|
|
|
v1[arrow_axis]= -size*0.125;
|
|
|
|
glVertex3fv(v1);
|
|
|
|
glVertex3fv(v2);
|
|
|
|
|
|
|
|
v1[arrow_axis]= size*0.125;
|
|
|
|
glVertex3fv(v1);
|
|
|
|
glVertex3fv(v2);
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
v2[axis]+= size*0.125;
|
|
|
|
glRasterPos3fv(v2);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-01-13 15:50:32 +00:00
|
|
|
// patch for 3d cards crashing on glSelect for text drawing (IBM)
|
|
|
|
if((flag & DRAW_PICKING) == 0) {
|
|
|
|
if (axis==0)
|
|
|
|
BMF_DrawString(G.font, "x");
|
|
|
|
else if (axis==1)
|
|
|
|
BMF_DrawString(G.font, "y");
|
|
|
|
else
|
|
|
|
BMF_DrawString(G.font, "z");
|
|
|
|
}
|
2004-05-10 20:14:21 +00:00
|
|
|
}
|
2006-01-13 15:50:32 +00:00
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* circle for object centers, special_color is for library or ob users */
|
|
|
|
static void drawcentercircle(float *vec, int selstate, int special_color)
|
|
|
|
{
|
|
|
|
View3D *v3d= G.vd;
|
|
|
|
float size;
|
|
|
|
|
|
|
|
size= v3d->persmat[0][3]*vec[0]+ v3d->persmat[1][3]*vec[1]+ v3d->persmat[2][3]*vec[2]+ v3d->persmat[3][3];
|
|
|
|
size*= v3d->pixsize*((float)U.obcenter_dia*0.5f);
|
|
|
|
|
2005-11-27 23:27:14 +00:00
|
|
|
/* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */
|
|
|
|
if(v3d->zbuf) glDepthFunc(GL_ALWAYS);
|
2005-11-19 10:55:07 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
if(special_color) {
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
if (selstate==VERSE) glColor4ub(0x00, 0xFF, 0x00, 155);
|
|
|
|
else if (selstate==ACTIVE || selstate==SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
|
|
|
|
#else
|
2005-11-19 10:55:07 +00:00
|
|
|
if (selstate==ACTIVE || selstate==SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
|
2006-08-20 15:22:56 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
else glColor4ub(0x55, 0xCC, 0xCC, 155);
|
|
|
|
}
|
|
|
|
else {
|
2005-11-27 18:19:00 +00:00
|
|
|
if (selstate == ACTIVE) BIF_ThemeColorShadeAlpha(TH_ACTIVE, 0, -80);
|
|
|
|
else if (selstate == SELECT) BIF_ThemeColorShadeAlpha(TH_SELECT, 0, -80);
|
|
|
|
else if (selstate == DESELECT) BIF_ThemeColorShadeAlpha(TH_TRANSFORM, 0, -80);
|
2005-11-19 10:55:07 +00:00
|
|
|
}
|
|
|
|
drawcircball(GL_POLYGON, vec, size, v3d->viewinv);
|
|
|
|
|
2005-11-27 18:19:00 +00:00
|
|
|
BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -30);
|
2005-11-19 10:55:07 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size, v3d->viewinv);
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
2005-11-27 23:27:14 +00:00
|
|
|
if(v3d->zbuf) glDepthFunc(GL_LEQUAL);
|
2005-11-19 10:55:07 +00:00
|
|
|
}
|
|
|
|
|
2005-03-19 12:17:06 +00:00
|
|
|
|
|
|
|
void drawsolidcube(float size)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
float n[3];
|
|
|
|
|
2005-03-19 12:17:06 +00:00
|
|
|
glPushMatrix();
|
|
|
|
glScalef(size, size, size);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
n[0]=0; n[1]=0; n[2]=0;
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
n[0]= -1.0;
|
|
|
|
glNormal3fv(n);
|
|
|
|
glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
|
|
|
|
n[0]=0;
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
n[1]= -1.0;
|
|
|
|
glNormal3fv(n);
|
|
|
|
glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[1]);
|
|
|
|
n[1]=0;
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
n[0]= 1.0;
|
|
|
|
glNormal3fv(n);
|
|
|
|
glVertex3fv(cube[4]); glVertex3fv(cube[7]); glVertex3fv(cube[6]); glVertex3fv(cube[5]);
|
|
|
|
n[0]=0;
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
n[1]= 1.0;
|
|
|
|
glNormal3fv(n);
|
|
|
|
glVertex3fv(cube[7]); glVertex3fv(cube[3]); glVertex3fv(cube[2]); glVertex3fv(cube[6]);
|
|
|
|
n[1]=0;
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
n[2]= 1.0;
|
|
|
|
glNormal3fv(n);
|
|
|
|
glVertex3fv(cube[1]); glVertex3fv(cube[5]); glVertex3fv(cube[6]); glVertex3fv(cube[2]);
|
|
|
|
n[2]=0;
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
n[2]= -1.0;
|
|
|
|
glNormal3fv(n);
|
|
|
|
glVertex3fv(cube[7]); glVertex3fv(cube[4]); glVertex3fv(cube[0]); glVertex3fv(cube[3]);
|
|
|
|
glEnd();
|
2005-03-19 12:17:06 +00:00
|
|
|
|
|
|
|
glPopMatrix();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void drawcube(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
|
|
|
|
glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
|
|
|
|
glVertex3fv(cube[7]); glVertex3fv(cube[4]);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[1]); glVertex3fv(cube[5]);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[2]); glVertex3fv(cube[6]);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[3]); glVertex3fv(cube[7]);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static void drawcube_size(float *size)
|
|
|
|
{
|
|
|
|
|
|
|
|
glPushMatrix();
|
|
|
|
glScalef(size[0], size[1], size[2]);
|
|
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
|
|
|
|
glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
|
|
|
|
glVertex3fv(cube[7]); glVertex3fv(cube[4]);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[1]); glVertex3fv(cube[5]);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[2]); glVertex3fv(cube[6]);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(cube[3]); glVertex3fv(cube[7]);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glPopMatrix();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
static void drawshadbuflimits(Lamp *la, float mat[][4])
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
float sta[3], end[3], lavec[3];
|
|
|
|
|
|
|
|
lavec[0]= -mat[2][0];
|
|
|
|
lavec[1]= -mat[2][1];
|
|
|
|
lavec[2]= -mat[2][2];
|
|
|
|
Normalise(lavec);
|
|
|
|
|
|
|
|
sta[0]= mat[3][0]+ la->clipsta*lavec[0];
|
|
|
|
sta[1]= mat[3][1]+ la->clipsta*lavec[1];
|
|
|
|
sta[2]= mat[3][2]+ la->clipsta*lavec[2];
|
|
|
|
|
|
|
|
end[0]= mat[3][0]+ la->clipend*lavec[0];
|
|
|
|
end[1]= mat[3][1]+ la->clipend*lavec[1];
|
|
|
|
end[2]= mat[3][2]+ la->clipend*lavec[2];
|
|
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(sta);
|
|
|
|
glVertex3fv(end);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glPointSize(3.0);
|
2004-07-10 21:35:17 +00:00
|
|
|
bglBegin(GL_POINTS);
|
|
|
|
bglVertex3fv(sta);
|
|
|
|
bglVertex3fv(end);
|
|
|
|
bglEnd();
|
2002-10-12 11:37:38 +00:00
|
|
|
glPointSize(1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void spotvolume(float *lvec, float *vvec, float inp)
|
|
|
|
{
|
2003-04-28 14:43:20 +00:00
|
|
|
/* camera is at 0,0,0 */
|
2006-10-14 23:27:18 +00:00
|
|
|
float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,angle;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
Normalise(lvec);
|
2003-04-28 14:43:20 +00:00
|
|
|
Normalise(vvec); /* is this the correct vector ? */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
Crossf(temp,vvec,lvec); /* equation for a plane through vvec en lvec */
|
|
|
|
Crossf(plane,lvec,temp); /* a plane perpendicular to this, parrallel with lvec */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
Normalise(plane);
|
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* now we've got two equations: one of a cone and one of a plane, but we have
|
|
|
|
three unknowns. We remove one unkown by rotating the plane to z=0 (the plane normal) */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* rotate around cross product vector of (0,0,1) and plane normal, dot product degrees */
|
|
|
|
/* according definition, we derive cross product is (plane[1],-plane[0],0), en cos = plane[2]);*/
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* translating this comment to english didnt really help me understanding the math! :-) (ton) */
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
q[1] = plane[1] ;
|
|
|
|
q[2] = -plane[0] ;
|
|
|
|
q[3] = 0 ;
|
|
|
|
Normalise(&q[1]);
|
|
|
|
|
2006-10-14 23:27:18 +00:00
|
|
|
angle = saacos(plane[2])/2.0;
|
|
|
|
co = cos(angle);
|
2002-10-12 11:37:38 +00:00
|
|
|
si = sqrt(1-co*co);
|
|
|
|
|
|
|
|
q[0] = co;
|
|
|
|
q[1] *= si;
|
|
|
|
q[2] *= si;
|
|
|
|
q[3] = 0;
|
|
|
|
|
|
|
|
QuatToMat3(q,mat1);
|
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* rotate lamp vector now over acos(inp) degrees */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
vvec[0] = lvec[0] ;
|
|
|
|
vvec[1] = lvec[1] ;
|
|
|
|
vvec[2] = lvec[2] ;
|
|
|
|
|
|
|
|
Mat3One(mat2);
|
|
|
|
co = inp;
|
|
|
|
si = sqrt(1-inp*inp);
|
|
|
|
|
|
|
|
mat2[0][0] = co;
|
|
|
|
mat2[1][0] = -si;
|
|
|
|
mat2[0][1] = si;
|
|
|
|
mat2[1][1] = co;
|
|
|
|
Mat3MulMat3(mat3,mat2,mat1);
|
|
|
|
|
|
|
|
mat2[1][0] = si;
|
|
|
|
mat2[0][1] = -si;
|
|
|
|
Mat3MulMat3(mat4,mat2,mat1);
|
|
|
|
Mat3Transp(mat1);
|
|
|
|
|
|
|
|
Mat3MulMat3(mat2,mat1,mat3);
|
|
|
|
Mat3MulVecfl(mat2,lvec);
|
|
|
|
Mat3MulMat3(mat2,mat1,mat4);
|
|
|
|
Mat3MulVecfl(mat2,vvec);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void drawlamp(Object *ob)
|
|
|
|
{
|
|
|
|
Lamp *la;
|
2005-11-19 10:55:07 +00:00
|
|
|
View3D *v3d= G.vd;
|
|
|
|
float vec[3], lvec[3], vvec[3], circrad, x,y,z;
|
|
|
|
float pixsize, lampsize;
|
|
|
|
float imat[4][4], curcol[4];
|
|
|
|
char col[4];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
la= ob->data;
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* we first draw only the screen aligned & fixed scale stuff */
|
|
|
|
glPushMatrix();
|
|
|
|
myloadmatrix(G.vd->viewmat);
|
|
|
|
|
|
|
|
/* lets calculate the scale: */
|
|
|
|
pixsize= v3d->persmat[0][3]*ob->obmat[3][0]+ v3d->persmat[1][3]*ob->obmat[3][1]+ v3d->persmat[2][3]*ob->obmat[3][2]+ v3d->persmat[3][3];
|
|
|
|
pixsize*= v3d->pixsize;
|
|
|
|
lampsize= pixsize*((float)U.obcenter_dia*0.5f);
|
|
|
|
|
|
|
|
/* and view aligned matrix: */
|
|
|
|
Mat4CpyMat4(imat, G.vd->viewinv);
|
|
|
|
Normalise(imat[0]);
|
|
|
|
Normalise(imat[1]);
|
|
|
|
|
|
|
|
/* for AA effects */
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, curcol);
|
|
|
|
curcol[3]= 0.6;
|
|
|
|
glColor4fv(curcol);
|
|
|
|
|
|
|
|
if(ob->id.us>1) {
|
|
|
|
if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
|
|
|
|
else glColor4ub(0x77, 0xCC, 0xCC, 155);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Inner Circle */
|
|
|
|
VECCOPY(vec, ob->obmat[3]);
|
|
|
|
glEnable(GL_BLEND);
|
2005-12-20 14:04:41 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
|
2005-11-19 10:55:07 +00:00
|
|
|
glDisable(GL_BLEND);
|
2005-12-20 14:04:41 +00:00
|
|
|
drawcircball(GL_POLYGON, vec, lampsize, imat);
|
2005-11-19 10:55:07 +00:00
|
|
|
|
|
|
|
/* restore */
|
|
|
|
if(ob->id.us>1)
|
|
|
|
glColor4fv(curcol);
|
|
|
|
|
|
|
|
/* Outer circle */
|
|
|
|
circrad = 3.0f*lampsize;
|
|
|
|
drawcircball(GL_LINE_LOOP, vec, circrad, imat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
setlinestyle(3);
|
|
|
|
|
2005-11-19 17:47:45 +00:00
|
|
|
/* draw dashed outer circle if shadow is on. remember some lamps can't have certain shadows! */
|
|
|
|
if (la->type!=LA_HEMI) {
|
|
|
|
if ((la->mode & LA_SHAD_RAY) ||
|
2006-10-14 10:21:19 +00:00
|
|
|
((la->mode & LA_SHAD_BUF) && (la->type==LA_SPOT)) )
|
2005-11-19 17:47:45 +00:00
|
|
|
{
|
|
|
|
drawcircball(GL_LINE_LOOP, vec, circrad + 3.0f*pixsize, imat);
|
|
|
|
}
|
2005-11-19 10:55:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw the pretty sun rays */
|
|
|
|
if(la->type==LA_SUN) {
|
|
|
|
float v1[3], v2[3], mat[3][3];
|
|
|
|
short axis;
|
|
|
|
|
|
|
|
/* setup a 45 degree rotation matrix */
|
|
|
|
VecRotToMat3(imat[2], M_PI/4.0f, mat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* vectors */
|
|
|
|
VECCOPY(v1, imat[0]);
|
|
|
|
VecMulf(v1, circrad*1.2f);
|
|
|
|
VECCOPY(v2, imat[0]);
|
|
|
|
VecMulf(v2, circrad*2.5f);
|
|
|
|
|
|
|
|
/* center */
|
|
|
|
glTranslatef(vec[0], vec[1], vec[2]);
|
|
|
|
|
|
|
|
setlinestyle(3);
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
for (axis=0; axis<8; axis++) {
|
|
|
|
glVertex3fv(v1);
|
|
|
|
glVertex3fv(v2);
|
|
|
|
Mat3MulVecfl(mat, v1);
|
|
|
|
Mat3MulVecfl(mat, v2);
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glTranslatef(-vec[0], -vec[1], -vec[2]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (la->type==LA_LOCAL) {
|
|
|
|
if(la->mode & LA_SPHERE) {
|
|
|
|
drawcircball(GL_LINE_LOOP, vec, la->dist, imat);
|
|
|
|
}
|
|
|
|
/* yafray: for photonlight also draw lightcone as for spot */
|
|
|
|
}
|
|
|
|
|
|
|
|
glPopMatrix(); /* back in object space */
|
|
|
|
vec[0]= vec[1]= vec[2]= 0.0f;
|
|
|
|
|
|
|
|
if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
lvec[0]=lvec[1]= 0.0;
|
|
|
|
lvec[2] = 1.0;
|
|
|
|
x = G.vd->persmat[0][2];
|
|
|
|
y = G.vd->persmat[1][2];
|
|
|
|
z = G.vd->persmat[2][2];
|
|
|
|
vvec[0]= x*ob->obmat[0][0] + y*ob->obmat[0][1] + z*ob->obmat[0][2];
|
|
|
|
vvec[1]= x*ob->obmat[1][0] + y*ob->obmat[1][1] + z*ob->obmat[1][2];
|
|
|
|
vvec[2]= x*ob->obmat[2][0] + y*ob->obmat[2][1] + z*ob->obmat[2][2];
|
|
|
|
|
|
|
|
y = cos( M_PI*la->spotsize/360.0 );
|
|
|
|
spotvolume(lvec, vvec, y);
|
|
|
|
x = -la->dist;
|
|
|
|
lvec[0] *= x ;
|
|
|
|
lvec[1] *= x ;
|
|
|
|
lvec[2] *= x;
|
|
|
|
vvec[0] *= x ;
|
|
|
|
vvec[1] *= x ;
|
|
|
|
vvec[2] *= x;
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* draw the angled sides of the cone */
|
2002-10-12 11:37:38 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(vvec);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glVertex3fv(lvec);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
z = x*sqrt(1.0 - y*y);
|
|
|
|
x *= y;
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* draw the circle/square at the end of the cone */
|
|
|
|
glTranslatef(0.0, 0.0 , x);
|
2002-10-12 11:37:38 +00:00
|
|
|
if(la->mode & LA_SQUARE) {
|
|
|
|
vvec[0]= fabs(z);
|
|
|
|
vvec[1]= fabs(z);
|
|
|
|
vvec[2]= 0.0;
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
glVertex3fv(vvec);
|
|
|
|
vvec[1]= -fabs(z);
|
|
|
|
glVertex3fv(vvec);
|
|
|
|
vvec[0]= -fabs(z);
|
|
|
|
glVertex3fv(vvec);
|
|
|
|
vvec[1]= fabs(z);
|
|
|
|
glVertex3fv(vvec);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
else circ(0.0, 0.0, fabs(z));
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* draw the circle/square representing spotbl */
|
|
|
|
if(la->type==LA_SPOT) {
|
|
|
|
float spotblcirc = fabs(z)*(1 - pow(la->spotblend, 2));
|
|
|
|
/* make sure the line is always visible - prevent it from reaching the outer border (or 0)
|
|
|
|
* values are kinda arbitrary - just what seemed to work well */
|
|
|
|
if (spotblcirc == 0) spotblcirc = 0.15;
|
|
|
|
else if (spotblcirc == fabs(z)) spotblcirc = fabs(z) - 0.07;
|
|
|
|
circ(0.0, 0.0, spotblcirc);
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if ELEM(la->type, LA_HEMI, LA_SUN) {
|
2005-11-19 10:55:07 +00:00
|
|
|
|
|
|
|
/* draw the line from the circle along the dist */
|
2002-10-12 11:37:38 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
2005-11-19 10:55:07 +00:00
|
|
|
vec[2] = -circrad;
|
2002-10-12 11:37:38 +00:00
|
|
|
glVertex3fv(vec);
|
|
|
|
vec[2]= -la->dist;
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glEnd();
|
2005-11-19 10:55:07 +00:00
|
|
|
|
|
|
|
if(la->type==LA_HEMI) {
|
|
|
|
/* draw the hemisphere curves */
|
|
|
|
short axis, steps, dir;
|
|
|
|
float outdist, zdist, mul;
|
|
|
|
vec[0]=vec[1]=vec[2]= 0.0;
|
2005-11-19 17:47:45 +00:00
|
|
|
outdist = 0.14; mul = 1.4; dir = 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
setlinestyle(4);
|
|
|
|
/* loop over the 4 compass points, and draw each arc as a LINE_STRIP */
|
|
|
|
for (axis=0; axis<4; axis++) {
|
|
|
|
float v[3]= {0.0, 0.0, 0.0};
|
|
|
|
zdist = 0.02;
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
|
|
|
|
for (steps=0; steps<6; steps++) {
|
|
|
|
if (axis == 0 || axis == 1) { /* x axis up, x axis down */
|
|
|
|
/* make the arcs start at the edge of the energy circle */
|
|
|
|
if (steps == 0) v[0] = dir*circrad;
|
|
|
|
else v[0] = v[0] + dir*(steps*outdist);
|
|
|
|
} else if (axis == 2 || axis == 3) { /* y axis up, y axis down */
|
|
|
|
/* make the arcs start at the edge of the energy circle */
|
|
|
|
if (steps == 0) v[1] = dir*circrad;
|
|
|
|
else v[1] = v[1] + dir*(steps*outdist);
|
|
|
|
}
|
|
|
|
|
|
|
|
v[2] = v[2] - steps*zdist;
|
|
|
|
|
|
|
|
glVertex3fv(v);
|
|
|
|
|
|
|
|
zdist = zdist * mul;
|
|
|
|
}
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
/* flip the direction */
|
|
|
|
dir = -dir;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-11-19 10:55:07 +00:00
|
|
|
} else if(la->type==LA_AREA) {
|
|
|
|
setlinestyle(3);
|
|
|
|
if(la->area_shape==LA_AREA_SQUARE)
|
|
|
|
fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
|
|
|
|
else if(la->area_shape==LA_AREA_RECT)
|
|
|
|
fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3f(0.0,0.0,-circrad);
|
|
|
|
glVertex3f(0.0,0.0,-la->dist);
|
|
|
|
glEnd();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* and back to viewspace */
|
|
|
|
myloadmatrix(G.vd->viewmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
VECCOPY(vec, ob->obmat[3]);
|
2005-11-19 10:55:07 +00:00
|
|
|
|
|
|
|
setlinestyle(0);
|
|
|
|
|
2006-10-14 10:21:19 +00:00
|
|
|
if(la->type==LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
|
2005-11-19 10:55:07 +00:00
|
|
|
drawshadbuflimits(la, ob->obmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
BIF_GetThemeColor4ubv(TH_LAMP, col);
|
|
|
|
glColor4ub(col[0], col[1], col[2], col[3]);
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
if (vec[2]>0) vec[2] -= circrad;
|
|
|
|
else vec[2] += circrad;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
vec[2]= 0;
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glEnd();
|
2005-03-27 20:39:28 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
glPointSize(2.0);
|
|
|
|
glBegin(GL_POINTS);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glEnd();
|
|
|
|
glPointSize(1.0);
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
2006-08-11 09:09:50 +00:00
|
|
|
/* restore for drawing extra stuff */
|
|
|
|
glColor3fv(curcol);
|
2005-11-19 10:55:07 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void draw_limit_line(float sta, float end, unsigned int col)
|
|
|
|
{
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3f(0.0, 0.0, -sta);
|
|
|
|
glVertex3f(0.0, 0.0, -end);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glPointSize(3.0);
|
|
|
|
glBegin(GL_POINTS);
|
|
|
|
cpack(col);
|
|
|
|
glVertex3f(0.0, 0.0, -sta);
|
|
|
|
glVertex3f(0.0, 0.0, -end);
|
|
|
|
glEnd();
|
|
|
|
glPointSize(1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-13 19:22:41 +00:00
|
|
|
/* yafray: draw camera focus point (cross, similar to aqsis code in tuhopuu) */
|
|
|
|
static void draw_focus_cross(float dist, float size)
|
|
|
|
{
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3f(-size, 0.f, -dist);
|
|
|
|
glVertex3f(size, 0.f, -dist);
|
|
|
|
glVertex3f(0.f, -size, -dist);
|
|
|
|
glVertex3f(0.f, size, -dist);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
/* flag similar to draw_object() */
|
|
|
|
static void drawcamera(Object *ob, int flag)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2003-04-28 14:43:20 +00:00
|
|
|
/* a standing up pyramid with (0,0,0) as top */
|
2002-10-12 11:37:38 +00:00
|
|
|
Camera *cam;
|
|
|
|
World *wrld;
|
|
|
|
float vec[8][4], tmat[4][4], fac, facx, facy, depth;
|
2005-11-11 17:26:08 +00:00
|
|
|
int i;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
cam= ob->data;
|
2004-07-21 21:27:14 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
glDisable(GL_CULL_FACE);
|
|
|
|
|
2005-01-30 11:25:27 +00:00
|
|
|
if(G.vd->persp>=2 && cam->type==CAM_ORTHO && ob==G.vd->camera) {
|
|
|
|
facx= 0.5*cam->ortho_scale*1.28;
|
|
|
|
facy= 0.5*cam->ortho_scale*1.024;
|
|
|
|
depth= -cam->clipsta-0.1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fac= cam->drawsize;
|
|
|
|
if(G.vd->persp>=2 && ob==G.vd->camera) fac= cam->clipsta+0.1; /* that way it's always visible */
|
|
|
|
|
|
|
|
depth= - fac*cam->lens/16.0;
|
|
|
|
facx= fac*1.28;
|
|
|
|
facy= fac*1.024;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-01-30 11:25:27 +00:00
|
|
|
vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */
|
2002-10-12 11:37:38 +00:00
|
|
|
vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth;
|
|
|
|
vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth;
|
|
|
|
vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth;
|
|
|
|
vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth;
|
|
|
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
glVertex3fv(vec[1]);
|
|
|
|
glVertex3fv(vec[2]);
|
|
|
|
glVertex3fv(vec[3]);
|
|
|
|
glVertex3fv(vec[4]);
|
|
|
|
glEnd();
|
2005-10-27 11:28:43 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-01-30 11:25:27 +00:00
|
|
|
if(G.vd->persp>=2 && ob==G.vd->camera) return;
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
2002-10-12 11:37:38 +00:00
|
|
|
glVertex3fv(vec[2]);
|
2005-01-30 11:25:27 +00:00
|
|
|
glVertex3fv(vec[0]);
|
2002-10-12 11:37:38 +00:00
|
|
|
glVertex3fv(vec[1]);
|
2005-01-30 11:25:27 +00:00
|
|
|
glVertex3fv(vec[4]);
|
|
|
|
glVertex3fv(vec[0]);
|
|
|
|
glVertex3fv(vec[3]);
|
2002-10-12 11:37:38 +00:00
|
|
|
glEnd();
|
|
|
|
|
2005-10-28 14:19:40 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* arrow on top */
|
2002-10-12 11:37:38 +00:00
|
|
|
vec[0][2]= depth;
|
|
|
|
|
|
|
|
|
2005-11-11 17:26:08 +00:00
|
|
|
/* draw an outline arrow for inactive cameras and filled
|
|
|
|
* for active cameras. We actually draw both outline+filled
|
|
|
|
* for active cameras so the wire can be seen side-on */
|
|
|
|
for (i=0;i<2;i++) {
|
|
|
|
if (i==0) glBegin(GL_LINE_LOOP);
|
|
|
|
else if (i==1 && (ob == G.vd->camera)) glBegin(GL_TRIANGLES);
|
|
|
|
else break;
|
|
|
|
|
2005-10-28 14:19:40 +00:00
|
|
|
vec[0][0]= -0.7*cam->drawsize;
|
|
|
|
vec[0][1]= 1.1*cam->drawsize;
|
2002-10-12 11:37:38 +00:00
|
|
|
glVertex3fv(vec[0]);
|
|
|
|
|
|
|
|
vec[0][0]= 0.0;
|
2005-10-28 14:19:40 +00:00
|
|
|
vec[0][1]= 1.8*cam->drawsize;
|
2002-10-12 11:37:38 +00:00
|
|
|
glVertex3fv(vec[0]);
|
|
|
|
|
2005-10-28 14:19:40 +00:00
|
|
|
vec[0][0]= 0.7*cam->drawsize;
|
|
|
|
vec[0][1]= 1.1*cam->drawsize;
|
2002-10-12 11:37:38 +00:00
|
|
|
glVertex3fv(vec[0]);
|
|
|
|
|
2005-11-11 17:26:08 +00:00
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
if(flag==0) {
|
|
|
|
if(cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
|
|
|
|
myloadmatrix(G.vd->viewmat);
|
|
|
|
Mat4CpyMat4(vec, ob->obmat);
|
|
|
|
Mat4Ortho(vec);
|
|
|
|
mymultmatrix(vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
MTC_Mat4SwapMat4(G.vd->persmat, tmat);
|
|
|
|
mygetsingmatrix(G.vd->persmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
if(cam->flag & CAM_SHOWLIMITS) {
|
|
|
|
draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
|
|
|
|
/* yafray: dof focus point */
|
|
|
|
if (G.scene->r.renderer==R_YAFRAY) draw_focus_cross(cam->YF_dofdist, cam->drawsize);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
wrld= G.scene->world;
|
|
|
|
if(cam->flag & CAM_SHOWMIST)
|
|
|
|
if(wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF);
|
|
|
|
|
|
|
|
MTC_Mat4SwapMat4(G.vd->persmat, tmat);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-08-15 10:30:53 +00:00
|
|
|
BPoint *bp = lt->def;
|
|
|
|
float *co = dl?dl->verts:NULL;
|
|
|
|
int u, v, w;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
BIF_ThemeColor(sel?TH_VERTEX_SELECT:TH_VERTEX);
|
|
|
|
glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
|
2004-07-10 21:35:17 +00:00
|
|
|
bglBegin(GL_POINTS);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
for(w=0; w<lt->pntsw; w++) {
|
|
|
|
int wxt = (w==0 || w==lt->pntsw-1);
|
|
|
|
for(v=0; v<lt->pntsv; v++) {
|
|
|
|
int vxt = (v==0 || v==lt->pntsv-1);
|
|
|
|
for(u=0; u<lt->pntsu; u++, bp++, co+=3) {
|
|
|
|
int uxt = (u==0 || u==lt->pntsu-1);
|
|
|
|
if(!(lt->flag & LT_OUTSIDE) || uxt || vxt || wxt) {
|
|
|
|
if(bp->hide==0) {
|
|
|
|
if((bp->f1 & 1)==sel) {
|
|
|
|
bglVertex3fv(dl?co:bp->vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
glPointSize(1.0);
|
2004-07-10 21:35:17 +00:00
|
|
|
bglEnd();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
void lattice_foreachScreenVert(void (*func)(void *userData, BPoint *bp, int x, int y), void *userData)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
int i, N = editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
|
2005-08-15 10:30:53 +00:00
|
|
|
DispList *dl = find_displist(&G.obedit->disp, DL_VERTS);
|
|
|
|
float *co = dl?dl->verts:NULL;
|
|
|
|
BPoint *bp = editLatt->def;
|
2005-08-20 19:18:35 +00:00
|
|
|
float pmat[4][4], vmat[4][4];
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
short s[2];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_get_object_project_mat(curarea, G.obedit, pmat, vmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
for (i=0; i<N; i++, bp++, co+=3) {
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
if (bp->hide==0) {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, dl?co:bp->vec, s, pmat, vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
func(userData, bp, s[0], s[1]);
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-09-03 12:16:14 +00:00
|
|
|
static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int use_wcol)
|
2005-08-15 10:30:53 +00:00
|
|
|
{
|
|
|
|
int index = ((w*lt->pntsv + v)*lt->pntsu) + u;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-09-03 12:16:14 +00:00
|
|
|
if(use_wcol) {
|
|
|
|
float col[3];
|
|
|
|
MDeformWeight *mdw= get_defweight (lt->dvert+index, use_wcol-1);
|
|
|
|
|
|
|
|
weight_to_rgb(mdw?mdw->weight:0.0f, col, col+1, col+2);
|
|
|
|
glColor3fv(col);
|
|
|
|
}
|
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
if (dl) {
|
|
|
|
glVertex3fv(&dl->verts[index*3]);
|
|
|
|
} else {
|
|
|
|
glVertex3fv(lt->def[index].vec);
|
|
|
|
}
|
|
|
|
}
|
2006-09-03 12:16:14 +00:00
|
|
|
|
|
|
|
/* lattice color is hardcoded, now also shows weightgroup values in edit mode */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void drawlattice(Object *ob)
|
|
|
|
{
|
|
|
|
Lattice *lt;
|
2005-08-15 10:30:53 +00:00
|
|
|
DispList *dl;
|
|
|
|
int u, v, w;
|
2006-09-03 12:16:14 +00:00
|
|
|
int use_wcol= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
lt= (ob==G.obedit)?editLatt:ob->data;
|
|
|
|
dl= find_displist(&ob->disp, DL_VERTS);
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob==G.obedit) {
|
|
|
|
cpack(0x004000);
|
2006-09-03 12:16:14 +00:00
|
|
|
|
|
|
|
if(ob->defbase.first && lt->dvert) {
|
|
|
|
use_wcol= ob->actdef;
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
glBegin(GL_LINES);
|
|
|
|
for(w=0; w<lt->pntsw; w++) {
|
|
|
|
int wxt = (w==0 || w==lt->pntsw-1);
|
|
|
|
for(v=0; v<lt->pntsv; v++) {
|
|
|
|
int vxt = (v==0 || v==lt->pntsv-1);
|
|
|
|
for(u=0; u<lt->pntsu; u++) {
|
|
|
|
int uxt = (u==0 || u==lt->pntsu-1);
|
|
|
|
|
|
|
|
if(w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
|
2006-09-03 12:16:14 +00:00
|
|
|
drawlattice__point(lt, dl, u, v, w-1, use_wcol);
|
|
|
|
drawlattice__point(lt, dl, u, v, w, use_wcol);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-08-15 10:30:53 +00:00
|
|
|
if(v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
|
2006-09-03 12:16:14 +00:00
|
|
|
drawlattice__point(lt, dl, u, v-1, w, use_wcol);
|
|
|
|
drawlattice__point(lt, dl, u, v, w, use_wcol);
|
2005-08-15 10:30:53 +00:00
|
|
|
}
|
|
|
|
if(u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
|
2006-09-03 12:16:14 +00:00
|
|
|
drawlattice__point(lt, dl, u-1, v, w, use_wcol);
|
|
|
|
drawlattice__point(lt, dl, u, v, w, use_wcol);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-08-15 10:30:53 +00:00
|
|
|
}
|
|
|
|
glEnd();
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-09-03 12:16:14 +00:00
|
|
|
/* restoration for weight colors */
|
|
|
|
if(use_wcol)
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob==G.obedit) {
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-15 10:30:53 +00:00
|
|
|
lattice_draw_verts(lt, dl, 0);
|
|
|
|
lattice_draw_verts(lt, dl, 1);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ***************** ******************** */
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
|
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
|
|
|
{
|
2005-08-20 19:18:35 +00:00
|
|
|
struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditVert *eve = EM_get_vert_for_index(index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
short s[2];
|
|
|
|
|
|
|
|
if (eve->h==0) {
|
|
|
|
if (data->clipVerts) {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, co, s, data->pmat, data->vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
} else {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_noclip(curarea, co, s, data->pmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
data->func(data->userData, eve, s[0], s[1], index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
void mesh_foreachScreenVert(void (*func)(void *userData, EditVert *eve, int x, int y, int index), void *userData, int clipVerts)
|
|
|
|
{
|
2005-08-20 19:18:35 +00:00
|
|
|
struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } data;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
DerivedMesh *dm = editmesh_get_derived_cage();
|
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
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
data.func = func;
|
|
|
|
data.userData = userData;
|
|
|
|
data.clipVerts = clipVerts;
|
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
|
|
|
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_get_object_project_mat(curarea, G.obedit, data.pmat, data.vmat);
|
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
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EM_init_index_arrays(1, 0, 0);
|
|
|
|
dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data);
|
|
|
|
EM_free_index_arrays();
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
dm->release(dm);
|
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
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0co, float *v1co)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-08-20 19:18:35 +00:00
|
|
|
struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditEdge *eed = EM_get_edge_for_index(index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
short s[2][2];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
if (eed->h==0) {
|
|
|
|
if (data->clipVerts==1) {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, v0co, s[0], data->pmat, data->vmat);
|
|
|
|
view3d_project_short_clip(curarea, v1co, s[1], data->pmat, data->vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
} else {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_noclip(curarea, v0co, s[0], data->pmat);
|
|
|
|
view3d_project_short_noclip(curarea, v1co, s[1], data->pmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
if (data->clipVerts==2) {
|
|
|
|
if (!(s[0][0]>=0 && s[0][1]>= 0 && s[0][0]<curarea->winx && s[0][1]<curarea->winy))
|
|
|
|
if (!(s[1][0]>=0 && s[1][1]>= 0 && s[1][0]<curarea->winx && s[1][1]<curarea->winy))
|
|
|
|
return;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-03-28 07:10:32 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
data->func(data->userData, eed, s[0][0], s[0][1], s[1][0], s[1][1], index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
void mesh_foreachScreenEdge(void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-08-20 19:18:35 +00:00
|
|
|
struct { void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; int clipVerts; float pmat[4][4], vmat[4][4]; } data;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
DerivedMesh *dm = editmesh_get_derived_cage();
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
|
|
|
data.func = func;
|
|
|
|
data.userData = userData;
|
|
|
|
data.clipVerts = clipVerts;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_get_object_project_mat(curarea, G.obedit, data.pmat, data.vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EM_init_index_arrays(0, 1, 0);
|
|
|
|
dm->foreachMappedEdge(dm, mesh_foreachScreenEdge__mapFunc, &data);
|
|
|
|
EM_free_index_arrays();
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
dm->release(dm);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *no)
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
{
|
2005-08-20 19:18:35 +00:00
|
|
|
struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; float pmat[4][4], vmat[4][4]; } *data = userData;
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditFace *efa = EM_get_face_for_index(index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
short s[2];
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
if (efa && efa->h==0 && efa->fgonf!=EM_FGON) {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, cent, s, data->pmat, data->vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
data->func(data->userData, efa, s[0], s[1], index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
void mesh_foreachScreenFace(void (*func)(void *userData, EditFace *efa, int x, int y, int index), void *userData)
|
2003-06-30 19:51:18 +00:00
|
|
|
{
|
2005-08-20 19:18:35 +00:00
|
|
|
struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; float pmat[4][4], vmat[4][4]; } data;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
DerivedMesh *dm = editmesh_get_derived_cage();
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
|
|
|
data.func = func;
|
|
|
|
data.userData = userData;
|
2004-09-26 17:15:52 +00:00
|
|
|
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_get_object_project_mat(curarea, G.obedit, data.pmat, data.vmat);
|
2003-06-30 19:51:18 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EM_init_index_arrays(0, 0, 1);
|
|
|
|
dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data);
|
|
|
|
EM_free_index_arrays();
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
dm->release(dm);
|
2003-06-30 19:51:18 +00:00
|
|
|
}
|
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
void nurbs_foreachScreenVert(void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y), void *userData)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-08-20 19:18:35 +00:00
|
|
|
float pmat[4][4], vmat[4][4];
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
short s[2];
|
|
|
|
Nurb *nu;
|
|
|
|
int i;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_get_object_project_mat(curarea, G.obedit, pmat, vmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
for (nu= editNurb.first; nu; nu=nu->next) {
|
|
|
|
if((nu->type & 7)==CU_BEZIER) {
|
|
|
|
for (i=0; i<nu->pntsu; i++) {
|
|
|
|
BezTriple *bezt = &nu->bezt[i];
|
|
|
|
|
|
|
|
if(bezt->hide==0) {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, bezt->vec[0], s, pmat, vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
func(userData, nu, NULL, bezt, 0, s[0], s[1]);
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, bezt->vec[1], s, pmat, vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
func(userData, nu, NULL, bezt, 1, s[0], s[1]);
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, bezt->vec[2], s, pmat, vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
func(userData, nu, NULL, bezt, 2, s[0], s[1]);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
for (i=0; i<nu->pntsu*nu->pntsv; i++) {
|
|
|
|
BPoint *bp = &nu->bp[i];
|
|
|
|
|
|
|
|
if(bp->hide==0) {
|
2005-08-20 19:18:35 +00:00
|
|
|
view3d_project_short_clip(curarea, bp->vec, s, pmat, vmat);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
func(userData, nu, bp, NULL, -1, s[0], s[1]);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
/* ************** DRAW MESH ****************** */
|
|
|
|
|
|
|
|
/* First section is all the "simple" draw routines,
|
|
|
|
* ones that just pass some sort of primitive to GL,
|
|
|
|
* with perhaps various options to control lighting,
|
|
|
|
* color, etc.
|
|
|
|
*
|
|
|
|
* These routines should not have user interface related
|
|
|
|
* logic!!!
|
|
|
|
*/
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no)
|
2005-03-26 17:29:37 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditFace *efa = EM_get_face_for_index(index);
|
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
if (efa->h==0 && efa->fgonf!=EM_FGON) {
|
|
|
|
glVertex3fv(cent);
|
|
|
|
glVertex3f( cent[0] + no[0]*G.scene->editbutsize,
|
|
|
|
cent[1] + no[1]*G.scene->editbutsize,
|
|
|
|
cent[2] + no[2]*G.scene->editbutsize);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
}
|
2005-07-23 07:45:39 +00:00
|
|
|
static void draw_dm_face_normals(DerivedMesh *dm) {
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
glBegin(GL_LINES);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, 0);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *no)
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditFace *efa = EM_get_face_for_index(index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
int sel = *((int*) userData);
|
|
|
|
|
|
|
|
if (efa->h==0 && efa->fgonf!=EM_FGON && (efa->f&SELECT)==sel) {
|
|
|
|
bglVertex3fv(cent);
|
|
|
|
}
|
2005-07-23 07:45:39 +00:00
|
|
|
}
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
static void draw_dm_face_centers(DerivedMesh *dm, int sel)
|
|
|
|
{
|
|
|
|
bglBegin(GL_POINTS);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, &sel);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglEnd();
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditVert *eve = EM_get_vert_for_index(index);
|
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
if (eve->h==0) {
|
|
|
|
glVertex3fv(co);
|
|
|
|
|
|
|
|
if (no_f) {
|
|
|
|
glVertex3f( co[0] + no_f[0]*G.scene->editbutsize,
|
|
|
|
co[1] + no_f[1]*G.scene->editbutsize,
|
|
|
|
co[2] + no_f[2]*G.scene->editbutsize);
|
|
|
|
} else {
|
|
|
|
glVertex3f( co[0] + no_s[0]*G.scene->editbutsize/32767.0f,
|
|
|
|
co[1] + no_s[1]*G.scene->editbutsize/32767.0f,
|
|
|
|
co[2] + no_s[2]*G.scene->editbutsize/32767.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-07-23 07:45:39 +00:00
|
|
|
static void draw_dm_vert_normals(DerivedMesh *dm) {
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
glBegin(GL_LINES);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, NULL);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
glEnd();
|
2005-07-23 07:45:39 +00:00
|
|
|
}
|
2005-03-30 00:32:10 +00:00
|
|
|
|
|
|
|
/* Draw verts with color set based on selection */
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditVert *eve = EM_get_vert_for_index(index);
|
2005-03-30 00:32:10 +00:00
|
|
|
int sel = *((int*) userData);
|
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
if (eve->h==0 && (eve->f&SELECT)==sel) {
|
|
|
|
bglVertex3fv(co);
|
|
|
|
}
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
|
|
|
static void draw_dm_verts(DerivedMesh *dm, int sel)
|
|
|
|
{
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglBegin(GL_POINTS);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &sel);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglEnd();
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw edges with color set based on selection */
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditEdge *eed = EM_get_edge_for_index(index);
|
2005-03-30 00:32:10 +00:00
|
|
|
unsigned char **cols = userData;
|
|
|
|
|
|
|
|
if (eed->h==0) {
|
|
|
|
glColor4ubv(cols[(eed->f&SELECT)?1:0]);
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol)
|
|
|
|
{
|
|
|
|
unsigned char *cols[2];
|
|
|
|
cols[0] = baseCol;
|
|
|
|
cols[1] = selCol;
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->drawMappedEdges(dm, draw_dm_edges_sel__setDrawOptions, cols);
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
|
|
|
|
2005-04-03 15:13:38 +00:00
|
|
|
/* Draw edges */
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int draw_dm_edges__setDrawOptions(void *userData, int index)
|
2005-04-03 15:13:38 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
return EM_get_edge_for_index(index)->h==0;
|
2005-04-03 15:13:38 +00:00
|
|
|
}
|
|
|
|
static void draw_dm_edges(DerivedMesh *dm)
|
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->drawMappedEdges(dm, draw_dm_edges__setDrawOptions, NULL);
|
2005-04-03 15:13:38 +00:00
|
|
|
}
|
|
|
|
|
2005-03-30 00:32:10 +00:00
|
|
|
/* Draw edges with color interpolated based on selection */
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
return EM_get_edge_for_index(index)->h==0;
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void draw_dm_edges_sel_interp__setDrawInterpOptions(void *userData, int index, float t)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditEdge *eed = EM_get_edge_for_index(index);
|
2005-03-30 00:32:10 +00:00
|
|
|
unsigned char **cols = userData;
|
|
|
|
unsigned char *col0 = cols[(eed->v1->f&SELECT)?1:0];
|
|
|
|
unsigned char *col1 = cols[(eed->v2->f&SELECT)?1:0];
|
|
|
|
|
|
|
|
glColor4ub( col0[0] + (col1[0]-col0[0])*t,
|
|
|
|
col0[1] + (col1[1]-col0[1])*t,
|
|
|
|
col0[2] + (col1[2]-col0[2])*t,
|
|
|
|
col0[3] + (col1[3]-col0[3])*t);
|
|
|
|
}
|
|
|
|
static void draw_dm_edges_sel_interp(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol)
|
|
|
|
{
|
|
|
|
unsigned char *cols[2];
|
|
|
|
cols[0] = baseCol;
|
|
|
|
cols[1] = selCol;
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->drawMappedEdgesInterp(dm, draw_dm_edges_sel_interp__setDrawOptions, draw_dm_edges_sel_interp__setDrawInterpOptions, cols);
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw only seam edges */
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int draw_dm_edges_seams__setDrawOptions(void *userData, int index)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditEdge *eed = EM_get_edge_for_index(index);
|
|
|
|
|
2005-03-30 00:32:10 +00:00
|
|
|
return (eed->h==0 && eed->seam);
|
|
|
|
}
|
|
|
|
static void draw_dm_edges_seams(DerivedMesh *dm)
|
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, NULL);
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
|
|
|
|
2006-08-31 06:03:24 +00:00
|
|
|
/* Draw only sharp edges */
|
|
|
|
static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index)
|
|
|
|
{
|
|
|
|
EditEdge *eed = EM_get_edge_for_index(index);
|
|
|
|
|
|
|
|
return (eed->h==0 && eed->sharp);
|
|
|
|
}
|
|
|
|
static void draw_dm_edges_sharp(DerivedMesh *dm)
|
|
|
|
{
|
|
|
|
dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-30 00:32:10 +00:00
|
|
|
/* Draw faces with color set based on selection */
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *drawSmooth_r)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditFace *efa = EM_get_face_for_index(index);
|
2005-03-30 00:32:10 +00:00
|
|
|
unsigned char **cols = userData;
|
|
|
|
|
|
|
|
if (efa->h==0) {
|
|
|
|
glColor4ubv(cols[(efa->f&SELECT)?1:0]);
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol)
|
|
|
|
{
|
|
|
|
unsigned char *cols[2];
|
|
|
|
cols[0] = baseCol;
|
|
|
|
cols[1] = selCol;
|
2005-08-23 20:04:10 +00:00
|
|
|
dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, cols, 0);
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int draw_dm_creases__setDrawOptions(void *userData, int index)
|
2005-08-07 02:30:29 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditEdge *eed = EM_get_edge_for_index(index);
|
|
|
|
|
2005-08-07 02:30:29 +00:00
|
|
|
if (eed->h==0 && eed->crease!=0.0) {
|
2006-07-02 11:21:06 +00:00
|
|
|
BIF_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, eed->crease);
|
2005-08-07 02:30:29 +00:00
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void draw_dm_creases(DerivedMesh *dm)
|
|
|
|
{
|
|
|
|
glLineWidth(3.0);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->drawMappedEdges(dm, draw_dm_creases__setDrawOptions, NULL);
|
2005-08-07 02:30:29 +00:00
|
|
|
glLineWidth(1.0);
|
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
/* Second section of routines: Combine first sets to form fancy
|
|
|
|
* drawing routines (for example rendering twice to get overlays).
|
|
|
|
*
|
|
|
|
* Also includes routines that are basic drawing but are too
|
|
|
|
* specialized to be split out (like drawing creases or measurements).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* EditMesh drawing routines*/
|
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
static void draw_em_fancy_verts(EditMesh *em, DerivedMesh *cageDM)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-03-27 20:39:28 +00:00
|
|
|
int sel;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
for (sel=0; sel<2; sel++) {
|
|
|
|
char col[4], fcol[4];
|
|
|
|
int pass;
|
|
|
|
|
|
|
|
BIF_GetThemeColor3ubv(sel?TH_VERTEX_SELECT:TH_VERTEX, col);
|
|
|
|
BIF_GetThemeColor3ubv(sel?TH_FACE_DOT:TH_WIRE, fcol);
|
|
|
|
|
|
|
|
for (pass=0; pass<2; pass++) {
|
|
|
|
float size = BIF_GetThemeValuef(TH_VERTEX_SIZE);
|
|
|
|
float fsize = BIF_GetThemeValuef(TH_FACEDOT_SIZE);
|
|
|
|
|
|
|
|
if (pass==0) {
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf && !(G.vd->flag&V3D_ZBUF_SELECT)) {
|
2005-03-27 20:39:28 +00:00
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
size = (size>2.1?size/2.0:size);
|
|
|
|
fsize = (fsize>2.1?fsize/2.0:fsize);
|
|
|
|
col[3] = fcol[3] = 100;
|
2005-03-26 17:29:37 +00:00
|
|
|
} else {
|
2005-03-27 20:39:28 +00:00
|
|
|
col[3] = fcol[3] = 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(G.scene->selectmode & SCE_SELECT_VERTEX) {
|
|
|
|
glPointSize(size);
|
|
|
|
glColor4ubv(col);
|
2005-03-30 00:32:10 +00:00
|
|
|
draw_dm_verts(cageDM, sel);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
if(G.scene->selectmode & SCE_SELECT_FACE) {
|
|
|
|
glPointSize(fsize);
|
|
|
|
glColor4ubv(fcol);
|
2005-08-08 18:50:47 +00:00
|
|
|
draw_dm_face_centers(cageDM, sel);
|
2004-10-29 15:39:01 +00:00
|
|
|
}
|
2005-03-27 20:39:28 +00:00
|
|
|
|
|
|
|
if (pass==0) {
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) glDepthMask(1);
|
2005-03-26 17:29:37 +00:00
|
|
|
glPointSize(1.0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
static void draw_em_fancy_edges(DerivedMesh *cageDM)
|
2005-03-26 17:29:37 +00:00
|
|
|
{
|
|
|
|
int pass;
|
|
|
|
char wire[4], sel[4];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
/* since this function does transparant... */
|
|
|
|
BIF_GetThemeColor3ubv(TH_EDGE_SELECT, sel);
|
|
|
|
BIF_GetThemeColor3ubv(TH_WIRE, wire);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
for (pass=0; pass<2; pass++) {
|
|
|
|
/* show wires in transparant when no zbuf clipping for select */
|
|
|
|
if (pass==0) {
|
2005-07-13 19:42:08 +00:00
|
|
|
if (G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0) {
|
2005-03-26 17:29:37 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
|
|
|
|
wire[3] = sel[3] = 85;
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
wire[3] = sel[3] = 255;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(G.scene->selectmode == SCE_SELECT_FACE) {
|
2005-03-30 00:32:10 +00:00
|
|
|
draw_dm_edges_sel(cageDM, wire, sel);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
else if( (G.f & G_DRAWEDGES) || (G.scene->selectmode & SCE_SELECT_EDGE) ) {
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
if(cageDM->drawMappedEdgesInterp && (G.scene->selectmode & SCE_SELECT_VERTEX)) {
|
2005-03-26 17:29:37 +00:00
|
|
|
glShadeModel(GL_SMOOTH);
|
2005-03-30 00:32:10 +00:00
|
|
|
draw_dm_edges_sel_interp(cageDM, wire, sel);
|
2005-03-26 17:29:37 +00:00
|
|
|
glShadeModel(GL_FLAT);
|
2005-03-27 20:39:28 +00:00
|
|
|
} else {
|
2005-03-30 00:32:10 +00:00
|
|
|
draw_dm_edges_sel(cageDM, wire, sel);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
else {
|
|
|
|
glColor4ubv(wire);
|
2005-04-03 15:13:38 +00:00
|
|
|
draw_dm_edges(cageDM);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if (pass==0) {
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
/*
|
|
|
|
* draw some debug info about verse mesh (vertex indexes,
|
|
|
|
* face indexes, status of )
|
|
|
|
*/
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
static void draw_verse_debug(Object *ob, EditMesh *em)
|
2006-08-20 15:22:56 +00:00
|
|
|
{
|
|
|
|
struct EditVert *eve=NULL;
|
|
|
|
struct EditFace *efa=NULL;
|
|
|
|
float v1[3], v2[3], v3[3], v4[3], fvec[3], col[3];
|
|
|
|
char val[32];
|
|
|
|
|
|
|
|
if(G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0)
|
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
|
|
|
|
if(G.vd->zbuf) bglPolygonOffset(5.0);
|
|
|
|
|
|
|
|
BIF_GetThemeColor3fv(TH_TEXT, col);
|
|
|
|
/* make color a bit more red */
|
|
|
|
if(col[0]> 0.5) {col[1]*=0.7; col[2]*= 0.7;}
|
|
|
|
else col[0]= col[0]*0.7 + 0.3;
|
|
|
|
glColor3fv(col);
|
|
|
|
|
|
|
|
/* draw IDs of verse vertexes */
|
|
|
|
for(eve = em->verts.first; eve; eve = eve->next) {
|
|
|
|
if(eve->vvert) {
|
|
|
|
VecLerpf(fvec, ob->loc, eve->co, 1.1);
|
|
|
|
glRasterPos3f(fvec[0], fvec[1], fvec[2]);
|
|
|
|
|
|
|
|
sprintf(val, "%d", ((VerseVert*)eve->vvert)->id);
|
|
|
|
BMF_DrawString(G.fonts, val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* draw IDs of verse faces */
|
|
|
|
for(efa = em->faces.first; efa; efa = efa->next) {
|
|
|
|
if(efa->vface) {
|
|
|
|
VECCOPY(v1, efa->v1->co);
|
|
|
|
VECCOPY(v2, efa->v2->co);
|
|
|
|
VECCOPY(v3, efa->v3->co);
|
|
|
|
if(efa->v4) {
|
|
|
|
VECCOPY(v4, efa->v4->co);
|
|
|
|
glRasterPos3f(0.25*(v1[0]+v2[0]+v3[0]+v4[0]),
|
|
|
|
0.25*(v1[1]+v2[1]+v3[1]+v4[1]),
|
|
|
|
0.25*(v1[2]+v2[2]+v3[2]+v4[2]));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
glRasterPos3f((v1[0]+v2[0]+v3[0])/3,
|
|
|
|
(v1[1]+v2[1]+v3[1])/3,
|
|
|
|
(v1[2]+v2[2]+v3[2])/3);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(val, "%d", ((VerseFace*)efa->vface)->id);
|
|
|
|
BMF_DrawString(G.fonts, val);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(G.vd->zbuf) {
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
bglPolygonOffset(0.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-04-29 18:43:17 +00:00
|
|
|
static void draw_em_measure_stats(Object *ob, EditMesh *em)
|
2004-09-25 13:42:31 +00:00
|
|
|
{
|
2004-09-30 22:29:19 +00:00
|
|
|
EditEdge *eed;
|
2005-03-26 17:29:37 +00:00
|
|
|
EditFace *efa;
|
2005-04-29 18:43:17 +00:00
|
|
|
float v1[3], v2[3], v3[3], v4[3];
|
|
|
|
float fvec[3];
|
2005-03-26 17:29:37 +00:00
|
|
|
char val[32]; /* Stores the measurement display text here */
|
2006-03-27 14:57:53 +00:00
|
|
|
char conv_float[5]; /* Use a float conversion matching the grid size */
|
2005-03-26 17:29:37 +00:00
|
|
|
float area, col[3]; /* area of the face, colour of the text to draw */
|
|
|
|
|
2006-03-27 14:57:53 +00:00
|
|
|
/* make the precission of the pronted value proportionate to the gridsize */
|
|
|
|
if ((G.vd->grid) < 0.01)
|
|
|
|
strcpy(conv_float, "%.6f");
|
|
|
|
else if ((G.vd->grid) < 0.1)
|
|
|
|
strcpy(conv_float, "%.5f");
|
|
|
|
else if ((G.vd->grid) < 1.0)
|
|
|
|
strcpy(conv_float, "%.4f");
|
|
|
|
else if ((G.vd->grid) < 10.0)
|
|
|
|
strcpy(conv_float, "%.3f");
|
|
|
|
else
|
|
|
|
strcpy(conv_float, "%.2f");
|
|
|
|
|
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0)
|
2005-03-26 17:29:37 +00:00
|
|
|
glDisable(GL_DEPTH_TEST);
|
2004-09-30 22:29:19 +00:00
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) bglPolygonOffset(5.0);
|
2004-09-30 22:29:19 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(G.f & G_DRAW_EDGELEN) {
|
|
|
|
BIF_GetThemeColor3fv(TH_TEXT, col);
|
|
|
|
/* make color a bit more red */
|
|
|
|
if(col[0]> 0.5) {col[1]*=0.7; col[2]*= 0.7;}
|
|
|
|
else col[0]= col[0]*0.7 + 0.3;
|
|
|
|
glColor3fv(col);
|
2004-09-30 22:29:19 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
2006-09-27 18:08:54 +00:00
|
|
|
/* draw non fgon edges, or selected edges, or edges next to selected verts while draging */
|
|
|
|
if((eed->h != EM_FGON) && ((eed->f & SELECT) || (G.moving && ((eed->v1->f & SELECT) || (eed->v2->f & SELECT)) ))) {
|
2005-04-29 18:43:17 +00:00
|
|
|
VECCOPY(v1, eed->v1->co);
|
|
|
|
VECCOPY(v2, eed->v2->co);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
glRasterPos3f( 0.5*(v1[0]+v2[0]), 0.5*(v1[1]+v2[1]), 0.5*(v1[2]+v2[2]));
|
2005-04-29 18:43:17 +00:00
|
|
|
|
|
|
|
if(G.vd->flag & V3D_GLOBAL_STATS) {
|
|
|
|
Mat4MulVecfl(ob->obmat, v1);
|
|
|
|
Mat4MulVecfl(ob->obmat, v2);
|
|
|
|
}
|
|
|
|
|
2006-03-27 14:57:53 +00:00
|
|
|
sprintf(val, conv_float, VecLenf(v1, v2));
|
2005-03-26 17:29:37 +00:00
|
|
|
BMF_DrawString( G.fonts, val);
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(G.f & G_DRAW_FACEAREA) {
|
2005-04-28 15:41:09 +00:00
|
|
|
extern int faceselectedOR(EditFace *efa, int flag); // editmesh.h shouldn't be in this file... ok for now?
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
BIF_GetThemeColor3fv(TH_TEXT, col);
|
|
|
|
/* make color a bit more green */
|
|
|
|
if(col[1]> 0.5) {col[0]*=0.7; col[2]*= 0.7;}
|
|
|
|
else col[1]= col[1]*0.7 + 0.3;
|
|
|
|
glColor3fv(col);
|
|
|
|
|
|
|
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
2005-04-28 15:41:09 +00:00
|
|
|
if((efa->f & SELECT) || (G.moving && faceselectedOR(efa, SELECT)) ) {
|
2005-04-29 18:43:17 +00:00
|
|
|
VECCOPY(v1, efa->v1->co);
|
|
|
|
VECCOPY(v2, efa->v2->co);
|
2005-06-01 18:36:58 +00:00
|
|
|
VECCOPY(v3, efa->v3->co);
|
2005-04-29 18:43:17 +00:00
|
|
|
if (efa->v4) {
|
|
|
|
VECCOPY(v4, efa->v4->co);
|
|
|
|
}
|
|
|
|
if(G.vd->flag & V3D_GLOBAL_STATS) {
|
|
|
|
Mat4MulVecfl(ob->obmat, v1);
|
|
|
|
Mat4MulVecfl(ob->obmat, v2);
|
|
|
|
Mat4MulVecfl(ob->obmat, v3);
|
|
|
|
if (efa->v4) Mat4MulVecfl(ob->obmat, v4);
|
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if (efa->v4)
|
2005-04-29 18:43:17 +00:00
|
|
|
area= AreaQ3Dfl(v1, v2, v3, v4);
|
2005-03-26 17:29:37 +00:00
|
|
|
else
|
2005-04-29 18:43:17 +00:00
|
|
|
area = AreaT3Dfl(v1, v2, v3);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2006-03-27 14:57:53 +00:00
|
|
|
sprintf(val, conv_float, area);
|
2005-03-26 17:29:37 +00:00
|
|
|
glRasterPos3fv(efa->cent);
|
|
|
|
BMF_DrawString( G.fonts, val);
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(G.f & G_DRAW_EDGEANG) {
|
|
|
|
EditEdge *e1, *e2, *e3, *e4;
|
2004-09-30 22:29:19 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
BIF_GetThemeColor3fv(TH_TEXT, col);
|
|
|
|
/* make color a bit more blue */
|
|
|
|
if(col[2]> 0.5) {col[0]*=0.7; col[1]*= 0.7;}
|
|
|
|
else col[2]= col[2]*0.7 + 0.3;
|
|
|
|
glColor3fv(col);
|
|
|
|
|
|
|
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
2005-04-29 18:43:17 +00:00
|
|
|
VECCOPY(v1, efa->v1->co);
|
|
|
|
VECCOPY(v2, efa->v2->co);
|
|
|
|
VECCOPY(v3, efa->v3->co);
|
|
|
|
if(efa->v4) {
|
|
|
|
VECCOPY(v4, efa->v4->co);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(v4, v3);
|
|
|
|
}
|
|
|
|
if(G.vd->flag & V3D_GLOBAL_STATS) {
|
|
|
|
Mat4MulVecfl(ob->obmat, v1);
|
|
|
|
Mat4MulVecfl(ob->obmat, v2);
|
|
|
|
Mat4MulVecfl(ob->obmat, v3);
|
|
|
|
if (efa->v4) Mat4MulVecfl(ob->obmat, v4);
|
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
e1= efa->e1;
|
|
|
|
e2= efa->e2;
|
|
|
|
e3= efa->e3;
|
|
|
|
if(efa->e4) e4= efa->e4; else e4= e3;
|
2004-09-30 22:29:19 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
/* Calculate the angles */
|
2004-09-30 22:29:19 +00:00
|
|
|
|
2005-04-28 15:41:09 +00:00
|
|
|
if( (e4->f & e1->f & SELECT) || (G.moving && (efa->v1->f & SELECT)) ) {
|
2005-03-26 17:29:37 +00:00
|
|
|
/* Vec 1 */
|
|
|
|
sprintf(val,"%.3f", VecAngle3(v4, v1, v2));
|
2005-08-08 18:50:47 +00:00
|
|
|
VecLerpf(fvec, efa->cent, efa->v1->co, 0.8);
|
2005-03-26 17:29:37 +00:00
|
|
|
glRasterPos3fv(fvec);
|
|
|
|
BMF_DrawString( G.fonts, val);
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
2005-04-28 15:41:09 +00:00
|
|
|
if( (e1->f & e2->f & SELECT) || (G.moving && (efa->v2->f & SELECT)) ) {
|
2005-03-26 17:29:37 +00:00
|
|
|
/* Vec 2 */
|
|
|
|
sprintf(val,"%.3f", VecAngle3(v1, v2, v3));
|
2005-08-08 18:50:47 +00:00
|
|
|
VecLerpf(fvec, efa->cent, efa->v2->co, 0.8);
|
2005-03-26 17:29:37 +00:00
|
|
|
glRasterPos3fv(fvec);
|
|
|
|
BMF_DrawString( G.fonts, val);
|
|
|
|
}
|
2005-04-28 15:41:09 +00:00
|
|
|
if( (e2->f & e3->f & SELECT) || (G.moving && (efa->v3->f & SELECT)) ) {
|
2005-03-26 17:29:37 +00:00
|
|
|
/* Vec 3 */
|
|
|
|
if(efa->v4)
|
|
|
|
sprintf(val,"%.3f", VecAngle3(v2, v3, v4));
|
|
|
|
else
|
|
|
|
sprintf(val,"%.3f", VecAngle3(v2, v3, v1));
|
2005-08-08 18:50:47 +00:00
|
|
|
VecLerpf(fvec, efa->cent, efa->v3->co, 0.8);
|
2005-03-26 17:29:37 +00:00
|
|
|
glRasterPos3fv(fvec);
|
|
|
|
BMF_DrawString( G.fonts, val);
|
|
|
|
}
|
|
|
|
/* Vec 4 */
|
|
|
|
if(efa->v4) {
|
2005-04-28 15:41:09 +00:00
|
|
|
if( (e3->f & e4->f & SELECT) || (G.moving && (efa->v4->f & SELECT)) ) {
|
2005-03-26 17:29:37 +00:00
|
|
|
sprintf(val,"%.3f", VecAngle3(v3, v4, v1));
|
2005-08-08 18:50:47 +00:00
|
|
|
VecLerpf(fvec, efa->cent, efa->v4->co, 0.8);
|
2005-03-26 17:29:37 +00:00
|
|
|
glRasterPos3fv(fvec);
|
|
|
|
BMF_DrawString( G.fonts, val);
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) {
|
2005-03-26 17:29:37 +00:00
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
bglPolygonOffset(0.0);
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth_r)
|
|
|
|
{
|
|
|
|
EditFace *efa = EM_get_face_for_index(index);
|
|
|
|
|
|
|
|
if (efa->h==0) {
|
2005-08-20 18:38:33 +00:00
|
|
|
set_gl_material(efa->mat_nr+1);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, int dt)
|
2005-03-26 17:29:37 +00:00
|
|
|
{
|
|
|
|
Mesh *me = ob->data;
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EM_init_index_arrays(1, 1, 1);
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(dt>OB_WIRE) {
|
|
|
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
|
|
|
|
|
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
|
2005-03-27 20:39:28 +00:00
|
|
|
|
2005-08-23 20:04:10 +00:00
|
|
|
finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
glFrontFace(GL_CCW);
|
|
|
|
glDisable(GL_LIGHTING);
|
2005-07-14 12:44:33 +00:00
|
|
|
|
|
|
|
// Setup for drawing wire over, disable zbuffer
|
|
|
|
// write to show selected edge wires better
|
2005-03-26 17:29:37 +00:00
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
|
|
|
|
bglPolygonOffset(1.0);
|
|
|
|
glDepthMask(0);
|
2005-07-14 12:44:33 +00:00
|
|
|
}
|
|
|
|
else {
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
if (cageDM!=finalDM) {
|
2005-03-26 17:29:37 +00:00
|
|
|
BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
|
2005-08-14 10:35:58 +00:00
|
|
|
finalDM->drawEdges(finalDM, 1);
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
2005-07-14 12:44:33 +00:00
|
|
|
|
2005-12-19 15:55:26 +00:00
|
|
|
if((G.f & (G_FACESELECT+G_DRAWFACES))) { /* transp faces */
|
2005-03-26 17:29:37 +00:00
|
|
|
char col1[4], col2[4];
|
|
|
|
|
|
|
|
BIF_GetThemeColor4ubv(TH_FACE, col1);
|
|
|
|
BIF_GetThemeColor4ubv(TH_FACE_SELECT, col2);
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glDepthMask(0); // disable write in zbuffer, needed for nice transp
|
|
|
|
|
2005-03-30 00:32:10 +00:00
|
|
|
draw_dm_faces_sel(cageDM, col1, col2);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glDepthMask(1); // restore write in zbuffer
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
/* here starts all fancy draw-extra over */
|
|
|
|
|
|
|
|
if(G.f & G_DRAWSEAMS) {
|
|
|
|
BIF_ThemeColor(TH_EDGE_SEAM);
|
|
|
|
glLineWidth(2);
|
|
|
|
|
2005-03-30 00:32:10 +00:00
|
|
|
draw_dm_edges_seams(cageDM);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
glColor3ub(0,0,0);
|
|
|
|
glLineWidth(1);
|
|
|
|
}
|
2006-08-31 06:03:24 +00:00
|
|
|
|
|
|
|
if(G.f & G_DRAWSHARP) {
|
|
|
|
glColor3ub(255, 32, 32); /* todo, make theme-able */
|
|
|
|
glLineWidth(2);
|
|
|
|
|
|
|
|
draw_dm_edges_sharp(cageDM);
|
|
|
|
|
|
|
|
glColor3ub(0,0,0);
|
|
|
|
glLineWidth(1);
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
if(G.f & G_DRAWCREASES) {
|
2005-08-07 02:30:29 +00:00
|
|
|
draw_dm_creases(cageDM);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
2006-07-02 11:21:06 +00:00
|
|
|
draw_em_fancy_edges(cageDM);
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(ob==G.obedit) {
|
2006-11-06 01:08:26 +00:00
|
|
|
retopo_matrix_update(G.vd);
|
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
draw_em_fancy_verts(em, cageDM);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
if(G.f & G_DRAWNORMALS) {
|
|
|
|
BIF_ThemeColor(TH_NORMAL);
|
2005-07-23 07:45:39 +00:00
|
|
|
draw_dm_face_normals(cageDM);
|
|
|
|
}
|
|
|
|
if(G.f & G_DRAW_VNORMALS) {
|
|
|
|
BIF_ThemeColor(TH_NORMAL);
|
|
|
|
draw_dm_vert_normals(cageDM);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(G.f & (G_DRAW_EDGELEN|G_DRAW_FACEAREA|G_DRAW_EDGEANG))
|
2005-04-29 18:43:17 +00:00
|
|
|
draw_em_measure_stats(ob, em);
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
if(em->vnode && (G.f & G_DRAW_VERSE_DEBUG))
|
|
|
|
draw_verse_debug(ob, em);
|
|
|
|
#endif
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(dt>OB_WIRE) {
|
|
|
|
glDepthMask(1);
|
|
|
|
bglPolygonOffset(0.0);
|
|
|
|
}
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
|
|
|
|
EM_free_index_arrays();
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
/* Mesh drawing routines */
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
static void draw_mesh_object_outline(Object *ob, DerivedMesh *dm)
|
2004-10-12 15:23:00 +00:00
|
|
|
{
|
2005-07-14 12:44:33 +00:00
|
|
|
|
|
|
|
if(G.vd->transp==0) { // not when we draw the transparent pass
|
|
|
|
glLineWidth(2.0);
|
|
|
|
glDepthMask(0);
|
|
|
|
|
|
|
|
/* if transparent, we cannot draw the edges for solid select... edges have no material info.
|
|
|
|
drawFacesSolid() doesn't draw the transparent faces */
|
|
|
|
if(ob->dtx & OB_DRAWTRANSP) {
|
|
|
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
|
|
|
dm->drawFacesSolid(dm, set_gl_material);
|
|
|
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
|
|
|
}
|
2005-08-14 10:35:58 +00:00
|
|
|
else {
|
|
|
|
dm->drawEdges(dm, 0);
|
|
|
|
}
|
2005-07-14 12:44:33 +00:00
|
|
|
|
|
|
|
glLineWidth(1.0);
|
|
|
|
glDepthMask(1);
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 13:49:55 +00:00
|
|
|
static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
|
|
|
|
{
|
|
|
|
*drawSmooth_r = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-11-03 06:39:58 +00:00
|
|
|
static void draw_mesh_fancy(Base *base, DerivedMesh *baseDM, DerivedMesh *dm, int dt, int flag)
|
2005-03-26 17:29:37 +00:00
|
|
|
{
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
Object *ob= base->object;
|
2005-03-26 17:29:37 +00:00
|
|
|
Mesh *me = ob->data;
|
|
|
|
Material *ma= give_current_material(ob, 1);
|
|
|
|
int hasHaloMat = (ma && (ma->mode&MA_HALO));
|
|
|
|
int draw_wire = ob->dtx&OB_DRAWWIRE;
|
2006-08-20 15:22:56 +00:00
|
|
|
int totvert, totedge, totface;
|
2005-03-31 15:57:18 +00:00
|
|
|
DispList *dl;
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
if(me->vnode) {
|
|
|
|
struct VNode *vnode = (VNode*)me->vnode;
|
|
|
|
struct VLayer *vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
|
|
|
|
struct VLayer *face_vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
|
|
|
|
|
|
|
|
if(vert_vlayer) totvert = vert_vlayer->dl.da.count;
|
|
|
|
else totvert = 0;
|
|
|
|
totedge = 0; /* total count of edge needn't to be zero, but verse doesn't know edges */
|
|
|
|
if(face_vlayer) totface = face_vlayer->dl.da.count;
|
|
|
|
else totface = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
totvert = me->totvert;
|
|
|
|
totedge = me->totedge;
|
|
|
|
totface = me->totface;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
totvert = me->totvert;
|
|
|
|
totedge = me->totedge;
|
|
|
|
totface = me->totface;
|
|
|
|
#endif
|
2005-05-26 21:00:50 +00:00
|
|
|
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
// Unwanted combination.
|
2005-12-19 15:55:26 +00:00
|
|
|
if (ob==OBACT && (G.f&G_FACESELECT)) draw_wire = 0;
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-07-26 02:44:59 +00:00
|
|
|
if(dt==OB_BOUNDBOX) {
|
2005-03-26 17:29:37 +00:00
|
|
|
draw_bounding_volume(ob);
|
|
|
|
}
|
2006-08-20 15:22:56 +00:00
|
|
|
else if(hasHaloMat || (totface==0 && totedge==0)) {
|
2005-03-26 17:29:37 +00:00
|
|
|
glPointSize(1.5);
|
2005-03-27 20:39:28 +00:00
|
|
|
dm->drawVerts(dm);
|
2005-03-26 17:29:37 +00:00
|
|
|
glPointSize(1.0);
|
|
|
|
}
|
2006-08-20 15:22:56 +00:00
|
|
|
else if(dt==OB_WIRE || totface==0) {
|
2005-03-26 17:29:37 +00:00
|
|
|
draw_wire = 1;
|
|
|
|
}
|
|
|
|
else if( (ob==OBACT && (G.f & G_FACESELECT)) || (G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID)) {
|
2005-07-14 12:44:33 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&(G_FACESELECT|G_PICKSEL)) && !draw_wire) {
|
2005-07-14 12:44:33 +00:00
|
|
|
draw_mesh_object_outline(ob, dm);
|
2005-04-13 11:46:46 +00:00
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
draw_tface_mesh(ob, ob->data, dt);
|
|
|
|
}
|
|
|
|
else if(dt==OB_SOLID ) {
|
2005-07-14 12:44:33 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire) {
|
2005-07-14 12:44:33 +00:00
|
|
|
draw_mesh_object_outline(ob, dm);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
2004-10-12 15:23:00 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED );
|
2004-10-12 15:23:00 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
|
2005-12-19 15:55:26 +00:00
|
|
|
|
2005-03-27 20:39:28 +00:00
|
|
|
dm->drawFacesSolid(dm, set_gl_material);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
glFrontFace(GL_CCW);
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(base->flag & SELECT) {
|
2005-08-14 10:35:58 +00:00
|
|
|
BIF_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
|
|
|
|
} else {
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
}
|
2005-08-21 20:48:45 +00:00
|
|
|
dm->drawLooseEdges(dm);
|
2004-10-12 15:23:00 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
else if(dt==OB_SHADED) {
|
2005-12-19 15:55:26 +00:00
|
|
|
int do_draw= 1; /* to resolve all G.f settings below... */
|
|
|
|
|
|
|
|
if(ob==OBACT) {
|
|
|
|
do_draw= 0;
|
|
|
|
if( (G.f & G_WEIGHTPAINT)) {
|
|
|
|
set_gl_material(0); /* enforce defmaterial settings */
|
|
|
|
|
|
|
|
/* but set default spec */
|
|
|
|
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
|
|
|
|
glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
|
|
|
|
glColor3ub(120, 120, 120);
|
|
|
|
glDisable(GL_COLOR_MATERIAL);
|
|
|
|
/* diffuse */
|
|
|
|
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
glEnable(GL_COLOR_MATERIAL);
|
2005-09-24 13:49:55 +00:00
|
|
|
|
2005-12-19 15:55:26 +00:00
|
|
|
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1);
|
|
|
|
glDisable(GL_COLOR_MATERIAL);
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
}
|
|
|
|
else if((G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) && me->mcol) {
|
2006-11-04 11:59:37 +00:00
|
|
|
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
|
2005-12-19 15:55:26 +00:00
|
|
|
}
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
else if((G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) && me->mtface) {
|
2006-11-04 11:59:37 +00:00
|
|
|
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
|
2005-12-19 15:55:26 +00:00
|
|
|
}
|
|
|
|
else do_draw= 1;
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
2005-12-19 15:55:26 +00:00
|
|
|
if(do_draw) {
|
2005-03-27 20:39:28 +00:00
|
|
|
dl = ob->disp.first;
|
|
|
|
if (!dl || !dl->col1) {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
shadeDispList(base);
|
2005-04-10 00:00:34 +00:00
|
|
|
dl = find_displist(&ob->disp, DL_VERTCOL);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !draw_wire) {
|
2005-07-14 12:44:33 +00:00
|
|
|
draw_mesh_object_outline(ob, dm);
|
2004-10-12 15:23:00 +00:00
|
|
|
}
|
2005-03-27 20:39:28 +00:00
|
|
|
|
2005-08-23 20:04:10 +00:00
|
|
|
/* False for dupliframe objects */
|
|
|
|
if (dl) {
|
|
|
|
unsigned int *obCol1 = dl->col1;
|
|
|
|
unsigned int *obCol2 = dl->col2;
|
|
|
|
|
|
|
|
dm->drawFacesColored(dm, me->flag&ME_TWOSIDED, (unsigned char*) obCol1, (unsigned char*) obCol2);
|
|
|
|
}
|
2005-08-18 11:49:33 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(base->flag & SELECT) {
|
2005-08-18 11:49:33 +00:00
|
|
|
BIF_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
|
|
|
|
} else {
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
}
|
2005-08-21 20:48:45 +00:00
|
|
|
dm->drawLooseEdges(dm);
|
2004-10-12 15:23:00 +00:00
|
|
|
}
|
|
|
|
}
|
2006-06-26 08:16:16 +00:00
|
|
|
|
|
|
|
/* set default draw color back for wire or for draw-extra later on */
|
|
|
|
if (dt!=OB_WIRE) {
|
|
|
|
if(base->flag & SELECT) {
|
|
|
|
if(ob==OBACT && ob->flag & OB_FROMGROUP)
|
|
|
|
BIF_ThemeColor(TH_GROUP_ACTIVE);
|
|
|
|
else if(ob->flag & OB_FROMGROUP)
|
|
|
|
BIF_ThemeColorShade(TH_GROUP_ACTIVE, -16);
|
2006-11-03 06:39:58 +00:00
|
|
|
else if(flag!=DRAW_CONSTCOLOR)
|
2006-06-26 08:16:16 +00:00
|
|
|
BIF_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
|
2006-11-03 06:39:58 +00:00
|
|
|
else
|
|
|
|
glColor3ub(80,80,80);
|
2006-06-26 08:16:16 +00:00
|
|
|
} else {
|
|
|
|
if (ob->flag & OB_FROMGROUP)
|
|
|
|
BIF_ThemeColor(TH_GROUP);
|
2006-11-03 06:39:58 +00:00
|
|
|
else {
|
|
|
|
if(ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR)
|
|
|
|
glColor3ub(80,80,80);
|
|
|
|
else
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
}
|
2006-06-26 08:16:16 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
if (draw_wire) {
|
|
|
|
/* If drawing wire and drawtype is not OB_WIRE then we are
|
|
|
|
* overlaying the wires.
|
|
|
|
*/
|
2006-03-10 18:52:49 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if (dt!=OB_WIRE) {
|
|
|
|
bglPolygonOffset(1.0);
|
|
|
|
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
|
|
|
|
}
|
|
|
|
|
2005-09-24 14:27:32 +00:00
|
|
|
/* I need advise on this from Daniel... without this code it does it nicer */
|
|
|
|
// if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)) {
|
|
|
|
// baseDM->drawEdges(baseDM, dt==OB_WIRE);
|
|
|
|
// } else {
|
2006-08-20 15:22:56 +00:00
|
|
|
dm->drawEdges(dm, (dt==OB_WIRE || totface==0));
|
2005-09-24 14:27:32 +00:00
|
|
|
// }
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
if (dt!=OB_WIRE) {
|
|
|
|
glDepthMask(1);
|
|
|
|
bglPolygonOffset(0.0);
|
|
|
|
}
|
|
|
|
}
|
2004-10-12 15:23:00 +00:00
|
|
|
}
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* returns 1 if nothing was drawn, for detecting to draw an object center */
|
2006-11-03 06:39:58 +00:00
|
|
|
static int draw_mesh_object(Base *base, int dt, int flag)
|
2005-01-08 21:16:24 +00:00
|
|
|
{
|
2005-07-14 12:44:33 +00:00
|
|
|
Object *ob= base->object;
|
2005-03-26 17:29:37 +00:00
|
|
|
Mesh *me= ob->data;
|
2005-11-19 10:55:07 +00:00
|
|
|
int has_alpha= 0, drawlinked= 0, retval= 0;
|
2005-07-14 12:44:33 +00:00
|
|
|
|
2005-09-26 15:34:21 +00:00
|
|
|
if(G.obedit && ob!=G.obedit && ob->data==G.obedit->data) {
|
|
|
|
if(ob_get_key(ob));
|
|
|
|
else drawlinked= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ob==G.obedit || drawlinked) {
|
2005-08-06 20:44:59 +00:00
|
|
|
DerivedMesh *finalDM, *cageDM;
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
if (G.obedit!=ob)
|
2005-08-06 20:44:59 +00:00
|
|
|
finalDM = cageDM = editmesh_get_derived_base();
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
else
|
|
|
|
cageDM = editmesh_get_derived_cage_and_final(&finalDM);
|
2005-07-14 17:10:44 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(dt>OB_WIRE) init_gl_materials(ob, 0); // no transp in editmode, the fancy draw over goes bad then
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
draw_em_fancy(ob, G.editMesh, cageDM, finalDM, dt);
|
2005-07-14 17:10:44 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
if (cageDM != finalDM)
|
|
|
|
cageDM->release(cageDM);
|
|
|
|
finalDM->release(finalDM);
|
2005-03-27 20:39:28 +00:00
|
|
|
}
|
2006-11-10 08:18:16 +00:00
|
|
|
else if(!G.obedit && G.scene->sculptdata.active_ob == ob && !modifiers_getVirtualModifierList(ob)) {
|
2006-11-06 01:08:26 +00:00
|
|
|
sculptmode_draw_mesh(NULL);
|
|
|
|
}
|
2005-03-27 20:39:28 +00:00
|
|
|
else {
|
2006-02-21 22:42:33 +00:00
|
|
|
/* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */
|
|
|
|
|
|
|
|
if(me->totface<=4 || boundbox_clip(ob->obmat, me->bb)) {
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
DerivedMesh *baseDM = mesh_get_derived_deform(ob);
|
|
|
|
DerivedMesh *realDM = mesh_get_derived_final(ob);
|
2005-07-14 17:10:44 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(dt==OB_SOLID) has_alpha= init_gl_materials(ob, (base->flag & OB_FROMDUPLI)==0);
|
2006-11-03 06:39:58 +00:00
|
|
|
if(baseDM && realDM) draw_mesh_fancy(base, baseDM, realDM, dt, flag);
|
2005-11-19 10:55:07 +00:00
|
|
|
|
|
|
|
if(me->totvert==0) retval= 1;
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
baseDM->release(baseDM);
|
|
|
|
realDM->release(realDM);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
}
|
2005-07-14 12:44:33 +00:00
|
|
|
|
|
|
|
/* init_gl_materials did the proper checking if this is needed */
|
|
|
|
if(has_alpha) add_view3d_after(G.vd, base, V3D_TRANSP);
|
2005-11-19 10:55:07 +00:00
|
|
|
|
|
|
|
return retval;
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************** DRAW DISPLIST ****************** */
|
|
|
|
|
|
|
|
static int draw_index_wire= 1;
|
|
|
|
static int index3_nors_incr= 1;
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* returns 1 when nothing was drawn */
|
|
|
|
static int drawDispListwire(ListBase *dlbase)
|
2005-03-26 17:29:37 +00:00
|
|
|
{
|
|
|
|
DispList *dl;
|
|
|
|
int parts, nr, ofs, *index;
|
|
|
|
float *data;
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
if(dlbase==NULL) return 1;
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2006-11-03 15:55:43 +00:00
|
|
|
for(dl= dlbase->first; dl; dl= dl->next) {
|
|
|
|
if(dl->parts==0 || dl->nr==0)
|
|
|
|
continue;
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
data= dl->verts;
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
switch(dl->type) {
|
|
|
|
case DL_SEGM:
|
|
|
|
parts= dl->parts;
|
|
|
|
while(parts--) {
|
|
|
|
nr= dl->nr;
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
while(nr--) {
|
|
|
|
glVertex3fv(data);
|
|
|
|
data+=3;
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DL_POLY:
|
|
|
|
parts= dl->parts;
|
|
|
|
while(parts--) {
|
|
|
|
nr= dl->nr;
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
while(nr--) {
|
|
|
|
glVertex3fv(data);
|
|
|
|
data+=3;
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DL_SURF:
|
|
|
|
parts= dl->parts;
|
|
|
|
while(parts--) {
|
|
|
|
nr= dl->nr;
|
|
|
|
if(dl->flag & DL_CYCL_U) glBegin(GL_LINE_LOOP);
|
|
|
|
else glBegin(GL_LINE_STRIP);
|
|
|
|
|
|
|
|
while(nr--) {
|
|
|
|
glVertex3fv(data);
|
|
|
|
data+=3;
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
ofs= 3*dl->nr;
|
|
|
|
nr= dl->nr;
|
|
|
|
while(nr--) {
|
|
|
|
data= ( dl->verts )+3*nr;
|
|
|
|
parts= dl->parts;
|
|
|
|
if(dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
|
|
|
|
else glBegin(GL_LINE_STRIP);
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
while(parts--) {
|
|
|
|
glVertex3fv(data);
|
|
|
|
data+=ofs;
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DL_INDEX3:
|
|
|
|
if(draw_index_wire) {
|
|
|
|
parts= dl->parts;
|
|
|
|
data= dl->verts;
|
|
|
|
index= dl->index;
|
|
|
|
while(parts--) {
|
|
|
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
glVertex3fv(data+3*index[0]);
|
|
|
|
glVertex3fv(data+3*index[1]);
|
|
|
|
glVertex3fv(data+3*index[2]);
|
|
|
|
glEnd();
|
|
|
|
index+= 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DL_INDEX4:
|
|
|
|
if(draw_index_wire) {
|
|
|
|
parts= dl->parts;
|
|
|
|
data= dl->verts;
|
|
|
|
index= dl->index;
|
|
|
|
while(parts--) {
|
|
|
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
glVertex3fv(data+3*index[0]);
|
|
|
|
glVertex3fv(data+3*index[1]);
|
|
|
|
glVertex3fv(data+3*index[2]);
|
|
|
|
if(index[3]) glVertex3fv(data+3*index[3]);
|
|
|
|
glEnd();
|
|
|
|
index+= 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-11-19 10:55:07 +00:00
|
|
|
return 0;
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void drawDispListsolid(ListBase *lb, Object *ob)
|
|
|
|
{
|
|
|
|
DispList *dl;
|
2005-09-23 08:29:32 +00:00
|
|
|
int nr, parts, ofs, p1, p2, p3, p4, a, b, *index;
|
2006-08-11 09:09:50 +00:00
|
|
|
float *data, *v1, *v2, *v3, *v4, curcol[4];
|
2005-03-26 17:29:37 +00:00
|
|
|
float *ndata, *n1, *n2, *n3, *n4;
|
|
|
|
|
2006-08-11 09:09:50 +00:00
|
|
|
if(lb==NULL) return;
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2006-08-11 09:09:50 +00:00
|
|
|
/* for drawing wire */
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, curcol);
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
|
|
|
|
if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
|
|
|
|
else glFrontFace(GL_CCW);
|
|
|
|
|
|
|
|
if(ob->type==OB_MBALL) { // mball always smooth shaded
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
}
|
|
|
|
|
|
|
|
dl= lb->first;
|
|
|
|
while(dl) {
|
|
|
|
data= dl->verts;
|
|
|
|
ndata= dl->nors;
|
|
|
|
|
|
|
|
switch(dl->type) {
|
2005-09-23 08:29:32 +00:00
|
|
|
case DL_SEGM:
|
2005-09-27 21:52:04 +00:00
|
|
|
if(ob->type==OB_SURF) {
|
|
|
|
glDisable(GL_LIGHTING);
|
2006-08-11 09:09:50 +00:00
|
|
|
glColor3fv(curcol);
|
2005-09-27 21:52:04 +00:00
|
|
|
parts= dl->parts;
|
|
|
|
while(parts--) {
|
|
|
|
nr= dl->nr;
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
while(nr--) {
|
|
|
|
glVertex3fv(data);
|
|
|
|
data+=3;
|
|
|
|
}
|
|
|
|
glEnd();
|
2005-09-23 08:29:32 +00:00
|
|
|
}
|
2005-09-27 21:52:04 +00:00
|
|
|
glEnable(GL_LIGHTING);
|
2005-09-23 08:29:32 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DL_POLY:
|
2005-09-27 21:52:04 +00:00
|
|
|
if(ob->type==OB_SURF) {
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
parts= dl->parts;
|
|
|
|
while(parts--) {
|
|
|
|
nr= dl->nr;
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
while(nr--) {
|
|
|
|
glVertex3fv(data);
|
|
|
|
data+=3;
|
|
|
|
}
|
|
|
|
glEnd();
|
2005-09-23 08:29:32 +00:00
|
|
|
}
|
2005-09-27 21:52:04 +00:00
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
break;
|
2005-09-23 08:29:32 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
case DL_SURF:
|
|
|
|
|
|
|
|
set_gl_material(dl->col+1);
|
|
|
|
|
|
|
|
if(dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
|
|
|
|
else glShadeModel(GL_FLAT);
|
|
|
|
|
|
|
|
for(a=0; a<dl->parts; a++) {
|
|
|
|
|
|
|
|
DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
|
|
|
|
|
|
|
|
v1= data+ 3*p1;
|
|
|
|
v2= data+ 3*p2;
|
|
|
|
v3= data+ 3*p3;
|
|
|
|
v4= data+ 3*p4;
|
|
|
|
n1= ndata+ 3*p1;
|
|
|
|
n2= ndata+ 3*p2;
|
|
|
|
n3= ndata+ 3*p3;
|
|
|
|
n4= ndata+ 3*p4;
|
|
|
|
|
|
|
|
glBegin(GL_QUAD_STRIP);
|
|
|
|
|
|
|
|
glNormal3fv(n2); glVertex3fv(v2);
|
|
|
|
glNormal3fv(n4); glVertex3fv(v4);
|
|
|
|
|
|
|
|
for(; b<dl->nr; b++) {
|
|
|
|
|
|
|
|
glNormal3fv(n1); glVertex3fv(v1);
|
|
|
|
glNormal3fv(n3); glVertex3fv(v3);
|
|
|
|
|
|
|
|
v2= v1; v1+= 3;
|
|
|
|
v4= v3; v3+= 3;
|
|
|
|
n2= n1; n1+= 3;
|
|
|
|
n4= n3; n3+= 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DL_INDEX3:
|
|
|
|
|
|
|
|
parts= dl->parts;
|
|
|
|
data= dl->verts;
|
|
|
|
ndata= dl->nors;
|
|
|
|
index= dl->index;
|
|
|
|
|
|
|
|
set_gl_material(dl->col+1);
|
|
|
|
|
|
|
|
/* voor polys only one normal needed */
|
|
|
|
if(index3_nors_incr==0) {
|
|
|
|
while(parts--) {
|
|
|
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
|
|
|
glNormal3fv(ndata);
|
|
|
|
glVertex3fv(data+3*index[0]);
|
|
|
|
glVertex3fv(data+3*index[1]);
|
|
|
|
glVertex3fv(data+3*index[2]);
|
|
|
|
glEnd();
|
|
|
|
index+= 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
while(parts--) {
|
|
|
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
|
|
|
ofs= 3*index[0];
|
|
|
|
glNormal3fv(ndata+ofs); glVertex3fv(data+ofs);
|
|
|
|
ofs= 3*index[1];
|
|
|
|
glNormal3fv(ndata+ofs); glVertex3fv(data+ofs);
|
|
|
|
ofs= 3*index[2];
|
|
|
|
glNormal3fv(ndata+ofs); glVertex3fv(data+ofs);
|
|
|
|
glEnd();
|
|
|
|
index+= 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DL_INDEX4:
|
|
|
|
|
|
|
|
parts= dl->parts;
|
|
|
|
data= dl->verts;
|
|
|
|
ndata= dl->nors;
|
|
|
|
index= dl->index;
|
|
|
|
|
|
|
|
set_gl_material(dl->col+1);
|
|
|
|
|
|
|
|
while(parts--) {
|
|
|
|
|
|
|
|
glBegin(index[3]?GL_QUADS:GL_TRIANGLES);
|
|
|
|
ofs= 3*index[0];
|
|
|
|
glNormal3fv(ndata+ofs); glVertex3fv(data+ofs);
|
|
|
|
ofs= 3*index[1];
|
|
|
|
glNormal3fv(ndata+ofs); glVertex3fv(data+ofs);
|
|
|
|
ofs= 3*index[2];
|
|
|
|
glNormal3fv(ndata+ofs); glVertex3fv(data+ofs);
|
|
|
|
if(index[3]) {
|
|
|
|
ofs= 3*index[3];
|
|
|
|
glNormal3fv(ndata+ofs); glVertex3fv(data+ofs);
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
index+= 4;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
dl= dl->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
glFrontFace(GL_CCW);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void drawDispListshaded(ListBase *lb, Object *ob)
|
|
|
|
{
|
|
|
|
DispList *dl, *dlob;
|
|
|
|
int parts, p1, p2, p3, p4, a, b, *index;
|
2005-07-17 18:37:27 +00:00
|
|
|
float *data, *v1, *v2, *v3, *v4;
|
2005-03-26 17:29:37 +00:00
|
|
|
unsigned int *cdata, *c1, *c2, *c3, *c4;
|
|
|
|
char *cp;
|
|
|
|
|
|
|
|
if(lb==0) return;
|
|
|
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
|
|
|
dl= lb->first;
|
|
|
|
dlob= ob->disp.first;
|
|
|
|
while(dl && dlob) {
|
|
|
|
|
|
|
|
cdata= dlob->col1;
|
|
|
|
data= dl->verts;
|
|
|
|
if(cdata==0) break;
|
|
|
|
|
|
|
|
switch(dl->type) {
|
|
|
|
case DL_SURF:
|
|
|
|
|
|
|
|
for(a=0; a<dl->parts; a++) {
|
|
|
|
|
|
|
|
DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
|
|
|
|
|
|
|
|
v1= data+ 3*p1;
|
|
|
|
v2= data+ 3*p2;
|
|
|
|
v3= data+ 3*p3;
|
|
|
|
v4= data+ 3*p4;
|
|
|
|
c1= cdata+ p1;
|
|
|
|
c2= cdata+ p2;
|
|
|
|
c3= cdata+ p3;
|
|
|
|
c4= cdata+ p4;
|
|
|
|
|
|
|
|
for(; b<dl->nr; b++) {
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
cp= (char *)c1;
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(v1);
|
|
|
|
cp= (char *)c2;
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(v2);
|
|
|
|
cp= (char *)c4;
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(v4);
|
|
|
|
cp= (char *)c3;
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(v3);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
v2= v1; v1+= 3;
|
|
|
|
v4= v3; v3+= 3;
|
|
|
|
c2= c1; c1++;
|
|
|
|
c4= c3; c3++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DL_INDEX3:
|
|
|
|
|
|
|
|
parts= dl->parts;
|
|
|
|
index= dl->index;
|
|
|
|
|
|
|
|
while(parts--) {
|
|
|
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
|
|
|
cp= (char *)(cdata+index[0]);
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(data+3*index[0]);
|
|
|
|
|
|
|
|
cp= (char *)(cdata+index[1]);
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(data+3*index[1]);
|
|
|
|
|
|
|
|
cp= (char *)(cdata+index[2]);
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(data+3*index[2]);
|
|
|
|
glEnd();
|
|
|
|
index+= 3;
|
2005-01-08 21:16:24 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
break;
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
case DL_INDEX4:
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
parts= dl->parts;
|
|
|
|
index= dl->index;
|
|
|
|
while(parts--) {
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glBegin(index[3]?GL_QUADS:GL_TRIANGLES);
|
|
|
|
cp= (char *)(cdata+index[0]);
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(data+3*index[0]);
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
cp= (char *)(cdata+index[1]);
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(data+3*index[1]);
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
cp= (char *)(cdata+index[2]);
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(data+3*index[2]);
|
|
|
|
|
|
|
|
if(index[3]) {
|
|
|
|
|
|
|
|
cp= (char *)(cdata+index[3]);
|
|
|
|
glColor3ub(cp[3], cp[2], cp[1]);
|
|
|
|
glVertex3fv(data+3*index[3]);
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
index+= 4;
|
2005-01-08 21:16:24 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
break;
|
|
|
|
|
2005-01-08 21:16:24 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
dl= dl->next;
|
|
|
|
dlob= dlob->next;
|
2005-01-08 21:16:24 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
2005-01-08 21:16:24 +00:00
|
|
|
}
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* returns 1 when nothing was drawn */
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
static int drawDispList(Base *base, int dt)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
Object *ob= base->object;
|
2005-03-26 17:29:37 +00:00
|
|
|
ListBase *lb=0;
|
2002-10-12 11:37:38 +00:00
|
|
|
DispList *dl;
|
2005-03-26 17:29:37 +00:00
|
|
|
Curve *cu;
|
2005-11-19 10:55:07 +00:00
|
|
|
int solid, retval= 0;
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
solid= (dt > OB_WIRE);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
switch(ob->type) {
|
|
|
|
case OB_FONT:
|
|
|
|
case OB_CURVE:
|
|
|
|
cu= ob->data;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
lb= &cu->disp;
|
2003-10-21 16:41:28 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(solid) {
|
|
|
|
dl= lb->first;
|
2005-11-19 10:55:07 +00:00
|
|
|
if(dl==NULL) return 1;
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(dl->nors==0) addnormalsDispList(ob, lb);
|
|
|
|
index3_nors_incr= 0;
|
2003-10-22 09:06:30 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if( displist_has_faces(lb)==0) {
|
|
|
|
draw_index_wire= 0;
|
|
|
|
drawDispListwire(lb);
|
|
|
|
draw_index_wire= 1;
|
2003-07-20 20:38:22 +00:00
|
|
|
}
|
2004-09-25 13:42:31 +00:00
|
|
|
else {
|
2005-03-26 17:29:37 +00:00
|
|
|
if(dt==OB_SHADED) {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(ob->disp.first==0) shadeDispList(base);
|
2005-03-26 17:29:37 +00:00
|
|
|
drawDispListshaded(lb, ob);
|
|
|
|
}
|
|
|
|
else {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
init_gl_materials(ob, 0);
|
2005-03-26 17:29:37 +00:00
|
|
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
|
|
|
|
drawDispListsolid(lb, ob);
|
|
|
|
}
|
2005-10-03 14:13:47 +00:00
|
|
|
if(ob==G.obedit && cu->bevobj==NULL && cu->taperobj==NULL) {
|
2005-03-26 17:29:37 +00:00
|
|
|
cpack(0);
|
|
|
|
draw_index_wire= 0;
|
|
|
|
drawDispListwire(lb);
|
|
|
|
draw_index_wire= 1;
|
2004-09-25 13:42:31 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
index3_nors_incr= 1;
|
2003-07-20 20:38:22 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
else {
|
|
|
|
draw_index_wire= 0;
|
2005-11-19 10:55:07 +00:00
|
|
|
retval= drawDispListwire(lb);
|
2005-03-26 17:29:37 +00:00
|
|
|
draw_index_wire= 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OB_SURF:
|
|
|
|
|
|
|
|
lb= &((Curve *)ob->data)->disp;
|
2004-09-25 13:42:31 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(solid) {
|
|
|
|
dl= lb->first;
|
2005-11-19 10:55:07 +00:00
|
|
|
if(dl==NULL) return 1;
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
if(dl->nors==NULL) addnormalsDispList(ob, lb);
|
2004-09-25 13:42:31 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(dt==OB_SHADED) {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(ob->disp.first==NULL) shadeDispList(base);
|
2005-03-26 17:29:37 +00:00
|
|
|
drawDispListshaded(lb, ob);
|
|
|
|
}
|
2003-10-22 09:06:30 +00:00
|
|
|
else {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
init_gl_materials(ob, 0);
|
2005-03-26 17:29:37 +00:00
|
|
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
|
|
|
|
|
|
|
|
drawDispListsolid(lb, ob);
|
2003-10-22 09:06:30 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
else {
|
2005-11-19 10:55:07 +00:00
|
|
|
retval= drawDispListwire(lb);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OB_MBALL:
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if( is_basis_mball(ob)) {
|
|
|
|
lb= &ob->disp;
|
2005-11-19 10:55:07 +00:00
|
|
|
if(lb->first==NULL) makeDispListMBall(ob);
|
|
|
|
if(lb->first==NULL) return 1;
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(solid) {
|
|
|
|
|
|
|
|
if(dt==OB_SHADED) {
|
|
|
|
dl= lb->first;
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(dl && dl->col1==0) shadeDispList(base);
|
2005-03-26 17:29:37 +00:00
|
|
|
drawDispListshaded(lb, ob);
|
|
|
|
}
|
|
|
|
else {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
init_gl_materials(ob, 0);
|
2005-03-26 17:29:37 +00:00
|
|
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
|
|
|
|
|
|
|
|
drawDispListsolid(lb, ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
/* MetaBalls use DL_INDEX4 type of DispList */
|
2005-11-19 10:55:07 +00:00
|
|
|
retval= drawDispListwire(lb);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
return retval;
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************************** */
|
|
|
|
|
|
|
|
|
2006-06-09 11:15:52 +00:00
|
|
|
static void draw_particle_system(Base *base, PartEff *paf)
|
2005-03-26 17:29:37 +00:00
|
|
|
{
|
2006-06-09 11:15:52 +00:00
|
|
|
Object *ob= base->object;
|
2005-03-26 17:29:37 +00:00
|
|
|
Particle *pa;
|
2005-12-11 14:28:22 +00:00
|
|
|
float ptime, ctime, vec[3], vec1[3], mat[4][4];
|
2005-11-21 15:08:02 +00:00
|
|
|
int a, totpart;
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
pa= paf->keys;
|
Sorry for the big commit, but I've been fixing many of these
issues in parallel... So this commit contains: an update of
the solver (e.g. moving objects), integration of blender IPOs,
improved rendering (motion blur, smoothed normals) and a first particle
test. In more detail:
Solver update:
- Moving objects using a relatively simple model, and not yet fully optimized - ok
for box falling into water, water in a moving glass might cause trouble. Simulation
times are influenced by overall no. of triangles of the mesh, scaling meshes up a lot
might also cause slowdowns.
- Additional obstacle settings: noslip (as before), free slip (move along wall freely)
and part slip (mix of both).
- Obstacle settings also added for domain boundaries now, the six walls of the domain are
obstacles after all as well
- Got rid of templates, should make compiling for e.g. macs more convenient,
for linux there's not much difference. Finally got rid of parser (and some other code
parts), the simulation now uses the internal API to transfer data.
- Some unnecessary file were removed, the GUI now needs 3 settings buttons...
This should still be changed (maybe by adding a new panel for domain objects).
IPOs:
- Animated params: viscosity, time and gravity for domains. In contrast
to normal time IPO for Blender objects, the fluidsim one scales the time
step size - so a constant 1 has no effect, values towards 0 slow it down,
larger ones speed the simulation up (-> longer time steps, more compuations).
The viscosity IPO is also only a factor for the selected viscosity (again, 1=no effect).
- For objects that are enabled for fluidsim, a new IPO type shows up. Inflow
objects can use the velocity channels to animate the inflow. Obstacles, in/outflow
objects can be switched on (Active IPO>0) and off (<0) during the simulation.
- Movement, rotation and scaling of those 3 types is exported from the normal
Blender channels (Loc,dLoc,etc.).
Particles:
- This is still experimental, so it might be deactivated for a
release... It should at some point be used to model smaller splashes,
depending on the the realworld size and the particle generation
settings particles are generated during simulation (stored in _particles_X.gz
files).
- These are loaded by enabling the particle field for an arbitrary object,
which should be given a halo material. For each frame, similar to the mesh
loading, the particle system them loads the simulated particle positions.
- For rendering, I "abused" the part->rt field - I couldnt find any use
for it in the code and it seems to work fine. The fluidsim particles
store their size there.
Rendering:
- The fluidims particles use scaled sizes and alpha values to give a more varied
appearance. In convertblender.c fluidsim particle systems use the p->rt field
to scale up the size and down the alpha of "smaller particles". Setting the
influence fields in the fluidims settings to 0 gives equally sized particles
with same alpha everywhere. Higher values cause larger differences.
- Smoothed normals: for unmodified fluid meshes (e.g. no subdivision) the normals
computed by the solver are used. This is basically done by switching off the
normal recalculation in convertblender.c (the function calc_fluidsimnormals
handles other mesh inits instead of calc_vertexnormals).
This could also be used to e.g. modify mesh normals in a modifier...
- Another change is that fluidsim meshes load the velocities computed
during the simulation for image based motion blur. This is inited in
load_fluidsimspeedvectors for the vector pass (they're loaded during the
normal load in DerivedMesh readBobjgz). Generation and loading can be switched
off in the settings. Vector pass currently loads the fluidism meshes 3 times,
so this should still be optimized.
Examples:
- smoothed normals versus normals from subdividing once:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_1smoothnorms.png
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_2subdivnorms.png
- fluidsim particles, size/alpha influence 0:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_3particlesnorm.png
size influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_4particlessize.png
size & alpha influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_5particlesalpha.png
- the standard drop with motion blur and particles:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t2new.mpg
(here's how it looks without
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t1old.mpg)
- another inflow animation (moving, switched on/off) with a moving obstacle
(and strong mblur :)
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t3ipos.mpg
Things still to fix:
- rotating & scaling domains causes wrong speed vectors
- get rid of SDL code for threading, use pthreads as well?
- update wiki documentation
- cool effects for rendering would be photon maps for caustics,
and motion blur for particles :)
2006-02-27 11:45:42 +00:00
|
|
|
// FSPARTICLE always rebuild fluid particle system upon change...
|
|
|
|
if( (pa==NULL)
|
|
|
|
|| ( (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings) && (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE))
|
|
|
|
) {
|
2005-03-26 17:29:37 +00:00
|
|
|
build_particle_system(ob);
|
|
|
|
pa= paf->keys;
|
2005-12-11 14:28:22 +00:00
|
|
|
if(pa==NULL) return;
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
myloadmatrix(G.vd->viewmat);
|
2006-04-08 14:50:04 +00:00
|
|
|
/* flag abuse... but I need working code too now. This feature doesnt work for per frame animated objects */
|
2006-06-09 11:15:52 +00:00
|
|
|
if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
|
2006-04-08 14:50:04 +00:00
|
|
|
Mat4MulMat4(mat, paf->imat, ob->obmat);
|
|
|
|
mymultmatrix(mat);
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= ob->sf;
|
|
|
|
else ptime= 0.0;
|
|
|
|
ctime= bsystem_time(ob, 0, (float)(G.scene->r.cfra), ptime);
|
|
|
|
|
|
|
|
glPointSize(1.0);
|
|
|
|
if(paf->stype!=PAF_VECT) glBegin(GL_POINTS);
|
Added LSCM UV Unwrapping:
http://www.loria.fr/~levy/Galleries/LSCM/index.html
http://www.loria.fr/~levy/Papers/2002/s2002_lscm.pdf
Implementation Least Squares Conformal Maps parameterization, based on
chapter 2 of:
Bruno Levy, Sylvain Petitjean, Nicolas Ray, Jerome Maillot. Least Squares
Conformal Maps for Automatic Texture Atlas Generation. In Siggraph 2002,
July 2002.
Seams: Stored as a flag (ME_SEAM) in the new MEdge struct, these seams define
where a mesh will be cut when executing LSCM unwrapping. Seams can be marked
and cleared in Edit Mode. Ctrl+EKEY will pop up a menu allowing to Clear or Mark
the selected edges as seams.
Select Linked in Face Select Mode now only selects linked faces if no seams
separate them. So if seams are defined, this will now select the 'face group'
defined by the seams. Hotkey is still LKEY.
LSCM Unwrap: unwrap UV's by calculating a conformal mapping (preserving local
angles). Based on seams, the selected faces will be 'cut'. If multiple
'face groups' are selected, they will be unwrapped separately and packed in
the image rectangle in the UV Editor. Packing uses a simple and fast
algorithm, only designed to avoid having overlapping faces.
LSCM can be found in the Unwrap menu (UKEY), and the UV Calculation panel.
Pinning: UV's can be pinned in the UV Editor. When LSCM Unwrap is then
executed, these UV's will stay in place, allowing to tweak the solution.
PKEY and ALT+PKEY will respectively pin and unpin selected UV's.
Face Select Mode Drawing Changes:
- Draw Seams option to enable disable drawing of seams
- Draw Faces option to enable drawing of selected faces in transparent purple
- Draw Hidden Edges option to enable drawing of edges of hidden faces
- Draw Edges option to enable drawing of edges of visible faces
The colors for these seams, faces and edges are themeable.
2004-07-13 11:48:52 +00:00
|
|
|
|
2005-11-21 15:08:02 +00:00
|
|
|
totpart= (paf->disp*paf->totpart)/100;
|
|
|
|
for(a=0; a<totpart; a++, pa+=paf->totkey) {
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(ctime > pa->time) {
|
|
|
|
if(ctime < pa->time+pa->lifetime) {
|
|
|
|
|
|
|
|
if(paf->stype==PAF_VECT) {
|
|
|
|
where_is_particle(paf, pa, ctime, vec);
|
|
|
|
where_is_particle(paf, pa, ctime+1.0, vec1);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glVertex3fv(vec1);
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
where_is_particle(paf, pa, ctime, vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glVertex3fv(vec);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
|
|
|
if(paf->stype!=PAF_VECT) glEnd();
|
|
|
|
|
2005-12-11 14:28:22 +00:00
|
|
|
myloadmatrix(G.vd->viewmat);
|
2005-03-26 17:29:37 +00:00
|
|
|
mymultmatrix(ob->obmat); // bring back local matrix for dtx
|
|
|
|
}
|
2005-01-08 21:16:24 +00:00
|
|
|
|
2005-11-10 19:00:10 +00:00
|
|
|
static void draw_static_particle_system(Object *ob, PartEff *paf, int dt)
|
2005-03-26 17:29:37 +00:00
|
|
|
{
|
|
|
|
Particle *pa;
|
2005-11-10 19:00:10 +00:00
|
|
|
float ctime, mtime, vec[3], veco[3];
|
2005-11-21 15:08:02 +00:00
|
|
|
int a, use_norm=0, totpart;
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
pa= paf->keys;
|
Sorry for the big commit, but I've been fixing many of these
issues in parallel... So this commit contains: an update of
the solver (e.g. moving objects), integration of blender IPOs,
improved rendering (motion blur, smoothed normals) and a first particle
test. In more detail:
Solver update:
- Moving objects using a relatively simple model, and not yet fully optimized - ok
for box falling into water, water in a moving glass might cause trouble. Simulation
times are influenced by overall no. of triangles of the mesh, scaling meshes up a lot
might also cause slowdowns.
- Additional obstacle settings: noslip (as before), free slip (move along wall freely)
and part slip (mix of both).
- Obstacle settings also added for domain boundaries now, the six walls of the domain are
obstacles after all as well
- Got rid of templates, should make compiling for e.g. macs more convenient,
for linux there's not much difference. Finally got rid of parser (and some other code
parts), the simulation now uses the internal API to transfer data.
- Some unnecessary file were removed, the GUI now needs 3 settings buttons...
This should still be changed (maybe by adding a new panel for domain objects).
IPOs:
- Animated params: viscosity, time and gravity for domains. In contrast
to normal time IPO for Blender objects, the fluidsim one scales the time
step size - so a constant 1 has no effect, values towards 0 slow it down,
larger ones speed the simulation up (-> longer time steps, more compuations).
The viscosity IPO is also only a factor for the selected viscosity (again, 1=no effect).
- For objects that are enabled for fluidsim, a new IPO type shows up. Inflow
objects can use the velocity channels to animate the inflow. Obstacles, in/outflow
objects can be switched on (Active IPO>0) and off (<0) during the simulation.
- Movement, rotation and scaling of those 3 types is exported from the normal
Blender channels (Loc,dLoc,etc.).
Particles:
- This is still experimental, so it might be deactivated for a
release... It should at some point be used to model smaller splashes,
depending on the the realworld size and the particle generation
settings particles are generated during simulation (stored in _particles_X.gz
files).
- These are loaded by enabling the particle field for an arbitrary object,
which should be given a halo material. For each frame, similar to the mesh
loading, the particle system them loads the simulated particle positions.
- For rendering, I "abused" the part->rt field - I couldnt find any use
for it in the code and it seems to work fine. The fluidsim particles
store their size there.
Rendering:
- The fluidims particles use scaled sizes and alpha values to give a more varied
appearance. In convertblender.c fluidsim particle systems use the p->rt field
to scale up the size and down the alpha of "smaller particles". Setting the
influence fields in the fluidims settings to 0 gives equally sized particles
with same alpha everywhere. Higher values cause larger differences.
- Smoothed normals: for unmodified fluid meshes (e.g. no subdivision) the normals
computed by the solver are used. This is basically done by switching off the
normal recalculation in convertblender.c (the function calc_fluidsimnormals
handles other mesh inits instead of calc_vertexnormals).
This could also be used to e.g. modify mesh normals in a modifier...
- Another change is that fluidsim meshes load the velocities computed
during the simulation for image based motion blur. This is inited in
load_fluidsimspeedvectors for the vector pass (they're loaded during the
normal load in DerivedMesh readBobjgz). Generation and loading can be switched
off in the settings. Vector pass currently loads the fluidism meshes 3 times,
so this should still be optimized.
Examples:
- smoothed normals versus normals from subdividing once:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_1smoothnorms.png
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_2subdivnorms.png
- fluidsim particles, size/alpha influence 0:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_3particlesnorm.png
size influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_4particlessize.png
size & alpha influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_5particlesalpha.png
- the standard drop with motion blur and particles:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t2new.mpg
(here's how it looks without
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t1old.mpg)
- another inflow animation (moving, switched on/off) with a moving obstacle
(and strong mblur :)
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t3ipos.mpg
Things still to fix:
- rotating & scaling domains causes wrong speed vectors
- get rid of SDL code for threading, use pthreads as well?
- update wiki documentation
- cool effects for rendering would be photon maps for caustics,
and motion blur for particles :)
2006-02-27 11:45:42 +00:00
|
|
|
// FSPARTICLE always rebuild upon change...
|
|
|
|
if( (pa==NULL)
|
|
|
|
|| ( (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings) && (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE))
|
|
|
|
) {
|
2005-03-26 17:29:37 +00:00
|
|
|
build_particle_system(ob);
|
|
|
|
pa= paf->keys;
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
if(pa==NULL) return;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-11-10 19:00:10 +00:00
|
|
|
if(paf->stype==PAF_VECT) {
|
|
|
|
if(dt>OB_WIRE) {
|
2006-06-02 12:34:09 +00:00
|
|
|
|
|
|
|
/* shaded/texture mode: we still draw solid, so have to set materials */
|
|
|
|
if(dt>OB_SOLID) init_gl_materials(ob, 0);
|
|
|
|
|
2005-11-10 19:00:10 +00:00
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
set_gl_material(paf->omat);
|
|
|
|
use_norm= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
glPointSize(1.0);
|
|
|
|
glBegin(GL_POINTS);
|
|
|
|
}
|
|
|
|
|
2005-11-21 15:08:02 +00:00
|
|
|
totpart= (paf->disp*paf->totpart)/100;
|
|
|
|
for(a=0; a<totpart; a++, pa+=paf->totkey) {
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-10 19:00:10 +00:00
|
|
|
if(paf->stype==PAF_VECT) {
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-11-10 19:00:10 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
where_is_particle(paf, pa, pa->time, veco);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2005-11-10 19:00:10 +00:00
|
|
|
mtime= pa->time+pa->lifetime+paf->staticstep;
|
|
|
|
for(ctime= pa->time+paf->staticstep; ctime<mtime; ctime+=paf->staticstep) {
|
2005-03-26 17:29:37 +00:00
|
|
|
|
|
|
|
where_is_particle(paf, pa, ctime, vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-10 19:00:10 +00:00
|
|
|
if(use_norm) {
|
|
|
|
float no[3];
|
|
|
|
VECSUB(no, vec, veco);
|
|
|
|
glNormal3fv(no);
|
|
|
|
}
|
|
|
|
glVertex3fv(veco);
|
|
|
|
VECCOPY(veco, vec);
|
|
|
|
}
|
|
|
|
|
|
|
|
glVertex3fv(veco);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mtime= pa->time+pa->lifetime+paf->staticstep-1;
|
|
|
|
for(ctime= pa->time; ctime<mtime; ctime+=paf->staticstep) {
|
|
|
|
where_is_particle(paf, pa, ctime, vec);
|
2005-03-26 17:29:37 +00:00
|
|
|
glVertex3fv(vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-11-10 19:00:10 +00:00
|
|
|
if(paf->stype==PAF_VECT) {
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int nurbcol[8]= {
|
|
|
|
0, 0x9090, 0x409030, 0x603080, 0, 0x40fff0, 0x40c033, 0xA090F0 };
|
|
|
|
|
|
|
|
static void tekenhandlesN(Nurb *nu, short sel)
|
|
|
|
{
|
|
|
|
BezTriple *bezt;
|
|
|
|
float *fp;
|
|
|
|
unsigned int *col;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
if(nu->hide) return;
|
|
|
|
if( (nu->type & 7)==1) {
|
|
|
|
if(sel) col= nurbcol+4;
|
|
|
|
else col= nurbcol;
|
|
|
|
|
|
|
|
bezt= nu->bezt;
|
|
|
|
a= nu->pntsu;
|
|
|
|
while(a--) {
|
|
|
|
if(bezt->hide==0) {
|
|
|
|
if( (bezt->f2 & 1)==sel) {
|
|
|
|
fp= bezt->vec[0];
|
|
|
|
cpack(col[bezt->h1]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(fp);
|
|
|
|
glVertex3fv(fp+3);
|
|
|
|
glEnd();
|
|
|
|
cpack(col[bezt->h2]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(fp+3);
|
|
|
|
glVertex3fv(fp+6);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
else if( (bezt->f1 & 1)==sel) {
|
|
|
|
fp= bezt->vec[0];
|
|
|
|
cpack(col[bezt->h1]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(fp);
|
|
|
|
glVertex3fv(fp+3);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
else if( (bezt->f3 & 1)==sel) {
|
|
|
|
fp= bezt->vec[1];
|
|
|
|
cpack(col[bezt->h2]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(fp);
|
|
|
|
glVertex3fv(fp+3);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bezt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tekenvertsN(Nurb *nu, short sel)
|
|
|
|
{
|
|
|
|
BezTriple *bezt;
|
|
|
|
BPoint *bp;
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
float size;
|
2002-10-12 11:37:38 +00:00
|
|
|
int a;
|
|
|
|
|
|
|
|
if(nu->hide) return;
|
|
|
|
|
2003-10-19 09:19:58 +00:00
|
|
|
if(sel) BIF_ThemeColor(TH_VERTEX_SELECT);
|
|
|
|
else BIF_ThemeColor(TH_VERTEX);
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
size= BIF_GetThemeValuef(TH_VERTEX_SIZE);
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
glPointSize(size);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-07-10 21:35:17 +00:00
|
|
|
bglBegin(GL_POINTS);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if((nu->type & 7)==1) {
|
|
|
|
|
|
|
|
bezt= nu->bezt;
|
|
|
|
a= nu->pntsu;
|
|
|
|
while(a--) {
|
|
|
|
if(bezt->hide==0) {
|
2004-07-10 21:35:17 +00:00
|
|
|
if((bezt->f1 & 1)==sel) bglVertex3fv(bezt->vec[0]);
|
|
|
|
if((bezt->f2 & 1)==sel) bglVertex3fv(bezt->vec[1]);
|
|
|
|
if((bezt->f3 & 1)==sel) bglVertex3fv(bezt->vec[2]);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
bezt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bp= nu->bp;
|
|
|
|
a= nu->pntsu*nu->pntsv;
|
|
|
|
while(a--) {
|
|
|
|
if(bp->hide==0) {
|
2004-07-10 21:35:17 +00:00
|
|
|
if((bp->f1 & 1)==sel) bglVertex3fv(bp->vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
bp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-10 21:35:17 +00:00
|
|
|
bglEnd();
|
2002-10-12 11:37:38 +00:00
|
|
|
glPointSize(1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
|
|
|
|
{
|
|
|
|
Nurb *nu;
|
|
|
|
BPoint *bp, *bp1;
|
|
|
|
int a, b, ofs;
|
|
|
|
|
|
|
|
nu= nurb;
|
|
|
|
while(nu) {
|
|
|
|
if(nu->hide==0) {
|
|
|
|
switch(nu->type & 7) {
|
|
|
|
case CU_POLY:
|
|
|
|
cpack(nurbcol[3]);
|
|
|
|
bp= nu->bp;
|
|
|
|
for(b=0; b<nu->pntsv; b++) {
|
|
|
|
if(nu->flagu & 1) glBegin(GL_LINE_LOOP);
|
|
|
|
|
|
|
|
else glBegin(GL_LINE_STRIP);
|
|
|
|
|
|
|
|
for(a=0; a<nu->pntsu; a++, bp++) {
|
|
|
|
glVertex3fv(bp->vec);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nu->flagu & 1) glEnd();
|
|
|
|
else glEnd();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CU_NURBS:
|
|
|
|
|
|
|
|
bp= nu->bp;
|
|
|
|
for(b=0; b<nu->pntsv; b++) {
|
|
|
|
bp1= bp;
|
|
|
|
bp++;
|
|
|
|
for(a=nu->pntsu-1; a>0; a--, bp++) {
|
|
|
|
if(bp->hide==0 && bp1->hide==0) {
|
|
|
|
if(sel) {
|
|
|
|
if( (bp->f1 & 1) && ( bp1->f1 & 1) ) {
|
|
|
|
cpack(nurbcol[5]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(bp->vec);
|
|
|
|
glVertex3fv(bp1->vec);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if( (bp->f1 & 1) && ( bp1->f1 & 1) );
|
|
|
|
else {
|
|
|
|
cpack(nurbcol[1]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(bp->vec);
|
|
|
|
glVertex3fv(bp1->vec);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bp1= bp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(nu->pntsv > 1) { /* surface */
|
|
|
|
|
|
|
|
ofs= nu->pntsu;
|
|
|
|
for(b=0; b<nu->pntsu; b++) {
|
|
|
|
bp1= nu->bp+b;
|
|
|
|
bp= bp1+ofs;
|
|
|
|
for(a=nu->pntsv-1; a>0; a--, bp+=ofs) {
|
|
|
|
if(bp->hide==0 && bp1->hide==0) {
|
|
|
|
if(sel) {
|
|
|
|
if( (bp->f1 & 1) && ( bp1->f1 & 1) ) {
|
|
|
|
cpack(nurbcol[7]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(bp->vec);
|
|
|
|
glVertex3fv(bp1->vec);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if( (bp->f1 & 1) && ( bp1->f1 & 1) );
|
|
|
|
else {
|
|
|
|
cpack(nurbcol[3]);
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(bp->vec);
|
|
|
|
glVertex3fv(bp1->vec);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bp1= bp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nu= nu->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
static void drawnurb(Base *base, Nurb *nurb, int dt)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
Object *ob= base->object;
|
2005-08-14 06:08:41 +00:00
|
|
|
Curve *cu = ob->data;
|
2002-10-12 11:37:38 +00:00
|
|
|
Nurb *nu;
|
|
|
|
BevList *bl;
|
|
|
|
|
2006-11-06 01:08:26 +00:00
|
|
|
retopo_matrix_update(G.vd);
|
|
|
|
|
2005-10-03 14:13:47 +00:00
|
|
|
/* DispList */
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
drawDispList(base, dt);
|
2005-10-03 14:13:47 +00:00
|
|
|
|
|
|
|
if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
|
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* first non-selected handles */
|
2005-08-14 06:08:41 +00:00
|
|
|
for(nu=nurb; nu; nu=nu->next) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if((nu->type & 7)==CU_BEZIER) {
|
|
|
|
tekenhandlesN(nu, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
draw_editnurb(ob, nurb, 0);
|
|
|
|
draw_editnurb(ob, nurb, 1);
|
2005-10-03 14:13:47 +00:00
|
|
|
/* selected handles */
|
|
|
|
for(nu=nurb; nu; nu=nu->next) {
|
|
|
|
if((nu->type & 7)==1) tekenhandlesN(nu, 1);
|
|
|
|
tekenvertsN(nu, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-10-03 14:13:47 +00:00
|
|
|
/* direction vectors for 3d curve paths */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(cu->flag & CU_3D) {
|
2003-12-04 11:37:39 +00:00
|
|
|
BIF_ThemeColor(TH_WIRE);
|
2005-08-14 06:08:41 +00:00
|
|
|
for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
|
2005-08-14 07:02:51 +00:00
|
|
|
BevPoint *bevp= (BevPoint *)(bl+1);
|
2005-08-14 06:08:41 +00:00
|
|
|
int nr= bl->nr;
|
|
|
|
int skip= nu->resolu/16;
|
2006-08-13 08:31:59 +00:00
|
|
|
float fac;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-14 06:08:41 +00:00
|
|
|
while (nr-->0) {
|
2006-10-01 18:28:46 +00:00
|
|
|
float ox,oy,oz; // Offset perpendicular to the curve
|
|
|
|
float dx,dy,dz; // Delta along the curve
|
|
|
|
|
|
|
|
fac = calc_curve_subdiv_radius(cu, nu, (bl->nr - nr)) * G.scene->editbutsize;
|
|
|
|
|
|
|
|
ox = fac*bevp->mat[0][0];
|
|
|
|
oy = fac*bevp->mat[0][1];
|
|
|
|
oz = fac*bevp->mat[0][2];
|
|
|
|
|
|
|
|
dx = fac*bevp->mat[2][0];
|
|
|
|
dy = fac*bevp->mat[2][1];
|
|
|
|
dz = fac*bevp->mat[2][2];
|
|
|
|
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3f(bevp->x - ox - dx, bevp->y - oy - dy, bevp->z - oz - dz);
|
|
|
|
glVertex3f(bevp->x, bevp->y, bevp->z);
|
|
|
|
glVertex3f(bevp->x + ox - dx, bevp->y + oy - dy, bevp->z + oz - dz);
|
|
|
|
glEnd();
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-14 06:08:41 +00:00
|
|
|
bevp += skip+1;
|
|
|
|
nr -= skip;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-14 06:08:41 +00:00
|
|
|
for(nu=nurb; nu; nu=nu->next) {
|
2002-10-12 11:37:38 +00:00
|
|
|
tekenvertsN(nu, 1);
|
|
|
|
}
|
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-11-08 10:51:27 +00:00
|
|
|
/* draw points on curve speed handles */
|
|
|
|
static void curve_draw_speed(Object *ob)
|
|
|
|
{
|
|
|
|
Curve *cu= ob->data;
|
|
|
|
IpoCurve *icu;
|
|
|
|
BezTriple *bezt;
|
|
|
|
float loc[4], dir[3];
|
|
|
|
int a;
|
|
|
|
|
|
|
|
if(cu->ipo==NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
icu= cu->ipo->curve.first;
|
|
|
|
if(icu==NULL || icu->totvert<2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) );
|
|
|
|
bglBegin(GL_POINTS);
|
|
|
|
|
|
|
|
for(a=0, bezt= icu->bezt; a<icu->totvert; a++, bezt++) {
|
|
|
|
if( where_on_path(ob, bezt->vec[1][1], loc, dir)) {
|
|
|
|
BIF_ThemeColor((bezt->f2 & SELECT) && ob==OBACT?TH_VERTEX_SELECT:TH_VERTEX);
|
|
|
|
bglVertex3fv(loc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
glPointSize(1.0);
|
|
|
|
bglEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void tekentextcurs(void)
|
|
|
|
{
|
|
|
|
cpack(0);
|
2006-05-22 05:52:48 +00:00
|
|
|
|
|
|
|
set_inverted_drawing(1);
|
2002-10-12 11:37:38 +00:00
|
|
|
glBegin(GL_QUADS);
|
|
|
|
glVertex2fv(G.textcurs[0]);
|
|
|
|
glVertex2fv(G.textcurs[1]);
|
|
|
|
glVertex2fv(G.textcurs[2]);
|
|
|
|
glVertex2fv(G.textcurs[3]);
|
|
|
|
glEnd();
|
2006-05-22 05:52:48 +00:00
|
|
|
set_inverted_drawing(0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
static void drawspiral(float *cent, float rad, float tmat[][4], int start)
|
2004-07-18 22:23:50 +00:00
|
|
|
{
|
|
|
|
float vec[3], vx[3], vy[3];
|
|
|
|
int a, tot=32;
|
2004-08-16 01:14:18 +00:00
|
|
|
char inverse=0;
|
2004-07-18 22:23:50 +00:00
|
|
|
/* 32 values of sin function (still same result!) */
|
|
|
|
static float si[32] = {0.00000000,
|
|
|
|
0.20129852,
|
|
|
|
0.39435585,
|
|
|
|
0.57126821,
|
|
|
|
0.72479278,
|
|
|
|
0.84864425,
|
|
|
|
0.93775213,
|
|
|
|
0.98846832,
|
|
|
|
0.99871650,
|
|
|
|
0.96807711,
|
|
|
|
0.89780453,
|
|
|
|
0.79077573,
|
|
|
|
0.65137248,
|
|
|
|
0.48530196,
|
|
|
|
0.29936312,
|
|
|
|
0.10116832,
|
|
|
|
-0.10116832,
|
|
|
|
-0.29936312,
|
|
|
|
-0.48530196,
|
|
|
|
-0.65137248,
|
|
|
|
-0.79077573,
|
|
|
|
-0.89780453,
|
|
|
|
-0.96807711,
|
|
|
|
-0.99871650,
|
|
|
|
-0.98846832,
|
|
|
|
-0.93775213,
|
|
|
|
-0.84864425,
|
|
|
|
-0.72479278,
|
|
|
|
-0.57126821,
|
|
|
|
-0.39435585,
|
|
|
|
-0.20129852,
|
|
|
|
0.00000000};
|
|
|
|
/* 32 values of cos function (still same result!) */
|
|
|
|
static float co[32] ={1.00000000,
|
|
|
|
0.97952994,
|
|
|
|
0.91895781,
|
|
|
|
0.82076344,
|
|
|
|
0.68896691,
|
|
|
|
0.52896401,
|
|
|
|
0.34730525,
|
|
|
|
0.15142777,
|
|
|
|
-0.05064916,
|
|
|
|
-0.25065253,
|
|
|
|
-0.44039415,
|
|
|
|
-0.61210598,
|
|
|
|
-0.75875812,
|
|
|
|
-0.87434661,
|
|
|
|
-0.95413925,
|
|
|
|
-0.99486932,
|
|
|
|
-0.99486932,
|
|
|
|
-0.95413925,
|
|
|
|
-0.87434661,
|
|
|
|
-0.75875812,
|
|
|
|
-0.61210598,
|
|
|
|
-0.44039415,
|
|
|
|
-0.25065253,
|
|
|
|
-0.05064916,
|
|
|
|
0.15142777,
|
|
|
|
0.34730525,
|
|
|
|
0.52896401,
|
|
|
|
0.68896691,
|
|
|
|
0.82076344,
|
|
|
|
0.91895781,
|
|
|
|
0.97952994,
|
|
|
|
1.00000000};
|
|
|
|
|
2004-08-16 01:14:18 +00:00
|
|
|
if (start < 0) {
|
|
|
|
inverse = 1;
|
|
|
|
start *= -1;
|
|
|
|
}
|
|
|
|
|
2004-07-18 22:23:50 +00:00
|
|
|
VECCOPY(vx, tmat[0]);
|
|
|
|
VECCOPY(vy, tmat[1]);
|
|
|
|
VecMulf(vx, rad);
|
|
|
|
VecMulf(vy, rad);
|
|
|
|
|
|
|
|
VECCOPY(vec, cent);
|
|
|
|
|
2004-08-16 01:14:18 +00:00
|
|
|
if (inverse==0) {
|
|
|
|
for(a=0; a<tot; a++) {
|
|
|
|
if (a+start>31)
|
|
|
|
start=-a + 1;
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
vec[0]= cent[0] + *(si+a+start) * (vx[0] * (float)a/(float)tot) + *(co+a+start) * (vy[0] * (float)a/(float)tot);
|
|
|
|
vec[1]= cent[1] + *(si+a+start) * (vx[1] * (float)a/(float)tot) + *(co+a+start) * (vy[1] * (float)a/(float)tot);
|
|
|
|
vec[2]= cent[2] + *(si+a+start) * (vx[2] * (float)a/(float)tot) + *(co+a+start) * (vy[2] * (float)a/(float)tot);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
a=0;
|
|
|
|
vec[0]= cent[0] + *(si+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
|
|
|
|
vec[1]= cent[1] + *(si+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
|
|
|
|
vec[2]= cent[2] + *(si+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
|
|
|
|
for(a=0; a<tot; a++) {
|
|
|
|
if (a+start>31)
|
|
|
|
start=-a + 1;
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
vec[0]= cent[0] + *(si+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
|
|
|
|
vec[1]= cent[1] + *(si+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
|
|
|
|
vec[2]= cent[2] + *(si+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glEnd();
|
|
|
|
}
|
2004-07-18 22:23:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-20 08:26:22 +00:00
|
|
|
void drawcircball(int mode, float *cent, float rad, float tmat[][4])
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2003-09-08 12:13:54 +00:00
|
|
|
float vec[3], vx[3], vy[3];
|
2002-10-12 11:37:38 +00:00
|
|
|
int a, tot=32;
|
2003-09-08 12:13:54 +00:00
|
|
|
|
|
|
|
/* 32 values of sin function (still same result!) */
|
|
|
|
static float si[32] = {0.00000000,
|
|
|
|
0.20129852,
|
|
|
|
0.39435585,
|
|
|
|
0.57126821,
|
|
|
|
0.72479278,
|
|
|
|
0.84864425,
|
|
|
|
0.93775213,
|
|
|
|
0.98846832,
|
|
|
|
0.99871650,
|
|
|
|
0.96807711,
|
|
|
|
0.89780453,
|
|
|
|
0.79077573,
|
|
|
|
0.65137248,
|
|
|
|
0.48530196,
|
|
|
|
0.29936312,
|
|
|
|
0.10116832,
|
|
|
|
-0.10116832,
|
|
|
|
-0.29936312,
|
|
|
|
-0.48530196,
|
|
|
|
-0.65137248,
|
|
|
|
-0.79077573,
|
|
|
|
-0.89780453,
|
|
|
|
-0.96807711,
|
|
|
|
-0.99871650,
|
|
|
|
-0.98846832,
|
|
|
|
-0.93775213,
|
|
|
|
-0.84864425,
|
|
|
|
-0.72479278,
|
|
|
|
-0.57126821,
|
|
|
|
-0.39435585,
|
|
|
|
-0.20129852,
|
|
|
|
0.00000000};
|
|
|
|
/* 32 values of cos function (still same result!) */
|
|
|
|
static float co[32] ={1.00000000,
|
|
|
|
0.97952994,
|
|
|
|
0.91895781,
|
|
|
|
0.82076344,
|
|
|
|
0.68896691,
|
|
|
|
0.52896401,
|
|
|
|
0.34730525,
|
|
|
|
0.15142777,
|
|
|
|
-0.05064916,
|
|
|
|
-0.25065253,
|
|
|
|
-0.44039415,
|
|
|
|
-0.61210598,
|
|
|
|
-0.75875812,
|
|
|
|
-0.87434661,
|
|
|
|
-0.95413925,
|
|
|
|
-0.99486932,
|
|
|
|
-0.99486932,
|
|
|
|
-0.95413925,
|
|
|
|
-0.87434661,
|
|
|
|
-0.75875812,
|
|
|
|
-0.61210598,
|
|
|
|
-0.44039415,
|
|
|
|
-0.25065253,
|
|
|
|
-0.05064916,
|
|
|
|
0.15142777,
|
|
|
|
0.34730525,
|
|
|
|
0.52896401,
|
|
|
|
0.68896691,
|
|
|
|
0.82076344,
|
|
|
|
0.91895781,
|
|
|
|
0.97952994,
|
|
|
|
1.00000000};
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
VECCOPY(vx, tmat[0]);
|
|
|
|
VECCOPY(vy, tmat[1]);
|
|
|
|
VecMulf(vx, rad);
|
|
|
|
VecMulf(vy, rad);
|
|
|
|
|
2005-04-20 08:26:22 +00:00
|
|
|
glBegin(mode);
|
2003-09-08 12:13:54 +00:00
|
|
|
for(a=0; a<tot; a++) {
|
|
|
|
vec[0]= cent[0] + *(si+a) * vx[0] + *(co+a) * vy[0];
|
|
|
|
vec[1]= cent[1] + *(si+a) * vx[1] + *(co+a) * vy[1];
|
|
|
|
vec[2]= cent[2] + *(si+a) * vx[2] + *(co+a) * vy[2];
|
2002-10-12 11:37:38 +00:00
|
|
|
glVertex3fv(vec);
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* return 1 if nothing was drawn */
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
static int drawmball(Base *base, int dt)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
Object *ob= base->object;
|
2002-10-12 11:37:38 +00:00
|
|
|
MetaBall *mb;
|
|
|
|
MetaElem *ml;
|
|
|
|
float imat[4][4], tmat[4][4];
|
|
|
|
int code= 1;
|
|
|
|
|
|
|
|
mb= ob->data;
|
|
|
|
|
|
|
|
if(ob==G.obedit) {
|
2003-12-04 11:37:39 +00:00
|
|
|
BIF_ThemeColor(TH_WIRE);
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if((G.f & G_PICKSEL)==0 ) drawDispList(base, dt);
|
2002-10-12 11:37:38 +00:00
|
|
|
ml= editelems.first;
|
2004-06-19 17:35:37 +00:00
|
|
|
}
|
|
|
|
else {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if((base->flag & OB_FROMDUPLI)==0)
|
|
|
|
drawDispList(base, dt);
|
2004-06-19 17:35:37 +00:00
|
|
|
ml= mb->elems.first;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
if(ml==NULL) return 1;
|
|
|
|
|
2004-06-19 17:35:37 +00:00
|
|
|
/* in case solid draw, reset wire colors */
|
|
|
|
if(ob!=G.obedit && (ob->flag & SELECT)) {
|
|
|
|
if(ob==OBACT) BIF_ThemeColor(TH_ACTIVE);
|
|
|
|
else BIF_ThemeColor(TH_SELECT);
|
|
|
|
}
|
|
|
|
else BIF_ThemeColor(TH_WIRE);
|
|
|
|
|
|
|
|
mygetmatrix(tmat);
|
|
|
|
Mat4Invert(imat, tmat);
|
|
|
|
Normalise(imat[0]);
|
|
|
|
Normalise(imat[1]);
|
|
|
|
|
|
|
|
while(ml) {
|
2005-04-11 19:31:05 +00:00
|
|
|
|
|
|
|
/* draw radius */
|
2004-06-19 17:35:37 +00:00
|
|
|
if(ob==G.obedit) {
|
2005-04-11 19:31:05 +00:00
|
|
|
if((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
|
2004-06-19 17:35:37 +00:00
|
|
|
else cpack(0x3030A0);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-06-19 17:35:37 +00:00
|
|
|
if(G.f & G_PICKSEL) {
|
2005-04-11 19:31:05 +00:00
|
|
|
ml->selcol1= code;
|
2004-06-19 17:35:37 +00:00
|
|
|
glLoadName(code++);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2005-04-20 08:26:22 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad, imat);
|
2005-04-11 19:31:05 +00:00
|
|
|
|
|
|
|
/* draw stiffness */
|
|
|
|
if(ob==G.obedit) {
|
|
|
|
if((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
|
|
|
|
else cpack(0x30A030);
|
|
|
|
|
|
|
|
if(G.f & G_PICKSEL) {
|
|
|
|
ml->selcol2= code;
|
|
|
|
glLoadName(code++);
|
|
|
|
}
|
2005-05-22 19:16:04 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad*atan(ml->s)/M_PI_2, imat);
|
2005-04-11 19:31:05 +00:00
|
|
|
}
|
2004-06-19 17:35:37 +00:00
|
|
|
|
|
|
|
ml= ml->next;
|
2004-06-19 09:35:23 +00:00
|
|
|
}
|
2005-11-19 10:55:07 +00:00
|
|
|
return 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2004-07-11 13:17:03 +00:00
|
|
|
static void draw_forcefield(Object *ob)
|
|
|
|
{
|
2005-04-04 18:09:47 +00:00
|
|
|
PartDeflect *pd= ob->pd;
|
2004-07-11 13:17:03 +00:00
|
|
|
float imat[4][4], tmat[4][4];
|
|
|
|
float vec[3]= {0.0, 0.0, 0.0};
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
int curcol;
|
2006-02-07 13:05:17 +00:00
|
|
|
float size;
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
|
|
|
|
if(ob!=G.obedit && (ob->flag & SELECT)) {
|
|
|
|
if(ob==OBACT) curcol= TH_ACTIVE;
|
|
|
|
else curcol= TH_SELECT;
|
|
|
|
}
|
|
|
|
else curcol= TH_WIRE;
|
2004-07-11 13:17:03 +00:00
|
|
|
|
2006-02-07 13:05:17 +00:00
|
|
|
/* scale size of circle etc with the empty drawsize */
|
|
|
|
if (ob->type == OB_EMPTY) size = ob->empty_drawsize;
|
|
|
|
else size = 1.0;
|
|
|
|
|
2005-04-04 18:09:47 +00:00
|
|
|
/* calculus here, is reused in PFIELD_FORCE */
|
|
|
|
mygetmatrix(tmat);
|
|
|
|
Mat4Invert(imat, tmat);
|
|
|
|
// Normalise(imat[0]); // we don't do this because field doesnt scale either... apart from wind!
|
|
|
|
// Normalise(imat[1]);
|
|
|
|
|
|
|
|
if (pd->forcefield == PFIELD_WIND) {
|
|
|
|
float force_val;
|
|
|
|
|
|
|
|
Mat4One(tmat);
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
|
2005-04-04 18:09:47 +00:00
|
|
|
|
|
|
|
if (has_ipo_code(ob->ipo, OB_PD_FSTR))
|
|
|
|
force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, G.scene->r.cfra);
|
|
|
|
else
|
|
|
|
force_val = pd->f_strength;
|
|
|
|
force_val*= 0.1;
|
2006-02-07 13:05:17 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size, tmat);
|
2005-04-04 18:09:47 +00:00
|
|
|
vec[2]= 0.5*force_val;
|
2006-02-07 13:05:17 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size, tmat);
|
2005-04-04 18:09:47 +00:00
|
|
|
vec[2]= 1.0*force_val;
|
2006-02-07 13:05:17 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size, tmat);
|
2005-04-04 18:09:47 +00:00
|
|
|
vec[2]= 1.5*force_val;
|
2006-02-07 13:05:17 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size, tmat);
|
2005-04-04 18:09:47 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else if (pd->forcefield == PFIELD_FORCE) {
|
2004-07-18 22:23:50 +00:00
|
|
|
float ffall_val;
|
|
|
|
|
|
|
|
if (has_ipo_code(ob->ipo, OB_PD_FFALL))
|
|
|
|
ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, G.scene->r.cfra);
|
|
|
|
else
|
2005-04-04 18:09:47 +00:00
|
|
|
ffall_val = pd->f_power;
|
2004-07-18 22:23:50 +00:00
|
|
|
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
|
2006-02-07 13:05:17 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size, imat);
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(1.5, (double)ffall_val));
|
2006-02-07 13:05:17 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size*1.5, imat);
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(2.0, (double)ffall_val));
|
2006-02-07 13:05:17 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, size*2.0, imat);
|
2004-07-18 22:23:50 +00:00
|
|
|
}
|
2005-04-04 18:09:47 +00:00
|
|
|
else if (pd->forcefield == PFIELD_VORTEX) {
|
2004-08-16 01:14:18 +00:00
|
|
|
float ffall_val, force_val;
|
2004-07-18 22:23:50 +00:00
|
|
|
|
2004-08-16 01:14:18 +00:00
|
|
|
Mat4One(imat);
|
2004-07-18 22:23:50 +00:00
|
|
|
if (has_ipo_code(ob->ipo, OB_PD_FFALL))
|
|
|
|
ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, G.scene->r.cfra);
|
|
|
|
else
|
2005-04-04 18:09:47 +00:00
|
|
|
ffall_val = pd->f_power;
|
2004-07-18 22:23:50 +00:00
|
|
|
|
2004-08-16 01:14:18 +00:00
|
|
|
if (has_ipo_code(ob->ipo, OB_PD_FSTR))
|
|
|
|
force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, G.scene->r.cfra);
|
|
|
|
else
|
2005-04-04 18:09:47 +00:00
|
|
|
force_val = pd->f_strength;
|
2004-08-16 01:14:18 +00:00
|
|
|
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.7);
|
2004-08-16 01:14:18 +00:00
|
|
|
if (force_val < 0) {
|
2006-02-07 13:05:17 +00:00
|
|
|
drawspiral(vec, size*1.0, imat, 1);
|
|
|
|
drawspiral(vec, size*1.0, imat, 16);
|
2004-08-16 01:14:18 +00:00
|
|
|
}
|
|
|
|
else {
|
2006-02-07 13:05:17 +00:00
|
|
|
drawspiral(vec, size*1.0, imat, -1);
|
|
|
|
drawspiral(vec, size*1.0, imat, -16);
|
2004-08-16 01:14:18 +00:00
|
|
|
}
|
2004-07-18 22:23:50 +00:00
|
|
|
}
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
else if (pd->forcefield == PFIELD_GUIDE && ob->type==OB_CURVE) {
|
|
|
|
Curve *cu= ob->data;
|
|
|
|
if((cu->flag & CU_PATH) && cu->path && cu->path->data) {
|
|
|
|
float mindist, guidevec1[4], guidevec2[3];
|
|
|
|
|
|
|
|
if (has_ipo_code(ob->ipo, OB_PD_FSTR))
|
|
|
|
mindist = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, G.scene->r.cfra);
|
|
|
|
else
|
|
|
|
mindist = pd->f_strength;
|
|
|
|
|
|
|
|
/*path end*/
|
|
|
|
setlinestyle(3);
|
|
|
|
where_on_path(ob, 1.0f, guidevec1, guidevec2);
|
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
|
|
|
|
drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
|
|
|
|
|
|
|
|
/*path beginning*/
|
|
|
|
setlinestyle(0);
|
|
|
|
where_on_path(ob, 0.0f, guidevec1, guidevec2);
|
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
|
|
|
|
drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
|
|
|
|
|
|
|
|
VECCOPY(vec, guidevec1); /* max center */
|
|
|
|
}
|
|
|
|
}
|
2004-07-18 22:23:50 +00:00
|
|
|
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
/* as last, guide curve alters it */
|
|
|
|
if(pd->flag & PFIELD_USEMAX) {
|
|
|
|
setlinestyle(3);
|
|
|
|
BIF_ThemeColorBlend(curcol, TH_BACK, 0.5);
|
|
|
|
drawcircball(GL_LINE_LOOP, vec, pd->maxdist, imat);
|
|
|
|
setlinestyle(0);
|
|
|
|
}
|
2004-07-11 13:17:03 +00:00
|
|
|
}
|
|
|
|
|
2005-07-15 15:00:08 +00:00
|
|
|
static void draw_box(float vec[8][3])
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
glBegin(GL_LINE_STRIP);
|
2005-07-15 15:00:08 +00:00
|
|
|
glVertex3fv(vec[0]); glVertex3fv(vec[1]);glVertex3fv(vec[2]); glVertex3fv(vec[3]);
|
|
|
|
glVertex3fv(vec[0]); glVertex3fv(vec[4]);glVertex3fv(vec[5]); glVertex3fv(vec[6]);
|
|
|
|
glVertex3fv(vec[7]); glVertex3fv(vec[4]);
|
2002-10-12 11:37:38 +00:00
|
|
|
glEnd();
|
|
|
|
|
2005-07-15 15:00:08 +00:00
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3fv(vec[1]); glVertex3fv(vec[5]);
|
|
|
|
glVertex3fv(vec[2]); glVertex3fv(vec[6]);
|
|
|
|
glVertex3fv(vec[3]); glVertex3fv(vec[7]);
|
2002-10-12 11:37:38 +00:00
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
2006-06-14 08:50:41 +00:00
|
|
|
/* uses boundbox, function used by Ketsji */
|
2002-10-12 11:37:38 +00:00
|
|
|
void get_local_bounds(Object *ob, float *centre, float *size)
|
|
|
|
{
|
2006-06-14 08:50:41 +00:00
|
|
|
BoundBox *bb= object_get_boundbox(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(bb==NULL) {
|
|
|
|
centre[0]= centre[1]= centre[2]= 0.0;
|
|
|
|
VECCOPY(size, ob->size);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]);
|
|
|
|
size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
|
|
|
|
size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
|
|
|
|
|
|
|
|
centre[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
|
|
|
|
centre[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
|
|
|
|
centre[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void draw_bb_quadric(BoundBox *bb, short type)
|
|
|
|
{
|
|
|
|
float size[3], cent[3];
|
|
|
|
GLUquadricObj *qobj = gluNewQuadric();
|
|
|
|
|
|
|
|
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
|
|
|
|
|
|
|
|
size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]);
|
|
|
|
size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
|
|
|
|
size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
|
|
|
|
|
|
|
|
cent[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
|
|
|
|
cent[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
|
|
|
|
cent[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
|
|
|
|
|
2004-04-06 14:37:25 +00:00
|
|
|
glPushMatrix();
|
2002-10-12 11:37:38 +00:00
|
|
|
if(type==OB_BOUND_SPHERE) {
|
|
|
|
glTranslatef(cent[0], cent[1], cent[2]);
|
|
|
|
glScalef(size[0], size[1], size[2]);
|
|
|
|
gluSphere(qobj, 1.0, 8, 5);
|
|
|
|
}
|
|
|
|
else if(type==OB_BOUND_CYLINDER) {
|
2004-05-16 13:23:59 +00:00
|
|
|
float radius = size[0] > size[1] ? size[0] : size[1];
|
2002-10-12 11:37:38 +00:00
|
|
|
glTranslatef(cent[0], cent[1], cent[2]-size[2]);
|
2004-05-16 13:23:59 +00:00
|
|
|
glScalef(radius, radius, 2.0*size[2]);
|
2002-10-12 11:37:38 +00:00
|
|
|
gluCylinder(qobj, 1.0, 1.0, 1.0, 8, 1);
|
|
|
|
}
|
|
|
|
else if(type==OB_BOUND_CONE) {
|
2004-05-16 13:23:59 +00:00
|
|
|
float radius = size[0] > size[1] ? size[0] : size[1];
|
|
|
|
glTranslatef(cent[0], cent[2]-size[2], cent[1]);
|
|
|
|
glScalef(radius, 2.0*size[2], radius);
|
|
|
|
glRotatef(-90., 1.0, 0.0, 0.0);
|
2002-10-12 11:37:38 +00:00
|
|
|
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
|
|
|
|
}
|
2004-04-06 14:37:25 +00:00
|
|
|
glPopMatrix();
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
gluDeleteQuadric(qobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void draw_bounding_volume(Object *ob)
|
|
|
|
{
|
|
|
|
BoundBox *bb=0;
|
|
|
|
|
|
|
|
if(ob->type==OB_MESH) {
|
2005-07-14 18:04:27 +00:00
|
|
|
bb= mesh_get_bb(ob->data);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
|
|
|
|
bb= ( (Curve *)ob->data )->bb;
|
|
|
|
}
|
|
|
|
else if(ob->type==OB_MBALL) {
|
|
|
|
bb= ob->bb;
|
|
|
|
if(bb==0) {
|
2005-07-14 18:14:19 +00:00
|
|
|
makeDispListMBall(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
bb= ob->bb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawcube();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(bb==0) return;
|
|
|
|
|
2005-07-15 15:00:08 +00:00
|
|
|
if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
else draw_bb_quadric(bb, ob->boundtype);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void drawtexspace(Object *ob)
|
|
|
|
{
|
2005-07-14 21:57:18 +00:00
|
|
|
float vec[8][3], loc[3], size[3];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(ob->type==OB_MESH) {
|
2005-07-14 21:57:18 +00:00
|
|
|
mesh_get_texspace(ob->data, loc, NULL, size);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
|
2005-07-14 21:57:18 +00:00
|
|
|
Curve *cu= ob->data;
|
|
|
|
VECCOPY(size, cu->size);
|
|
|
|
VECCOPY(loc, cu->loc);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if(ob->type==OB_MBALL) {
|
2005-07-14 21:57:18 +00:00
|
|
|
MetaBall *mb= ob->data;
|
|
|
|
VECCOPY(size, mb->size);
|
|
|
|
VECCOPY(loc, mb->loc);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else return;
|
|
|
|
|
2005-07-14 21:57:18 +00:00
|
|
|
vec[0][0]=vec[1][0]=vec[2][0]=vec[3][0]= loc[0]-size[0];
|
|
|
|
vec[4][0]=vec[5][0]=vec[6][0]=vec[7][0]= loc[0]+size[0];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-14 21:57:18 +00:00
|
|
|
vec[0][1]=vec[1][1]=vec[4][1]=vec[5][1]= loc[1]-size[1];
|
|
|
|
vec[2][1]=vec[3][1]=vec[6][1]=vec[7][1]= loc[1]+size[1];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-14 21:57:18 +00:00
|
|
|
vec[0][2]=vec[3][2]=vec[4][2]=vec[7][2]= loc[2]-size[2];
|
|
|
|
vec[1][2]=vec[2][2]=vec[5][2]=vec[6][2]= loc[2]+size[2];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
setlinestyle(2);
|
|
|
|
|
2005-07-15 15:00:08 +00:00
|
|
|
draw_box(vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
setlinestyle(0);
|
|
|
|
}
|
|
|
|
|
2004-06-17 18:31:42 +00:00
|
|
|
/* draws wire outline */
|
2005-07-23 18:52:31 +00:00
|
|
|
static void drawSolidSelect(Base *base)
|
2004-06-17 18:31:42 +00:00
|
|
|
{
|
2005-07-23 18:52:31 +00:00
|
|
|
Object *ob= base->object;
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glLineWidth(2.0);
|
|
|
|
glDepthMask(0);
|
2005-07-14 12:44:33 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if(ELEM3(ob->type, OB_FONT,OB_CURVE, OB_SURF)) {
|
|
|
|
Curve *cu = ob->data;
|
|
|
|
if (displist_has_faces(&cu->disp) && boundbox_clip(ob->obmat, cu->bb)) {
|
|
|
|
drawDispListwire(&cu->disp);
|
2004-10-27 09:25:55 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
} else if (ob->type==OB_MBALL) {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if((base->flag & OB_FROMDUPLI)==0)
|
|
|
|
drawDispListwire(&ob->disp);
|
2004-06-19 17:35:37 +00:00
|
|
|
}
|
2005-07-12 15:47:53 +00:00
|
|
|
else if(ob->type==OB_ARMATURE) {
|
2005-07-23 18:52:31 +00:00
|
|
|
if(!(ob->flag & OB_POSEMODE)) {
|
|
|
|
draw_armature(base, OB_WIRE);
|
2005-07-12 15:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
2004-06-19 18:23:22 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
glLineWidth(1.0);
|
|
|
|
glDepthMask(1);
|
2004-06-17 18:31:42 +00:00
|
|
|
}
|
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
static void drawWireExtra(Object *ob)
|
2003-10-21 16:41:28 +00:00
|
|
|
{
|
|
|
|
if(ob!=G.obedit && (ob->flag & SELECT)) {
|
2006-03-11 18:51:41 +00:00
|
|
|
if(ob==OBACT) {
|
|
|
|
if(ob->flag & OB_FROMGROUP) BIF_ThemeColor(TH_GROUP_ACTIVE);
|
|
|
|
else BIF_ThemeColor(TH_ACTIVE);
|
|
|
|
}
|
|
|
|
else if(ob->flag & OB_FROMGROUP)
|
|
|
|
BIF_ThemeColorShade(TH_GROUP_ACTIVE, -16);
|
|
|
|
else
|
|
|
|
BIF_ThemeColor(TH_SELECT);
|
2003-10-21 16:41:28 +00:00
|
|
|
}
|
2006-03-11 18:51:41 +00:00
|
|
|
else {
|
|
|
|
if(ob->flag & OB_FROMGROUP)
|
|
|
|
BIF_ThemeColor(TH_GROUP);
|
2006-11-03 06:39:58 +00:00
|
|
|
else {
|
|
|
|
if(ob->dtx & OB_DRAWWIRE) {
|
|
|
|
glColor3ub(80,80,80);
|
|
|
|
} else {
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
}
|
|
|
|
}
|
2006-03-11 18:51:41 +00:00
|
|
|
}
|
|
|
|
|
2004-09-27 10:12:45 +00:00
|
|
|
bglPolygonOffset(1.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
|
|
|
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
|
2003-10-21 16:41:28 +00:00
|
|
|
|
2005-03-26 17:29:37 +00:00
|
|
|
if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
|
|
|
|
Curve *cu = ob->data;
|
|
|
|
if (boundbox_clip(ob->obmat, cu->bb)) {
|
|
|
|
if (ob->type==OB_CURVE)
|
|
|
|
draw_index_wire= 0;
|
|
|
|
drawDispListwire(&cu->disp);
|
|
|
|
if (ob->type==OB_CURVE)
|
|
|
|
draw_index_wire= 1;
|
|
|
|
}
|
|
|
|
} else if (ob->type==OB_MBALL) {
|
|
|
|
drawDispListwire(&ob->disp);
|
2004-09-30 14:27:20 +00:00
|
|
|
}
|
2003-10-21 16:41:28 +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
|
|
|
glDepthMask(1);
|
2004-09-27 10:12:45 +00:00
|
|
|
bglPolygonOffset(0.0);
|
2003-10-21 16:41:28 +00:00
|
|
|
}
|
|
|
|
|
2004-09-14 19:03:11 +00:00
|
|
|
/* should be called in view space */
|
|
|
|
static void draw_hooks(Object *ob)
|
|
|
|
{
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
ModifierData *md;
|
2004-09-14 19:03:11 +00:00
|
|
|
float vec[3];
|
|
|
|
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
for (md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
if (md->type==eModifierType_Hook) {
|
|
|
|
HookModifierData *hmd = (HookModifierData*) md;
|
2004-09-14 19:03:11 +00:00
|
|
|
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
VecMat4MulVecfl(vec, ob->obmat, hmd->cent);
|
|
|
|
|
|
|
|
if(hmd->object) {
|
|
|
|
setlinestyle(3);
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3fv(hmd->object->obmat[3]);
|
|
|
|
glVertex3fv(vec);
|
|
|
|
glEnd();
|
|
|
|
setlinestyle(0);
|
|
|
|
}
|
2004-09-14 19:03:11 +00:00
|
|
|
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
glPointSize(3.0);
|
|
|
|
bglBegin(GL_POINTS);
|
|
|
|
bglVertex3fv(vec);
|
|
|
|
bglEnd();
|
|
|
|
glPointSize(1.0);
|
|
|
|
}
|
2004-09-14 19:03:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
/* flag can be DRAW_PICKING and/or DRAW_CONSTCOLOR */
|
|
|
|
void draw_object(Base *base, int flag)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-11-19 10:55:07 +00:00
|
|
|
static int warning_recursive= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *ob;
|
|
|
|
Curve *cu;
|
2005-11-19 10:55:07 +00:00
|
|
|
float cfraont;
|
|
|
|
float vec1[3], vec2[3];
|
|
|
|
unsigned int col=0;
|
2002-10-12 11:37:38 +00:00
|
|
|
int sel, drawtype, colindex= 0, ipoflag;
|
2005-11-19 10:55:07 +00:00
|
|
|
int i, selstart, selend, empty_object=0;
|
2002-10-12 11:37:38 +00:00
|
|
|
short dt, dtx, zbufoff= 0;
|
2005-11-19 10:55:07 +00:00
|
|
|
|
|
|
|
/* only once set now, will be removed too, should become a global standard */
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob= base->object;
|
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
/* xray delay? */
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if((flag & DRAW_PICKING)==0 && (base->flag & OB_FROMDUPLI)==0) {
|
2005-11-28 16:59:12 +00:00
|
|
|
/* xray and transp are set when it is drawing the 2nd/3rd pass */
|
2005-07-14 15:49:31 +00:00
|
|
|
if(!G.vd->xray && !G.vd->transp && (ob->dtx & OB_DRAWXRAY)) {
|
2005-07-14 12:44:33 +00:00
|
|
|
add_view3d_after(G.vd, base, V3D_XRAY);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* draw keys? */
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
if(base==(G.scene->basact) || (base->flag & (SELECT+BA_WAS_SEL))) {
|
2005-11-28 16:59:12 +00:00
|
|
|
if(flag==0 && warning_recursive==0 && ob!=G.obedit) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
|
2005-11-19 10:55:07 +00:00
|
|
|
ListBase elems;
|
|
|
|
CfraElem *ce;
|
2002-10-12 11:37:38 +00:00
|
|
|
float temp[7][3];
|
|
|
|
|
|
|
|
warning_recursive= 1;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
elems.first= elems.last= 0;
|
|
|
|
make_cfra_list(ob->ipo, &elems);
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cfraont= (G.scene->r.cfra);
|
|
|
|
drawtype= G.vd->drawtype;
|
|
|
|
if(drawtype>OB_WIRE) G.vd->drawtype= OB_WIRE;
|
|
|
|
sel= base->flag;
|
|
|
|
memcpy(temp, &ob->loc, 7*3*sizeof(float));
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ipoflag= ob->ipoflag;
|
|
|
|
ob->ipoflag &= ~OB_OFFS_OB;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
set_no_parent_ipo(1);
|
|
|
|
disable_speed_curve(1);
|
|
|
|
|
|
|
|
if ((ob->ipoflag & OB_DRAWKEYSEL)==0) {
|
|
|
|
ce= elems.first;
|
|
|
|
while(ce) {
|
|
|
|
if(!ce->sel) {
|
|
|
|
(G.scene->r.cfra)= ce->cfra/G.scene->r.framelen;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
base->flag= 0;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
where_is_object_time(ob, (G.scene->r.cfra));
|
2005-11-28 16:59:12 +00:00
|
|
|
draw_object(base, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
ce= ce->next;
|
|
|
|
}
|
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ce= elems.first;
|
|
|
|
while(ce) {
|
|
|
|
if(ce->sel) {
|
|
|
|
(G.scene->r.cfra)= ce->cfra/G.scene->r.framelen;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
base->flag= SELECT;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
where_is_object_time(ob, (G.scene->r.cfra));
|
2005-11-28 16:59:12 +00:00
|
|
|
draw_object(base, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
ce= ce->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_no_parent_ipo(0);
|
|
|
|
disable_speed_curve(0);
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
base->flag= sel;
|
|
|
|
ob->ipoflag= ipoflag;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* restore icu->curval */
|
|
|
|
(G.scene->r.cfra)= cfraont;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
memcpy(&ob->loc, temp, 7*3*sizeof(float));
|
|
|
|
where_is_object(ob);
|
|
|
|
G.vd->drawtype= drawtype;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_freelistN(&elems);
|
|
|
|
|
|
|
|
warning_recursive= 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* patch? children objects with a timeoffs change the parents. How to solve! */
|
2002-10-12 11:37:38 +00:00
|
|
|
/* if( ((int)ob->ctime) != F_(G.scene->r.cfra)) where_is_object(ob); */
|
|
|
|
|
|
|
|
mymultmatrix(ob->obmat);
|
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* which wire color */
|
2005-11-28 16:59:12 +00:00
|
|
|
if((flag & DRAW_CONSTCOLOR) == 0) {
|
2002-10-12 11:37:38 +00:00
|
|
|
project_short(ob->obmat[3], &base->sx);
|
2006-11-03 06:42:08 +00:00
|
|
|
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
if((G.moving & G_TRANSFORM_OBJ) && (base->flag & (SELECT+BA_WAS_SEL))) BIF_ThemeColor(TH_TRANSFORM);
|
2002-10-12 11:37:38 +00:00
|
|
|
else {
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
if(ob->type==OB_LAMP) BIF_ThemeColor(TH_LAMP);
|
|
|
|
else BIF_ThemeColor(TH_WIRE);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if((G.scene->basact)==base) {
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
if(base->flag & (SELECT+BA_WAS_SEL)) BIF_ThemeColor(TH_ACTIVE);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else {
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
if(base->flag & (SELECT+BA_WAS_SEL)) BIF_ThemeColor(TH_SELECT);
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
// no theme yet
|
|
|
|
if(ob->id.lib) {
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
if(base->flag & (SELECT+BA_WAS_SEL)) colindex = 4;
|
2003-10-25 22:29:24 +00:00
|
|
|
else colindex = 3;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
else if(warning_recursive==1) {
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
if(base->flag & (SELECT+BA_WAS_SEL)) {
|
|
|
|
if(G.scene->basact==base) colindex = 8;
|
|
|
|
else colindex= 7;
|
|
|
|
}
|
2003-10-25 22:29:24 +00:00
|
|
|
else colindex = 6;
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
}
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
else if(ob->flag & OB_FROMGROUP) {
|
2006-03-10 18:52:49 +00:00
|
|
|
if(base->flag & (SELECT+BA_WAS_SEL)) {
|
|
|
|
if(G.scene->basact==base) BIF_ThemeColor(TH_GROUP_ACTIVE);
|
2006-03-11 18:51:41 +00:00
|
|
|
else BIF_ThemeColorShade(TH_GROUP_ACTIVE, -16);
|
2006-03-10 18:52:49 +00:00
|
|
|
}
|
|
|
|
else BIF_ThemeColor(TH_GROUP);
|
|
|
|
colindex= 0;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
}
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
if(colindex) {
|
|
|
|
col= colortab[colindex];
|
|
|
|
cpack(col);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* maximum drawtype */
|
|
|
|
dt= MIN2(G.vd->drawtype, ob->dt);
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf==0 && dt>OB_WIRE) dt= OB_WIRE;
|
2002-10-12 11:37:38 +00:00
|
|
|
dtx= 0;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* faceselect exception: also draw solid when dt==wire, except in editmode */
|
2005-12-19 15:55:26 +00:00
|
|
|
if(ob==OBACT && (G.f & (G_FACESELECT+G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->type==OB_MESH) {
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2004-09-27 20:19:16 +00:00
|
|
|
if(ob==G.obedit);
|
2002-10-12 11:37:38 +00:00
|
|
|
else {
|
2004-09-27 10:12:45 +00:00
|
|
|
dt= OB_SHADED;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT);
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
2005-12-19 15:55:26 +00:00
|
|
|
if(dt<OB_SOLID) zbufoff= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(dt<OB_SOLID) {
|
|
|
|
dt= OB_SOLID;
|
|
|
|
glClearDepth(1.); glClear(GL_DEPTH_BUFFER_BIT);
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
zbufoff= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-06 01:08:26 +00:00
|
|
|
|
2006-09-14 12:40:53 +00:00
|
|
|
/* draw-extra supported for boundbox drawmode too */
|
|
|
|
if(dt>=OB_BOUNDBOX ) {
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
dtx= ob->dtx;
|
|
|
|
if(G.obedit==ob) {
|
2003-10-21 21:59:00 +00:00
|
|
|
// the only 2 extra drawtypes alowed in editmode
|
|
|
|
dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(G.f & G_DRAW_EXT) {
|
|
|
|
if(ob->type==OB_EMPTY || ob->type==OB_CAMERA || ob->type==OB_LAMP) dt= OB_WIRE;
|
|
|
|
}
|
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
|
|
|
/* draw outline for selected solid objects, mesh does itself */
|
2005-03-26 17:29:37 +00:00
|
|
|
if((G.vd->flag & V3D_SELECT_OUTLINE) && ob->type!=OB_MESH) {
|
2004-09-27 10:12:45 +00:00
|
|
|
if(dt>OB_WIRE && dt<OB_TEXTURE && ob!=G.obedit) {
|
2005-11-28 16:59:12 +00:00
|
|
|
if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) {
|
2005-07-23 18:52:31 +00:00
|
|
|
drawSolidSelect(base);
|
2005-03-26 17:29:37 +00:00
|
|
|
}
|
2004-07-28 13:21:27 +00:00
|
|
|
}
|
2004-07-06 16:32:44 +00:00
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2004-06-19 09:35:23 +00:00
|
|
|
switch( ob->type) {
|
2006-11-03 06:42:08 +00:00
|
|
|
case OB_MESH:
|
|
|
|
if (!(base->flag&OB_RADIO)) {
|
|
|
|
empty_object= draw_mesh_object(base, dt, flag);
|
|
|
|
if(flag!=DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
|
|
|
|
|
|
|
|
if(G.obedit!=ob && warning_recursive==0) {
|
|
|
|
PartEff *paf = give_parteff(ob);
|
|
|
|
|
|
|
|
if(paf) {
|
|
|
|
if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
|
|
|
|
if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf, dt);
|
|
|
|
else if((flag & DRAW_PICKING) == 0) draw_particle_system(base, paf); // selection errors happen to easy
|
|
|
|
if(col) cpack(col);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-26 17:29:37 +00:00
|
|
|
|
2006-11-03 06:42:08 +00:00
|
|
|
break;
|
|
|
|
case OB_FONT:
|
|
|
|
cu= ob->data;
|
|
|
|
if (cu->disp.first==NULL) makeDispListCurveTypes(ob, 0);
|
|
|
|
if(ob==G.obedit) {
|
|
|
|
tekentextcurs();
|
|
|
|
|
|
|
|
if (cu->flag & CU_FAST) {
|
|
|
|
cpack(0xFFFFFF);
|
|
|
|
set_inverted_drawing(1);
|
|
|
|
drawDispList(base, OB_WIRE);
|
|
|
|
set_inverted_drawing(0);
|
|
|
|
} else {
|
|
|
|
drawDispList(base, dt);
|
|
|
|
}
|
2005-06-17 21:04:27 +00:00
|
|
|
|
2006-11-03 06:42:08 +00:00
|
|
|
if (cu->linewidth != 0.0) {
|
|
|
|
cpack(0xff44ff);
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
VECCOPY(vec1, ob->orig);
|
|
|
|
VECCOPY(vec2, ob->orig);
|
|
|
|
vec1[0] += cu->linewidth;
|
|
|
|
vec2[0] += cu->linewidth;
|
|
|
|
vec1[1] += cu->linedist * cu->fsize;
|
|
|
|
vec2[1] -= cu->lines * cu->linedist * cu->fsize;
|
|
|
|
setlinestyle(3);
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex2fv(vec1);
|
|
|
|
glVertex2fv(vec2);
|
|
|
|
glEnd();
|
|
|
|
setlinestyle(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
setlinestyle(3);
|
|
|
|
for (i=0; i<cu->totbox; i++) {
|
|
|
|
if (cu->tb[i].w != 0.0) {
|
|
|
|
if (i == (cu->actbox-1))
|
|
|
|
BIF_ThemeColor(TH_ACTIVE);
|
|
|
|
else
|
|
|
|
BIF_ThemeColor(TH_WIRE);
|
|
|
|
vec1[0] = cu->tb[i].x;
|
|
|
|
vec1[1] = cu->tb[i].y + cu->linedist*cu->fsize;
|
|
|
|
vec1[2] = 0.001;
|
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(vec1);
|
|
|
|
vec1[0] += cu->tb[i].w;
|
|
|
|
glVertex3fv(vec1);
|
|
|
|
vec1[1] -= (cu->tb[i].h + cu->linedist*cu->fsize);
|
|
|
|
glVertex3fv(vec1);
|
|
|
|
vec1[0] -= cu->tb[i].w;
|
|
|
|
glVertex3fv(vec1);
|
|
|
|
vec1[1] += cu->tb[i].h + cu->linedist*cu->fsize;
|
|
|
|
glVertex3fv(vec1);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setlinestyle(0);
|
|
|
|
|
|
|
|
|
|
|
|
if (getselection(&selstart, &selend) && selboxes) {
|
|
|
|
float selboxw;
|
|
|
|
|
|
|
|
cpack(0xffffff);
|
|
|
|
set_inverted_drawing(1);
|
|
|
|
for (i=0; i<(selend-selstart+1); i++) {
|
|
|
|
SelBox *sb = &(selboxes[i]);
|
|
|
|
|
|
|
|
if (i<(selend-selstart)) {
|
|
|
|
if (selboxes[i+1].y == sb->y)
|
|
|
|
selboxw= selboxes[i+1].x - sb->x;
|
|
|
|
else
|
|
|
|
selboxw= sb->w;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
selboxw= sb->w;
|
|
|
|
}
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
glVertex3f(sb->x, sb->y, 0.001);
|
|
|
|
glVertex3f(sb->x+selboxw, sb->y, 0.001);
|
|
|
|
glVertex3f(sb->x+selboxw, sb->y+sb->h, 0.001);
|
|
|
|
glVertex3f(sb->x, sb->y+sb->h, 0.001);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
set_inverted_drawing(0);
|
|
|
|
}
|
2005-06-17 21:04:27 +00:00
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
else if(dt==OB_BOUNDBOX)
|
|
|
|
draw_bounding_volume(ob);
|
|
|
|
else if(boundbox_clip(ob->obmat, cu->bb))
|
|
|
|
empty_object= drawDispList(base, dt);
|
2005-06-17 21:04:27 +00:00
|
|
|
|
2006-11-03 06:42:08 +00:00
|
|
|
break;
|
|
|
|
case OB_CURVE:
|
|
|
|
case OB_SURF:
|
|
|
|
cu= ob->data;
|
|
|
|
/* still needed for curves hidden in other layers. depgraph doesnt handle that yet */
|
|
|
|
if (cu->disp.first==NULL) makeDispListCurveTypes(ob, 0);
|
|
|
|
|
|
|
|
if(ob==G.obedit) {
|
|
|
|
drawnurb(base, editNurb.first, dt);
|
|
|
|
}
|
|
|
|
else if(dt==OB_BOUNDBOX)
|
|
|
|
draw_bounding_volume(ob);
|
2006-11-08 10:51:27 +00:00
|
|
|
else if(boundbox_clip(ob->obmat, cu->bb)) {
|
2006-11-03 06:42:08 +00:00
|
|
|
empty_object= drawDispList(base, dt);
|
2006-11-08 10:51:27 +00:00
|
|
|
|
|
|
|
if(cu->path)
|
|
|
|
curve_draw_speed(ob);
|
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
break;
|
|
|
|
case OB_MBALL:
|
|
|
|
if(ob==G.obedit)
|
|
|
|
drawmball(base, dt);
|
|
|
|
else if(dt==OB_BOUNDBOX)
|
|
|
|
draw_bounding_volume(ob);
|
|
|
|
else
|
|
|
|
empty_object= drawmball(base, dt);
|
|
|
|
break;
|
|
|
|
case OB_EMPTY:
|
|
|
|
drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype);
|
|
|
|
break;
|
|
|
|
case OB_LAMP:
|
|
|
|
drawlamp(ob);
|
|
|
|
if(dtx || (base->flag & SELECT)) mymultmatrix(ob->obmat);
|
|
|
|
break;
|
|
|
|
case OB_CAMERA:
|
|
|
|
drawcamera(ob, flag);
|
|
|
|
break;
|
|
|
|
case OB_LATTICE:
|
|
|
|
drawlattice(ob);
|
|
|
|
break;
|
|
|
|
case OB_ARMATURE:
|
|
|
|
if(dt>OB_WIRE) set_gl_material(0); // we use defmaterial
|
|
|
|
empty_object= draw_armature(base, dt);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
drawaxes(1.0, flag, OB_ARROWS);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-07-18 22:23:50 +00:00
|
|
|
if(ob->pd && ob->pd->forcefield) draw_forcefield(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-06-19 09:35:23 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* draw extra: after normal draw because of makeDispList */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(dtx) {
|
|
|
|
if(G.f & G_SIMULATION);
|
|
|
|
else if(dtx & OB_AXIS) {
|
2006-01-13 15:50:32 +00:00
|
|
|
drawaxes(1.0f, flag, OB_ARROWS);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(dtx & OB_BOUNDBOX) draw_bounding_volume(ob);
|
|
|
|
if(dtx & OB_TEXSPACE) drawtexspace(ob);
|
|
|
|
if(dtx & OB_DRAWNAME) {
|
2005-11-28 16:59:12 +00:00
|
|
|
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
|
|
|
|
/* but, we also dont draw names for sets or duplicators */
|
|
|
|
if(flag == 0) {
|
2004-05-10 20:14:21 +00:00
|
|
|
glRasterPos3f(0.0, 0.0, 0.0);
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2004-05-10 20:14:21 +00:00
|
|
|
BMF_DrawString(G.font, " ");
|
|
|
|
BMF_DrawString(G.font, ob->id.name+2);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);
|
2005-03-26 17:29:37 +00:00
|
|
|
if((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(dt<OB_SHADED) {
|
|
|
|
if((ob->gameflag & OB_ACTOR) && (ob->gameflag & OB_DYNAMIC)) {
|
|
|
|
float tmat[4][4], imat[4][4], vec[3];
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
vec[0]= vec[1]= vec[2]= 0.0;
|
|
|
|
mygetmatrix(tmat);
|
|
|
|
Mat4Invert(imat, tmat);
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
setlinestyle(2);
|
2005-04-20 08:26:22 +00:00
|
|
|
drawcircball(GL_LINE_LOOP, vec, ob->inertia, imat);
|
2002-10-12 11:37:38 +00:00
|
|
|
setlinestyle(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
myloadmatrix(G.vd->viewmat);
|
|
|
|
|
|
|
|
if(zbufoff) glDisable(GL_DEPTH_TEST);
|
|
|
|
|
|
|
|
if(warning_recursive) return;
|
2005-08-20 19:18:35 +00:00
|
|
|
if(base->flag & (OB_FROMDUPLI|OB_RADIO)) return;
|
2002-10-12 11:37:38 +00:00
|
|
|
if(G.f & G_SIMULATION) return;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2005-11-19 10:55:07 +00:00
|
|
|
/* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
|
2005-12-19 15:55:26 +00:00
|
|
|
if(ob!=OBACT || (G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
|
2006-06-11 09:43:05 +00:00
|
|
|
int do_draw_center= -1; /* defines below are zero or positive... */
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2006-06-11 09:43:05 +00:00
|
|
|
if((G.scene->basact)==base)
|
|
|
|
do_draw_center= ACTIVE;
|
|
|
|
else if(base->flag & SELECT)
|
|
|
|
do_draw_center= SELECT;
|
|
|
|
else if(empty_object || (G.vd->flag & V3D_DRAW_CENTERS))
|
|
|
|
do_draw_center= DESELECT;
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2006-06-11 09:43:05 +00:00
|
|
|
if(do_draw_center != -1) {
|
|
|
|
if(flag & DRAW_PICKING) {
|
|
|
|
/* draw a single point for opengl selection */
|
|
|
|
glBegin(GL_POINTS);
|
|
|
|
glVertex3fv(ob->obmat[3]);
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
else if((flag & DRAW_CONSTCOLOR)==0) {
|
|
|
|
/* we don't draw centers for duplicators and sets */
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
if(ob->vnode)
|
|
|
|
drawcentercircle(ob->obmat[3], VERSE, 1);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
drawcentercircle(ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
|
2006-06-11 09:43:05 +00:00
|
|
|
}
|
2005-11-28 16:59:12 +00:00
|
|
|
}
|
2005-11-19 10:55:07 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
/* not for sets, duplicators or picking */
|
2006-01-11 14:44:23 +00:00
|
|
|
if(flag==0 && (!(G.vd->flag & V3D_HIDE_HELPLINES))) {
|
2003-11-11 16:56:51 +00:00
|
|
|
ListBase *list;
|
|
|
|
|
2004-09-14 19:03:11 +00:00
|
|
|
/* draw hook center and offset line */
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
if(ob!=G.obedit) draw_hooks(ob);
|
2004-09-14 19:03:11 +00:00
|
|
|
|
2003-04-28 14:43:20 +00:00
|
|
|
/* help lines and so */
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
if(ob!=G.obedit && ob->parent && (ob->parent->lay & G.vd->lay)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
setlinestyle(3);
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3fv(ob->obmat[3]);
|
|
|
|
glVertex3fv(ob->orig);
|
|
|
|
glEnd();
|
|
|
|
setlinestyle(0);
|
|
|
|
}
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2003-11-11 16:56:51 +00:00
|
|
|
/* Drawing the constraint lines */
|
|
|
|
list = &ob->constraints;
|
|
|
|
if (list){
|
2005-03-09 19:45:59 +00:00
|
|
|
/*
|
2006-11-03 06:42:08 +00:00
|
|
|
extern void make_axis_color(char *col, char *col2, char axis); // drawview.c
|
|
|
|
*/
|
2003-11-11 16:56:51 +00:00
|
|
|
bConstraint *curcon;
|
|
|
|
float size[3], tmat[4][4];
|
2003-11-17 22:33:11 +00:00
|
|
|
char col[4], col2[4];
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2003-11-17 22:33:11 +00:00
|
|
|
BIF_GetThemeColor3ubv(TH_GRID, col);
|
|
|
|
make_axis_color(col, col2, 'z');
|
|
|
|
glColor3ubv(col2);
|
2006-11-03 06:42:08 +00:00
|
|
|
|
2003-11-11 16:56:51 +00:00
|
|
|
for (curcon = list->first; curcon; curcon=curcon->next){
|
2003-11-23 20:28:35 +00:00
|
|
|
if ((curcon->flag & CONSTRAINT_EXPAND)&&(curcon->type!=CONSTRAINT_TYPE_NULL)&&(constraint_has_target(curcon))){
|
2004-08-16 01:14:18 +00:00
|
|
|
get_constraint_target_matrix(curcon, TARGET_OBJECT, NULL, tmat, size, bsystem_time(ob, 0, (float)(G.scene->r.cfra), ob->sf));
|
2003-11-11 16:56:51 +00:00
|
|
|
setlinestyle(3);
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex3fv(tmat[3]);
|
|
|
|
glVertex3fv(ob->obmat[3]);
|
|
|
|
glEnd();
|
|
|
|
setlinestyle(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
|
|
|
free_old_images();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void draw_object_ext(Base *base)
|
|
|
|
{
|
|
|
|
|
2003-07-11 20:02:52 +00:00
|
|
|
if(G.vd==NULL || base==NULL) return;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(G.vd->drawtype > OB_WIRE) {
|
2005-07-13 19:42:08 +00:00
|
|
|
G.vd->zbuf= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
}
|
|
|
|
|
|
|
|
G.f |= G_DRAW_EXT;
|
2003-07-21 17:46:55 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
glDrawBuffer(GL_FRONT);
|
2003-11-08 17:51:32 +00:00
|
|
|
persp(PERSP_VIEW);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-20 19:18:35 +00:00
|
|
|
if(G.vd->flag & V3D_CLIPPING)
|
|
|
|
view3d_set_clipping(G.vd);
|
|
|
|
|
2005-11-28 16:59:12 +00:00
|
|
|
draw_object(base, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-20 19:18:35 +00:00
|
|
|
if(G.vd->flag & V3D_CLIPPING)
|
|
|
|
view3d_clr_clipping();
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
G.f &= ~G_DRAW_EXT;
|
|
|
|
|
2006-07-31 19:23:42 +00:00
|
|
|
bglFlush(); /* reveil frontbuffer drawing */
|
2002-10-12 11:37:38 +00:00
|
|
|
glDrawBuffer(GL_BACK);
|
|
|
|
|
2005-07-13 19:42:08 +00:00
|
|
|
if(G.vd->zbuf) {
|
|
|
|
G.vd->zbuf= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
}
|
2003-11-10 15:28:48 +00:00
|
|
|
curarea->win_swap= WIN_FRONT_OK;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-09-27 10:12:45 +00:00
|
|
|
|
|
|
|
/* ***************** BACKBUF SEL (BBS) ********* */
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
int offset = (int) userData;
|
|
|
|
EditVert *eve = EM_get_vert_for_index(index);
|
|
|
|
|
2005-03-30 00:32:10 +00:00
|
|
|
if (eve->h==0) {
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
set_framebuffer_index_color(offset+index);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglVertex3fv(co);
|
2005-03-30 00:32:10 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-28 06:46:21 +00:00
|
|
|
static int bbs_mesh_verts(DerivedMesh *dm, int offset)
|
2004-09-27 10:12:45 +00:00
|
|
|
{
|
2004-09-28 11:19:57 +00:00
|
|
|
glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) );
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglBegin(GL_POINTS);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, (void*) offset);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglEnd();
|
2004-09-28 11:19:57 +00:00
|
|
|
glPointSize(1.0);
|
2005-03-28 06:46:21 +00:00
|
|
|
|
2005-08-20 07:42:25 +00:00
|
|
|
return offset + G.totvert;
|
2004-09-28 09:43:37 +00:00
|
|
|
}
|
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int bbs_mesh_wire__setDrawOptions(void *userData, int index)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
int offset = (int) userData;
|
|
|
|
EditEdge *eed = EM_get_edge_for_index(index);
|
|
|
|
|
2005-03-30 00:32:10 +00:00
|
|
|
if (eed->h==0) {
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
set_framebuffer_index_color(offset+index);
|
2005-03-30 00:32:10 +00:00
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2005-03-28 06:46:21 +00:00
|
|
|
static int bbs_mesh_wire(DerivedMesh *dm, int offset)
|
2004-09-28 09:43:37 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*) offset);
|
2005-03-30 00:32:10 +00:00
|
|
|
|
2005-08-20 07:42:25 +00:00
|
|
|
return offset + G.totedge;
|
2004-09-28 09:43:37 +00:00
|
|
|
}
|
2005-03-30 00:32:10 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r)
|
2005-03-30 00:32:10 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
if (EM_get_face_for_index(index)->h==0) {
|
2005-04-02 18:21:50 +00:00
|
|
|
if (userData) {
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
set_framebuffer_index_color(index+1);
|
2005-04-02 18:21:50 +00:00
|
|
|
}
|
2005-03-30 00:32:10 +00:00
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2005-08-08 18:50:47 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static void bbs_mesh_solid__drawCenter(void *userData, int index, float *cent, float *no)
|
2005-08-08 18:50:47 +00:00
|
|
|
{
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EditFace *efa = EM_get_face_for_index(index);
|
|
|
|
|
2005-08-08 18:50:47 +00:00
|
|
|
if (efa->h==0 && efa->fgonf!=EM_FGON) {
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
set_framebuffer_index_color(index+1);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
|
|
|
|
bglVertex3fv(cent);
|
2005-08-08 18:50:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-28 09:43:37 +00:00
|
|
|
/* two options, facecolors or black */
|
2005-07-17 17:41:03 +00:00
|
|
|
static int bbs_mesh_solid_EM(DerivedMesh *dm, int facecol)
|
2004-09-28 09:43:37 +00:00
|
|
|
{
|
|
|
|
cpack(0);
|
|
|
|
|
2005-07-17 17:41:03 +00:00
|
|
|
if (facecol) {
|
2005-08-23 20:04:10 +00:00
|
|
|
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 1, 0);
|
2005-03-30 00:32:10 +00:00
|
|
|
|
2005-07-17 17:41:03 +00:00
|
|
|
if(G.scene->selectmode & SCE_SELECT_FACE) {
|
|
|
|
glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
|
2005-08-08 18:50:47 +00:00
|
|
|
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglBegin(GL_POINTS);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, NULL);
|
Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.
- added DerivedMesh foreach functions to iterate over mapped
verts/edges/face centers. These replaced some of the drawing
functions and are more general anyway. Special edge drawing
functions remain for performance reasons.
- removed EditFace xs, ys fields
- added general functions to iterate over screen coordinates of
mesh/curve/lattice objects
- removed all calc_*verts* functions that were used for storing
screen coordinates in objects. they were recalc'd on the fly
for most situations anyway, so now we just always do that.
calc_*verts_ext was one of those calls that did dirty things
deep down in the callstack (changing curarea and poking at
matrices)
- rewrote all vertex level selection routines (circle, lasso, bbox)
and closest vertex routines (rightmouse select) to use the new
system. This cleaned up the selection code a lot and the structure
of selection is much easier to see now. This is good for future
work on allowing modifiers to completely override the selection
system. It also points out some discrepancies in the way selection
is handled that might be nice to resolve (mesh vertex selection has
fancy stuff to try to help with selecting overlapping, but it only
works w/o bbuf select, and curves/lattices don't have at all).
- had to remove ton's code to move Manipulator to cage location, this
is not reliable (can come up with a different method if requested)
- as it happens BezTriple.s and BPoint.s are basically available to
be removed, just need to rewrite editipo code that still does
background calc of screen coordinates
- MVert.{xs,ys} are still around because they are abused in some places
for other info (not sure if this is safe actually, since they are
short's and the mvert limit went up).
And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
|
|
|
bglEnd();
|
2004-09-28 09:43:37 +00:00
|
|
|
}
|
2005-07-17 17:41:03 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
return 1+G.totface;
|
2005-07-17 17:41:03 +00:00
|
|
|
} else {
|
2005-08-23 20:04:10 +00:00
|
|
|
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0);
|
2005-07-17 17:41:03 +00:00
|
|
|
return 1;
|
2004-09-28 09:43:37 +00:00
|
|
|
}
|
2005-07-17 17:41:03 +00:00
|
|
|
}
|
2004-11-05 12:58:12 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmooth_r)
|
|
|
|
{
|
|
|
|
Mesh *me = userData;
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
if (!me->mtface || !(me->mtface[index].flag&TF_HIDE)) {
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
set_framebuffer_index_color(index+1);
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2006-02-08 21:01:00 +00:00
|
|
|
|
|
|
|
static int bbs_mesh_wire__setDrawOpts(void *userData, int index)
|
|
|
|
{
|
|
|
|
struct { Mesh *me; EdgeHash *eh; int offset; } *data = userData;
|
|
|
|
MEdge *med = data->me->medge + index;
|
|
|
|
unsigned int flags = (int)BLI_edgehash_lookup(data->eh, med->v1, med->v2);
|
|
|
|
|
|
|
|
if (flags & 1) {
|
|
|
|
set_framebuffer_index_color(data->offset+index);
|
|
|
|
return 1;
|
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-07-17 17:41:03 +00:00
|
|
|
static void bbs_mesh_solid(Object *ob)
|
|
|
|
{
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
DerivedMesh *dm = mesh_get_derived_final(ob);
|
2006-02-08 21:01:00 +00:00
|
|
|
Mesh *me = (Mesh*)ob->data;
|
2005-07-17 17:41:03 +00:00
|
|
|
|
2005-08-18 11:49:33 +00:00
|
|
|
glColor3ub(0, 0, 0);
|
2006-02-08 21:01:00 +00:00
|
|
|
dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0);
|
|
|
|
|
|
|
|
/* draw edges for seam marking in faceselect mode, but not when painting,
|
|
|
|
so that painting doesn't get interrupted on an edge */
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
if ((G.f & G_FACESELECT) && !(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) && me->mtface) {
|
2006-02-08 21:01:00 +00:00
|
|
|
struct { Mesh *me; EdgeHash *eh; int offset; } userData;
|
|
|
|
|
|
|
|
userData.me = me;
|
|
|
|
userData.eh = get_tface_mesh_marked_edge_info(me);
|
|
|
|
userData.offset = userData.me->totface+1;
|
|
|
|
|
|
|
|
bglPolygonOffset(1.0);
|
|
|
|
dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOpts, (void*)&userData);
|
|
|
|
bglPolygonOffset(0.0);
|
|
|
|
|
|
|
|
BLI_edgehash_free(userData.eh, NULL);
|
2004-09-27 10:12:45 +00:00
|
|
|
}
|
2006-02-08 21:01:00 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
dm->release(dm);
|
2004-09-27 10:12:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void draw_object_backbufsel(Object *ob)
|
|
|
|
{
|
2005-03-28 06:46:21 +00:00
|
|
|
|
2004-09-27 10:12:45 +00:00
|
|
|
mymultmatrix(ob->obmat);
|
|
|
|
|
|
|
|
glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT);
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
2004-09-28 09:43:37 +00:00
|
|
|
|
2004-09-27 10:12:45 +00:00
|
|
|
switch( ob->type) {
|
|
|
|
case OB_MESH:
|
2005-07-17 17:41:03 +00:00
|
|
|
if(ob==G.obedit) {
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
DerivedMesh *dm = editmesh_get_derived_cage();
|
2004-09-28 09:43:37 +00:00
|
|
|
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
EM_init_index_arrays(1, 1, 1);
|
|
|
|
|
2005-07-17 17:41:03 +00:00
|
|
|
em_solidoffs= bbs_mesh_solid_EM(dm, G.scene->selectmode & SCE_SELECT_FACE);
|
2004-09-28 09:43:37 +00:00
|
|
|
|
|
|
|
bglPolygonOffset(1.0);
|
|
|
|
|
2004-10-10 19:41:43 +00:00
|
|
|
// we draw edges always, for loop (select) tools
|
2005-03-28 06:46:21 +00:00
|
|
|
em_wireoffs= bbs_mesh_wire(dm, em_solidoffs);
|
2006-02-08 21:01:00 +00:00
|
|
|
|
2004-09-28 22:05:16 +00:00
|
|
|
if(G.scene->selectmode & SCE_SELECT_VERTEX)
|
2005-03-28 06:46:21 +00:00
|
|
|
em_vertoffs= bbs_mesh_verts(dm, em_wireoffs);
|
2004-09-28 22:05:16 +00:00
|
|
|
else em_vertoffs= em_wireoffs;
|
|
|
|
|
2004-09-28 09:43:37 +00:00
|
|
|
bglPolygonOffset(0.0);
|
2005-03-28 06:46:21 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
dm->release(dm);
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
|
|
|
|
EM_free_index_arrays();
|
2005-03-29 16:43:39 +00:00
|
|
|
}
|
2005-07-17 17:41:03 +00:00
|
|
|
else bbs_mesh_solid(ob);
|
|
|
|
|
2004-09-27 10:12:45 +00:00
|
|
|
break;
|
|
|
|
case OB_CURVE:
|
|
|
|
case OB_SURF:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
myloadmatrix(G.vd->viewmat);
|
2005-12-07 12:36:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ************* draw object instances for bones, for example ****************** */
|
|
|
|
/* assumes all matrices/etc set OK */
|
2004-09-27 10:12:45 +00:00
|
|
|
|
2005-12-07 15:07:31 +00:00
|
|
|
void draw_object_instance(Object *ob, int dt, int outline)
|
2005-12-07 12:36:26 +00:00
|
|
|
{
|
|
|
|
DerivedMesh *dm=NULL, *edm=NULL;
|
|
|
|
|
|
|
|
if(ob==NULL || ob->type!=OB_MESH) return;
|
|
|
|
|
|
|
|
if(G.obedit && ob->data==G.obedit->data)
|
|
|
|
edm= editmesh_get_derived_base();
|
|
|
|
else
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
dm = mesh_get_derived_final(ob);
|
2005-12-07 15:07:31 +00:00
|
|
|
|
2005-12-07 12:36:26 +00:00
|
|
|
if(dt<=OB_WIRE) {
|
|
|
|
if(dm)
|
|
|
|
dm->drawEdges(dm, 1);
|
|
|
|
else if(edm)
|
|
|
|
edm->drawEdges(edm, 1);
|
|
|
|
}
|
|
|
|
else {
|
2005-12-07 15:07:31 +00:00
|
|
|
if(outline)
|
|
|
|
draw_mesh_object_outline(ob, dm?dm:edm);
|
|
|
|
|
2005-12-07 12:36:26 +00:00
|
|
|
if(dm)
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
init_gl_materials(ob, 0);
|
2005-12-07 12:36:26 +00:00
|
|
|
else {
|
|
|
|
glEnable(GL_COLOR_MATERIAL);
|
|
|
|
BIF_ThemeColor(TH_BONE_SOLID);
|
|
|
|
glDisable(GL_COLOR_MATERIAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
|
|
|
|
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
|
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
|
|
|
|
if(dm)
|
|
|
|
dm->drawFacesSolid(dm, set_gl_material);
|
|
|
|
else if(edm)
|
|
|
|
edm->drawMappedFaces(edm, NULL, NULL, 0);
|
|
|
|
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(edm) edm->release(edm);
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
if(dm) dm->release(dm);
|
2004-09-29 22:22:51 +00:00
|
|
|
}
|
2005-12-07 12:36:26 +00:00
|
|
|
|