2002-10-12 11:37:38 +00:00
/**
* $ Id $
*
2008-04-16 22:40:48 +00:00
* * * * * * BEGIN GPL LICENSE BLOCK * * * * *
2002-10-12 11:37:38 +00:00
*
* 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
2008-04-16 22:40:48 +00:00
* of the License , or ( at your option ) any later version .
2002-10-12 11:37:38 +00:00
*
* 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 .
*
2008-04-16 22:40:48 +00:00
* * * * * * END GPL LICENSE BLOCK * * * * *
2002-10-12 11:37:38 +00:00
*/
//#define NAN_LINEAR_PHYSICS
# include <math.h>
2003-10-28 16:26:51 +00:00
# include <string.h>
2002-11-25 12:02:15 +00:00
2002-10-12 11:37:38 +00:00
# ifndef WIN32
# include <unistd.h>
# include <sys/times.h>
# else
# include <io.h>
# endif
2007-02-01 20:25:24 +00:00
# ifdef WIN32
# ifndef snprintf
# define snprintf _snprintf
# endif
# endif
2002-10-12 11:37:38 +00:00
# include "MEM_guardedalloc.h"
# include "PIL_time.h"
# include "BMF_Api.h"
# include "IMB_imbuf_types.h"
2006-02-08 21:01:00 +00:00
# include "IMB_imbuf.h"
2002-10-12 11:37:38 +00:00
2003-10-28 16:26:51 +00:00
# include "DNA_action_types.h"
# include "DNA_armature_types.h"
2006-08-27 13:29:00 +00:00
# include "DNA_brush_types.h"
2005-10-27 11:28:43 +00:00
# include "DNA_camera_types.h"
2002-10-12 11:37:38 +00:00
# include "DNA_constraint_types.h"
2003-10-28 16:26:51 +00:00
# include "DNA_curve_types.h"
2002-10-12 11:37:38 +00:00
# include "DNA_group_types.h"
# include "DNA_image_types.h"
2007-03-19 15:48:24 +00:00
# include "DNA_key_types.h"
2003-10-28 16:26:51 +00:00
# include "DNA_lattice_types.h"
Fix for undo... it didn't do the UV coords (tface) nor the vertexpaint
colors. This because of the pretty weird (ab)use of load & make editmesh...
For each added undo step, the load_editmesh was fed with an empty mesh
to assign data to, without knowledge of what was in the original mesh.
That way UV and color data got lost.
Solved it in 2 steps:
1. removing the ->tface pointer from EditVlak, and make TFace a builtin
struct inside EditVlak. This didnt cost much extra mem, since it already
stored UV and color. This enabled some pretty cleanup in editmesh.c as
well, storing tface pointers was cumbersome.
2. for each undo step, it then generates always a tface and mcol block to
link to the undo Mesh.
Even when it wasn't in the actual Mesh, at exit editmode the original
Mesh is used as reference anyway, and undo-meshes are freed correctly.
The enormous commit is because I had to change the BLI_editVert.h file, and
found it was included in about every file unnecessary. I removed it there.
ALso found out that subsurf has code ready (unfinished) to make UV coords for
the displaylist in EditMode as well, nice to know for later...
2003-11-19 22:00:14 +00:00
# include "DNA_mesh_types.h"
2005-08-19 21:37:29 +00:00
# include "DNA_meshdata_types.h"
2004-05-30 14:12:14 +00:00
# include "DNA_meta_types.h"
2007-11-29 21:09:16 +00:00
# include "DNA_modifier_types.h"
# include "DNA_object_force.h"
2003-10-28 16:26:51 +00:00
# include "DNA_object_types.h"
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
# include "DNA_particle_types.h"
2002-10-12 11:37:38 +00:00
# include "DNA_screen_types.h"
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
# include "DNA_scene_types.h"
# include "DNA_space_types.h"
2002-10-12 11:37:38 +00:00
# include "DNA_texture_types.h"
# include "DNA_userdef_types.h"
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
# include "DNA_view3d_types.h"
# include "DNA_world_types.h"
2002-10-12 11:37:38 +00:00
Fix for undo... it didn't do the UV coords (tface) nor the vertexpaint
colors. This because of the pretty weird (ab)use of load & make editmesh...
For each added undo step, the load_editmesh was fed with an empty mesh
to assign data to, without knowledge of what was in the original mesh.
That way UV and color data got lost.
Solved it in 2 steps:
1. removing the ->tface pointer from EditVlak, and make TFace a builtin
struct inside EditVlak. This didnt cost much extra mem, since it already
stored UV and color. This enabled some pretty cleanup in editmesh.c as
well, storing tface pointers was cumbersome.
2. for each undo step, it then generates always a tface and mcol block to
link to the undo Mesh.
Even when it wasn't in the actual Mesh, at exit editmode the original
Mesh is used as reference anyway, and undo-meshes are freed correctly.
The enormous commit is because I had to change the BLI_editVert.h file, and
found it was included in about every file unnecessary. I removed it there.
ALso found out that subsurf has code ready (unfinished) to make UV coords for
the displaylist in EditMode as well, nice to know for later...
2003-11-19 22:00:14 +00:00
# include "BLI_blenlib.h"
# include "BLI_arithb.h"
# include "BLI_editVert.h"
2002-10-12 11:37:38 +00:00
# include "BKE_action.h"
2003-10-28 16:26:51 +00:00
# include "BKE_armature.h"
2002-10-12 11:37:38 +00:00
# include "BKE_anim.h"
# include "BKE_constraint.h"
2003-10-28 16:26:51 +00:00
# include "BKE_curve.h"
2006-11-11 23:23:15 +00:00
# include "BKE_customdata.h"
2002-10-12 11:37:38 +00:00
# include "BKE_displist.h"
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
# include "BKE_depsgraph.h"
2006-02-28 20:43:21 +00:00
# include "BKE_DerivedMesh.h"
2002-10-12 11:37:38 +00:00
# include "BKE_global.h"
2003-10-28 16:26:51 +00:00
# include "BKE_lattice.h"
2003-10-15 12:26:26 +00:00
# include "BKE_library.h"
2002-10-12 11:37:38 +00:00
# include "BKE_image.h"
# include "BKE_ipo.h"
# include "BKE_key.h"
# include "BKE_main.h"
2006-06-12 20:01:18 +00:00
# include "BKE_mesh.h"
2007-11-29 21:09:16 +00:00
# include "BKE_modifier.h"
2002-10-12 11:37:38 +00:00
# include "BKE_object.h"
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
# include "BKE_particle.h"
2007-11-29 21:09:16 +00:00
# include "BKE_pointcache.h"
2006-05-15 10:46:04 +00:00
# include "BKE_scene.h"
2007-12-26 22:40:56 +00:00
# include "BKE_sculpt.h"
2002-10-12 11:37:38 +00:00
# include "BKE_texture.h"
# include "BKE_utildefines.h"
2003-10-07 18:24:02 +00:00
# include "BIF_butspace.h"
2002-10-12 11:37:38 +00:00
# include "BIF_drawimage.h"
# include "BIF_editgroup.h"
2003-10-28 16:26:51 +00:00
# include "BIF_editarmature.h"
2005-06-12 12:44:51 +00:00
# include "BIF_editmesh.h"
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
# include "BIF_editparticle.h"
2005-01-07 21:48:25 +00:00
# include "BIF_gl.h"
# include "BIF_glutil.h"
# include "BIF_interface.h"
2005-12-21 23:39:20 +00:00
# include "BIF_interface_icons.h"
2005-01-07 21:48:25 +00:00
# include "BIF_mywindow.h"
2003-10-28 16:26:51 +00:00
# include "BIF_poseobject.h"
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
# include "BIF_previewrender.h"
2008-01-16 07:19:21 +00:00
# include "BIF_radialcontrol.h"
2005-01-07 21:48:25 +00:00
# include "BIF_resources.h"
2006-11-06 01:08:26 +00:00
# include "BIF_retopo.h"
2005-01-07 21:48:25 +00:00
# include "BIF_screen.h"
# include "BIF_space.h"
2002-10-12 11:37:38 +00:00
2006-08-20 15:22:56 +00:00
# ifdef WITH_VERSE
# include "BIF_verse.h"
# endif
2002-10-12 11:37:38 +00:00
# include "BDR_drawmesh.h"
# include "BDR_drawobject.h"
2004-04-06 19:16:14 +00:00
# include "BDR_editobject.h"
2004-07-10 17:40:40 +00:00
# include "BDR_vpaint.h"
2006-11-06 01:08:26 +00:00
# include "BDR_sculptmode.h"
2002-10-12 11:37:38 +00:00
# include "BSE_drawview.h"
2005-05-08 20:10:59 +00:00
# include "BSE_filesel.h"
2002-10-12 11:37:38 +00:00
# include "BSE_headerbuttons.h"
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
# include "BSE_seqaudio.h"
2007-10-01 08:03:11 +00:00
# include "BSE_sequence.h"
2004-07-10 17:40:40 +00:00
# include "BSE_trans_types.h"
2005-05-08 20:10:59 +00:00
# include "BSE_time.h"
# include "BSE_view.h"
2002-10-12 11:37:38 +00:00
2003-11-23 14:28:46 +00:00
# include "BPY_extern.h"
2006-04-09 18:22:05 +00:00
# include "RE_render_ext.h"
2002-10-12 11:37:38 +00:00
# include "blendef.h"
# include "mydevice.h"
2003-10-15 12:26:26 +00:00
# include "butspace.h" // event codes
2002-10-12 11:37:38 +00:00
2005-02-20 01:25:10 +00:00
# include "BIF_transform.h"
2005-02-14 02:53:36 +00:00
2006-06-14 08:50:41 +00:00
# include "RE_pipeline.h" // make_stars
2006-11-06 01:08:26 +00:00
# include "multires.h"
2007-01-26 14:30:43 +00:00
/* For MULTISAMPLE_ARB #define.
Note that older systems like irix
may not have this , and will need a # ifdef
to disable it . */
/* #include "GL/glext.h" Disabled for release, to avoid possibly breaking platforms.
Instead , the define we need will just be # defined if it ' s not in the platform opengl . h .
*/
2002-10-12 11:37:38 +00:00
/* Modules used */
# include "radio.h"
/* locals */
void drawname ( Object * ob ) ;
2006-06-13 20:00:14 +00:00
static void star_stuff_init_func ( void )
2002-10-12 11:37:38 +00:00
{
cpack ( - 1 ) ;
glPointSize ( 1.0 ) ;
glBegin ( GL_POINTS ) ;
}
2006-06-13 20:00:14 +00:00
static void star_stuff_vertex_func ( float * i )
2002-10-12 11:37:38 +00:00
{
glVertex3fv ( i ) ;
}
2006-06-13 20:00:14 +00:00
static void star_stuff_term_func ( void )
2002-10-12 11:37:38 +00:00
{
glEnd ( ) ;
}
void default_gl_light ( void )
{
int a ;
2003-10-25 16:53:50 +00:00
/* initialize */
if ( U . light [ 0 ] . flag = = 0 & & U . light [ 1 ] . flag = = 0 & & U . light [ 2 ] . flag = = 0 ) {
U . light [ 0 ] . flag = 1 ;
U . light [ 0 ] . vec [ 0 ] = - 0.3 ; U . light [ 0 ] . vec [ 1 ] = 0.3 ; U . light [ 0 ] . vec [ 2 ] = 0.9 ;
U . light [ 0 ] . col [ 0 ] = 0.8 ; U . light [ 0 ] . col [ 1 ] = 0.8 ; U . light [ 0 ] . col [ 2 ] = 0.8 ;
U . light [ 0 ] . spec [ 0 ] = 0.5 ; U . light [ 0 ] . spec [ 1 ] = 0.5 ; U . light [ 0 ] . spec [ 2 ] = 0.5 ;
U . light [ 0 ] . spec [ 3 ] = 1.0 ;
2003-10-26 20:45:52 +00:00
U . light [ 1 ] . flag = 0 ;
2003-10-25 16:53:50 +00:00
U . light [ 1 ] . vec [ 0 ] = 0.5 ; U . light [ 1 ] . vec [ 1 ] = 0.5 ; U . light [ 1 ] . vec [ 2 ] = 0.1 ;
U . light [ 1 ] . col [ 0 ] = 0.4 ; U . light [ 1 ] . col [ 1 ] = 0.4 ; U . light [ 1 ] . col [ 2 ] = 0.8 ;
U . light [ 1 ] . spec [ 0 ] = 0.3 ; U . light [ 1 ] . spec [ 1 ] = 0.3 ; U . light [ 1 ] . spec [ 2 ] = 0.5 ;
U . light [ 1 ] . spec [ 3 ] = 1.0 ;
U . light [ 2 ] . flag = 0 ;
U . light [ 2 ] . vec [ 0 ] = 0.3 ; U . light [ 2 ] . vec [ 1 ] = - 0.3 ; U . light [ 2 ] . vec [ 2 ] = - 0.2 ;
U . light [ 2 ] . col [ 0 ] = 0.8 ; U . light [ 2 ] . col [ 1 ] = 0.5 ; U . light [ 2 ] . col [ 2 ] = 0.4 ;
U . light [ 2 ] . spec [ 0 ] = 0.5 ; U . light [ 2 ] . spec [ 1 ] = 0.4 ; U . light [ 2 ] . spec [ 2 ] = 0.3 ;
U . light [ 2 ] . spec [ 3 ] = 1.0 ;
}
glLightfv ( GL_LIGHT0 , GL_POSITION , U . light [ 0 ] . vec ) ;
glLightfv ( GL_LIGHT0 , GL_DIFFUSE , U . light [ 0 ] . col ) ;
glLightfv ( GL_LIGHT0 , GL_SPECULAR , U . light [ 0 ] . spec ) ;
2003-10-22 17:34:51 +00:00
2003-10-25 16:53:50 +00:00
glLightfv ( GL_LIGHT1 , GL_POSITION , U . light [ 1 ] . vec ) ;
glLightfv ( GL_LIGHT1 , GL_DIFFUSE , U . light [ 1 ] . col ) ;
glLightfv ( GL_LIGHT1 , GL_SPECULAR , U . light [ 1 ] . spec ) ;
2002-10-12 11:37:38 +00:00
2003-10-25 16:53:50 +00:00
glLightfv ( GL_LIGHT2 , GL_POSITION , U . light [ 2 ] . vec ) ;
glLightfv ( GL_LIGHT2 , GL_DIFFUSE , U . light [ 2 ] . col ) ;
glLightfv ( GL_LIGHT2 , GL_SPECULAR , U . light [ 2 ] . spec ) ;
2003-10-22 17:34:51 +00:00
2003-10-25 16:53:50 +00:00
for ( a = 0 ; a < 8 ; a + + ) {
if ( a < 3 ) {
if ( U . light [ a ] . flag ) glEnable ( GL_LIGHT0 + a ) ;
else glDisable ( GL_LIGHT0 + a ) ;
2003-11-20 17:51:37 +00:00
// clear stuff from other opengl lamp usage
glLightf ( GL_LIGHT0 + a , GL_SPOT_CUTOFF , 180.0 ) ;
glLightf ( GL_LIGHT0 + a , GL_CONSTANT_ATTENUATION , 1.0 ) ;
glLightf ( GL_LIGHT0 + a , GL_LINEAR_ATTENUATION , 0.0 ) ;
2003-10-25 16:53:50 +00:00
}
else glDisable ( GL_LIGHT0 + a ) ;
}
2002-10-12 11:37:38 +00:00
glDisable ( GL_LIGHTING ) ;
glDisable ( GL_COLOR_MATERIAL ) ;
}
2004-09-29 10:49:19 +00:00
/* also called when render 'ogl' */
2002-10-12 11:37:38 +00:00
void init_gl_stuff ( void )
{
2005-10-26 19:00:40 +00:00
float mat_ambient [ ] = { 0.0 , 0.0 , 0.0 , 0.0 } ;
2002-10-12 11:37:38 +00:00
float mat_specular [ ] = { 0.5 , 0.5 , 0.5 , 1.0 } ;
float mat_shininess [ ] = { 35.0 } ;
int a , x , y ;
GLubyte pat [ 32 * 32 ] ;
const GLubyte * patc = pat ;
2005-10-26 19:00:40 +00:00
glMaterialfv ( GL_FRONT_AND_BACK , GL_AMBIENT , mat_ambient ) ;
2002-10-12 11:37:38 +00:00
glMaterialfv ( GL_FRONT_AND_BACK , GL_DIFFUSE , mat_specular ) ;
glMaterialfv ( GL_FRONT_AND_BACK , GL_SPECULAR , mat_specular ) ;
glMaterialfv ( GL_FRONT_AND_BACK , GL_SHININESS , mat_shininess ) ;
default_gl_light ( ) ;
/* no local viewer, looks ugly in ortho mode */
/* glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, &one); */
glDepthFunc ( GL_LEQUAL ) ;
/* scaling matrices */
glEnable ( GL_NORMALIZE ) ;
glShadeModel ( GL_FLAT ) ;
glDisable ( GL_ALPHA_TEST ) ;
glDisable ( GL_BLEND ) ;
glDisable ( GL_DEPTH_TEST ) ;
glDisable ( GL_FOG ) ;
glDisable ( GL_LIGHTING ) ;
glDisable ( GL_LOGIC_OP ) ;
glDisable ( GL_STENCIL_TEST ) ;
glDisable ( GL_TEXTURE_1D ) ;
glDisable ( GL_TEXTURE_2D ) ;
2006-11-20 21:25:02 +00:00
/* default on, disable/enable should be local per function */
glEnableClientState ( GL_VERTEX_ARRAY ) ;
glEnableClientState ( GL_NORMAL_ARRAY ) ;
2002-10-12 11:37:38 +00:00
glPixelTransferi ( GL_MAP_COLOR , GL_FALSE ) ;
glPixelTransferi ( GL_RED_SCALE , 1 ) ;
glPixelTransferi ( GL_RED_BIAS , 0 ) ;
glPixelTransferi ( GL_GREEN_SCALE , 1 ) ;
glPixelTransferi ( GL_GREEN_BIAS , 0 ) ;
glPixelTransferi ( GL_BLUE_SCALE , 1 ) ;
glPixelTransferi ( GL_BLUE_BIAS , 0 ) ;
glPixelTransferi ( GL_ALPHA_SCALE , 1 ) ;
glPixelTransferi ( GL_ALPHA_BIAS , 0 ) ;
2004-09-25 15:15:26 +00:00
2004-09-25 13:42:31 +00:00
glPixelTransferi ( GL_DEPTH_BIAS , 0 ) ;
glPixelTransferi ( GL_DEPTH_SCALE , 1 ) ;
2004-09-25 15:15:26 +00:00
glDepthRange ( 0.0 , 1.0 ) ;
2002-10-12 11:37:38 +00:00
a = 0 ;
for ( x = 0 ; x < 32 ; x + + ) {
for ( y = 0 ; y < 4 ; y + + ) {
if ( ( x ) & 1 ) pat [ a + + ] = 0x88 ;
else pat [ a + + ] = 0x22 ;
}
}
glPolygonStipple ( patc ) ;
init_realtime_GL ( ) ;
}
void circf ( float x , float y , float rad )
{
GLUquadricObj * qobj = gluNewQuadric ( ) ;
gluQuadricDrawStyle ( qobj , GLU_FILL ) ;
glPushMatrix ( ) ;
glTranslatef ( x , y , 0. ) ;
gluDisk ( qobj , 0.0 , rad , 32 , 1 ) ;
glPopMatrix ( ) ;
gluDeleteQuadric ( qobj ) ;
}
void circ ( float x , float y , float rad )
{
GLUquadricObj * qobj = gluNewQuadric ( ) ;
gluQuadricDrawStyle ( qobj , GLU_SILHOUETTE ) ;
glPushMatrix ( ) ;
glTranslatef ( x , y , 0. ) ;
gluDisk ( qobj , 0.0 , rad , 32 , 1 ) ;
glPopMatrix ( ) ;
gluDeleteQuadric ( qobj ) ;
}
2003-04-28 14:43:20 +00:00
/* ********** ********** */
2002-10-12 11:37:38 +00:00
static void draw_bgpic ( void )
{
BGpic * bgpic ;
Image * ima ;
2006-12-20 17:57:56 +00:00
ImBuf * ibuf = NULL ;
2005-03-08 18:58:27 +00:00
float vec [ 4 ] , fac , asp , zoomx , zoomy ;
2005-03-08 19:18:40 +00:00
float x1 , y1 , x2 , y2 , cx , cy ;
2002-10-12 11:37:38 +00:00
bgpic = G . vd - > bgpic ;
2006-04-10 13:27:06 +00:00
if ( bgpic = = NULL ) return ;
2002-10-12 11:37:38 +00:00
2006-12-20 17:57:56 +00:00
ima = bgpic - > ima ;
2002-10-12 11:37:38 +00:00
2006-12-20 17:57:56 +00:00
if ( ima )
ibuf = BKE_image_get_ibuf ( ima , & bgpic - > iuser ) ;
if ( ibuf = = NULL | | ( ibuf - > rect = = NULL & & ibuf - > rect_float = = NULL ) )
return ;
if ( ibuf - > channels ! = 4 )
return ;
if ( ibuf - > rect = = NULL )
IMB_rect_from_float ( ibuf ) ;
2006-04-10 13:27:06 +00:00
2002-10-12 11:37:38 +00:00
if ( G . vd - > persp = = 2 ) {
2006-08-12 11:27:00 +00:00
rctf vb ;
2002-10-12 11:37:38 +00:00
calc_viewborder ( G . vd , & vb ) ;
x1 = vb . xmin ;
y1 = vb . ymin ;
x2 = vb . xmax ;
y2 = vb . ymax ;
}
else {
2005-08-15 04:10:02 +00:00
float sco [ 2 ] ;
2003-04-28 14:43:20 +00:00
/* calc window coord */
2002-10-12 11:37:38 +00:00
initgrabz ( 0.0 , 0.0 , 0.0 ) ;
window_to_3d ( vec , 1 , 0 ) ;
fac = MAX3 ( fabs ( vec [ 0 ] ) , fabs ( vec [ 1 ] ) , fabs ( vec [ 1 ] ) ) ;
fac = 1.0 / fac ;
2006-12-20 17:57:56 +00:00
asp = ( ( float ) ibuf - > y ) / ( float ) ibuf - > x ;
2005-03-08 18:58:27 +00:00
2005-08-15 04:10:02 +00:00
vec [ 0 ] = vec [ 1 ] = vec [ 2 ] = 0.0 ;
view3d_project_float ( curarea , vec , sco , G . vd - > persmat ) ;
cx = sco [ 0 ] ;
cy = sco [ 1 ] ;
2002-10-12 11:37:38 +00:00
x1 = cx + fac * ( bgpic - > xof - bgpic - > size ) ;
y1 = cy + asp * fac * ( bgpic - > yof - bgpic - > size ) ;
x2 = cx + fac * ( bgpic - > xof + bgpic - > size ) ;
y2 = cy + asp * fac * ( bgpic - > yof + bgpic - > size ) ;
}
2003-04-28 14:43:20 +00:00
/* complete clip? */
2002-10-12 11:37:38 +00:00
if ( x2 < 0 ) return ;
if ( y2 < 0 ) return ;
if ( x1 > curarea - > winx ) return ;
if ( y1 > curarea - > winy ) return ;
2006-12-20 17:57:56 +00:00
zoomx = ( x2 - x1 ) / ibuf - > x ;
zoomy = ( y2 - y1 ) / ibuf - > y ;
/* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */
if ( zoomx < 1.0f | | zoomy < 1.0f ) {
float tzoom = MIN2 ( zoomx , zoomy ) ;
int mip = 0 ;
if ( ibuf - > mipmap [ 0 ] = = NULL )
IMB_makemipmap ( ibuf , 0 ) ;
while ( tzoom < 1.0f & & mip < 8 & & ibuf - > mipmap [ mip ] ) {
tzoom * = 2.0f ;
zoomx * = 2.0f ;
zoomy * = 2.0f ;
mip + + ;
}
if ( mip > 0 )
ibuf = ibuf - > mipmap [ mip - 1 ] ;
}
2005-07-13 19:42:08 +00:00
if ( G . vd - > zbuf ) glDisable ( GL_DEPTH_TEST ) ;
2002-10-12 11:37:38 +00:00
glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ;
2005-01-07 22:17:56 +00:00
glMatrixMode ( GL_PROJECTION ) ;
glPushMatrix ( ) ;
glMatrixMode ( GL_MODELVIEW ) ;
glPushMatrix ( ) ;
2005-01-07 21:48:25 +00:00
glaDefine2DArea ( & curarea - > winrct ) ;
2007-09-13 14:33:21 +00:00
2006-12-20 17:57:56 +00:00
glEnable ( GL_BLEND ) ;
2007-09-13 14:33:21 +00:00
2005-01-07 21:48:25 +00:00
glPixelZoom ( zoomx , zoomy ) ;
2007-09-13 14:33:21 +00:00
glColor4f ( 1.0 , 1.0 , 1.0 , 1.0 - bgpic - > blend ) ;
glaDrawPixelsTex ( x1 , y1 , ibuf - > x , ibuf - > y , GL_UNSIGNED_BYTE , ibuf - > rect ) ;
2005-01-07 21:48:25 +00:00
glPixelZoom ( 1.0 , 1.0 ) ;
2006-12-20 17:57:56 +00:00
glPixelTransferf ( GL_ALPHA_SCALE , 1.0f ) ;
2005-03-08 18:58:27 +00:00
2005-01-07 22:17:56 +00:00
glMatrixMode ( GL_PROJECTION ) ;
glPopMatrix ( ) ;
glMatrixMode ( GL_MODELVIEW ) ;
glPopMatrix ( ) ;
2002-10-12 11:37:38 +00:00
glDisable ( GL_BLEND ) ;
2005-07-13 19:42:08 +00:00
if ( G . vd - > zbuf ) glEnable ( GL_DEPTH_TEST ) ;
2005-01-30 13:13:31 +00:00
areawinset ( curarea - > win ) ; // restore viewport / scissor
2002-10-12 11:37:38 +00:00
}
2003-10-18 12:21:41 +00:00
static void drawgrid_draw ( float wx , float wy , float x , float y , float dx )
{
float fx , fy ;
x + = ( wx ) ;
y + = ( wy ) ;
fx = x / dx ;
fx = x - dx * floor ( fx ) ;
while ( fx < curarea - > winx ) {
fdrawline ( fx , 0.0 , fx , ( float ) curarea - > winy ) ;
fx + = dx ;
}
fy = y / dx ;
fy = y - dx * floor ( fy ) ;
while ( fy < curarea - > winy ) {
fdrawline ( 0.0 , fy , ( float ) curarea - > winx , fy ) ;
fy + = dx ;
}
}
2002-10-12 11:37:38 +00:00
2003-10-23 16:15:05 +00:00
// not intern, called in editobject for constraint axis too
void make_axis_color ( char * col , char * col2 , char axis )
{
if ( axis = = ' x ' ) {
col2 [ 0 ] = col [ 0 ] > 219 ? 255 : col [ 0 ] + 36 ;
col2 [ 1 ] = col [ 1 ] < 26 ? 0 : col [ 1 ] - 26 ;
col2 [ 2 ] = col [ 2 ] < 26 ? 0 : col [ 2 ] - 26 ;
}
else if ( axis = = ' y ' ) {
col2 [ 0 ] = col [ 0 ] < 46 ? 0 : col [ 0 ] - 36 ;
col2 [ 1 ] = col [ 1 ] > 189 ? 255 : col [ 1 ] + 66 ;
col2 [ 2 ] = col [ 2 ] < 46 ? 0 : col [ 2 ] - 36 ;
}
else {
col2 [ 0 ] = col [ 0 ] < 26 ? 0 : col [ 0 ] - 26 ;
col2 [ 1 ] = col [ 1 ] < 26 ? 0 : col [ 1 ] - 26 ;
col2 [ 2 ] = col [ 2 ] > 209 ? 255 : col [ 2 ] + 46 ;
}
}
2003-10-19 09:19:58 +00:00
static void drawgrid ( void )
2002-10-12 11:37:38 +00:00
{
/* extern short bgpicmode; */
float wx , wy , x , y , fw , fx , fy , dx ;
float vec4 [ 4 ] ;
2003-10-23 16:15:05 +00:00
char col [ 3 ] , col2 [ 3 ] ;
2006-10-25 23:34:24 +00:00
short sublines = G . vd - > gridsubdiv ;
2003-10-18 12:21:41 +00:00
2002-10-12 11:37:38 +00:00
vec4 [ 0 ] = vec4 [ 1 ] = vec4 [ 2 ] = 0.0 ;
vec4 [ 3 ] = 1.0 ;
Mat4MulVec4fl ( G . vd - > persmat , vec4 ) ;
fx = vec4 [ 0 ] ;
fy = vec4 [ 1 ] ;
fw = vec4 [ 3 ] ;
2003-04-28 14:43:20 +00:00
wx = ( curarea - > winx / 2.0 ) ; /* because of rounding errors, grid at wrong location */
2002-10-12 11:37:38 +00:00
wy = ( curarea - > winy / 2.0 ) ;
x = ( wx ) * fx / fw ;
y = ( wy ) * fy / fw ;
vec4 [ 0 ] = vec4 [ 1 ] = G . vd - > grid ;
vec4 [ 2 ] = 0.0 ;
vec4 [ 3 ] = 1.0 ;
Mat4MulVec4fl ( G . vd - > persmat , vec4 ) ;
fx = vec4 [ 0 ] ;
fy = vec4 [ 1 ] ;
fw = vec4 [ 3 ] ;
dx = fabs ( x - ( wx ) * fx / fw ) ;
if ( dx = = 0 ) dx = fabs ( y - ( wy ) * fy / fw ) ;
2003-10-22 09:06:30 +00:00
glDepthMask ( 0 ) ; // disable write in zbuffer
2005-03-23 14:24:43 +00:00
2003-10-18 12:21:41 +00:00
/* check zoom out */
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2003-10-18 12:21:41 +00:00
persp ( PERSP_WIN ) ;
2005-03-23 14:24:43 +00:00
2002-10-12 11:37:38 +00:00
if ( dx < 6.0 ) {
2006-10-25 23:34:24 +00:00
G . vd - > gridview * = sublines ;
dx * = sublines ;
2003-10-18 12:21:41 +00:00
if ( dx < 6.0 ) {
2006-10-25 23:34:24 +00:00
G . vd - > gridview * = sublines ;
dx * = sublines ;
2003-10-18 12:21:41 +00:00
2002-10-12 11:37:38 +00:00
if ( dx < 6.0 ) {
2006-10-25 23:34:24 +00:00
G . vd - > gridview * = sublines ;
dx * = sublines ;
2003-10-18 12:21:41 +00:00
if ( dx < 6.0 ) ;
else {
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2003-10-18 12:21:41 +00:00
drawgrid_draw ( wx , wy , x , y , dx ) ;
}
}
else { // start blending out
2003-10-19 09:19:58 +00:00
BIF_ThemeColorBlend ( TH_BACK , TH_GRID , dx / 60.0 ) ;
2003-10-18 12:21:41 +00:00
drawgrid_draw ( wx , wy , x , y , dx ) ;
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2006-10-25 23:34:24 +00:00
drawgrid_draw ( wx , wy , x , y , sublines * dx ) ;
2002-10-12 11:37:38 +00:00
}
}
2003-10-18 12:21:41 +00:00
else { // start blending out (6 < dx < 60)
2003-10-19 09:19:58 +00:00
BIF_ThemeColorBlend ( TH_BACK , TH_GRID , dx / 60.0 ) ;
2003-10-18 12:21:41 +00:00
drawgrid_draw ( wx , wy , x , y , dx ) ;
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2006-10-25 23:34:24 +00:00
drawgrid_draw ( wx , wy , x , y , sublines * dx ) ;
2003-10-18 12:21:41 +00:00
}
}
else {
if ( dx > 60.0 ) { // start blending in
2006-10-25 23:34:24 +00:00
G . vd - > gridview / = sublines ;
dx / = sublines ;
2003-10-18 12:21:41 +00:00
if ( dx > 60.0 ) { // start blending in
2006-10-25 23:34:24 +00:00
G . vd - > gridview / = sublines ;
dx / = sublines ;
2003-10-18 12:21:41 +00:00
if ( dx > 60.0 ) {
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2003-10-18 12:21:41 +00:00
drawgrid_draw ( wx , wy , x , y , dx ) ;
}
else {
2003-10-19 09:19:58 +00:00
BIF_ThemeColorBlend ( TH_BACK , TH_GRID , dx / 60.0 ) ;
2003-10-18 12:21:41 +00:00
drawgrid_draw ( wx , wy , x , y , dx ) ;
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2006-10-25 23:34:24 +00:00
drawgrid_draw ( wx , wy , x , y , dx * sublines ) ;
2003-10-18 12:21:41 +00:00
}
}
else {
2003-10-19 09:19:58 +00:00
BIF_ThemeColorBlend ( TH_BACK , TH_GRID , dx / 60.0 ) ;
2003-10-18 12:21:41 +00:00
drawgrid_draw ( wx , wy , x , y , dx ) ;
Commit for the 4 aforementioned "features":
- "Global Pivot": Maintains a global Pivot and Align mode setting for
all 3d views when enabled, instead of seperate settings per 3d view
- "Auto Perspective": Switch to ortho mode automatically on 1/3/7, and
to Perspective when the view is rotated with the mouse
- "Align mode": As suggested on the list, when enabled, transformations
on several objects only transform their locations, not their sizes or
rotations.
- Grid dotted when not 1:1
***ATTENTION***! The User Interface parts of these features have not been
committed, as I work on my own modified UI here. The three features need
toggle buttons to turn them on and off.
I used the following 3 buttons (first two features are in userprefs,
third as a 3d view setting):
uiDefButBitS(block, TOG, USER_AUTOPERSP, B_DRAWINFO, "Auto Persp",
(xpos+edgespace+(3*medprefbut)+(3*midspace)+smallprefbut+2),y3+10,smallprefbut,buth,
&(U.uiflag), 0, 0, 0, 0,
"Automatically switch between orthographic and perspective");
uiDefButBitS(block, TOG, USER_LOCKAROUND, B_DRAWINFO, "Global Pivot",
(xpos+edgespace+(4*midspace)+(4*medprefbut)),y3+10,smallprefbut,buth,
&(U.uiflag), 0, 0, 0, 0,
"Use global pivot setting for all 3d views");
uiDefIconButS(block, TOG|BIT|10, B_AROUND, ICON_ALIGN,
xco+=XIC,0,XIC,YIC,
&G.vd->flag, 0, 0, 0, 0, "Translate only (align)");
Someone needs to add these to the interface in an appropriate manner!
Thanks.
2004-07-15 13:31:18 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2006-10-25 23:34:24 +00:00
drawgrid_draw ( wx , wy , x , y , dx * sublines ) ;
2003-10-18 12:21:41 +00:00
}
}
else {
2003-10-19 09:19:58 +00:00
BIF_ThemeColorBlend ( TH_BACK , TH_GRID , dx / 60.0 ) ;
2004-07-27 23:24:56 +00:00
drawgrid_draw ( wx , wy , x , y , dx ) ;
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_GRID ) ;
2006-10-25 23:34:24 +00:00
drawgrid_draw ( wx , wy , x , y , dx * sublines ) ;
2003-10-18 12:21:41 +00:00
}
2002-10-12 11:37:38 +00:00
}
x + = ( wx ) ;
y + = ( wy ) ;
2003-10-19 09:19:58 +00:00
BIF_GetThemeColor3ubv ( TH_GRID , col ) ;
2004-07-15 16:40:01 +00:00
setlinestyle ( 0 ) ;
2002-10-12 11:37:38 +00:00
2003-04-28 14:43:20 +00:00
/* center cross */
2003-10-23 16:15:05 +00:00
if ( G . vd - > view = = 3 ) make_axis_color ( col , col2 , ' y ' ) ;
else make_axis_color ( col , col2 , ' x ' ) ;
2007-03-17 14:15:02 +00:00
glColor3ubv ( ( GLubyte * ) col2 ) ;
2003-10-23 16:15:05 +00:00
2002-10-12 11:37:38 +00:00
fdrawline ( 0.0 , y , ( float ) curarea - > winx , y ) ;
2003-10-23 16:15:05 +00:00
if ( G . vd - > view = = 7 ) make_axis_color ( col , col2 , ' y ' ) ;
else make_axis_color ( col , col2 , ' z ' ) ;
2007-03-17 14:15:02 +00:00
glColor3ubv ( ( GLubyte * ) col2 ) ;
2002-10-12 11:37:38 +00:00
2003-10-18 12:21:41 +00:00
fdrawline ( x , 0.0 , x , ( float ) curarea - > winy ) ;
2002-10-12 11:37:38 +00:00
2003-10-22 09:06:30 +00:00
glDepthMask ( 1 ) ; // enable write in zbuffer
2003-10-16 09:39:19 +00:00
persp ( PERSP_VIEW ) ;
2002-10-12 11:37:38 +00:00
}
2006-10-25 23:34:24 +00:00
2003-10-19 09:19:58 +00:00
static void drawfloor ( void )
2002-10-12 11:37:38 +00:00
{
View3D * vd ;
float vert [ 3 ] , grid ;
2006-06-05 02:17:24 +00:00
int a , gridlines , emphasise ;
2003-10-23 16:15:05 +00:00
char col [ 3 ] , col2 [ 3 ] ;
2004-01-24 05:06:12 +00:00
short draw_line = 0 ;
2002-10-12 11:37:38 +00:00
vd = curarea - > spacedata . first ;
vert [ 2 ] = 0.0 ;
if ( vd - > gridlines < 3 ) return ;
2004-09-25 14:21:09 +00:00
2005-07-13 19:42:08 +00:00
if ( G . vd - > zbuf & & G . obedit ) glDepthMask ( 0 ) ; // for zbuffer-select
2004-09-25 14:21:09 +00:00
2002-10-12 11:37:38 +00:00
gridlines = vd - > gridlines / 2 ;
grid = gridlines * vd - > grid ;
2003-10-19 09:19:58 +00:00
BIF_GetThemeColor3ubv ( TH_GRID , col ) ;
2006-06-07 15:01:40 +00:00
BIF_GetThemeColor3ubv ( TH_BACK , col2 ) ;
2006-06-05 02:17:24 +00:00
/* emphasise division lines lighter instead of darker, if background is darker than grid */
2006-06-25 06:00:22 +00:00
if ( ( ( col [ 0 ] + col [ 1 ] + col [ 2 ] ) / 3 + 10 ) > ( col2 [ 0 ] + col2 [ 1 ] + col2 [ 2 ] ) / 3 )
2006-06-05 02:17:24 +00:00
emphasise = 20 ;
2006-06-25 06:00:22 +00:00
else
emphasise = - 10 ;
2003-10-18 12:21:41 +00:00
2004-01-24 05:06:12 +00:00
/* draw the Y axis and/or grid lines */
2002-10-12 11:37:38 +00:00
for ( a = - gridlines ; a < = gridlines ; a + + ) {
if ( a = = 0 ) {
2004-01-24 05:06:12 +00:00
/* check for the 'show Y axis' preference */
if ( vd - > gridflag & V3D_SHOW_Y ) {
make_axis_color ( col , col2 , ' y ' ) ;
2007-03-17 14:15:02 +00:00
glColor3ubv ( ( GLubyte * ) col2 ) ;
2004-01-24 05:06:12 +00:00
draw_line = 1 ;
} else if ( vd - > gridflag & V3D_SHOW_FLOOR ) {
2006-06-05 02:17:24 +00:00
BIF_ThemeColorShade ( TH_GRID , emphasise ) ;
2004-01-24 05:06:12 +00:00
} else {
draw_line = 0 ;
}
} else {
/* check for the 'show grid floor' preference */
if ( vd - > gridflag & V3D_SHOW_FLOOR ) {
if ( ( a % 10 ) = = 0 ) {
2006-06-05 02:17:24 +00:00
BIF_ThemeColorShade ( TH_GRID , emphasise ) ;
2004-01-24 05:06:12 +00:00
}
else BIF_ThemeColorShade ( TH_GRID , 10 ) ;
draw_line = 1 ;
} else {
draw_line = 0 ;
}
2002-10-12 11:37:38 +00:00
}
2004-01-24 05:06:12 +00:00
if ( draw_line ) {
glBegin ( GL_LINE_STRIP ) ;
vert [ 0 ] = a * vd - > grid ;
vert [ 1 ] = grid ;
glVertex3fv ( vert ) ;
vert [ 1 ] = - grid ;
glVertex3fv ( vert ) ;
glEnd ( ) ;
}
2002-10-12 11:37:38 +00:00
}
2004-01-24 05:06:12 +00:00
/* draw the X axis and/or grid lines */
2002-10-12 11:37:38 +00:00
for ( a = - gridlines ; a < = gridlines ; a + + ) {
if ( a = = 0 ) {
2004-01-24 05:06:12 +00:00
/* check for the 'show X axis' preference */
if ( vd - > gridflag & V3D_SHOW_X ) {
make_axis_color ( col , col2 , ' x ' ) ;
2007-03-17 14:15:02 +00:00
glColor3ubv ( ( GLubyte * ) col2 ) ;
2004-01-24 05:06:12 +00:00
draw_line = 1 ;
} else if ( vd - > gridflag & V3D_SHOW_FLOOR ) {
2006-06-05 02:17:24 +00:00
BIF_ThemeColorShade ( TH_GRID , emphasise ) ;
2004-01-24 05:06:12 +00:00
} else {
draw_line = 0 ;
}
} else {
/* check for the 'show grid floor' preference */
if ( vd - > gridflag & V3D_SHOW_FLOOR ) {
if ( ( a % 10 ) = = 0 ) {
2006-06-05 02:17:24 +00:00
BIF_ThemeColorShade ( TH_GRID , emphasise ) ;
2004-01-24 05:06:12 +00:00
}
else BIF_ThemeColorShade ( TH_GRID , 10 ) ;
draw_line = 1 ;
} else {
draw_line = 0 ;
}
2002-10-12 11:37:38 +00:00
}
2004-01-24 05:06:12 +00:00
if ( draw_line ) {
glBegin ( GL_LINE_STRIP ) ;
vert [ 1 ] = a * vd - > grid ;
vert [ 0 ] = grid ;
glVertex3fv ( vert ) ;
vert [ 0 ] = - grid ;
glVertex3fv ( vert ) ;
glEnd ( ) ;
2002-10-12 11:37:38 +00:00
}
2004-01-24 05:06:12 +00:00
}
2002-10-12 11:37:38 +00:00
2004-01-24 05:06:12 +00:00
/* draw the Z axis line */
/* check for the 'show Z axis' preference */
if ( vd - > gridflag & V3D_SHOW_Z ) {
make_axis_color ( col , col2 , ' z ' ) ;
2007-03-17 14:15:02 +00:00
glColor3ubv ( ( GLubyte * ) col2 ) ;
2004-01-24 05:06:12 +00:00
2002-10-12 11:37:38 +00:00
glBegin ( GL_LINE_STRIP ) ;
2004-01-24 05:06:12 +00:00
vert [ 0 ] = 0 ;
vert [ 1 ] = 0 ;
vert [ 2 ] = grid ;
glVertex3fv ( vert ) ;
vert [ 2 ] = - grid ;
glVertex3fv ( vert ) ;
2002-10-12 11:37:38 +00:00
glEnd ( ) ;
}
2005-07-13 19:42:08 +00:00
if ( G . vd - > zbuf & & G . obedit ) glDepthMask ( 1 ) ;
2004-09-25 14:21:09 +00:00
2002-10-12 11:37:38 +00:00
}
2005-09-23 07:28:15 +00:00
static void drawcursor ( View3D * v3d )
2002-10-12 11:37:38 +00:00
{
2005-08-15 04:10:02 +00:00
short mx , my , co [ 2 ] ;
2005-09-23 07:28:15 +00:00
int flag ;
2002-10-12 11:37:38 +00:00
2005-09-23 07:28:15 +00:00
/* we dont want the clipping for cursor */
flag = v3d - > flag ;
v3d - > flag = 0 ;
2005-08-15 04:10:02 +00:00
project_short ( give_cursor ( ) , co ) ;
2005-09-23 07:28:15 +00:00
v3d - > flag = flag ;
2005-08-15 04:10:02 +00:00
mx = co [ 0 ] ;
my = co [ 1 ] ;
2002-10-12 11:37:38 +00:00
2005-08-20 19:18:35 +00:00
if ( mx ! = IS_CLIPPED ) {
2002-10-12 11:37:38 +00:00
setlinestyle ( 0 ) ;
cpack ( 0xFF ) ;
2005-08-15 04:10:02 +00:00
circ ( ( float ) mx , ( float ) my , 10.0 ) ;
2002-10-12 11:37:38 +00:00
setlinestyle ( 4 ) ;
cpack ( 0xFFFFFF ) ;
2005-08-15 04:10:02 +00:00
circ ( ( float ) mx , ( float ) my , 10.0 ) ;
2002-10-12 11:37:38 +00:00
setlinestyle ( 0 ) ;
cpack ( 0x0 ) ;
2005-08-15 04:10:02 +00:00
sdrawline ( mx - 20 , my , mx - 5 , my ) ;
sdrawline ( mx + 5 , my , mx + 20 , my ) ;
sdrawline ( mx , my - 20 , mx , my - 5 ) ;
sdrawline ( mx , my + 5 , mx , my + 20 ) ;
2002-10-12 11:37:38 +00:00
}
}
2005-08-20 19:18:35 +00:00
/* ********* custom clipping *********** */
static void view3d_draw_clipping ( View3D * v3d )
{
BoundBox * bb = v3d - > clipbb ;
BIF_ThemeColorShade ( TH_BACK , - 8 ) ;
glBegin ( GL_QUADS ) ;
glVertex3fv ( bb - > vec [ 0 ] ) ; glVertex3fv ( bb - > vec [ 1 ] ) ; glVertex3fv ( bb - > vec [ 2 ] ) ; glVertex3fv ( bb - > vec [ 3 ] ) ;
glVertex3fv ( bb - > vec [ 0 ] ) ; glVertex3fv ( bb - > vec [ 4 ] ) ; glVertex3fv ( bb - > vec [ 5 ] ) ; glVertex3fv ( bb - > vec [ 1 ] ) ;
glVertex3fv ( bb - > vec [ 4 ] ) ; glVertex3fv ( bb - > vec [ 7 ] ) ; glVertex3fv ( bb - > vec [ 6 ] ) ; glVertex3fv ( bb - > vec [ 5 ] ) ;
glVertex3fv ( bb - > vec [ 7 ] ) ; glVertex3fv ( bb - > vec [ 3 ] ) ; glVertex3fv ( bb - > vec [ 2 ] ) ; glVertex3fv ( bb - > vec [ 6 ] ) ;
glVertex3fv ( bb - > vec [ 1 ] ) ; glVertex3fv ( bb - > vec [ 5 ] ) ; glVertex3fv ( bb - > vec [ 6 ] ) ; glVertex3fv ( bb - > vec [ 2 ] ) ;
glVertex3fv ( bb - > vec [ 7 ] ) ; glVertex3fv ( bb - > vec [ 4 ] ) ; glVertex3fv ( bb - > vec [ 0 ] ) ; glVertex3fv ( bb - > vec [ 3 ] ) ;
glEnd ( ) ;
}
void view3d_set_clipping ( View3D * v3d )
{
double plane [ 4 ] ;
int a ;
2005-08-20 19:45:34 +00:00
for ( a = 0 ; a < 4 ; a + + ) {
2005-08-20 19:18:35 +00:00
QUATCOPY ( plane , v3d - > clip [ a ] ) ;
glClipPlane ( GL_CLIP_PLANE0 + a , plane ) ;
glEnable ( GL_CLIP_PLANE0 + a ) ;
}
}
void view3d_clr_clipping ( void )
{
int a ;
for ( a = 0 ; a < 4 ; a + + ) {
glDisable ( GL_CLIP_PLANE0 + a ) ;
}
}
int view3d_test_clipping ( View3D * v3d , float * vec )
{
/* vec in world coordinates, returns 1 if clipped */
float view [ 3 ] ;
VECCOPY ( view , vec ) ;
if ( 0.0f < v3d - > clip [ 0 ] [ 3 ] + INPR ( view , v3d - > clip [ 0 ] ) )
if ( 0.0f < v3d - > clip [ 1 ] [ 3 ] + INPR ( view , v3d - > clip [ 1 ] ) )
if ( 0.0f < v3d - > clip [ 2 ] [ 3 ] + INPR ( view , v3d - > clip [ 2 ] ) )
if ( 0.0f < v3d - > clip [ 3 ] [ 3 ] + INPR ( view , v3d - > clip [ 3 ] ) )
return 0 ;
return 1 ;
}
/* ********* end custom clipping *********** */
2002-10-12 11:37:38 +00:00
static void view3d_get_viewborder_size ( View3D * v3d , float size_r [ 2 ] )
{
float winmax = MAX2 ( v3d - > area - > winx , v3d - > area - > winy ) ;
float aspect = ( float ) ( G . scene - > r . xsch * G . scene - > r . xasp ) / ( G . scene - > r . ysch * G . scene - > r . yasp ) ;
if ( aspect > 1.0 ) {
size_r [ 0 ] = winmax ;
size_r [ 1 ] = winmax / aspect ;
} else {
size_r [ 0 ] = winmax * aspect ;
size_r [ 1 ] = winmax ;
}
}
2006-08-12 11:27:00 +00:00
void calc_viewborder ( struct View3D * v3d , rctf * viewborder_r )
2002-10-12 11:37:38 +00:00
{
float zoomfac , size [ 2 ] ;
2006-01-04 21:16:09 +00:00
float dx = 0.0f , dy = 0.0f ;
2002-10-12 11:37:38 +00:00
view3d_get_viewborder_size ( v3d , size ) ;
/* magic zoom calculation, no idea what
* it signifies , if you find out , tell me ! - zr
*/
2003-04-28 14:43:20 +00:00
/* simple, its magic dude!
* well , to be honest , this gives a natural feeling zooming
* with multiple keypad presses ( ton )
*/
2002-10-12 11:37:38 +00:00
zoomfac = ( M_SQRT2 + v3d - > camzoom / 50.0 ) ;
zoomfac = ( zoomfac * zoomfac ) * 0.25 ;
size [ 0 ] = size [ 0 ] * zoomfac ;
size [ 1 ] = size [ 1 ] * zoomfac ;
/* center in window */
viewborder_r - > xmin = 0.5 * v3d - > area - > winx - 0.5 * size [ 0 ] ;
viewborder_r - > ymin = 0.5 * v3d - > area - > winy - 0.5 * size [ 1 ] ;
viewborder_r - > xmax = viewborder_r - > xmin + size [ 0 ] ;
viewborder_r - > ymax = viewborder_r - > ymin + size [ 1 ] ;
2006-01-04 21:16:09 +00:00
2006-11-03 16:37:27 +00:00
dx = v3d - > area - > winx * G . vd - > camdx * zoomfac * 2.0f ;
dy = v3d - > area - > winy * G . vd - > camdy * zoomfac * 2.0f ;
2006-01-04 21:16:09 +00:00
/* apply offset */
viewborder_r - > xmin - = dx ;
viewborder_r - > ymin - = dy ;
viewborder_r - > xmax - = dx ;
viewborder_r - > ymax - = dy ;
2006-11-06 15:42:38 +00:00
if ( v3d - > camera & & v3d - > camera - > type = = OB_CAMERA ) {
Camera * cam = v3d - > camera - > data ;
float w = viewborder_r - > xmax - viewborder_r - > xmin ;
float h = viewborder_r - > ymax - viewborder_r - > ymin ;
float side = MAX2 ( w , h ) ;
viewborder_r - > xmin + = cam - > shiftx * side ;
viewborder_r - > xmax + = cam - > shiftx * side ;
viewborder_r - > ymin + = cam - > shifty * side ;
viewborder_r - > ymax + = cam - > shifty * side ;
}
2002-10-12 11:37:38 +00:00
}
void view3d_set_1_to_1_viewborder ( View3D * v3d )
{
float size [ 2 ] ;
int im_width = ( G . scene - > r . size * G . scene - > r . xsch ) / 100 ;
view3d_get_viewborder_size ( v3d , size ) ;
v3d - > camzoom = ( sqrt ( 4.0 * im_width / size [ 0 ] ) - M_SQRT2 ) * 50.0 ;
v3d - > camzoom = CLAMPIS ( v3d - > camzoom , - 30 , 300 ) ;
}
2006-06-08 18:10:41 +00:00
static void drawviewborder_flymode ( void )
{
/* draws 4 edge brackets that frame the safe area where the
mouse can move during fly mode without spinning the view */
float x1 , x2 , y1 , y2 ;
x1 = 0.45 * ( float ) curarea - > winx ;
y1 = 0.45 * ( float ) curarea - > winy ;
x2 = 0.55 * ( float ) curarea - > winx ;
y2 = 0.55 * ( float ) curarea - > winy ;
cpack ( 0 ) ;
glBegin ( GL_LINES ) ;
/* bottom left */
glVertex2f ( x1 , y1 ) ;
glVertex2f ( x1 , y1 + 5 ) ;
glVertex2f ( x1 , y1 ) ;
glVertex2f ( x1 + 5 , y1 ) ;
/* top right */
glVertex2f ( x2 , y2 ) ;
glVertex2f ( x2 , y2 - 5 ) ;
glVertex2f ( x2 , y2 ) ;
glVertex2f ( x2 - 5 , y2 ) ;
/* top left */
glVertex2f ( x1 , y2 ) ;
glVertex2f ( x1 , y2 - 5 ) ;
glVertex2f ( x1 , y2 ) ;
glVertex2f ( x1 + 5 , y2 ) ;
/* bottom right */
glVertex2f ( x2 , y1 ) ;
glVertex2f ( x2 , y1 + 5 ) ;
glVertex2f ( x2 , y1 ) ;
glVertex2f ( x2 - 5 , y1 ) ;
glEnd ( ) ;
}
2002-10-12 11:37:38 +00:00
static void drawviewborder ( void )
{
2005-10-27 11:28:43 +00:00
extern void gl_round_box ( int mode , float minx , float miny , float maxx , float maxy , float rad ) ; // interface_panel.c
2002-10-12 11:37:38 +00:00
float fac , a ;
float x1 , x2 , y1 , y2 ;
float x3 , y3 , x4 , y4 ;
2006-08-12 11:27:00 +00:00
rctf viewborder ;
2005-11-22 16:14:07 +00:00
Camera * ca = NULL ;
2005-10-27 11:28:43 +00:00
2005-11-22 16:14:07 +00:00
if ( G . vd - > camera = = NULL )
return ;
if ( G . vd - > camera - > type = = OB_CAMERA )
ca = G . vd - > camera - > data ;
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
2002-10-12 11:37:38 +00:00
calc_viewborder ( G . vd , & viewborder ) ;
x1 = viewborder . xmin ;
y1 = viewborder . ymin ;
x2 = viewborder . xmax ;
y2 = viewborder . ymax ;
2005-11-16 16:03:01 +00:00
/* passepartout, specified in camera edit buttons */
2007-04-26 19:05:22 +00:00
if ( ca & & ( ca - > flag & CAM_SHOWPASSEPARTOUT ) & & ca - > passepartalpha > 0.000001 ) {
if ( ca - > passepartalpha = = 1.0 ) {
glColor3f ( 0 , 0 , 0 ) ;
} else {
glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ;
glEnable ( GL_BLEND ) ;
glColor4f ( 0 , 0 , 0 , ca - > passepartalpha ) ;
}
2006-01-04 21:29:32 +00:00
if ( x1 > 0.0 )
2004-10-06 19:21:57 +00:00
glRectf ( 0.0 , ( float ) curarea - > winy , x1 , 0.0 ) ;
2006-01-04 21:29:32 +00:00
if ( x2 < ( float ) curarea - > winx )
2004-10-06 19:21:57 +00:00
glRectf ( x2 , ( float ) curarea - > winy , ( float ) curarea - > winx , 0.0 ) ;
2006-01-04 21:29:32 +00:00
if ( y2 < ( float ) curarea - > winy )
2004-10-06 19:21:57 +00:00
glRectf ( x1 , ( float ) curarea - > winy , x2 , y2 ) ;
2006-01-04 21:29:32 +00:00
if ( y2 > 0.0 )
2004-10-06 19:21:57 +00:00
glRectf ( x1 , y1 , x2 , 0.0 ) ;
2006-01-04 21:29:32 +00:00
2004-10-06 19:21:57 +00:00
glDisable ( GL_BLEND ) ;
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
}
2005-10-27 11:28:43 +00:00
2003-04-28 14:43:20 +00:00
/* edge */
2002-10-12 11:37:38 +00:00
glPolygonMode ( GL_FRONT_AND_BACK , GL_LINE ) ;
2005-10-27 11:28:43 +00:00
setlinestyle ( 0 ) ;
BIF_ThemeColor ( TH_BACK ) ;
glRectf ( x1 , y1 , x2 , y2 ) ;
setlinestyle ( 3 ) ;
BIF_ThemeColor ( TH_WIRE ) ;
glRectf ( x1 , y1 , x2 , y2 ) ;
2005-11-23 15:20:45 +00:00
2007-10-20 16:17:27 +00:00
/* camera name - draw in highlighted text color */
2005-11-22 16:14:07 +00:00
if ( ca & & ( ca - > flag & CAM_SHOWNAME ) ) {
2007-07-15 04:35:56 +00:00
BIF_ThemeColor ( TH_TEXT_HI ) ;
2007-07-16 19:04:42 +00:00
glRasterPos2f ( x1 , y1 - 15 ) ;
2005-10-27 11:28:43 +00:00
2005-11-01 18:39:54 +00:00
BMF_DrawString ( G . font , G . vd - > camera - > id . name + 2 ) ;
2007-07-15 04:35:56 +00:00
BIF_ThemeColor ( TH_WIRE ) ;
2005-10-27 11:28:43 +00:00
}
2002-10-12 11:37:38 +00:00
/* border */
if ( G . scene - > r . mode & R_BORDER ) {
cpack ( 0 ) ;
x3 = x1 + G . scene - > r . border . xmin * ( x2 - x1 ) ;
y3 = y1 + G . scene - > r . border . ymin * ( y2 - y1 ) ;
x4 = x1 + G . scene - > r . border . xmax * ( x2 - x1 ) ;
y4 = y1 + G . scene - > r . border . ymax * ( y2 - y1 ) ;
cpack ( 0x4040FF ) ;
glRectf ( x3 , y3 , x4 , y4 ) ;
}
2003-04-28 14:43:20 +00:00
/* safety border */
2005-11-22 16:14:07 +00:00
if ( ca & & ( ca - > flag & CAM_SHOWTITLESAFE ) ) {
2005-10-27 11:28:43 +00:00
fac = 0.1 ;
a = fac * ( x2 - x1 ) ;
x1 + = a ;
x2 - = a ;
a = fac * ( y2 - y1 ) ;
y1 + = a ;
y2 - = a ;
BIF_ThemeColorBlendShade ( TH_WIRE , TH_BACK , 0.25 , 0 ) ;
uiSetRoundBox ( 15 ) ;
gl_round_box ( GL_LINE_LOOP , x1 , y1 , x2 , y2 , 12.0 ) ;
}
2002-10-12 11:37:38 +00:00
setlinestyle ( 0 ) ;
glPolygonMode ( GL_FRONT_AND_BACK , GL_FILL ) ;
}
void backdrawview3d ( int test )
{
struct Base * base ;
2007-01-26 14:30:43 +00:00
/*for 2.43 release, don't use glext and just define the constant.
this to avoid possibly breaking platforms before release . */
# ifndef GL_MULTISAMPLE_ARB
# define GL_MULTISAMPLE_ARB 0x809D
# endif
2007-01-25 22:47:47 +00:00
2007-01-26 14:30:43 +00:00
# ifdef GL_MULTISAMPLE_ARB
2007-01-25 22:47:47 +00:00
int m ;
# endif
2007-01-26 14:30:43 +00:00
2007-09-10 19:32:44 +00:00
if ( G . f & G_VERTEXPAINT | | G . f & G_WEIGHTPAINT | | G . f & G_TEXTUREPAINT ) ;
2004-09-28 09:43:37 +00:00
else if ( G . obedit & & G . vd - > drawtype > OB_WIRE & & ( G . vd - > flag & V3D_ZBUF_SELECT ) ) ;
2002-10-12 11:37:38 +00:00
else {
G . vd - > flag & = ~ V3D_NEEDBACKBUFDRAW ;
return ;
}
2004-09-28 09:43:37 +00:00
if ( ! ( G . vd - > flag & V3D_NEEDBACKBUFDRAW ) ) return ;
2002-10-12 11:37:38 +00:00
if ( test ) {
if ( qtest ( ) ) {
addafterqueue ( curarea - > win , BACKBUFDRAW , 1 ) ;
return ;
}
}
2003-10-21 12:23:38 +00:00
persp ( PERSP_VIEW ) ;
2004-10-30 17:13:10 +00:00
2007-01-26 14:30:43 +00:00
/*Disable FSAA for backbuffer selection.
Only works if GL_MULTISAMPLE_ARB is defined by the header
file , which is should be for every OS that supports FSAA . */
# ifdef GL_MULTISAMPLE_ARB
m = glIsEnabled ( GL_MULTISAMPLE_ARB ) ;
if ( m ) glDisable ( GL_MULTISAMPLE_ARB ) ;
2007-01-25 22:47:47 +00:00
# endif
2003-06-11 15:43:20 +00:00
# ifdef __APPLE__
glDrawBuffer ( GL_AUX0 ) ;
# endif
2005-07-13 19:42:08 +00:00
if ( G . vd - > drawtype > OB_WIRE ) G . vd - > zbuf = TRUE ;
2002-10-12 11:37:38 +00:00
curarea - > win_swap & = ~ WIN_BACK_OK ;
glDisable ( GL_DITHER ) ;
glClearColor ( 0.0 , 0.0 , 0.0 , 0.0 ) ;
2005-07-13 19:42:08 +00:00
if ( G . vd - > zbuf ) {
2002-10-12 11:37:38 +00:00
glEnable ( GL_DEPTH_TEST ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
}
else {
glClear ( GL_COLOR_BUFFER_BIT ) ;
glDisable ( GL_DEPTH_TEST ) ;
}
2005-08-20 19:18:35 +00:00
if ( G . vd - > flag & V3D_CLIPPING )
view3d_set_clipping ( G . vd ) ;
2002-10-12 11:37:38 +00:00
G . f | = G_BACKBUFSEL ;
2004-09-28 09:43:37 +00:00
base = ( G . scene - > basact ) ;
if ( base & & ( base - > lay & G . vd - > lay ) ) {
draw_object_backbufsel ( base - > object ) ;
2002-10-12 11:37:38 +00:00
}
2004-09-28 09:43:37 +00:00
G . vd - > flag & = ~ V3D_NEEDBACKBUFDRAW ;
2002-10-12 11:37:38 +00:00
G . f & = ~ G_BACKBUFSEL ;
2005-07-13 19:42:08 +00:00
G . vd - > zbuf = FALSE ;
2002-10-12 11:37:38 +00:00
glDisable ( GL_DEPTH_TEST ) ;
glEnable ( GL_DITHER ) ;
2003-06-11 15:43:20 +00:00
# ifdef __APPLE__
glDrawBuffer ( GL_BACK ) ; /* we were in aux buffers */
# endif
2003-12-01 13:01:18 +00:00
2005-08-20 19:18:35 +00:00
if ( G . vd - > flag & V3D_CLIPPING )
view3d_clr_clipping ( ) ;
2007-01-25 22:47:47 +00:00
2007-01-26 14:30:43 +00:00
# ifdef GL_MULTISAMPLE_ARB
if ( m ) glEnable ( GL_MULTISAMPLE_ARB ) ;
2007-01-25 22:47:47 +00:00
# endif
2003-12-01 13:01:18 +00:00
/* it is important to end a view in a transform compatible with buttons */
persp ( PERSP_WIN ) ; // set ortho
bwin_scalematrix ( curarea - > win , G . vd - > blockscale , G . vd - > blockscale , G . vd - > blockscale ) ;
2002-10-12 11:37:38 +00:00
}
2006-02-08 21:01:00 +00:00
void check_backbuf ( void )
{
if ( G . vd - > flag & V3D_NEEDBACKBUFDRAW )
backdrawview3d ( 0 ) ;
}
/* samples a single pixel (copied from vpaint) */
unsigned int sample_backbuf ( int x , int y )
{
unsigned int col ;
if ( x > = curarea - > winx | | y > = curarea - > winy ) return 0 ;
x + = curarea - > winrct . xmin ;
y + = curarea - > winrct . ymin ;
check_backbuf ( ) ; // actually not needed for apple
# ifdef __APPLE__
glReadBuffer ( GL_AUX0 ) ;
# endif
glReadPixels ( x , y , 1 , 1 , GL_RGBA , GL_UNSIGNED_BYTE , & col ) ;
glReadBuffer ( GL_BACK ) ;
if ( G . order = = B_ENDIAN ) SWITCH_INT ( col ) ;
return framebuffer_to_index ( col ) ;
}
/* reads full rect, converts indices */
ImBuf * read_backbuf ( short xmin , short ymin , short xmax , short ymax )
{
unsigned int * dr , * rd ;
struct ImBuf * ibuf , * ibuf1 ;
int a ;
short xminc , yminc , xmaxc , ymaxc , xs , ys ;
/* clip */
if ( xmin < 0 ) xminc = 0 ; else xminc = xmin ;
if ( xmax > = curarea - > winx ) xmaxc = curarea - > winx - 1 ; else xmaxc = xmax ;
if ( xminc > xmaxc ) return NULL ;
if ( ymin < 0 ) yminc = 0 ; else yminc = ymin ;
if ( ymax > = curarea - > winy ) ymaxc = curarea - > winy - 1 ; else ymaxc = ymax ;
if ( yminc > ymaxc ) return NULL ;
2006-07-10 14:49:20 +00:00
ibuf = IMB_allocImBuf ( ( xmaxc - xminc + 1 ) , ( ymaxc - yminc + 1 ) , 32 , IB_rect , 0 ) ;
2006-02-08 21:01:00 +00:00
check_backbuf ( ) ; // actually not needed for apple
# ifdef __APPLE__
glReadBuffer ( GL_AUX0 ) ;
# endif
glReadPixels ( curarea - > winrct . xmin + xminc , curarea - > winrct . ymin + yminc , ( xmaxc - xminc + 1 ) , ( ymaxc - yminc + 1 ) , GL_RGBA , GL_UNSIGNED_BYTE , ibuf - > rect ) ;
glReadBuffer ( GL_BACK ) ;
if ( G . order = = B_ENDIAN ) IMB_convert_rgba_to_abgr ( ibuf ) ;
a = ( xmaxc - xminc + 1 ) * ( ymaxc - yminc + 1 ) ;
dr = ibuf - > rect ;
while ( a - - ) {
if ( * dr ) * dr = framebuffer_to_index ( * dr ) ;
dr + + ;
}
/* put clipped result back, if needed */
2006-07-10 14:49:20 +00:00
if ( xminc = = xmin & & xmaxc = = xmax & & yminc = = ymin & & ymaxc = = ymax )
return ibuf ;
2006-02-08 21:01:00 +00:00
ibuf1 = IMB_allocImBuf ( ( xmax - xmin + 1 ) , ( ymax - ymin + 1 ) , 32 , IB_rect , 0 ) ;
rd = ibuf - > rect ;
dr = ibuf1 - > rect ;
for ( ys = ymin ; ys < = ymax ; ys + + ) {
for ( xs = xmin ; xs < = xmax ; xs + + , dr + + ) {
if ( xs > = xminc & & xs < = xmaxc & & ys > = yminc & & ys < = ymaxc ) {
* dr = * rd ;
rd + + ;
}
}
}
IMB_freeImBuf ( ibuf ) ;
return ibuf1 ;
}
/* smart function to sample a rect spiralling outside, nice for backbuf selection */
2007-01-01 09:41:10 +00:00
unsigned int sample_backbuf_rect ( short mval [ 2 ] , int size , unsigned int min , unsigned int max , int * dist , short strict , unsigned int ( * indextest ) ( unsigned int index ) )
2006-02-08 21:01:00 +00:00
{
struct ImBuf * buf ;
unsigned int * bufmin , * bufmax , * tbuf ;
int minx , miny ;
int a , b , rc , nr , amount , dirvec [ 4 ] [ 2 ] ;
2006-11-15 10:02:57 +00:00
int distance = 0 ;
2006-02-08 21:01:00 +00:00
unsigned int index = 0 ;
2007-01-01 09:41:10 +00:00
short indexok = 0 ;
2006-02-08 21:01:00 +00:00
amount = ( size - 1 ) / 2 ;
minx = mval [ 0 ] - ( amount + 1 ) ;
miny = mval [ 1 ] - ( amount + 1 ) ;
buf = read_backbuf ( minx , miny , minx + size - 1 , miny + size - 1 ) ;
if ( ! buf ) return 0 ;
rc = 0 ;
dirvec [ 0 ] [ 0 ] = 1 ; dirvec [ 0 ] [ 1 ] = 0 ;
dirvec [ 1 ] [ 0 ] = 0 ; dirvec [ 1 ] [ 1 ] = - size ;
dirvec [ 2 ] [ 0 ] = - 1 ; dirvec [ 2 ] [ 1 ] = 0 ;
dirvec [ 3 ] [ 0 ] = 0 ; dirvec [ 3 ] [ 1 ] = size ;
bufmin = buf - > rect ;
tbuf = buf - > rect ;
bufmax = buf - > rect + size * size ;
tbuf + = amount * size + amount ;
for ( nr = 1 ; nr < = size ; nr + + ) {
2002-10-12 11:37:38 +00:00
2006-02-08 21:01:00 +00:00
for ( a = 0 ; a < 2 ; a + + ) {
for ( b = 0 ; b < nr ; b + + , distance + + ) {
2007-01-01 09:41:10 +00:00
if ( * tbuf & & * tbuf > = min & & * tbuf < max ) { //we got a hit
if ( strict ) {
indexok = indextest ( * tbuf - min + 1 ) ;
if ( indexok ) {
* dist = ( short ) sqrt ( ( float ) distance ) ;
index = * tbuf - min + 1 ;
goto exit ;
}
}
else {
* dist = ( short ) sqrt ( ( float ) distance ) ; // XXX, this distance is wrong -
index = * tbuf - min + 1 ; // messy yah, but indices start at 1
goto exit ;
}
2006-02-08 21:01:00 +00:00
}
tbuf + = ( dirvec [ rc ] [ 0 ] + dirvec [ rc ] [ 1 ] ) ;
if ( tbuf < bufmin | | tbuf > = bufmax ) {
goto exit ;
}
}
rc + + ;
rc & = 3 ;
}
}
exit :
IMB_freeImBuf ( buf ) ;
return index ;
}
2002-10-12 11:37:38 +00:00
void drawname ( Object * ob )
{
cpack ( 0x404040 ) ;
glRasterPos3f ( 0.0 , 0.0 , 0.0 ) ;
BMF_DrawString ( G . font , " " ) ;
BMF_DrawString ( G . font , ob - > id . name + 2 ) ;
}
2003-04-28 11:17:21 +00:00
2005-07-27 10:37:20 +00:00
static void draw_selected_name ( Object * ob )
2003-04-28 11:17:21 +00:00
{
char info [ 128 ] ;
2006-04-25 12:26:46 +00:00
short offset = 30 ;
2003-04-28 11:17:21 +00:00
2005-07-27 10:37:20 +00:00
if ( ob - > type = = OB_ARMATURE ) {
2005-12-07 23:25:43 +00:00
bArmature * arm = ob - > data ;
2005-07-27 10:37:20 +00:00
char * name = NULL ;
if ( ob = = G . obedit ) {
EditBone * ebo ;
for ( ebo = G . edbo . first ; ebo ; ebo = ebo - > next ) {
2005-12-07 23:25:43 +00:00
if ( ( ebo - > flag & BONE_ACTIVE ) & & ( ebo - > layer & arm - > layer ) ) {
2005-07-27 10:37:20 +00:00
name = ebo - > name ;
break ;
}
}
}
else if ( ob - > pose & & ( ob - > flag & OB_POSEMODE ) ) {
bPoseChannel * pchan ;
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
2005-12-07 23:25:43 +00:00
if ( ( pchan - > bone - > flag & BONE_ACTIVE ) & & ( pchan - > bone - > layer & arm - > layer ) ) {
2005-07-27 10:37:20 +00:00
name = pchan - > name ;
break ;
}
}
}
if ( name )
sprintf ( info , " (%d) %s %s " , CFRA , ob - > id . name + 2 , name ) ;
else
sprintf ( info , " (%d) %s " , CFRA , ob - > id . name + 2 ) ;
}
2007-03-24 12:44:55 +00:00
else if ( ob - > type = = OB_MESH ) {
2007-03-19 15:48:24 +00:00
Key * key = NULL ;
KeyBlock * kb = NULL ;
char shapes [ 75 ] ;
2007-03-24 05:10:03 +00:00
shapes [ 0 ] = 0 ;
2007-03-19 15:48:24 +00:00
key = ob_get_key ( ob ) ;
if ( key ) {
kb = BLI_findlink ( & key - > block , ob - > shapenr - 1 ) ;
if ( kb ) {
sprintf ( shapes , " : %s " , kb - > name ) ;
if ( ob - > shapeflag = = OB_SHAPE_LOCK ) {
sprintf ( shapes , " %s (Pinned) " , shapes ) ;
}
}
}
sprintf ( info , " (%d) %s %s " , CFRA , ob - > id . name + 2 , shapes ) ;
}
2005-07-27 10:37:20 +00:00
else sprintf ( info , " (%d) % s " , CFRA, ob->id.name+2) ;
2003-04-28 11:17:21 +00:00
2003-10-19 09:19:58 +00:00
BIF_ThemeColor ( TH_TEXT_HI ) ;
2006-04-25 12:26:46 +00:00
if ( U . uiflag & USER_SHOW_ROTVIEWICON )
offset = 14 + ( U . rvisize * 2 ) ;
glRasterPos2i ( offset , 10 ) ;
2003-04-28 11:17:21 +00:00
BMF_DrawString ( G . fonts , info ) ;
}
2006-04-25 12:26:46 +00:00
/* Draw a live substitute of the view icon, which is always shown */
static void draw_view_axis ( void )
{
const float k = U . rvisize ; /* axis size */
const float toll = 0.5 ; /* used to see when view is quasi-orthogonal */
const float start = k + 1.0 ; /* axis center in screen coordinates, x=y */
float ydisp = 0.0 ; /* vertical displacement to allow obj info text */
/* rvibright ranges approx. from original axis icon color to gizmo color */
2006-04-26 01:42:35 +00:00
float bright = U . rvibright / 15.0f ;
2006-04-25 12:26:46 +00:00
unsigned char col [ 3 ] ;
unsigned char gridcol [ 3 ] ;
2006-04-26 01:42:35 +00:00
float colf [ 3 ] ;
2006-04-25 12:26:46 +00:00
float vec [ 4 ] ;
float dx , dy ;
float h , s , v ;
2008-01-24 00:03:16 +00:00
/* thickness of lines is proportional to k */
/* (log(k)-1) gives a more suitable thickness, but fps decreased by about 3 fps */
glLineWidth ( k / 10 ) ;
//glLineWidth(log(k)-1); // a bit slow
2007-03-17 14:15:02 +00:00
BIF_GetThemeColor3ubv ( TH_GRID , ( char * ) gridcol ) ;
2006-04-25 12:26:46 +00:00
/* X */
vec [ 0 ] = vec [ 3 ] = 1 ;
vec [ 1 ] = vec [ 2 ] = 0 ;
QuatMulVecf ( G . vd - > viewquat , vec ) ;
2007-03-17 14:15:02 +00:00
make_axis_color ( ( char * ) gridcol , ( char * ) col , ' x ' ) ;
2006-04-26 01:42:35 +00:00
rgb_to_hsv ( col [ 0 ] / 255.0f , col [ 1 ] / 255.0f , col [ 2 ] / 255.0f , & h , & s , & v ) ;
s = s < 0.5 ? s + 0.5 : 1.0 ;
v = 0.3 ;
v = ( v < 1.0 - ( bright ) ? v + bright : 1.0 ) ;
hsv_to_rgb ( h , s , v , colf , colf + 1 , colf + 2 ) ;
glColor3fv ( colf ) ;
2006-04-25 12:26:46 +00:00
dx = vec [ 0 ] * k ;
dy = vec [ 1 ] * k ;
fdrawline ( start , start + ydisp , start + dx , start + dy + ydisp ) ;
if ( fabs ( dx ) > toll | | fabs ( dy ) > toll ) {
glRasterPos2i ( start + dx + 2 , start + dy + ydisp + 2 ) ;
BMF_DrawString ( G . fonts , " x " ) ;
}
/* Y */
vec [ 1 ] = vec [ 3 ] = 1 ;
vec [ 0 ] = vec [ 2 ] = 0 ;
QuatMulVecf ( G . vd - > viewquat , vec ) ;
2007-03-17 14:15:02 +00:00
make_axis_color ( ( char * ) gridcol , ( char * ) col , ' y ' ) ;
2006-04-26 01:42:35 +00:00
rgb_to_hsv ( col [ 0 ] / 255.0f , col [ 1 ] / 255.0f , col [ 2 ] / 255.0f , & h , & s , & v ) ;
s = s < 0.5 ? s + 0.5 : 1.0 ;
v = 0.3 ;
v = ( v < 1.0 - ( bright ) ? v + bright : 1.0 ) ;
hsv_to_rgb ( h , s , v , colf , colf + 1 , colf + 2 ) ;
glColor3fv ( colf ) ;
2006-04-25 12:26:46 +00:00
dx = vec [ 0 ] * k ;
dy = vec [ 1 ] * k ;
fdrawline ( start , start + ydisp , start + dx , start + dy + ydisp ) ;
if ( fabs ( dx ) > toll | | fabs ( dy ) > toll ) {
glRasterPos2i ( start + dx + 2 , start + dy + ydisp + 2 ) ;
BMF_DrawString ( G . fonts , " y " ) ;
}
/* Z */
vec [ 2 ] = vec [ 3 ] = 1 ;
vec [ 1 ] = vec [ 0 ] = 0 ;
QuatMulVecf ( G . vd - > viewquat , vec ) ;
2007-03-17 14:15:02 +00:00
make_axis_color ( ( char * ) gridcol , ( char * ) col , ' z ' ) ;
2006-04-26 01:42:35 +00:00
rgb_to_hsv ( col [ 0 ] / 255.0f , col [ 1 ] / 255.0f , col [ 2 ] / 255.0f , & h , & s , & v ) ;
s = s < 0.5 ? s + 0.5 : 1.0 ;
v = 0.5 ;
v = ( v < 1.0 - ( bright ) ? v + bright : 1.0 ) ;
hsv_to_rgb ( h , s , v , colf , colf + 1 , colf + 2 ) ;
glColor3fv ( colf ) ;
2006-04-25 12:26:46 +00:00
dx = vec [ 0 ] * k ;
dy = vec [ 1 ] * k ;
fdrawline ( start , start + ydisp , start + dx , start + dy + ydisp ) ;
if ( fabs ( dx ) > toll | | fabs ( dy ) > toll ) {
glRasterPos2i ( start + dx + 2 , start + dy + ydisp + 2 ) ;
BMF_DrawString ( G . fonts , " z " ) ;
}
2008-01-24 00:03:16 +00:00
/* restore line-width */
glLineWidth ( 1.0 ) ;
2006-04-25 12:26:46 +00:00
}
2002-10-12 11:37:38 +00:00
static void draw_view_icon ( void )
{
BIFIconID icon ;
if ( G . vd - > view = = 7 ) icon = ICON_AXIS_TOP ;
else if ( G . vd - > view = = 1 ) icon = ICON_AXIS_FRONT ;
else if ( G . vd - > view = = 3 ) icon = ICON_AXIS_SIDE ;
else return ;
glEnable ( GL_BLEND ) ;
glBlendFunc ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA ) ;
2005-12-21 22:21:43 +00:00
BIF_icon_draw ( 5.0 , 5.0 , icon ) ;
2002-10-12 11:37:38 +00:00
glDisable ( GL_BLEND ) ;
}
2006-04-25 12:26:46 +00:00
static void draw_viewport_name ( ScrArea * sa )
{
char * name = NULL ;
2007-06-04 00:35:19 +00:00
char * printable = NULL ;
2006-04-25 12:26:46 +00:00
switch ( G . vd - > view ) {
case 1 :
2008-04-16 08:48:49 +00:00
if ( G . vd - > persp = = V3D_ORTHO )
2007-06-04 00:35:19 +00:00
name = ( G . vd - > flag2 & V3D_OPP_DIRECTION_NAME ) ? " Back Ortho " : " Front Ortho " ;
2008-04-16 08:48:49 +00:00
else
name = ( G . vd - > flag2 & V3D_OPP_DIRECTION_NAME ) ? " Back Persp " : " Front Persp " ;
2006-04-25 12:26:46 +00:00
break ;
case 3 :
2008-04-16 08:48:49 +00:00
if ( G . vd - > persp = = V3D_ORTHO )
2007-06-04 00:35:19 +00:00
name = ( G . vd - > flag2 & V3D_OPP_DIRECTION_NAME ) ? " Left Ortho " : " Right Ortho " ;
2008-04-16 08:48:49 +00:00
else
name = ( G . vd - > flag2 & V3D_OPP_DIRECTION_NAME ) ? " Left Persp " : " Right Persp " ;
2006-04-25 12:26:46 +00:00
break ;
case 7 :
2008-04-16 08:48:49 +00:00
if ( G . vd - > persp = = V3D_ORTHO )
2007-06-04 00:35:19 +00:00
name = ( G . vd - > flag2 & V3D_OPP_DIRECTION_NAME ) ? " Bottom Ortho " : " Top Ortho " ;
2008-04-16 08:48:49 +00:00
else
name = ( G . vd - > flag2 & V3D_OPP_DIRECTION_NAME ) ? " Bottom Persp " : " Top Persp " ;
2006-04-25 12:26:46 +00:00
break ;
default :
2008-04-16 08:48:49 +00:00
if ( G . vd - > persp = = V3D_CAMOB ) {
2007-10-22 06:28:39 +00:00
if ( ( G . vd - > camera ) & & ( G . vd - > camera - > type = = OB_CAMERA ) ) {
2007-06-04 00:35:19 +00:00
Camera * cam ;
cam = G . vd - > camera - > data ;
name = ( cam - > type ! = CAM_ORTHO ) ? " Camera Persp " : " Camera Ortho " ;
} else {
name = " Object as Camera " ;
}
} else {
2008-04-16 08:48:49 +00:00
name = ( G . vd - > persp = = V3D_ORTHO ) ? " User Ortho " : " User Persp " ;
2007-06-04 00:35:19 +00:00
}
2006-04-25 12:26:46 +00:00
}
2007-06-04 10:53:37 +00:00
2007-06-04 00:35:19 +00:00
if ( G . vd - > localview ) {
printable = malloc ( strlen ( name ) + strlen ( " (Local)_ " ) ) ; /* '_' gives space for '\0' */
strcpy ( printable , name ) ;
strcat ( printable , " (Local) " ) ;
} else {
printable = name ;
}
if ( printable ) {
2006-04-25 12:26:46 +00:00
BIF_ThemeColor ( TH_TEXT_HI ) ;
glRasterPos2i ( 10 , sa - > winy - 20 ) ;
2007-06-04 00:35:19 +00:00
BMF_DrawString ( G . fonts , printable ) ;
}
if ( G . vd - > localview ) {
free ( printable ) ;
2006-04-25 12:26:46 +00:00
}
}
2003-10-15 12:26:26 +00:00
/* ******************* view3d space & buttons ************** */
2006-11-27 15:23:21 +00:00
/* temporal struct for storing transform properties */
typedef struct {
float ob_eul [ 4 ] ; // used for quat too....
float ob_scale [ 3 ] ; // need temp space due to linked values
float ob_dims [ 3 ] ;
short link_scale ;
float ve_median [ 5 ] ;
int curdef ;
float * defweightp ;
} TransformProperties ;
2003-10-18 12:21:41 +00:00
/* is used for both read and write... */
static void v3d_editvertex_buts ( uiBlock * block , Object * ob , float lim )
{
2004-03-28 08:46:35 +00:00
EditMesh * em = G . editMesh ;
2005-08-19 21:37:29 +00:00
EditVert * eve , * evedef = NULL ;
2004-07-28 16:45:00 +00:00
EditEdge * eed ;
2006-11-12 10:53:30 +00:00
MDeformVert * dvert = NULL ;
2006-11-27 15:23:21 +00:00
TransformProperties * tfp = G . vd - > properties_storage ;
2008-03-18 10:55:07 +00:00
float median [ 5 ] , ve_median [ 5 ] ;
2005-11-17 11:40:57 +00:00
int tot , totw , totweight , totedge ;
2005-08-19 21:37:29 +00:00
char defstr [ 320 ] ;
2003-10-18 12:21:41 +00:00
2005-11-17 11:40:57 +00:00
median [ 0 ] = median [ 1 ] = median [ 2 ] = median [ 3 ] = median [ 4 ] = 0.0 ;
tot = totw = totweight = totedge = 0 ;
2005-08-19 21:37:29 +00:00
defstr [ 0 ] = 0 ;
2005-08-21 20:09:50 +00:00
if ( ob - > type = = OB_MESH ) {
2004-03-28 08:46:35 +00:00
eve = em - > verts . first ;
2003-10-18 12:21:41 +00:00
while ( eve ) {
2008-01-01 02:20:13 +00:00
if ( eve - > f & SELECT ) {
2005-08-19 21:37:29 +00:00
evedef = eve ;
2003-10-18 12:21:41 +00:00
tot + + ;
VecAddf ( median , median , eve - > co ) ;
}
eve = eve - > next ;
}
- added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
- change all Mesh's to have ->medge now. This is forced by make_edges
on readfile, and in the various exotic important routines, and on
conversion back in python.
- make python NMesh structure always have medges now (needs testing)
- with above two changes it is guarenteed that mf->v3 is never ==0
in main blender code (i.e., all MFace's are actually triangles
or quads) and so I went through and removed all the historic tests
to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
- removed MEdge edcode flag, no longer needed
- added experimental replacement for edge flag system
Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.
NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.
To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
2005-08-21 07:19:20 +00:00
eed = em - > edges . first ;
while ( eed ) {
if ( ( eed - > f & SELECT ) ) {
totedge + + ;
median [ 3 ] + = eed - > crease ;
2004-07-28 16:45:00 +00:00
}
- added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
- change all Mesh's to have ->medge now. This is forced by make_edges
on readfile, and in the various exotic important routines, and on
conversion back in python.
- make python NMesh structure always have medges now (needs testing)
- with above two changes it is guarenteed that mf->v3 is never ==0
in main blender code (i.e., all MFace's are actually triangles
or quads) and so I went through and removed all the historic tests
to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
- removed MEdge edcode flag, no longer needed
- added experimental replacement for edge flag system
Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.
NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.
To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
2005-08-21 07:19:20 +00:00
eed = eed - > next ;
2004-07-28 16:45:00 +00:00
}
2006-11-11 23:23:15 +00:00
2005-08-19 21:37:29 +00:00
/* check for defgroups */
2006-11-12 10:53:30 +00:00
if ( evedef )
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
dvert = CustomData_em_get ( & em - > vdata , evedef - > data , CD_MDEFORMVERT ) ;
2006-11-12 10:53:30 +00:00
if ( tot = = 1 & & dvert & & dvert - > totweight ) {
2005-08-19 21:37:29 +00:00
bDeformGroup * dg ;
int i , max = 1 , init = 1 ;
2007-02-26 20:36:03 +00:00
char str [ 320 ] ;
2005-08-19 21:37:29 +00:00
2006-11-11 23:23:15 +00:00
for ( i = 0 ; i < dvert - > totweight ; i + + ) {
dg = BLI_findlink ( & ob - > defbase , dvert - > dw [ i ] . def_nr ) ;
2006-03-11 12:34:50 +00:00
if ( dg ) {
2007-02-01 20:25:24 +00:00
max + = snprintf ( str , sizeof ( str ) , " %s %%x%d| " , dg - > name , dvert - > dw [ i ] . def_nr ) ;
2006-03-11 12:34:50 +00:00
if ( max < 320 ) strcat ( defstr , str ) ;
}
else printf ( " oh no! \n " ) ;
2006-11-27 15:23:21 +00:00
if ( tfp - > curdef = = dvert - > dw [ i ] . def_nr ) {
2005-08-19 21:37:29 +00:00
init = 0 ;
2006-11-27 15:23:21 +00:00
tfp - > defweightp = & dvert - > dw [ i ] . weight ;
2005-08-19 21:37:29 +00:00
}
}
if ( init ) { // needs new initialized
2006-11-27 15:23:21 +00:00
tfp - > curdef = dvert - > dw [ 0 ] . def_nr ;
tfp - > defweightp = & dvert - > dw [ 0 ] . weight ;
2005-08-19 21:37:29 +00:00
}
}
2003-10-18 12:21:41 +00:00
}
2003-10-28 16:26:51 +00:00
else if ( ob - > type = = OB_CURVE | | ob - > type = = OB_SURF ) {
extern ListBase editNurb ; /* editcurve.c */
Nurb * nu ;
BPoint * bp ;
BezTriple * bezt ;
int a ;
nu = editNurb . first ;
while ( nu ) {
2006-08-13 07:37:51 +00:00
if ( ( nu - > type & 7 ) = = CU_BEZIER ) {
2003-10-28 16:26:51 +00:00
bezt = nu - > bezt ;
a = nu - > pntsu ;
while ( a - - ) {
2007-12-01 23:25:00 +00:00
if ( bezt - > f2 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( median , median , bezt - > vec [ 1 ] ) ;
tot + + ;
2005-11-17 11:40:57 +00:00
median [ 4 ] + = bezt - > weight ;
totweight + + ;
2003-10-28 16:26:51 +00:00
}
else {
2007-12-01 23:25:00 +00:00
if ( bezt - > f1 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( median , median , bezt - > vec [ 0 ] ) ;
tot + + ;
}
2007-12-01 23:25:00 +00:00
if ( bezt - > f3 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( median , median , bezt - > vec [ 2 ] ) ;
tot + + ;
}
}
bezt + + ;
}
}
else {
bp = nu - > bp ;
a = nu - > pntsu * nu - > pntsv ;
while ( a - - ) {
2007-12-11 14:19:05 +00:00
if ( bp - > f1 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( median , median , bp - > vec ) ;
2004-01-24 16:56:12 +00:00
median [ 3 ] + = bp - > vec [ 3 ] ;
totw + + ;
2003-10-28 16:26:51 +00:00
tot + + ;
2005-11-17 11:40:57 +00:00
median [ 4 ] + = bp - > weight ;
totweight + + ;
2003-10-28 16:26:51 +00:00
}
bp + + ;
}
}
nu = nu - > next ;
}
}
2005-04-02 19:52:32 +00:00
else if ( ob - > type = = OB_LATTICE ) {
BPoint * bp ;
int a ;
a = editLatt - > pntsu * editLatt - > pntsv * editLatt - > pntsw ;
bp = editLatt - > def ;
while ( a - - ) {
if ( bp - > f1 & SELECT ) {
VecAddf ( median , median , bp - > vec ) ;
tot + + ;
2005-11-17 11:40:57 +00:00
median [ 4 ] + = bp - > weight ;
totweight + + ;
2005-04-02 19:52:32 +00:00
}
bp + + ;
}
}
2003-10-18 12:21:41 +00:00
if ( tot = = 0 ) return ;
median [ 0 ] / = ( float ) tot ;
median [ 1 ] / = ( float ) tot ;
median [ 2 ] / = ( float ) tot ;
2004-07-28 16:45:00 +00:00
if ( totedge ) median [ 3 ] / = ( float ) totedge ;
2005-11-17 11:40:57 +00:00
else if ( totw ) median [ 3 ] / = ( float ) totw ;
if ( totweight ) median [ 4 ] / = ( float ) totweight ;
2003-10-18 12:21:41 +00:00
2005-04-29 18:43:17 +00:00
if ( G . vd - > flag & V3D_GLOBAL_STATS )
Mat4MulVecfl ( ob - > obmat , median ) ;
2003-10-18 12:21:41 +00:00
if ( block ) { // buttons
2008-01-01 02:20:13 +00:00
int but_y ;
if ( ( ob - > parent ) & & ( ob - > partype = = PARBONE ) ) but_y = 135 ;
else but_y = 150 ;
2005-04-29 18:43:17 +00:00
uiBlockBeginAlign ( block ) ;
2008-01-01 02:20:13 +00:00
uiDefButBitS ( block , TOG , V3D_GLOBAL_STATS , REDRAWVIEW3D , " Global " , 160 , but_y , 70 , 19 , & G . vd - > flag , 0 , 0 , 0 , 0 , " Displays global values " ) ;
uiDefButBitS ( block , TOGN , V3D_GLOBAL_STATS , REDRAWVIEW3D , " Local " , 230 , but_y , 70 , 19 , & G . vd - > flag , 0 , 0 , 0 , 0 , " Displays local values " ) ;
uiBlockEndAlign ( block ) ;
2006-11-27 15:23:21 +00:00
memcpy ( tfp - > ve_median , median , sizeof ( tfp - > ve_median ) ) ;
2003-10-18 12:21:41 +00:00
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2004-07-28 16:45:00 +00:00
if ( tot = = 1 ) {
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Vertex X: " , 10 , 110 , 290 , 19 , & ( tfp - > ve_median [ 0 ] ) , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Vertex Y: " , 10 , 90 , 290 , 19 , & ( tfp - > ve_median [ 1 ] ) , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Vertex Z: " , 10 , 70 , 290 , 19 , & ( tfp - > ve_median [ 2 ] ) , - lim , lim , 10 , 3 , " " ) ;
2005-11-17 11:40:57 +00:00
if ( totw = = 1 )
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Vertex W: " , 10 , 50 , 290 , 19 , & ( tfp - > ve_median [ 3 ] ) , 0.01 , 100.0 , 10 , 3 , " " ) ;
2005-11-17 11:40:57 +00:00
uiBlockEndAlign ( block ) ;
2005-08-19 21:37:29 +00:00
if ( defstr [ 0 ] ) {
uiDefBut ( block , LABEL , 1 , " Vertex Deform Groups " , 10 , 40 , 290 , 20 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
uiBlockBeginAlign ( block ) ;
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_NOP , " Weight: " , 10 , 20 , 150 , 19 , tfp - > defweightp , 0.0f , 1.0f , 10 , 3 , " Weight value " ) ;
uiDefButI ( block , MENU , REDRAWVIEW3D , defstr , 160 , 20 , 140 , 19 , & tfp - > curdef , 0.0 , 0.0 , 0 , 0 , " Current Vertex Group " ) ;
2005-11-17 11:40:57 +00:00
uiBlockEndAlign ( block ) ;
2005-08-19 21:37:29 +00:00
}
2005-11-17 11:40:57 +00:00
else if ( totweight )
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Weight: " , 10 , 20 , 290 , 19 , & ( tfp - > ve_median [ 4 ] ) , 0.0 , 1.0 , 10 , 3 , " " ) ;
2005-11-17 11:40:57 +00:00
2003-10-18 12:21:41 +00:00
}
else {
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Median X: " , 10 , 110 , 290 , 19 , & ( tfp - > ve_median [ 0 ] ) , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Median Y: " , 10 , 90 , 290 , 19 , & ( tfp - > ve_median [ 1 ] ) , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Median Z: " , 10 , 70 , 290 , 19 , & ( tfp - > ve_median [ 2 ] ) , - lim , lim , 10 , 3 , " " ) ;
2005-11-17 11:40:57 +00:00
if ( totw = = tot )
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Median W: " , 10 , 50 , 290 , 19 , & ( tfp - > ve_median [ 3 ] ) , 0.01 , 100.0 , 10 , 3 , " " ) ;
2005-11-17 11:40:57 +00:00
uiBlockEndAlign ( block ) ;
if ( totweight )
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Weight: " , 10 , 20 , 290 , 19 , & ( tfp - > ve_median [ 4 ] ) , 0.0 , 1.0 , 10 , 3 , " Weight is used for SoftBody Goal " ) ;
2003-10-18 12:21:41 +00:00
}
2007-11-10 15:31:41 +00:00
if ( ob - > type = = OB_CURVE & & ( totw = = 0 ) ) { /* bez curves have no w */
uiBlockBeginAlign ( block ) ;
uiDefBut ( block , BUT , B_SETPT_AUTO , " Auto " , 10 , 44 , 72 , 19 , 0 , 0 , 0 , 0 , 0 , " Auto handles (Shift H) " ) ;
uiDefBut ( block , BUT , B_SETPT_VECTOR , " Vector " , 82 , 44 , 73 , 19 , 0 , 0 , 0 , 0 , 0 , " Vector handles (V) " ) ;
uiDefBut ( block , BUT , B_SETPT_ALIGN , " Align " , 155 , 44 , 73 , 19 , 0 , 0 , 0 , 0 , 0 , " Align handles (H Toggles) " ) ;
uiDefBut ( block , BUT , B_SETPT_FREE , " Free " , 227 , 44 , 72 , 19 , 0 , 0 , 0 , 0 , 0 , " Align handles (H Toggles) " ) ;
uiBlockEndAlign ( block ) ;
}
2004-07-28 16:45:00 +00:00
if ( totedge = = 1 )
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Crease W: " , 10 , 30 , 290 , 19 , & ( tfp - > ve_median [ 3 ] ) , 0.0 , 1.0 , 10 , 3 , " " ) ;
2004-07-28 16:45:00 +00:00
else if ( totedge > 1 )
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELMEDIAN , " Median Crease W: " , 10 , 30 , 290 , 19 , & ( tfp - > ve_median [ 3 ] ) , 0.0 , 1.0 , 10 , 3 , " " ) ;
2004-07-28 16:45:00 +00:00
2003-10-18 12:21:41 +00:00
}
else { // apply
2008-03-18 10:55:07 +00:00
memcpy ( ve_median , tfp - > ve_median , sizeof ( tfp - > ve_median ) ) ;
2003-10-18 12:21:41 +00:00
2005-04-29 18:43:17 +00:00
if ( G . vd - > flag & V3D_GLOBAL_STATS ) {
Mat4Invert ( ob - > imat , ob - > obmat ) ;
Mat4MulVecfl ( ob - > imat , median ) ;
2008-03-18 10:55:07 +00:00
Mat4MulVecfl ( ob - > imat , ve_median ) ;
2005-04-29 18:43:17 +00:00
}
2008-03-18 10:55:07 +00:00
VecSubf ( median , ve_median , median ) ;
median [ 3 ] = ve_median [ 3 ] - median [ 3 ] ;
median [ 4 ] = ve_median [ 4 ] - median [ 4 ] ;
2003-10-18 12:21:41 +00:00
if ( ob - > type = = OB_MESH ) {
2004-12-09 16:43:37 +00:00
2004-03-28 08:46:35 +00:00
eve = em - > verts . first ;
2003-10-18 12:21:41 +00:00
while ( eve ) {
2008-01-01 02:20:13 +00:00
if ( eve - > f & SELECT ) {
2003-10-18 12:21:41 +00:00
VecAddf ( eve - > co , eve - > co , median ) ;
}
eve = eve - > next ;
}
2004-07-28 16:45:00 +00:00
2004-12-09 16:43:37 +00:00
for ( eed = em - > edges . first ; eed ; eed = eed - > next ) {
if ( eed - > f & SELECT ) {
2006-11-04 10:09:05 +00:00
/* ensure the median can be set to zero or one */
2008-03-18 10:55:07 +00:00
if ( ve_median [ 3 ] = = 0.0f ) eed - > crease = 0.0f ;
else if ( ve_median [ 3 ] = = 1.0f ) eed - > crease = 1.0f ;
2006-11-04 10:09:05 +00:00
else {
eed - > crease + = median [ 3 ] ;
CLAMP ( eed - > crease , 0.0 , 1.0 ) ;
}
2004-07-28 16:45:00 +00:00
}
}
2005-06-12 12:44:51 +00:00
recalc_editnormals ( ) ;
2003-10-18 12:21:41 +00:00
}
2003-10-28 16:26:51 +00:00
else if ( ob - > type = = OB_CURVE | | ob - > type = = OB_SURF ) {
extern ListBase editNurb ; /* editcurve.c */
Nurb * nu ;
BPoint * bp ;
BezTriple * bezt ;
int a ;
nu = editNurb . first ;
while ( nu ) {
if ( ( nu - > type & 7 ) = = 1 ) {
bezt = nu - > bezt ;
a = nu - > pntsu ;
while ( a - - ) {
2007-12-01 23:25:00 +00:00
if ( bezt - > f2 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( bezt - > vec [ 0 ] , bezt - > vec [ 0 ] , median ) ;
VecAddf ( bezt - > vec [ 1 ] , bezt - > vec [ 1 ] , median ) ;
VecAddf ( bezt - > vec [ 2 ] , bezt - > vec [ 2 ] , median ) ;
2005-11-17 11:40:57 +00:00
bezt - > weight + = median [ 4 ] ;
2003-10-28 16:26:51 +00:00
}
else {
2007-12-01 23:25:00 +00:00
if ( bezt - > f1 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( bezt - > vec [ 0 ] , bezt - > vec [ 0 ] , median ) ;
}
2007-12-01 23:25:00 +00:00
if ( bezt - > f3 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( bezt - > vec [ 2 ] , bezt - > vec [ 2 ] , median ) ;
}
}
bezt + + ;
}
}
else {
bp = nu - > bp ;
a = nu - > pntsu * nu - > pntsv ;
while ( a - - ) {
2007-12-11 14:19:05 +00:00
if ( bp - > f1 & SELECT ) {
2003-10-28 16:26:51 +00:00
VecAddf ( bp - > vec , bp - > vec , median ) ;
2004-01-24 16:56:12 +00:00
bp - > vec [ 3 ] + = median [ 3 ] ;
2005-11-17 11:40:57 +00:00
bp - > weight + = median [ 4 ] ;
2003-10-28 16:26:51 +00:00
}
bp + + ;
}
}
test2DNurb ( nu ) ;
testhandlesNurb ( nu ) ; /* test for bezier too */
nu = nu - > next ;
}
}
2005-04-02 19:52:32 +00:00
else if ( ob - > type = = OB_LATTICE ) {
BPoint * bp ;
int a ;
a = editLatt - > pntsu * editLatt - > pntsv * editLatt - > pntsw ;
bp = editLatt - > def ;
while ( a - - ) {
if ( bp - > f1 & SELECT ) {
VecAddf ( bp - > vec , bp - > vec , median ) ;
2005-11-17 11:40:57 +00:00
bp - > weight + = median [ 4 ] ;
2005-04-02 19:52:32 +00:00
}
bp + + ;
}
}
2004-12-09 16:43:37 +00:00
BIF_undo_push ( " Transform properties " ) ;
2003-10-18 12:21:41 +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
/* assumes armature active */
static void validate_bonebutton_cb ( void * bonev , void * namev )
{
Object * ob = OBACT ;
if ( ob & & ob - > type = = OB_ARMATURE ) {
Bone * bone = bonev ;
char oldname [ 32 ] , newname [ 32 ] ;
/* need to be on the stack */
BLI_strncpy ( newname , bone - > name , 32 ) ;
BLI_strncpy ( oldname , ( char * ) namev , 32 ) ;
/* restore */
BLI_strncpy ( bone - > name , oldname , 32 ) ;
armature_bone_rename ( ob - > data , oldname , newname ) ; // editarmature.c
allqueue ( REDRAWALL , 0 ) ;
}
}
2003-10-28 16:26:51 +00:00
static void v3d_posearmature_buts ( uiBlock * block , Object * ob , float lim )
{
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
uiBut * but ;
2003-10-28 16:26:51 +00:00
bArmature * arm ;
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
bPoseChannel * pchan ;
2006-12-13 08:50:11 +00:00
Bone * bone = NULL ;
2006-11-27 15:23:21 +00:00
TransformProperties * tfp = G . vd - > properties_storage ;
2003-10-28 16:26:51 +00:00
arm = get_armature ( OBACT ) ;
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 ( ! arm | | ! ob - > pose ) return ;
2003-10-28 16:26:51 +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
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
bone = pchan - > bone ;
2005-12-07 23:25:43 +00:00
if ( bone & & ( bone - > flag & BONE_ACTIVE ) & & ( bone - > layer & arm - > layer ) )
break ;
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
}
2006-12-13 08:50:11 +00:00
if ( ! pchan | | ! bone ) return ;
2007-04-09 11:43:46 +00:00
if ( ( ob - > parent ) & & ( ob - > partype = = PARBONE ) )
but = uiDefBut ( block , TEX , B_DIFF , " Bone: " , 160 , 130 , 140 , 19 , bone - > name , 1 , 31 , 0 , 0 , " " ) ;
else
but = uiDefBut ( block , TEX , B_DIFF , " Bone: " , 160 , 140 , 140 , 19 , bone - > name , 1 , 31 , 0 , 0 , " " ) ;
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
uiButSetFunc ( but , validate_bonebutton_cb , bone , NULL ) ;
2006-11-27 15:23:21 +00:00
QuatToEul ( pchan - > quat , tfp - > ob_eul ) ;
tfp - > ob_eul [ 0 ] * = 180.0 / M_PI ;
tfp - > ob_eul [ 1 ] * = 180.0 / M_PI ;
tfp - > ob_eul [ 2 ] * = 180.0 / M_PI ;
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
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2005-10-29 20:08:25 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_LOCX , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 140 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_ARMATUREPANEL2 , " LocX: " , 30 , 140 , 120 , 19 , pchan - > loc , - lim , lim , 100 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_LOCY , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 120 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_ARMATUREPANEL2 , " LocY: " , 30 , 120 , 120 , 19 , pchan - > loc + 1 , - lim , lim , 100 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_LOCZ , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 100 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-11-09 08:09:54 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL2 , " LocZ: " , 30 , 100 , 120 , 19 , pchan - > loc + 2 , - lim , lim , 100 , 3 , " " ) ;
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
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2005-10-29 20:08:25 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTX , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 70 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL3 , " RotX: " , 30 , 70 , 120 , 19 , tfp - > ob_eul , - 1000.0 , 1000.0 , 100 , 3 , " " ) ;
2005-10-29 20:08:25 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTY , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 50 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL3 , " RotY: " , 30 , 50 , 120 , 19 , tfp - > ob_eul + 1 , - 1000.0 , 1000.0 , 100 , 3 , " " ) ;
2005-10-29 20:08:25 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTZ , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 30 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL3 , " RotZ: " , 30 , 30 , 120 , 19 , tfp - > ob_eul + 2 , - 1000.0 , 1000.0 , 100 , 3 , " " ) ;
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
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2006-06-12 20:01:18 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_SCALEX , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 70 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-06-15 04:13:26 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL2 , " ScaleX: " , 180 , 70 , 120 , 19 , pchan - > size , - lim , lim , 10 , 3 , " " ) ;
2006-06-12 20:01:18 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_SCALEY , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 50 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-06-15 04:13:26 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL2 , " ScaleY: " , 180 , 50 , 120 , 19 , pchan - > size + 1 , - lim , lim , 10 , 3 , " " ) ;
2006-06-12 20:01:18 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_SCALEZ , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 30 , 20 , 19 , & ( pchan - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-06-15 04:13:26 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL2 , " ScaleZ: " , 180 , 30 , 120 , 19 , pchan - > size + 2 , - lim , lim , 10 , 3 , " " ) ;
2003-11-14 00:44:48 +00:00
uiBlockEndAlign ( block ) ;
2003-10-28 16:26:51 +00:00
}
static void v3d_editarmature_buts ( uiBlock * block , Object * ob , float lim )
{
2005-12-07 23:25:43 +00:00
bArmature * arm = G . obedit - > data ;
2003-10-28 16:26:51 +00:00
EditBone * ebone ;
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
uiBut * but ;
2006-11-27 15:23:21 +00:00
TransformProperties * tfp = G . vd - > properties_storage ;
2003-10-28 16:26:51 +00:00
ebone = G . edbo . first ;
for ( ebone = G . edbo . first ; ebone ; ebone = ebone - > next ) {
2005-12-07 23:25:43 +00:00
if ( ( ebone - > flag & BONE_ACTIVE ) & & ( ebone - > layer & arm - > layer ) )
2003-10-28 16:26:51 +00:00
break ;
}
if ( ! ebone )
return ;
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
2007-04-09 11:43:46 +00:00
if ( ( ob - > parent ) & & ( ob - > partype = = PARBONE ) )
but = uiDefBut ( block , TEX , B_DIFF , " Bone: " , 160 , 130 , 140 , 19 , ebone - > name , 1 , 31 , 0 , 0 , " " ) ;
else
but = uiDefBut ( block , TEX , B_DIFF , " Bone: " , 160 , 150 , 140 , 19 , ebone - > name , 1 , 31 , 0 , 0 , " " ) ;
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
uiButSetFunc ( but , validate_editbonebutton_cb , ebone , NULL ) ;
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2007-09-12 07:33:18 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " HeadX: " , 10 , 70 , 140 , 19 , ebone - > head , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " HeadY: " , 10 , 50 , 140 , 19 , ebone - > head + 1 , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " HeadZ: " , 10 , 30 , 140 , 19 , ebone - > head + 2 , - lim , lim , 10 , 3 , " " ) ;
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2007-09-12 07:33:18 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " TailX: " , 160 , 70 , 140 , 19 , ebone - > tail , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " TailY: " , 160 , 50 , 140 , 19 , ebone - > tail + 1 , - lim , lim , 10 , 3 , " " ) ;
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " TailZ: " , 160 , 30 , 140 , 19 , ebone - > tail + 2 , - lim , lim , 10 , 3 , " " ) ;
2003-11-14 00:44:48 +00:00
uiBlockEndAlign ( block ) ;
2007-08-03 11:16:12 +00:00
2006-11-27 15:23:21 +00:00
tfp - > ob_eul [ 0 ] = 180.0 * ebone - > roll / M_PI ;
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " Roll: " , 10 , 100 , 140 , 19 , tfp - > ob_eul , - lim , lim , 1000 , 3 , " " ) ;
2006-03-10 02:55:18 +00:00
2006-02-23 14:45:59 +00:00
uiBlockBeginAlign ( block ) ;
2007-09-13 05:15:55 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " TailRadius: " , 10 , 150 , 140 , 19 , & ebone - > rad_tail , 0 , lim , 10 , 3 , " " ) ;
2006-03-10 02:55:18 +00:00
if ( ebone - > parent & & ebone - > flag & BONE_CONNECTED )
2006-02-23 14:45:59 +00:00
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " HeadRadius: " , 10 , 130 , 140 , 19 , & ebone - > parent - > rad_tail , 0 , lim , 10 , 3 , " " ) ;
else
uiDefButF ( block , NUM , B_ARMATUREPANEL1 , " HeadRadius: " , 10 , 130 , 140 , 19 , & ebone - > rad_head , 0 , lim , 10 , 3 , " " ) ;
uiBlockEndAlign ( block ) ;
2003-10-28 16:26:51 +00:00
}
2004-05-30 14:12:14 +00:00
static void v3d_editmetaball_buts ( uiBlock * block , Object * ob , float lim )
{
2004-07-21 17:44:44 +00:00
extern MetaElem * lastelem ;
2005-01-06 21:27:53 +00:00
2004-07-21 17:44:44 +00:00
if ( lastelem ) {
uiBlockBeginAlign ( block ) ;
uiDefButF ( block , NUM , B_RECALCMBALL , " LocX: " , 10 , 70 , 140 , 19 , & lastelem - > x , - lim , lim , 100 , 3 , " " ) ;
uiDefButF ( block , NUM , B_RECALCMBALL , " LocY: " , 10 , 50 , 140 , 19 , & lastelem - > y , - lim , lim , 100 , 3 , " " ) ;
uiDefButF ( block , NUM , B_RECALCMBALL , " LocZ: " , 10 , 30 , 140 , 19 , & lastelem - > z , - lim , lim , 100 , 3 , " " ) ;
2005-01-06 21:27:53 +00:00
2004-07-21 17:44:44 +00:00
uiBlockBeginAlign ( block ) ;
if ( lastelem - > type ! = MB_BALL )
2006-09-16 04:26:22 +00:00
uiDefButF ( block , NUM , B_RECALCMBALL , " dx: " , 160 , 70 , 140 , 19 , & lastelem - > expx , 0 , lim , 100 , 3 , " " ) ;
2004-07-21 17:44:44 +00:00
if ( ( lastelem - > type ! = MB_BALL ) & & ( lastelem - > type ! = MB_TUBE ) )
2006-09-16 04:26:22 +00:00
uiDefButF ( block , NUM , B_RECALCMBALL , " dy: " , 160 , 50 , 140 , 19 , & lastelem - > expy , 0 , lim , 100 , 3 , " " ) ;
2004-07-21 17:44:44 +00:00
if ( ( lastelem - > type = = MB_ELIPSOID ) | | ( lastelem - > type = = MB_CUBE ) )
2006-09-16 04:26:22 +00:00
uiDefButF ( block , NUM , B_RECALCMBALL , " dz: " , 160 , 30 , 140 , 19 , & lastelem - > expz , 0 , lim , 100 , 3 , " " ) ;
2005-01-06 21:27:53 +00:00
2006-09-16 04:26:22 +00:00
uiBlockEndAlign ( block ) ;
2005-01-06 21:27:53 +00:00
2006-09-16 04:26:22 +00:00
uiBlockBeginAlign ( block ) ;
uiDefButF ( block , NUM , B_RECALCMBALL , " Radius: " , 10 , 120 , 140 , 19 , & lastelem - > rad , 0 , lim , 100 , 3 , " Size of the active metaball " ) ;
uiDefButF ( block , NUM , B_RECALCMBALL , " Stiffness: " , 10 , 100 , 140 , 19 , & lastelem - > s , 0 , 10 , 100 , 3 , " Stiffness of the active metaball " ) ;
uiBlockEndAlign ( block ) ;
uiDefButS ( block , MENU , B_RECALCMBALL , " Type%t|Ball%x0|Tube%x4|Plane%x5|Elipsoid%x6|Cube%x7 " , 160 , 120 , 140 , 19 , & lastelem - > type , 0.0 , 0.0 , 0 , 0 , " Set active element type " ) ;
2004-07-21 17:44:44 +00:00
}
2004-05-30 14:12:14 +00:00
}
2003-10-15 16:01:08 +00:00
2003-10-15 12:26:26 +00:00
void do_viewbuts ( unsigned short event )
{
2006-06-14 08:50:41 +00:00
BoundBox * bb ;
2003-10-15 12:26:26 +00:00
View3D * vd ;
2003-10-15 16:01:08 +00:00
Object * ob = OBACT ;
2006-11-27 15:23:21 +00:00
TransformProperties * tfp = G . vd - > properties_storage ;
2003-10-15 12:26:26 +00:00
vd = G . vd ;
2006-12-20 17:57:56 +00:00
if ( vd = = NULL ) return ;
2003-10-15 12:26:26 +00:00
switch ( event ) {
2003-10-15 16:01: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
case B_OBJECTPANEL :
DAG_object_flush_update ( G . scene , ob , OB_RECALC_OB ) ;
allqueue ( REDRAWVIEW3D , 1 ) ;
break ;
2003-10-15 16:01:08 +00:00
case B_OBJECTPANELROT :
if ( ob ) {
2006-11-27 15:23:21 +00:00
ob - > rot [ 0 ] = M_PI * tfp - > ob_eul [ 0 ] / 180.0 ;
ob - > rot [ 1 ] = M_PI * tfp - > ob_eul [ 1 ] / 180.0 ;
ob - > rot [ 2 ] = M_PI * tfp - > ob_eul [ 2 ] / 180.0 ;
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
DAG_object_flush_update ( G . scene , ob , OB_RECALC_OB ) ;
2003-10-15 16:01:08 +00:00
allqueue ( REDRAWVIEW3D , 1 ) ;
}
break ;
2006-06-12 20:01:18 +00:00
case B_OBJECTPANELSCALE :
if ( ob ) {
2007-04-09 10:01:46 +00:00
/* link scale; figure out which axis changed */
if ( tfp - > link_scale ) {
float ratio , tmp , max = 0.0 ;
int axis ;
axis = 0 ;
max = fabs ( tfp - > ob_scale [ 0 ] - ob - > size [ 0 ] ) ;
tmp = fabs ( tfp - > ob_scale [ 1 ] - ob - > size [ 1 ] ) ;
if ( tmp > max ) {
axis = 1 ;
max = tmp ;
}
tmp = fabs ( tfp - > ob_scale [ 2 ] - ob - > size [ 2 ] ) ;
if ( tmp > max ) {
axis = 2 ;
max = tmp ;
}
if ( ob - > size [ axis ] ! = tfp - > ob_scale [ axis ] ) {
2006-06-13 05:19:43 +00:00
if ( fabs ( ob - > size [ axis ] ) > FLT_EPSILON ) {
2006-11-27 15:23:21 +00:00
ratio = tfp - > ob_scale [ axis ] / ob - > size [ axis ] ;
2006-06-12 20:01:18 +00:00
ob - > size [ 0 ] * = ratio ;
ob - > size [ 1 ] * = ratio ;
ob - > size [ 2 ] * = ratio ;
}
}
}
2007-04-09 10:01:46 +00:00
else {
VECCOPY ( ob - > size , tfp - > ob_scale ) ;
}
DAG_object_flush_update ( G . scene , ob , OB_RECALC_OB ) ;
allqueue ( REDRAWVIEW3D , 1 ) ;
2006-06-12 20:01:18 +00:00
}
break ;
case B_OBJECTPANELDIMS :
2006-06-14 08:50:41 +00:00
bb = object_get_boundbox ( ob ) ;
if ( bb ) {
float old_dims [ 3 ] , scale [ 3 ] , ratio , len [ 3 ] ;
2006-06-12 20:01:18 +00:00
int axis ;
Mat4ToSize ( ob - > obmat , scale ) ;
len [ 0 ] = bb - > vec [ 4 ] [ 0 ] - bb - > vec [ 0 ] [ 0 ] ;
len [ 1 ] = bb - > vec [ 2 ] [ 1 ] - bb - > vec [ 0 ] [ 1 ] ;
len [ 2 ] = bb - > vec [ 1 ] [ 2 ] - bb - > vec [ 0 ] [ 2 ] ;
old_dims [ 0 ] = fabs ( scale [ 0 ] ) * len [ 0 ] ;
old_dims [ 1 ] = fabs ( scale [ 1 ] ) * len [ 1 ] ;
old_dims [ 2 ] = fabs ( scale [ 2 ] ) * len [ 2 ] ;
2006-06-14 08:50:41 +00:00
/* for each axis changed */
for ( axis = 0 ; axis < 3 ; axis + + ) {
2006-11-27 15:23:21 +00:00
if ( fabs ( old_dims [ axis ] - tfp - > ob_dims [ axis ] ) > 0.0001 ) {
2006-06-14 08:50:41 +00:00
if ( old_dims [ axis ] > 0.0 ) {
2006-11-27 15:23:21 +00:00
ratio = tfp - > ob_dims [ axis ] / old_dims [ axis ] ;
if ( tfp - > link_scale ) {
2006-06-14 08:50:41 +00:00
ob - > size [ 0 ] * = ratio ;
ob - > size [ 1 ] * = ratio ;
ob - > size [ 2 ] * = ratio ;
break ;
}
else {
ob - > size [ axis ] * = ratio ;
}
2006-06-12 20:01:18 +00:00
}
else {
2006-06-14 08:50:41 +00:00
if ( len [ axis ] > 0 ) {
2006-11-27 15:23:21 +00:00
ob - > size [ axis ] = tfp - > ob_dims [ axis ] / len [ axis ] ;
2006-06-14 08:50:41 +00:00
}
2006-06-12 20:01:18 +00:00
}
}
}
2006-06-14 08:50:41 +00:00
/* prevent multiple B_OBJECTPANELDIMS events to keep scaling, cycling with TAB on buttons can cause that */
2006-11-27 15:23:21 +00:00
VECCOPY ( tfp - > ob_dims , old_dims ) ;
2006-06-14 08:50:41 +00:00
DAG_object_flush_update ( G . scene , ob , OB_RECALC_OB ) ;
allqueue ( REDRAWVIEW3D , 1 ) ;
2006-06-12 20:01:18 +00:00
}
break ;
2004-04-06 19:16:14 +00:00
2003-10-18 12:21:41 +00:00
case B_OBJECTPANELMEDIAN :
if ( ob ) {
v3d_editvertex_buts ( NULL , ob , 1.0 ) ;
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
DAG_object_flush_update ( G . scene , ob , OB_RECALC_DATA ) ;
2003-10-18 12:21:41 +00:00
allqueue ( REDRAWVIEW3D , 1 ) ;
}
break ;
2007-04-09 11:43:46 +00:00
/* note; this case also used for parbone */
2004-04-06 19:16:14 +00:00
case B_OBJECTPANELPARENT :
if ( ob ) {
2006-06-25 17:31:13 +00:00
if ( ob - > id . lib | | test_parent_loop ( ob - > parent , ob ) )
2004-04-06 19:16:14 +00:00
ob - > parent = NULL ;
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
else {
DAG_scene_sort ( G . scene ) ;
DAG_object_flush_update ( G . scene , ob , OB_RECALC_OB ) ;
}
2006-06-25 17:31:13 +00:00
allqueue ( REDRAWVIEW3D , 1 ) ;
allqueue ( REDRAWBUTSOBJECT , 0 ) ;
2008-06-08 10:46:30 +00:00
allqueue ( REDRAWOOPS , 0 ) ;
2004-04-06 19:16:14 +00:00
}
break ;
2003-10-28 16:26:51 +00:00
case B_ARMATUREPANEL1 :
{
2005-08-15 14:44:51 +00:00
bArmature * arm = G . obedit - > data ;
2003-10-28 16:26:51 +00:00
EditBone * ebone , * child ;
for ( ebone = G . edbo . first ; ebone ; ebone = ebone - > next ) {
2005-12-07 23:25:43 +00:00
if ( ( ebone - > flag & BONE_ACTIVE ) & & ( ebone - > layer & arm - > layer ) )
break ;
2003-10-28 16:26:51 +00:00
}
if ( ebone ) {
2006-11-27 15:23:21 +00:00
ebone - > roll = M_PI * tfp - > ob_eul [ 0 ] / 180.0 ;
2003-10-28 16:26:51 +00:00
// Update our parent
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
if ( ebone - > parent & & ebone - > flag & BONE_CONNECTED ) {
2003-10-28 16:26:51 +00:00
VECCOPY ( ebone - > parent - > tail , ebone - > head ) ;
}
// Update our children if necessary
for ( child = G . edbo . first ; child ; child = child - > next ) {
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
if ( child - > parent = = ebone & & ( child - > flag & BONE_CONNECTED ) ) {
2003-10-28 16:26:51 +00:00
VECCOPY ( child - > head , ebone - > tail ) ;
}
}
2005-08-15 14:44:51 +00:00
if ( arm - > flag & ARM_MIRROR_EDIT ) {
EditBone * eboflip = armature_bone_get_mirrored ( ebone ) ;
if ( eboflip ) {
eboflip - > roll = - ebone - > roll ;
eboflip - > head [ 0 ] = - ebone - > head [ 0 ] ;
eboflip - > tail [ 0 ] = - ebone - > tail [ 0 ] ;
// Update our parent
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
if ( eboflip - > parent & & eboflip - > flag & BONE_CONNECTED ) {
2005-08-15 14:44:51 +00:00
VECCOPY ( eboflip - > parent - > tail , eboflip - > head ) ;
}
// Update our children if necessary
for ( child = G . edbo . first ; child ; child = child - > next ) {
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
if ( child - > parent = = eboflip & & ( child - > flag & BONE_CONNECTED ) ) {
2005-08-15 14:44:51 +00:00
VECCOPY ( child - > head , eboflip - > tail ) ;
}
}
}
}
2003-10-28 16:26:51 +00:00
allqueue ( REDRAWVIEW3D , 1 ) ;
}
}
break ;
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
case B_ARMATUREPANEL3 : // rotate button on channel
2003-10-28 16:26:51 +00:00
{
bArmature * arm ;
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
bPoseChannel * pchan ;
2003-10-28 16:26:51 +00:00
Bone * bone ;
2006-09-10 09:18:33 +00:00
float eul [ 3 ] ;
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
2003-10-28 16:26:51 +00:00
arm = get_armature ( OBACT ) ;
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 ( ! arm | | ! ob - > pose ) return ;
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
bone = pchan - > bone ;
2005-12-07 23:25:43 +00:00
if ( bone & & ( bone - > flag & BONE_ACTIVE ) & & ( bone - > layer & arm - > layer ) )
break ;
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 ( ! pchan ) return ;
2003-10-28 16:26:51 +00:00
2006-09-10 09:18:33 +00:00
/* make a copy to eul[3], to allow TAB on buttons to work */
2006-11-27 15:23:21 +00:00
eul [ 0 ] = M_PI * tfp - > ob_eul [ 0 ] / 180.0 ;
eul [ 1 ] = M_PI * tfp - > ob_eul [ 1 ] / 180.0 ;
eul [ 2 ] = M_PI * tfp - > ob_eul [ 2 ] / 180.0 ;
2006-09-10 09:18:33 +00:00
EulToQuat ( eul , pchan - > quat ) ;
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
}
/* no break, pass on */
case B_ARMATUREPANEL2 :
{
2006-01-03 12:04:05 +00:00
ob - > pose - > flag | = ( POSE_LOCKED | POSE_DO_UNLOCK ) ;
2005-07-23 18:52:31 +00:00
DAG_object_flush_update ( G . scene , ob , OB_RECALC_DATA ) ;
2003-10-28 16:26:51 +00:00
allqueue ( REDRAWVIEW3D , 1 ) ;
}
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
break ;
=== Custom Transform Orientation ===
Custom Orientations can be added with Ctrl-Shift-C (hotkey suggestions are welcomed), this adds and select the new alignment. Custom Orientations can also be added, deleted, selected from the Transform Orientations panel (View -> Transform Orientations). Standard orientations (global, local, normal, view) can also be selected from this panel.
If you plan on using only a single custom orientation and don't really need a list, I suggest you use the hotkey as it adds and selects at the same time.
Custom Orientations are save in the scene and are selected per 3D view (like normal orientation).
Adding from an object, the orientation is a normalized version of the object's orientation.
Adding from mesh data, a single element (vertex, edge, face) must be selected in its respective selection mode. Vertex orientation Z-axis is based on the normal, edge Z-axis on the edge itself (X-axis is on the XoY plane when possible, Y-axis is perpendicular to the rest). Face orientation Z-axis is the face normal, X-axis is perpendicular to the first edge, Y-axis is perpendicular to the rest.
(More logical orientations can be suggested).
I plan to add: 2 vertice (connected or not) => edge orientation , 3 vertice = face orientation
Differences from the patch:
- orientations no longer link back to the object they came from, everything is copy on creation.
- orientations are overwritten based on name (if you add an orientation with the same name as one that already exists, it overwrites the old one)
2008-01-13 18:24:09 +00:00
case B_TRANSFORMSPACEADD :
BIF_manageTransformOrientation ( 1 , 0 ) ;
allqueue ( REDRAWVIEW3D , 1 ) ;
break ;
case B_TRANSFORMSPACECLEAR :
BIF_clearTransformOrientation ( ) ;
allqueue ( REDRAWVIEW3D , 1 ) ;
2003-10-15 12:26:26 +00:00
}
}
=== Custom Transform Orientation ===
Custom Orientations can be added with Ctrl-Shift-C (hotkey suggestions are welcomed), this adds and select the new alignment. Custom Orientations can also be added, deleted, selected from the Transform Orientations panel (View -> Transform Orientations). Standard orientations (global, local, normal, view) can also be selected from this panel.
If you plan on using only a single custom orientation and don't really need a list, I suggest you use the hotkey as it adds and selects at the same time.
Custom Orientations are save in the scene and are selected per 3D view (like normal orientation).
Adding from an object, the orientation is a normalized version of the object's orientation.
Adding from mesh data, a single element (vertex, edge, face) must be selected in its respective selection mode. Vertex orientation Z-axis is based on the normal, edge Z-axis on the edge itself (X-axis is on the XoY plane when possible, Y-axis is perpendicular to the rest). Face orientation Z-axis is the face normal, X-axis is perpendicular to the first edge, Y-axis is perpendicular to the rest.
(More logical orientations can be suggested).
I plan to add: 2 vertice (connected or not) => edge orientation , 3 vertice = face orientation
Differences from the patch:
- orientations no longer link back to the object they came from, everything is copy on creation.
- orientations are overwritten based on name (if you add an orientation with the same name as one that already exists, it overwrites the old one)
2008-01-13 18:24:09 +00:00
void removeTransformOrientation_func ( void * target , void * unused )
{
BIF_removeTransformOrientation ( ( TransformOrientation * ) target ) ;
}
void selectTransformOrientation_func ( void * target , void * unused )
{
BIF_selectTransformOrientation ( ( TransformOrientation * ) target ) ;
}
static void view3d_panel_transform_spaces ( short cntrl )
{
ListBase * transform_spaces = & G . scene - > transform_spaces ;
TransformOrientation * ts = transform_spaces - > first ;
uiBlock * block ;
uiBut * but ;
int xco = 20 , yco = 70 , height = 140 ;
int index ;
block = uiNewBlock ( & curarea - > uiblocks , " view3d_panel_transform " , UI_EMBOSS , UI_HELV , curarea - > win ) ;
uiPanelControl ( UI_PNL_SOLID | UI_PNL_CLOSE | cntrl ) ;
uiSetPanelHandler ( VIEW3D_HANDLER_TRANSFORM ) ; // for close and esc
if ( uiNewPanel ( curarea , block , " Transform Orientations " , " View3d " , 10 , 230 , 318 , height ) = = 0 ) return ;
uiNewPanelHeight ( block , height ) ;
uiBlockBeginAlign ( block ) ;
if ( G . obedit )
uiDefBut ( block , BUT , B_TRANSFORMSPACEADD , " Add " , xco , 120 , 80 , 20 , 0 , 0 , 0 , 0 , 0 , " Add the selected element as a Transform Orientation " ) ;
else
uiDefBut ( block , BUT , B_TRANSFORMSPACEADD , " Add " , xco , 120 , 80 , 20 , 0 , 0 , 0 , 0 , 0 , " Add the active object as a Transform Orientation " ) ;
uiDefBut ( block , BUT , B_TRANSFORMSPACECLEAR , " Clear " , xco + 80 , 120 , 80 , 20 , 0 , 0 , 0 , 0 , 0 , " Removal all Transform Orientations " ) ;
uiBlockEndAlign ( block ) ;
2008-01-14 02:49:25 +00:00
=== Custom Transform Orientation ===
Custom Orientations can be added with Ctrl-Shift-C (hotkey suggestions are welcomed), this adds and select the new alignment. Custom Orientations can also be added, deleted, selected from the Transform Orientations panel (View -> Transform Orientations). Standard orientations (global, local, normal, view) can also be selected from this panel.
If you plan on using only a single custom orientation and don't really need a list, I suggest you use the hotkey as it adds and selects at the same time.
Custom Orientations are save in the scene and are selected per 3D view (like normal orientation).
Adding from an object, the orientation is a normalized version of the object's orientation.
Adding from mesh data, a single element (vertex, edge, face) must be selected in its respective selection mode. Vertex orientation Z-axis is based on the normal, edge Z-axis on the edge itself (X-axis is on the XoY plane when possible, Y-axis is perpendicular to the rest). Face orientation Z-axis is the face normal, X-axis is perpendicular to the first edge, Y-axis is perpendicular to the rest.
(More logical orientations can be suggested).
I plan to add: 2 vertice (connected or not) => edge orientation , 3 vertice = face orientation
Differences from the patch:
- orientations no longer link back to the object they came from, everything is copy on creation.
- orientations are overwritten based on name (if you add an orientation with the same name as one that already exists, it overwrites the old one)
2008-01-13 18:24:09 +00:00
uiBlockBeginAlign ( block ) ;
uiDefButS ( block , ROW , REDRAWHEADERS , " Global " , xco , 90 , 40 , 20 , & G . vd - > twmode , 5.0 , ( float ) V3D_MANIP_GLOBAL , 0 , 0 , " Global Transform Orientation " ) ;
uiDefButS ( block , ROW , REDRAWHEADERS , " Local " , xco + 40 , 90 , 40 , 20 , & G . vd - > twmode , 5.0 , ( float ) V3D_MANIP_LOCAL , 0 , 0 , " Local Transform Orientation " ) ;
uiDefButS ( block , ROW , REDRAWHEADERS , " Normal " , xco + 80 , 90 , 40 , 20 , & G . vd - > twmode , 5.0 , ( float ) V3D_MANIP_NORMAL , 0 , 0 , " Normal Transform Orientation " ) ;
uiDefButS ( block , ROW , REDRAWHEADERS , " View " , xco + 120 , 90 , 40 , 20 , & G . vd - > twmode , 5.0 , ( float ) V3D_MANIP_VIEW , 0 , 0 , " View Transform Orientation " ) ;
for ( index = V3D_MANIP_CUSTOM , ts = transform_spaces - > first ; ts ; ts = ts - > next , index + + ) {
BIF_ThemeColor ( TH_BUT_ACTION ) ;
2008-01-28 01:15:21 +00:00
if ( G . vd - > twmode = = index ) {
but = uiDefIconButS ( block , ROW , REDRAWHEADERS , ICON_CHECKBOX_HLT , xco , yco , XIC , YIC , & G . vd - > twmode , 5.0 , ( float ) index , 0 , 0 , " Use this Custom Transform Orientation " ) ;
}
else {
but = uiDefIconButS ( block , ROW , REDRAWHEADERS , ICON_CHECKBOX_DEHLT , xco , yco , XIC , YIC , & G . vd - > twmode , 5.0 , ( float ) index , 0 , 0 , " Use this Custom Transform Orientation " ) ;
}
=== Custom Transform Orientation ===
Custom Orientations can be added with Ctrl-Shift-C (hotkey suggestions are welcomed), this adds and select the new alignment. Custom Orientations can also be added, deleted, selected from the Transform Orientations panel (View -> Transform Orientations). Standard orientations (global, local, normal, view) can also be selected from this panel.
If you plan on using only a single custom orientation and don't really need a list, I suggest you use the hotkey as it adds and selects at the same time.
Custom Orientations are save in the scene and are selected per 3D view (like normal orientation).
Adding from an object, the orientation is a normalized version of the object's orientation.
Adding from mesh data, a single element (vertex, edge, face) must be selected in its respective selection mode. Vertex orientation Z-axis is based on the normal, edge Z-axis on the edge itself (X-axis is on the XoY plane when possible, Y-axis is perpendicular to the rest). Face orientation Z-axis is the face normal, X-axis is perpendicular to the first edge, Y-axis is perpendicular to the rest.
(More logical orientations can be suggested).
I plan to add: 2 vertice (connected or not) => edge orientation , 3 vertice = face orientation
Differences from the patch:
- orientations no longer link back to the object they came from, everything is copy on creation.
- orientations are overwritten based on name (if you add an orientation with the same name as one that already exists, it overwrites the old one)
2008-01-13 18:24:09 +00:00
uiButSetFunc ( but , selectTransformOrientation_func , ts , NULL ) ;
uiDefBut ( block , TEX , 0 , " " , xco + = XIC , yco , 100 + XIC , 20 , & ts - > name , 0 , 30 , 0 , 0 , " Edits the name of this Transform Orientation " ) ;
but = uiDefIconBut ( block , BUT , REDRAWVIEW3D , ICON_X , xco + = 100 + XIC , yco , XIC , YIC , 0 , 0 , 0 , 0 , 0 , " Deletes this Transform Orientation " ) ;
uiButSetFunc ( but , removeTransformOrientation_func , ts , NULL ) ;
xco = 20 ;
yco - = 25 ;
}
uiBlockEndAlign ( block ) ;
if ( yco < 0 ) uiNewPanelHeight ( block , height - yco ) ;
}
2003-10-16 00:17:24 +00:00
static void view3d_panel_object ( short cntrl ) // VIEW3D_HANDLER_OBJECT
2003-10-15 16:01:08 +00:00
{
uiBlock * block ;
2004-11-08 22:10:20 +00:00
uiBut * bt ;
2003-10-15 16:01:08 +00:00
Object * ob = OBACT ;
2006-11-27 15:23:21 +00:00
TransformProperties * tfp ;
2003-10-15 16:01:08 +00:00
float lim ;
2005-10-04 21:23:19 +00:00
static char hexcol [ 128 ] ;
2003-10-15 16:01:08 +00:00
if ( ob = = NULL ) return ;
2003-10-16 00:17:24 +00:00
2006-11-27 15:23:21 +00:00
/* make sure we got storage */
if ( G . vd - > properties_storage = = NULL )
G . vd - > properties_storage = MEM_callocN ( sizeof ( TransformProperties ) , " TransformProperties " ) ;
tfp = G . vd - > properties_storage ;
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
block = uiNewBlock ( & curarea - > uiblocks , " view3d_panel_object " , UI_EMBOSS , UI_HELV , curarea - > win ) ;
- 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
uiPanelControl ( UI_PNL_SOLID | UI_PNL_CLOSE | cntrl ) ;
2003-10-16 00:17:24 +00:00
uiSetPanelHandler ( VIEW3D_HANDLER_OBJECT ) ; // for close and esc
2004-07-31 22:05:46 +00:00
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
if ( ( G . f & G_SCULPTMODE ) & & ! G . obedit ) {
2007-12-20 19:07:47 +00:00
if ( ! uiNewPanel ( curarea , block , " Transform Properties " , " View3d " , 10 , 230 , 318 , 234 ) )
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
return ;
} else if ( G . f & G_PARTICLEEDIT & & ! G . obedit ) {
if ( ! uiNewPanel ( curarea , block , " Transform Properties " , " View3d " , 10 , 230 , 318 , 234 ) )
return ;
} else {
if ( ! uiNewPanel ( curarea , block , " Transform Properties " , " View3d " , 10 , 230 , 318 , 204 ) )
return ;
}
2006-11-06 01:08:26 +00:00
2007-11-27 19:23:26 +00:00
uiSetButLock ( object_is_libdata ( ob ) , ERROR_LIBDATA_MESSAGE ) ;
2005-05-12 19:17:12 +00:00
2007-09-10 19:32:44 +00:00
if ( G . f & ( G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT ) ) {
2004-10-03 20:02:22 +00:00
uiBlockSetFlag ( block , UI_BLOCK_FRONTBUFFER ) ; // force old style frontbuffer draw
}
else {
2007-04-11 17:10:57 +00:00
bt = uiDefBut ( block , TEX , B_IDNAME , " OB: " , 10 , 180 , 140 , 20 , ob - > id . name + 2 , 0.0 , 21.0 , 0 , 0 , " " ) ;
2006-08-20 15:22:56 +00:00
# ifdef WITH_VERSE
if ( ob - > vnode ) uiButSetFunc ( bt , test_and_send_idbutton_cb , ob , ob - > id . name ) ;
else uiButSetFunc ( bt , test_idbutton_cb , ob - > id . name , NULL ) ;
# else
2004-11-08 22:10:20 +00:00
uiButSetFunc ( bt , test_idbutton_cb , ob - > id . name , NULL ) ;
2006-08-20 15:22:56 +00:00
# endif
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
if ( ( G . f & G_PARTICLEEDIT ) = = 0 ) {
uiBlockBeginAlign ( block ) ;
uiDefIDPoinBut ( block , test_obpoin_but , ID_OB , B_OBJECTPANELPARENT , " Par: " , 160 , 180 , 140 , 20 , & ob - > parent , " Parent Object " ) ;
if ( ( ob - > parent ) & & ( ob - > partype = = PARBONE ) ) {
bt = uiDefBut ( block , TEX , B_OBJECTPANELPARENT , " ParBone: " , 160 , 160 , 140 , 20 , ob - > parsubstr , 0 , 30 , 0 , 0 , " " ) ;
uiButSetCompleteFunc ( bt , autocomplete_bone , ( void * ) ob - > parent ) ;
}
else {
strcpy ( ob - > parsubstr , " " ) ;
}
uiBlockEndAlign ( block ) ;
2007-04-09 11:43:46 +00:00
}
2004-07-10 17:40:40 +00:00
}
2003-10-15 16:01:08 +00:00
2005-09-11 11:03:09 +00:00
lim = 10000.0f * MAX2 ( 1.0 , G . vd - > grid ) ;
2003-10-15 16:01:08 +00:00
2003-10-18 12:21:41 +00:00
if ( ob = = G . obedit ) {
2003-10-28 16:26:51 +00:00
if ( ob - > type = = OB_ARMATURE ) v3d_editarmature_buts ( block , ob , lim ) ;
2004-05-30 14:12:14 +00:00
if ( ob - > type = = OB_MBALL ) v3d_editmetaball_buts ( block , ob , lim ) ;
2003-10-28 16:26:51 +00:00
else v3d_editvertex_buts ( block , ob , lim ) ;
}
2005-07-23 18:52:31 +00:00
else if ( ob - > flag & OB_POSEMODE ) {
2003-10-28 16:26:51 +00:00
v3d_posearmature_buts ( block , ob , lim ) ;
2003-10-18 12:21:41 +00:00
}
2006-12-29 13:13:17 +00:00
else if ( G . f & G_WEIGHTPAINT ) {
uiNewPanelTitle ( block , " Weight Paint Properties " ) ;
weight_paint_buttons ( block ) ;
}
2004-07-10 17:40:40 +00:00
else if ( G . f & ( G_VERTEXPAINT | G_TEXTUREPAINT ) ) {
extern VPaint Gvp ; /* from vpaint */
static float hsv [ 3 ] , old [ 3 ] ; // used as temp mem for picker
2006-08-27 13:29:00 +00:00
float * rgb = NULL ;
ToolSettings * settings = G . scene - > toolsettings ;
if ( G . f & G_VERTEXPAINT ) rgb = & Gvp . r ;
else if ( settings - > imapaint . brush ) rgb = settings - > imapaint . brush - > rgb ;
2006-11-16 20:55:11 +00:00
uiNewPanelTitle ( block , " Paint Properties " ) ;
2006-08-27 13:29:00 +00:00
if ( rgb )
/* 'f' is for floating panel */
uiBlockPickerButtons ( block , rgb , hsv , old , hexcol , ' f ' , REDRAWBUTSEDIT ) ;
2004-07-10 17:40:40 +00:00
}
2006-11-06 01:08:26 +00:00
else if ( G . f & G_SCULPTMODE ) {
2006-11-16 20:55:11 +00:00
uiNewPanelTitle ( block , " Sculpt Properties " ) ;
2006-11-06 01:08:26 +00:00
sculptmode_draw_interface_tools ( block , 10 , 150 ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
} else if ( G . f & G_PARTICLEEDIT ) {
uiNewPanelTitle ( block , " Particle Edit Properties " ) ;
particle_edit_buttons ( block ) ;
2006-11-06 01:08:26 +00:00
} else {
2006-06-12 20:01:18 +00:00
BoundBox * bb = NULL ;
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2006-06-12 20:01:18 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_LOCX , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 150 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANEL , " LocX: " , 30 , 150 , 120 , 19 , & ( ob - > loc [ 0 ] ) , - lim , lim , 100 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_LOCY , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 130 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANEL , " LocY: " , 30 , 130 , 120 , 19 , & ( ob - > loc [ 1 ] ) , - lim , lim , 100 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_LOCZ , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 110 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANEL , " LocZ: " , 30 , 110 , 120 , 19 , & ( ob - > loc [ 2 ] ) , - lim , lim , 100 , 3 , " " ) ;
2005-04-29 18:43:17 +00:00
2006-11-27 15:23:21 +00:00
tfp - > ob_eul [ 0 ] = 180.0 * ob - > rot [ 0 ] / M_PI ;
tfp - > ob_eul [ 1 ] = 180.0 * ob - > rot [ 1 ] / M_PI ;
tfp - > ob_eul [ 2 ] = 180.0 * ob - > rot [ 2 ] / M_PI ;
2003-10-18 12:21:41 +00:00
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2007-04-09 11:43:46 +00:00
if ( ( ob - > parent ) & & ( ob - > partype = = PARBONE ) ) {
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTX , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 130 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELROT , " RotX: " , 180 , 130 , 120 , 19 , & ( tfp - > ob_eul [ 0 ] ) , - lim , lim , 1000 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTY , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 110 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELROT , " RotY: " , 180 , 110 , 120 , 19 , & ( tfp - > ob_eul [ 1 ] ) , - lim , lim , 1000 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTZ , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 90 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELROT , " RotZ: " , 180 , 90 , 120 , 19 , & ( tfp - > ob_eul [ 2 ] ) , - lim , lim , 1000 , 3 , " " ) ;
}
else {
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTX , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 150 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELROT , " RotX: " , 180 , 150 , 120 , 19 , & ( tfp - > ob_eul [ 0 ] ) , - lim , lim , 1000 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTY , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 130 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELROT , " RotY: " , 180 , 130 , 120 , 19 , & ( tfp - > ob_eul [ 1 ] ) , - lim , lim , 1000 , 3 , " " ) ;
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_ROTZ , REDRAWVIEW3D , ICON_UNLOCKED , 160 , 110 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELROT , " RotZ: " , 180 , 110 , 120 , 19 , & ( tfp - > ob_eul [ 2 ] ) , - lim , lim , 1000 , 3 , " " ) ;
}
2006-06-12 20:01:18 +00:00
2006-11-27 15:23:21 +00:00
tfp - > ob_scale [ 0 ] = ob - > size [ 0 ] ;
tfp - > ob_scale [ 1 ] = ob - > size [ 1 ] ;
tfp - > ob_scale [ 2 ] = ob - > size [ 2 ] ;
2006-06-12 20:01:18 +00:00
2003-11-14 15:49:26 +00:00
uiBlockBeginAlign ( block ) ;
2006-06-12 20:01:18 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_SCALEX , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 80 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELSCALE , " ScaleX: " , 30 , 80 , 120 , 19 , & ( tfp - > ob_scale [ 0 ] ) , - lim , lim , 10 , 3 , " " ) ;
2006-06-12 20:01:18 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_SCALEY , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 60 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELSCALE , " ScaleY: " , 30 , 60 , 120 , 19 , & ( tfp - > ob_scale [ 1 ] ) , - lim , lim , 10 , 3 , " " ) ;
2006-06-12 20:01:18 +00:00
uiDefIconButBitS ( block , ICONTOG , OB_LOCK_SCALEZ , REDRAWVIEW3D , ICON_UNLOCKED , 10 , 40 , 20 , 19 , & ( ob - > protectflag ) , 0 , 0 , 0 , 0 , " Protects this value from being Transformed " ) ;
2006-11-27 15:23:21 +00:00
uiDefButF ( block , NUM , B_OBJECTPANELSCALE , " ScaleZ: " , 30 , 40 , 120 , 19 , & ( tfp - > ob_scale [ 2 ] ) , - lim , lim , 10 , 3 , " " ) ;
2003-11-14 00:44:48 +00:00
uiBlockEndAlign ( block ) ;
2006-06-12 20:01:18 +00:00
2006-11-27 15:23:21 +00:00
uiDefButS ( block , TOG , REDRAWVIEW3D , " Link Scale " , 10 , 10 , 140 , 19 , & ( tfp - > link_scale ) , 0 , 1 , 0 , 0 , " Scale values vary proportionally in all directions " ) ;
2006-06-12 20:01:18 +00:00
2006-06-14 08:50:41 +00:00
bb = object_get_boundbox ( ob ) ;
2006-06-12 20:01:18 +00:00
if ( bb ) {
float scale [ 3 ] ;
Mat4ToSize ( ob - > obmat , scale ) ;
2006-11-27 15:23:21 +00:00
tfp - > ob_dims [ 0 ] = fabs ( scale [ 0 ] ) * ( bb - > vec [ 4 ] [ 0 ] - bb - > vec [ 0 ] [ 0 ] ) ;
tfp - > ob_dims [ 1 ] = fabs ( scale [ 1 ] ) * ( bb - > vec [ 2 ] [ 1 ] - bb - > vec [ 0 ] [ 1 ] ) ;
tfp - > ob_dims [ 2 ] = fabs ( scale [ 2 ] ) * ( bb - > vec [ 1 ] [ 2 ] - bb - > vec [ 0 ] [ 2 ] ) ;
2006-06-12 20:01:18 +00:00
uiBlockBeginAlign ( block ) ;
2007-04-09 11:43:46 +00:00
if ( ( ob - > parent ) & & ( ob - > partype = = PARBONE ) ) {
uiDefButF ( block , NUM , B_OBJECTPANELDIMS , " DimX: " , 160 , 60 , 140 , 19 , & ( tfp - > ob_dims [ 0 ] ) , 0.0 , lim , 10 , 3 , " Manipulate bounding box size " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELDIMS , " DimY: " , 160 , 40 , 140 , 19 , & ( tfp - > ob_dims [ 1 ] ) , 0.0 , lim , 10 , 3 , " Manipulate bounding box size " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELDIMS , " DimZ: " , 160 , 20 , 140 , 19 , & ( tfp - > ob_dims [ 2 ] ) , 0.0 , lim , 10 , 3 , " Manipulate bounding box size " ) ;
}
else {
uiDefButF ( block , NUM , B_OBJECTPANELDIMS , " DimX: " , 160 , 80 , 140 , 19 , & ( tfp - > ob_dims [ 0 ] ) , 0.0 , lim , 10 , 3 , " Manipulate bounding box size " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELDIMS , " DimY: " , 160 , 60 , 140 , 19 , & ( tfp - > ob_dims [ 1 ] ) , 0.0 , lim , 10 , 3 , " Manipulate bounding box size " ) ;
uiDefButF ( block , NUM , B_OBJECTPANELDIMS , " DimZ: " , 160 , 40 , 140 , 19 , & ( tfp - > ob_dims [ 2 ] ) , 0.0 , lim , 10 , 3 , " Manipulate bounding box size " ) ;
}
2006-06-12 20:01:18 +00:00
uiBlockEndAlign ( block ) ;
}
2003-10-18 12:21:41 +00:00
}
2005-05-12 19:17:12 +00:00
uiClearButLock ( ) ;
2003-10-16 00:17:24 +00:00
}
2003-10-15 16:01:08 +00:00
2004-06-29 20:34:10 +00:00
static void view3d_panel_background ( short cntrl ) // VIEW3D_HANDLER_BACKGROUND
2003-10-15 12:26:26 +00:00
{
uiBlock * block ;
View3D * vd ;
vd = G . vd ;
2003-10-25 22:03:19 +00:00
block = uiNewBlock ( & curarea - > uiblocks , " view3d_panel_background " , UI_EMBOSS , UI_HELV , curarea - > win ) ;
- 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
uiPanelControl ( UI_PNL_SOLID | UI_PNL_CLOSE | cntrl ) ;
2003-10-16 00:17:24 +00:00
uiSetPanelHandler ( VIEW3D_HANDLER_BACKGROUND ) ; // for close and esc
2004-01-24 05:06:12 +00:00
if ( uiNewPanel ( curarea , block , " Background Image " , " View3d " , 340 , 10 , 318 , 204 ) = = 0 ) return ;
2003-10-15 12:26:26 +00:00
2007-09-10 19:32:44 +00:00
if ( G . f & G_VERTEXPAINT | | G . f & G_WEIGHTPAINT | | G . f & G_TEXTUREPAINT ) {
2004-10-03 20:02:22 +00:00
uiBlockSetFlag ( block , UI_BLOCK_FRONTBUFFER ) ; // force old style frontbuffer draw
}
2003-10-15 12:26:26 +00:00
if ( vd - > flag & V3D_DISPBGPIC ) {
2006-12-20 17:57:56 +00:00
if ( vd - > bgpic = = NULL ) {
2003-10-15 12:26:26 +00:00
vd - > bgpic = MEM_callocN ( sizeof ( BGpic ) , " bgpic " ) ;
vd - > bgpic - > size = 5.0 ;
vd - > bgpic - > blend = 0.5 ;
2006-12-20 17:57:56 +00:00
vd - > bgpic - > iuser . fie_ima = 2 ;
vd - > bgpic - > iuser . ok = 1 ;
2003-10-15 12:26:26 +00:00
}
}
2006-12-20 17:57:56 +00:00
if ( ! ( vd - > flag & V3D_DISPBGPIC ) ) {
2007-08-14 05:01:39 +00:00
uiDefButBitS ( block , TOG , V3D_DISPBGPIC , B_REDR , " Use Background Image " , 10 , 180 , 150 , 20 , & vd - > flag , 0 , 0 , 0 , 0 , " Display an image in the background of this 3D View " ) ;
2006-12-20 17:57:56 +00:00
uiDefBut ( block , LABEL , 1 , " " , 160 , 180 , 150 , 20 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
}
else {
2004-01-24 05:06:12 +00:00
uiBlockBeginAlign ( block ) ;
2007-08-14 05:01:39 +00:00
uiDefButBitS ( block , TOG , V3D_DISPBGPIC , B_REDR , " Use " , 10 , 225 , 50 , 20 , & vd - > flag , 0 , 0 , 0 , 0 , " Display an image in the background of this 3D View " ) ;
2006-12-20 17:57:56 +00:00
uiDefButF ( block , NUMSLI , B_REDR , " Blend: " , 60 , 225 , 150 , 20 , & vd - > bgpic - > blend , 0.0 , 1.0 , 0 , 0 , " Set the transparency of the background image " ) ;
uiDefButF ( block , NUM , B_REDR , " Size: " , 210 , 225 , 100 , 20 , & vd - > bgpic - > size , 0.1 , 250.0 * vd - > grid , 100 , 0 , " Set the size (width) of the background image " ) ;
2004-01-24 05:06:12 +00:00
2006-12-20 17:57:56 +00:00
uiDefButF ( block , NUM , B_REDR , " X Offset: " , 10 , 205 , 150 , 20 , & vd - > bgpic - > xof , - 250.0 * vd - > grid , 250.0 * vd - > grid , 10 , 2 , " Set the horizontal offset of the background image " ) ;
uiDefButF ( block , NUM , B_REDR , " Y Offset: " , 160 , 205 , 150 , 20 , & vd - > bgpic - > yof , - 250.0 * vd - > grid , 250.0 * vd - > grid , 10 , 2 , " Set the vertical offset of the background image " ) ;
2003-10-15 12:26:26 +00:00
2006-12-20 17:57:56 +00:00
uiblock_image_panel ( block , & vd - > bgpic - > ima , & vd - > bgpic - > iuser , B_REDR , B_REDR ) ;
2003-10-15 12:26:26 +00:00
}
2003-10-25 22:03:19 +00:00
}
2004-06-29 20:34:10 +00:00
static void view3d_panel_properties ( short cntrl ) // VIEW3D_HANDLER_SETTINGS
2003-10-25 22:03:19 +00:00
{
uiBlock * block ;
View3D * vd ;
2004-07-28 13:21:27 +00:00
float * curs ;
2003-10-25 22:03:19 +00:00
vd = G . vd ;
block = uiNewBlock ( & curarea - > uiblocks , " view3d_panel_properties " , UI_EMBOSS , UI_HELV , curarea - > win ) ;
uiPanelControl ( UI_PNL_SOLID | UI_PNL_CLOSE | cntrl ) ;
uiSetPanelHandler ( VIEW3D_HANDLER_PROPERTIES ) ; // for close and esc
2006-01-11 14:44:23 +00:00
if ( uiNewPanel ( curarea , block , " View Properties " , " View3d " , 340 , 30 , 318 , 254 ) = = 0 ) return ;
/* to force height */
2006-11-07 15:47:10 +00:00
uiNewPanelHeight ( block , 264 ) ;
2003-10-25 22:03:19 +00:00
2004-10-03 20:02:22 +00:00
if ( G . f & ( G_VERTEXPAINT | G_FACESELECT | G_TEXTUREPAINT | G_WEIGHTPAINT ) ) {
uiBlockSetFlag ( block , UI_BLOCK_FRONTBUFFER ) ; // force old style frontbuffer draw
}
2006-01-11 14:44:23 +00:00
uiDefBut ( block , LABEL , 1 , " Grid: " , 10 , 220 , 150 , 19 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
2006-10-25 23:34:24 +00:00
uiBlockBeginAlign ( block ) ;
2006-01-11 14:44:23 +00:00
uiDefButF ( block , NUM , REDRAWVIEW3D , " Spacing: " , 10 , 200 , 140 , 19 , & vd - > grid , 0.001 , 100.0 , 10 , 0 , " Set the distance between grid lines " ) ;
2007-08-14 05:01:39 +00:00
uiDefButS ( block , NUM , REDRAWVIEW3D , " Lines: " , 10 , 180 , 140 , 19 , & vd - > gridlines , 0.0 , 100.0 , 100 , 0 , " Set the number of grid lines in perspective view " ) ;
2007-10-08 17:37:04 +00:00
uiDefButS ( block , NUM , REDRAWVIEW3D , " Divisions: " , 10 , 160 , 140 , 19 , & vd - > gridsubdiv , 1.0 , 100.0 , 100 , 0 , " Set the number of grid lines " ) ;
2006-10-25 23:34:24 +00:00
uiBlockEndAlign ( block ) ;
2004-07-29 02:25:10 +00:00
2006-01-11 14:44:23 +00:00
uiDefBut ( block , LABEL , 1 , " 3D Display: " , 160 , 220 , 150 , 19 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
uiDefButBitS ( block , TOG , V3D_SHOW_FLOOR , REDRAWVIEW3D , " Grid Floor " , 160 , 200 , 150 , 19 , & vd - > gridflag , 0 , 0 , 0 , 0 , " Show the grid floor in free camera mode " ) ;
uiDefButBitS ( block , TOG , V3D_SHOW_X , REDRAWVIEW3D , " X Axis " , 160 , 176 , 48 , 19 , & vd - > gridflag , 0 , 0 , 0 , 0 , " Show the X Axis line " ) ;
uiDefButBitS ( block , TOG , V3D_SHOW_Y , REDRAWVIEW3D , " Y Axis " , 212 , 176 , 48 , 19 , & vd - > gridflag , 0 , 0 , 0 , 0 , " Show the Y Axis line " ) ;
uiDefButBitS ( block , TOG , V3D_SHOW_Z , REDRAWVIEW3D , " Z Axis " , 262 , 176 , 48 , 19 , & vd - > gridflag , 0 , 0 , 0 , 0 , " Show the Z Axis line " ) ;
2004-01-24 05:06:12 +00:00
2006-10-25 23:34:24 +00:00
uiDefBut ( block , LABEL , 1 , " View Camera: " , 10 , 140 , 140 , 19 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
2003-10-15 12:26:26 +00:00
2006-10-25 23:34:24 +00:00
uiDefButF ( block , NUM , REDRAWVIEW3D , " Lens: " , 10 , 120 , 140 , 19 , & vd - > lens , 10.0 , 120.0 , 100 , 0 , " The lens angle in perspective view " ) ;
2004-07-29 02:25:10 +00:00
uiBlockBeginAlign ( block ) ;
2006-12-13 08:50:11 +00:00
uiDefButF ( block , NUM , REDRAWVIEW3D , " Clip Start: " , 10 , 96 , 140 , 19 , & vd - > near , vd - > grid / 100.0 , 100.0 , 10 , 0 , " Set the beginning of the range in which 3D objects are displayed (perspective view) " ) ;
uiDefButF ( block , NUM , REDRAWVIEW3D , " Clip End: " , 10 , 76 , 140 , 19 , & vd - > far , 1.0 , 10000.0 * vd - > grid , 100 , 0 , " Set the end of the range in which 3D objects are displayed (perspective view) " ) ;
2004-07-28 13:21:27 +00:00
uiBlockEndAlign ( block ) ;
2003-10-15 12:26:26 +00:00
2006-01-11 14:44:23 +00:00
uiDefBut ( block , LABEL , 1 , " 3D Cursor: " , 160 , 150 , 140 , 19 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
2004-07-28 13:21:27 +00:00
uiBlockBeginAlign ( block ) ;
curs = give_cursor ( ) ;
2006-12-13 08:50:11 +00:00
uiDefButF ( block , NUM , REDRAWVIEW3D , " X: " , 160 , 130 , 150 , 22 , curs , - 10000.0 * vd - > grid , 10000.0 * vd - > grid , 10 , 0 , " X co-ordinate of the 3D cursor " ) ;
uiDefButF ( block , NUM , REDRAWVIEW3D , " Y: " , 160 , 108 , 150 , 22 , curs + 1 , - 10000.0 * vd - > grid , 10000.0 * vd - > grid , 10 , 0 , " Y co-ordinate of the 3D cursor " ) ;
uiDefButF ( block , NUM , REDRAWVIEW3D , " Z: " , 160 , 86 , 150 , 22 , curs + 2 , - 10000.0 * vd - > grid , 10000.0 * vd - > grid , 10 , 0 , " Z co-ordinate of the 3D cursor " ) ;
2004-07-28 13:21:27 +00:00
uiBlockEndAlign ( block ) ;
2006-01-11 14:44:23 +00:00
uiDefBut ( block , LABEL , 1 , " Display: " , 10 , 50 , 150 , 19 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
2006-11-07 15:47:10 +00:00
uiBlockBeginAlign ( block ) ;
2006-01-11 14:44:23 +00:00
uiDefButBitS ( block , TOG , V3D_SELECT_OUTLINE , REDRAWVIEW3D , " Outline Selected " , 10 , 30 , 140 , 19 , & vd - > flag , 0 , 0 , 0 , 0 , " Highlight selected objects with an outline, in Solid, Shaded or Textured viewport shading modes " ) ;
2006-11-07 15:47:10 +00:00
uiDefButBitS ( block , TOG , V3D_DRAW_CENTERS , REDRAWVIEW3D , " All Object Centers " , 10 , 10 , 140 , 19 , & vd - > flag , 0 , 0 , 0 , 0 , " Draw the center points on all objects " ) ;
uiDefButBitS ( block , TOGN , V3D_HIDE_HELPLINES , REDRAWVIEW3D , " Relationship Lines " , 10 , - 10 , 140 , 19 , & vd - > flag , 0 , 0 , 0 , 0 , " Draw dashed lines indicating Parent, Constraint, or Hook relationships " ) ;
2007-09-15 18:12:16 +00:00
uiDefButBitS ( block , TOG , V3D_SOLID_TEX , REDRAWVIEW3D , " Solid Tex " , 10 , - 30 , 140 , 19 , & vd - > flag2 , 0 , 0 , 0 , 0 , " Display textures in Solid draw type (Shift T) " ) ;
2006-11-07 15:47:10 +00:00
uiBlockEndAlign ( block ) ;
2006-01-11 14:44:23 +00:00
2006-11-07 15:47:10 +00:00
uiDefBut ( block , LABEL , 1 , " View Locking: " , 160 , 50 , 150 , 19 , NULL , 0.0 , 0.0 , 0 , 0 , " " ) ;
uiBlockBeginAlign ( block ) ;
2007-08-14 05:01:39 +00:00
uiDefIDPoinBut ( block , test_obpoin_but , ID_OB , REDRAWVIEW3D , " Object: " , 160 , 30 , 140 , 19 , & vd - > ob_centre , " Lock view to center to this Object " ) ;
2006-11-07 15:47:10 +00:00
uiDefBut ( block , TEX , REDRAWVIEW3D , " Bone: " , 160 , 10 , 140 , 19 , vd - > ob_centre_bone , 1 , 31 , 0 , 0 , " If view locked to Object, use this Bone to lock to view to " ) ;
2003-10-15 12:26:26 +00:00
}
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
static void view3d_panel_preview ( ScrArea * sa , short cntrl ) // VIEW3D_HANDLER_PREVIEW
{
uiBlock * block ;
View3D * v3d = sa - > spacedata . first ;
int ofsx , ofsy ;
block = uiNewBlock ( & sa - > uiblocks , " view3d_panel_preview " , UI_EMBOSS , UI_HELV , sa - > win ) ;
uiPanelControl ( UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl ) ;
uiSetPanelHandler ( VIEW3D_HANDLER_PREVIEW ) ; // for close and esc
ofsx = - 150 + ( sa - > winx / 2 ) / v3d - > blockscale ;
ofsy = - 100 + ( sa - > winy / 2 ) / v3d - > blockscale ;
if ( uiNewPanel ( sa , block , " Preview " , " View3d " , ofsx , ofsy , 300 , 200 ) = = 0 ) return ;
uiBlockSetDrawExtraFunc ( block , BIF_view3d_previewdraw ) ;
if ( G . scene - > recalc & SCE_PRV_CHANGED ) {
G . scene - > recalc & = ~ SCE_PRV_CHANGED ;
//printf("found recalc\n");
New:
- ZTransp render now also delivers Z values and Speed vectors in passes
Note that speed vectors accumulate within a pixel to store the minimum,
so rendering ztransp on top of a non-moving plane won't give speed...
Best results you get is by rendering it in a separate layer.
The Z value stored is the closest visible transparent face in the pixel.
Fixes:
- Render to 'spare page' has been enabled again. Because of the strict
separation of Render and UI, but especially because a 'render result' now
can consist of unlimited images, I've not made this a Render feature.
Instead, the render-window itself stores the 'spare' image... I also
had to change the convention for it a bit.
Now, instead of having two "render buffers" (which was a render feature),
the RenderWindow will store each previous frame on a re-render. This
storing will only start after you've pressed 'Jkey' once, but then always
will happen for as long the rendered image is same size as previously.
For clarity, I've also renamed the window title, to 'previous frame'.
- RenderWindow shows alpha again on Akey
- Display of the Zvalues in ImageWindow has been tweaked. White now denotes
closest, and the color range goes from camera clip-sta to clip-end.
- Bugfix: on splitting/merging/duplicating windows, the 3D Previewrender was
not always freed correctly, potentially causing crashes or memory leaks.
2006-02-08 16:51:09 +00:00
BIF_view3d_previewrender_free ( sa - > spacedata . first ) ;
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
BIF_preview_changed ( 0 ) ;
}
}
2003-10-15 12:26:26 +00:00
static void view3d_blockhandlers ( ScrArea * sa )
{
View3D * v3d = sa - > spacedata . first ;
short a ;
2004-06-16 20:25:56 +00:00
/* warning; blocks need to be freed each time, handlers dont remove */
2003-10-16 00:17:24 +00:00
uiFreeBlocksWin ( & sa - > uiblocks , sa - > win ) ;
2006-05-02 07:55:26 +00:00
/*uv face-sel and wp mode when mixed with wire leave depth enabled causing
models to draw over the UI */
glDisable ( GL_DEPTH_TEST ) ;
2003-10-15 16:01:08 +00:00
for ( a = 0 ; a < SPACE_MAXHANDLER ; a + = 2 ) {
2003-10-15 12:26:26 +00:00
switch ( v3d - > blockhandler [ a ] ) {
2003-10-25 22:03:19 +00:00
case VIEW3D_HANDLER_PROPERTIES :
view3d_panel_properties ( v3d - > blockhandler [ a + 1 ] ) ;
2003-10-15 16:01:08 +00:00
break ;
2003-10-25 22:03:19 +00:00
case VIEW3D_HANDLER_BACKGROUND :
view3d_panel_background ( v3d - > blockhandler [ a + 1 ] ) ;
2003-10-15 12:26:26 +00:00
break ;
case VIEW3D_HANDLER_OBJECT :
2003-10-15 16:01:08 +00:00
view3d_panel_object ( v3d - > blockhandler [ a + 1 ] ) ;
2003-10-15 12:26:26 +00:00
break ;
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
case VIEW3D_HANDLER_PREVIEW :
view3d_panel_preview ( sa , v3d - > blockhandler [ a + 1 ] ) ;
2006-11-07 20:55:09 +00:00
break ;
=== Custom Transform Orientation ===
Custom Orientations can be added with Ctrl-Shift-C (hotkey suggestions are welcomed), this adds and select the new alignment. Custom Orientations can also be added, deleted, selected from the Transform Orientations panel (View -> Transform Orientations). Standard orientations (global, local, normal, view) can also be selected from this panel.
If you plan on using only a single custom orientation and don't really need a list, I suggest you use the hotkey as it adds and selects at the same time.
Custom Orientations are save in the scene and are selected per 3D view (like normal orientation).
Adding from an object, the orientation is a normalized version of the object's orientation.
Adding from mesh data, a single element (vertex, edge, face) must be selected in its respective selection mode. Vertex orientation Z-axis is based on the normal, edge Z-axis on the edge itself (X-axis is on the XoY plane when possible, Y-axis is perpendicular to the rest). Face orientation Z-axis is the face normal, X-axis is perpendicular to the first edge, Y-axis is perpendicular to the rest.
(More logical orientations can be suggested).
I plan to add: 2 vertice (connected or not) => edge orientation , 3 vertice = face orientation
Differences from the patch:
- orientations no longer link back to the object they came from, everything is copy on creation.
- orientations are overwritten based on name (if you add an orientation with the same name as one that already exists, it overwrites the old one)
2008-01-13 18:24:09 +00:00
case VIEW3D_HANDLER_TRANSFORM :
view3d_panel_transform_spaces ( v3d - > blockhandler [ a + 1 ] ) ;
break ;
2003-10-15 12:26:26 +00:00
}
2003-10-15 16:01:08 +00:00
/* clear action value for event */
v3d - > blockhandler [ a + 1 ] = 0 ;
2003-10-15 12:26:26 +00:00
}
uiDrawBlocksPanels ( sa , 0 ) ;
}
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
/* ****************** View3d afterdraw *************** */
typedef struct View3DAfter {
struct View3DAfter * next , * prev ;
struct Base * base ;
2008-05-06 15:31:17 +00:00
int type , flag ;
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
} View3DAfter ;
2005-07-13 19:42:08 +00:00
/* temp storage of Objects that need to be drawn as last */
2008-05-06 15:31:17 +00:00
void add_view3d_after ( View3D * v3d , Base * base , int type , int flag )
2005-07-13 19:42:08 +00:00
{
View3DAfter * v3da = MEM_callocN ( sizeof ( View3DAfter ) , " View 3d after " ) ;
2005-07-14 12:44:33 +00:00
2005-07-13 19:42:08 +00:00
BLI_addtail ( & v3d - > afterdraw , v3da ) ;
v3da - > base = base ;
v3da - > type = type ;
2008-05-06 15:31:17 +00:00
v3da - > flag = flag ;
2005-07-13 19:42:08 +00:00
}
/* clears zbuffer and draws it over */
2008-05-06 15:31:17 +00:00
static void view3d_draw_xray ( View3D * v3d )
2005-07-13 19:42:08 +00:00
{
View3DAfter * v3da , * next ;
int doit = 0 ;
2005-07-14 12:44:33 +00:00
for ( v3da = v3d - > afterdraw . first ; v3da ; v3da = v3da - > next )
2005-07-13 19:42:08 +00:00
if ( v3da - > type = = V3D_XRAY ) doit = 1 ;
if ( doit ) {
if ( v3d - > zbuf ) glClear ( GL_DEPTH_BUFFER_BIT ) ;
v3d - > xray = TRUE ;
2005-07-14 12:44:33 +00:00
for ( v3da = v3d - > afterdraw . first ; v3da ; v3da = next ) {
2005-07-13 19:42:08 +00:00
next = v3da - > next ;
if ( v3da - > type = = V3D_XRAY ) {
2008-05-06 15:31:17 +00:00
draw_object ( v3da - > base , v3da - > flag ) ;
2005-07-14 12:44:33 +00:00
BLI_remlink ( & v3d - > afterdraw , v3da ) ;
2005-07-13 19:42:08 +00:00
MEM_freeN ( v3da ) ;
}
}
v3d - > xray = FALSE ;
}
}
2005-07-14 12:44:33 +00:00
/* disables write in zbuffer and draws it over */
2008-05-06 15:31:17 +00:00
static void view3d_draw_transp ( View3D * v3d )
2005-07-14 12:44:33 +00:00
{
View3DAfter * v3da , * next ;
glDepthMask ( 0 ) ;
v3d - > transp = TRUE ;
for ( v3da = v3d - > afterdraw . first ; v3da ; v3da = next ) {
next = v3da - > next ;
if ( v3da - > type = = V3D_TRANSP ) {
2008-05-06 15:31:17 +00:00
draw_object ( v3da - > base , v3da - > flag ) ;
2005-07-14 12:44:33 +00:00
BLI_remlink ( & v3d - > afterdraw , v3da ) ;
MEM_freeN ( v3da ) ;
}
}
v3d - > transp = FALSE ;
glDepthMask ( 1 ) ;
}
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
/* *********************** */
2007-04-12 07:59:14 +00:00
/*
In most cases call draw_dupli_objects ,
draw_dupli_objects_color was added because when drawing set dupli ' s
we need to force the color
*/
static void draw_dupli_objects_color ( View3D * v3d , Base * base , int color )
{
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
ListBase * lb ;
DupliObject * dob ;
Base tbase ;
2006-11-29 12:44:48 +00:00
BoundBox * bb = NULL ;
GLuint displist = 0 ;
2006-12-10 20:30:15 +00:00
short transflag , use_displist = - 1 ; /* -1 is initialize */
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
char dt , dtx ;
2006-11-21 03:22:34 +00:00
if ( base - > object - > restrictflag & OB_RESTRICT_VIEW ) return ;
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
tbase . flag = OB_FROMDUPLI | base - > flag ;
lb = object_duplilist ( G . scene , base - > object ) ;
for ( dob = lb - > first ; dob ; dob = dob - > next ) {
2006-11-14 20:41:38 +00:00
if ( dob - > no_draw ) ;
else {
tbase . object = dob - > ob ;
/* extra service: draw the duplicator in drawtype of parent */
dt = tbase . object - > dt ; tbase . object - > dt = base - > object - > dt ;
dtx = tbase . object - > dtx ; tbase . object - > dtx = base - > object - > dtx ;
/* negative scale flag has to propagate */
transflag = tbase . object - > transflag ;
if ( base - > object - > transflag & OB_NEG_SCALE )
tbase . object - > transflag ^ = OB_NEG_SCALE ;
BIF_ThemeColorBlend ( color , TH_BACK , 0.5 ) ;
2006-11-29 12:44:48 +00:00
/* generate displist, test for new object */
if ( use_displist = = 1 & & dob - > prev & & dob - > prev - > ob ! = dob - > ob ) {
use_displist = - 1 ;
glDeleteLists ( displist , 1 ) ;
}
/* generate displist */
if ( use_displist = = - 1 ) {
2007-01-07 14:20:17 +00:00
/* lamp drawing messes with matrices, could be handled smarter... but this works */
2008-01-04 17:48:07 +00:00
if ( dob - > ob - > type = = OB_LAMP | | dob - > type = = OB_DUPLIGROUP )
2007-01-07 14:20:17 +00:00
use_displist = 0 ;
else {
/* disable boundbox check for list creation */
object_boundbox_flag ( dob - > ob , OB_BB_DISABLED , 1 ) ;
/* need this for next part of code */
bb = object_get_boundbox ( dob - > ob ) ;
Mat4One ( dob - > ob - > obmat ) ; /* obmat gets restored */
displist = glGenLists ( 1 ) ;
glNewList ( displist , GL_COMPILE ) ;
draw_object ( & tbase , DRAW_CONSTCOLOR ) ;
glEndList ( ) ;
use_displist = 1 ;
object_boundbox_flag ( dob - > ob , OB_BB_DISABLED , 0 ) ;
}
2006-11-29 12:44:48 +00:00
}
if ( use_displist ) {
mymultmatrix ( dob - > mat ) ;
if ( boundbox_clip ( dob - > mat , bb ) )
glCallList ( displist ) ;
myloadmatrix ( G . vd - > viewmat ) ;
}
else {
Mat4CpyMat4 ( dob - > ob - > obmat , dob - > mat ) ;
draw_object ( & tbase , DRAW_CONSTCOLOR ) ;
}
2006-11-14 20:41:38 +00:00
tbase . object - > dt = dt ;
tbase . object - > dtx = dtx ;
tbase . object - > transflag = transflag ;
}
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
}
2006-02-28 20:43:21 +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
/* Transp afterdraw disabled, afterdraw only stores base pointers, and duplis can be same obj */
2006-02-28 20:43:21 +00:00
free_object_duplilist ( lb ) ; /* does restore */
2006-11-29 12:44:48 +00:00
if ( use_displist )
glDeleteLists ( displist , 1 ) ;
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
}
2007-04-12 07:59:14 +00:00
static void draw_dupli_objects ( View3D * v3d , Base * base )
{
/* define the color here so draw_dupli_objects_color can be called
* from the set loop */
int color = ( base - > flag & SELECT ) ? TH_SELECT : TH_WIRE ;
/* debug */
if ( base - > object - > dup_group & & base - > object - > dup_group - > id . us < 1 )
color = TH_REDALERT ;
draw_dupli_objects_color ( v3d , base , color ) ;
}
2006-11-06 01:08:26 +00:00
void view3d_update_depths ( View3D * v3d )
{
/* Create storage for, and, if necessary, copy depth buffer */
if ( ! v3d - > depths ) v3d - > depths = MEM_callocN ( sizeof ( ViewDepths ) , " ViewDepths " ) ;
if ( v3d - > depths ) {
ViewDepths * d = v3d - > depths ;
if ( d - > w ! = v3d - > area - > winx | |
2007-01-06 19:46:33 +00:00
d - > h ! = v3d - > area - > winy | |
! d - > depths ) {
2006-11-06 01:08:26 +00:00
d - > w = v3d - > area - > winx ;
d - > h = v3d - > area - > winy ;
if ( d - > depths )
MEM_freeN ( d - > depths ) ;
d - > depths = MEM_mallocN ( sizeof ( float ) * d - > w * d - > h , " View depths " ) ;
d - > damaged = 1 ;
}
if ( d - > damaged ) {
glReadPixels ( v3d - > area - > winrct . xmin , v3d - > area - > winrct . ymin , d - > w , d - > h ,
GL_DEPTH_COMPONENT , GL_FLOAT , d - > depths ) ;
glGetDoublev ( GL_DEPTH_RANGE , d - > depth_range ) ;
d - > damaged = 0 ;
}
}
}
2007-12-08 21:53:17 +00:00
/* Enable sculpting in wireframe mode by drawing sculpt object only to the depth buffer */
static void draw_sculpt_depths ( View3D * v3d )
{
Object * ob = OBACT ;
int dt = MIN2 ( v3d - > drawtype , ob - > dt ) ;
if ( v3d - > zbuf = = 0 & & dt > OB_WIRE )
dt = OB_WIRE ;
if ( dt = = OB_WIRE ) {
GLboolean depth_on ;
int orig_vdt = v3d - > drawtype ;
int orig_zbuf = v3d - > zbuf ;
int orig_odt = ob - > dt ;
glGetBooleanv ( GL_DEPTH_TEST , & depth_on ) ;
v3d - > drawtype = ob - > dt = OB_SOLID ;
v3d - > zbuf = 1 ;
glColorMask ( GL_FALSE , GL_FALSE , GL_FALSE , GL_FALSE ) ;
glEnable ( GL_DEPTH_TEST ) ;
draw_object ( BASACT , 0 ) ;
glColorMask ( GL_TRUE , GL_TRUE , GL_TRUE , GL_TRUE ) ;
if ( ! depth_on )
glDisable ( GL_DEPTH_TEST ) ;
v3d - > drawtype = orig_vdt ;
v3d - > zbuf = orig_zbuf ;
ob - > dt = orig_odt ;
}
}
2008-03-20 20:03:13 +00:00
void draw_depth ( ScrArea * sa , void * spacedata )
{
View3D * v3d = spacedata ;
Base * base ;
Scene * sce ;
2008-03-21 17:13:35 +00:00
short zbuf , flag ;
2008-03-21 16:27:43 +00:00
float glalphaclip ;
2008-03-20 20:03:13 +00:00
/* temp set drawtype to solid */
2008-03-21 16:27:43 +00:00
/* Setting these temporarily is not nice */
2008-03-20 21:43:32 +00:00
zbuf = v3d - > zbuf ;
2008-03-21 16:27:43 +00:00
flag = v3d - > flag ;
glalphaclip = U . glalphaclip ;
2008-03-20 20:03:13 +00:00
2008-03-21 16:27:43 +00:00
U . glalphaclip = 0.5 ; /* not that nice but means we wont zoom into billboards */
v3d - > flag & = ~ V3D_SELECT_OUTLINE ;
2008-03-20 20:03:13 +00:00
setwinmatrixview3d ( sa - > winx , sa - > winy , NULL ) ; /* 0= no pick rect */
setviewmatrixview3d ( ) ; /* note: calls where_is_object for camera... */
Mat4MulMat4 ( v3d - > persmat , v3d - > viewmat , sa - > winmat ) ;
Mat4Invert ( v3d - > persinv , v3d - > persmat ) ;
Mat4Invert ( v3d - > viewinv , v3d - > viewmat ) ;
glClear ( GL_DEPTH_BUFFER_BIT ) ;
myloadmatrix ( v3d - > viewmat ) ;
persp ( PERSP_STORE ) ; // store correct view for persp(PERSP_VIEW) calls
if ( v3d - > flag & V3D_CLIPPING ) {
view3d_set_clipping ( v3d ) ;
}
v3d - > zbuf = TRUE ;
glEnable ( GL_DEPTH_TEST ) ;
/* draw set first */
if ( G . scene - > set ) {
for ( SETLOOPER ( G . scene - > set , base ) ) {
if ( v3d - > lay & base - > lay ) {
2008-03-20 21:43:32 +00:00
draw_object ( base , 0 ) ;
2008-03-20 20:03:13 +00:00
if ( base - > object - > transflag & OB_DUPLI ) {
draw_dupli_objects_color ( v3d , base , TH_WIRE ) ;
}
}
}
}
for ( base = G . scene - > base . first ; base ; base = base - > next ) {
if ( v3d - > lay & base - > lay ) {
/* dupli drawing */
if ( base - > object - > transflag & OB_DUPLI ) {
draw_dupli_objects ( v3d , base ) ;
}
draw_object ( base , 0 ) ;
}
}
2008-03-20 21:43:32 +00:00
/* this isnt that nice, draw xray objects as if they are normal */
if ( v3d - > afterdraw . first ) {
View3DAfter * v3da , * next ;
int num = 0 ;
v3d - > xray = TRUE ;
glDepthFunc ( GL_ALWAYS ) ; /* always write into the depth bufer, overwriting front z values */
for ( v3da = v3d - > afterdraw . first ; v3da ; v3da = next ) {
next = v3da - > next ;
if ( v3da - > type = = V3D_XRAY ) {
draw_object ( v3da - > base , 0 ) ;
num + + ;
}
/* dont remove this time */
}
v3d - > xray = FALSE ;
glDepthFunc ( GL_LEQUAL ) ; /* Now write the depth buffer normally */
for ( v3da = v3d - > afterdraw . first ; v3da ; v3da = next ) {
next = v3da - > next ;
if ( v3da - > type = = V3D_XRAY ) {
v3d - > xray = TRUE ; v3d - > transp = FALSE ;
} else if ( v3da - > type = = V3D_TRANSP ) {
v3d - > xray = FALSE ; v3d - > transp = TRUE ;
}
draw_object ( v3da - > base , 0 ) ; /* Draw Xray or Transp objects normally */
BLI_remlink ( & v3d - > afterdraw , v3da ) ;
MEM_freeN ( v3da ) ;
}
v3d - > xray = FALSE ;
v3d - > transp = FALSE ;
}
v3d - > zbuf = zbuf ;
2008-03-21 16:27:43 +00:00
U . glalphaclip = glalphaclip ;
v3d - > flag = flag ;
2008-03-20 20:03:13 +00:00
}
2007-12-11 14:19:05 +00:00
static void draw_viewport_fps ( ScrArea * sa ) ;
2007-12-11 23:05:10 +00:00
2003-03-24 01:46:05 +00:00
void drawview3dspace ( ScrArea * sa , void * spacedata )
2002-10-12 11:37:38 +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
View3D * v3d = spacedata ;
2002-10-12 11:37:38 +00:00
Base * base ;
Object * ob ;
2006-05-15 10:46:04 +00:00
Scene * sce ;
2008-03-13 10:27:35 +00:00
char retopo , sculptparticle ;
2007-01-09 03:00:58 +00:00
Object * obact = OBACT ;
2002-10-12 11:37:38 +00:00
2006-05-23 14:57:40 +00:00
/* update all objects, ipos, matrices, displists, etc. Flags set by depgraph or manual,
no layer check here , gets correct flushed */
2007-01-31 10:59:39 +00:00
/* sets first, we allow per definition current scene to have dependencies on sets */
if ( G . scene - > set ) {
for ( SETLOOPER ( G . scene - > set , base ) )
object_handle_update ( base - > object ) ; // bke_object.h
2006-05-23 14:57:40 +00:00
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
2007-01-31 10:59:39 +00:00
for ( base = G . scene - > base . first ; base ; base = base - > next )
object_handle_update ( base - > object ) ; // bke_object.h
2006-05-23 14:57:40 +00:00
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
setwinmatrixview3d ( sa - > winx , sa - > winy , NULL ) ; /* 0= no pick rect */
2005-07-26 09:21:20 +00:00
setviewmatrixview3d ( ) ; /* note: calls where_is_object for camera... */
2002-10-12 11:37:38 +00:00
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
Mat4MulMat4 ( v3d - > persmat , v3d - > viewmat , sa - > winmat ) ;
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
Mat4Invert ( v3d - > persinv , v3d - > persmat ) ;
Mat4Invert ( v3d - > viewinv , v3d - > viewmat ) ;
2002-10-12 11:37:38 +00:00
2005-11-19 10:55:07 +00:00
/* calculate pixelsize factor once, is used for lamps and obcenters */
{
float len1 , len2 , vec [ 3 ] ;
VECCOPY ( vec , v3d - > persinv [ 0 ] ) ;
2007-04-04 13:18:41 +00:00
len1 = Normalize ( vec ) ;
2005-11-19 10:55:07 +00:00
VECCOPY ( vec , v3d - > persinv [ 1 ] ) ;
2007-04-04 13:18:41 +00:00
len2 = Normalize ( vec ) ;
2005-11-19 10:55:07 +00:00
v3d - > pixsize = 2.0f * ( len1 > len2 ? len1 : len2 ) ;
/* correct for window size */
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
if ( sa - > winx > sa - > winy ) v3d - > pixsize / = ( float ) sa - > winx ;
2005-11-19 10:55:07 +00:00
else v3d - > pixsize / = ( float ) sa - > winy ;
}
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 ( v3d - > drawtype > OB_WIRE ) {
2005-08-20 19:18:35 +00:00
if ( G . f & G_SIMULATION )
2002-10-12 11:37:38 +00:00
glClearColor ( 0.0 , 0.0 , 0.0 , 0.0 ) ;
else {
- 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 col [ 3 ] ;
2003-10-19 09:19:58 +00:00
BIF_GetThemeColor3fv ( TH_BACK , col ) ;
- 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
glClearColor ( col [ 0 ] , col [ 1 ] , col [ 2 ] , 0.0 ) ;
2002-10-12 11:37:38 +00:00
}
2008-02-26 18:30:41 +00:00
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
2002-10-12 11:37:38 +00:00
glLoadIdentity ( ) ;
}
else {
- 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 col [ 3 ] ;
2003-10-19 09:19:58 +00:00
BIF_GetThemeColor3fv ( TH_BACK , col ) ;
- 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
glClearColor ( col [ 0 ] , col [ 1 ] , col [ 2 ] , 0.0 ) ;
2008-02-26 18:30:41 +00:00
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
2002-10-12 11:37:38 +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
myloadmatrix ( v3d - > viewmat ) ;
2003-10-16 09:39:19 +00:00
persp ( PERSP_STORE ) ; // store correct view for persp(PERSP_VIEW) calls
2002-10-12 11:37:38 +00:00
2005-08-20 19:18:35 +00:00
if ( v3d - > flag & V3D_CLIPPING )
view3d_draw_clipping ( v3d ) ;
/* set zbuffer after we draw clipping region */
if ( v3d - > drawtype > OB_WIRE ) {
v3d - > zbuf = TRUE ;
glEnable ( GL_DEPTH_TEST ) ;
}
2005-03-23 21:08:15 +00:00
// needs to be done always, gridview is adjusted in drawgrid() now
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
v3d - > gridview = v3d - > grid ;
2005-03-23 21:08:15 +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 ( v3d - > view = = 0 | | v3d - > persp ! = 0 ) {
2003-10-19 09:19:58 +00:00
drawfloor ( ) ;
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 ( v3d - > persp = = 2 ) {
2002-10-12 11:37:38 +00:00
if ( G . scene - > world ) {
2005-06-06 10:35:50 +00:00
if ( G . scene - > world - > mode & WO_STARS ) {
2006-06-13 20:00:14 +00:00
RE_make_stars ( NULL , star_stuff_init_func , star_stuff_vertex_func ,
star_stuff_term_func ) ;
2005-06-06 10:35:50 +00:00
}
2002-10-12 11:37:38 +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 ( v3d - > flag & V3D_DISPBGPIC ) draw_bgpic ( ) ;
2002-10-12 11:37:38 +00:00
}
}
else {
2003-10-19 09:19:58 +00:00
drawgrid ( ) ;
2002-10-12 11:37:38 +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 ( v3d - > flag & V3D_DISPBGPIC ) {
2002-10-12 11:37:38 +00:00
draw_bgpic ( ) ;
}
}
2005-08-20 19:18:35 +00:00
if ( v3d - > flag & V3D_CLIPPING )
view3d_set_clipping ( v3d ) ;
2003-04-28 14:43:20 +00:00
/* draw set first */
2006-05-15 10:46:04 +00:00
if ( G . scene - > set ) {
for ( SETLOOPER ( G . scene - > set , 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 ( v3d - > lay & base - > lay ) {
2005-11-20 13:43:08 +00:00
BIF_ThemeColorBlend ( TH_WIRE , TH_BACK , 0.6f ) ;
2005-11-28 16:59:12 +00:00
draw_object ( base , DRAW_CONSTCOLOR ) ;
2002-10-12 11:37:38 +00:00
if ( base - > object - > transflag & OB_DUPLI ) {
2007-04-12 07:59:14 +00:00
draw_dupli_objects_color ( v3d , base , TH_WIRE ) ;
2002-10-12 11:37:38 +00:00
}
}
}
2005-11-03 18:43:05 +00:00
2008-05-06 15:31:17 +00:00
/* Transp and X-ray afterdraw stuff for sets is done later */
2002-10-12 11:37:38 +00:00
}
2005-01-08 13:15:43 +00:00
/* then draw not selected and the duplis, but skip editmode object */
2005-07-25 21:38:13 +00:00
for ( base = G . scene - > base . first ; base ; base = base - > next ) {
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 ( v3d - > lay & base - > lay ) {
2002-10-12 11:37:38 +00:00
2005-09-24 09:05:48 +00:00
/* dupli drawing */
2005-07-25 21:38:13 +00:00
if ( base - > object - > transflag & OB_DUPLI ) {
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
draw_dupli_objects ( v3d , base ) ;
2002-10-12 11:37:38 +00:00
}
2005-11-21 11:30:53 +00:00
if ( ( base - > flag & SELECT ) = = 0 ) {
2005-11-28 16:59:12 +00:00
if ( base - > object ! = G . obedit ) draw_object ( base , 0 ) ;
2002-10-12 11:37:38 +00:00
}
}
}
2006-11-06 01:08:26 +00:00
2007-01-06 19:46:33 +00:00
retopo = retopo_mesh_check ( ) | | retopo_curve_check ( ) ;
2008-03-13 10:27:35 +00:00
sculptparticle = ( G . f & ( G_SCULPTMODE | G_PARTICLEEDIT ) ) & & ! G . obedit ;
2007-01-06 19:46:33 +00:00
if ( retopo )
2006-11-06 01:08:26 +00:00
view3d_update_depths ( v3d ) ;
2005-01-08 13:15:43 +00:00
/* draw selected and editmode */
2005-07-25 21:38:13 +00:00
for ( base = G . scene - > base . first ; base ; base = base - > next ) {
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 ( v3d - > lay & base - > lay ) {
2005-02-08 16:25:20 +00:00
if ( base - > object = = G . obedit | | ( base - > flag & SELECT ) )
2005-11-28 16:59:12 +00:00
draw_object ( base , 0 ) ;
2002-10-12 11:37:38 +00:00
}
}
2008-03-13 10:27:35 +00:00
if ( ! retopo & & sculptparticle & & ! ( obact & & ( obact - > dtx & OB_DRAWXRAY ) ) ) {
if ( G . f & G_SCULPTMODE )
draw_sculpt_depths ( v3d ) ;
2007-01-06 19:46:33 +00:00
view3d_update_depths ( v3d ) ;
2007-12-08 21:53:17 +00:00
}
2007-01-06 19:46:33 +00:00
2005-02-14 02:53:36 +00:00
if ( G . moving ) {
2005-02-20 01:25:10 +00:00
BIF_drawConstraint ( ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
if ( G . obedit | | ( G . f & G_PARTICLEEDIT ) )
BIF_drawPropCircle ( ) ; // only editmode and particles have proportional edit
2006-12-19 22:25:07 +00:00
BIF_drawSnap ( ) ;
2005-02-14 02:53:36 +00:00
}
2002-10-12 11:37:38 +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 . scene - > radio ) RAD_drawall ( v3d - > drawtype > = OB_SOLID ) ;
2002-10-12 11:37:38 +00:00
2005-07-14 12:44:33 +00:00
/* Transp and X-ray afterdraw stuff */
2008-05-06 15:31:17 +00:00
view3d_draw_xray ( v3d ) ; // clears zbuffer if it is used!
view3d_draw_transp ( v3d ) ;
2007-12-08 21:53:17 +00:00
2008-03-13 10:27:35 +00:00
if ( ! retopo & & sculptparticle & & ( obact & & ( OBACT - > dtx & OB_DRAWXRAY ) ) ) {
if ( G . f & G_SCULPTMODE )
draw_sculpt_depths ( v3d ) ;
2006-12-04 02:36:04 +00:00
view3d_update_depths ( v3d ) ;
2007-12-08 21:53:17 +00:00
}
2006-12-04 02:36:04 +00:00
2005-08-20 19:18:35 +00:00
if ( v3d - > flag & V3D_CLIPPING )
view3d_clr_clipping ( ) ;
So! Finally a show-off of the *power* of Martin P's work! :)
- Made framework for 3d Transform Manipulators (widgets)
- The Manipulators act like '2d buttons', by default with LeftMouse and with
while-hold-move-release
- Implemented now: Translation Widget, which allows:
- four hotspots for axis grab or view-aligned grab
- center defined by 'around' setting
- SHIFT+LMB gives planar constraint on other 2 axes
- works in Object mode and Edit mode (not posemode yet)
Enable it with (temporal) icon in 3D header. All other 'normal' transforms
then keeps working btw.
On the todo for this widget:
- choice for Global, Local or Normal orientation
The way the widgets are going to work is in review still. Commit is also for
Matt for his proposal/paper on topic.
Some notes regarding this project;
- no life updates (on mouse over) like 3DS, I think that's neurotic
- on click, dominant axis changes to theme defined "Transform" color, other axes disappear, like maya
- manipulater size is fixed preset, independent zoom.
- manipulator follows selection, and is located based on 'around' mode
Unresolved;
- in maya, when you select 2 or more objects, the manipulator draws on the 'active' object, also interesting
- what to do with G,R,S hotkeys? It could switch the manipulator "mode"...
- header button/menu for manipulator mode?
2005-03-17 21:31:49 +00:00
BIF_draw_manipulator ( sa ) ;
2005-07-14 12:44:33 +00:00
if ( v3d - > zbuf ) {
v3d - > zbuf = FALSE ;
2003-10-04 20:35:50 +00:00
glDisable ( GL_DEPTH_TEST ) ;
}
2003-10-16 09:39:19 +00:00
persp ( PERSP_WIN ) ; // set ortho
2006-11-06 01:08:26 +00:00
/* Draw Sculpt Mode brush */
2006-12-25 23:52:17 +00:00
if ( ! G . obedit & & ( G . f & G_SCULPTMODE ) & & area_is_active_area ( v3d - > area ) & & sculpt_session ( ) ) {
2008-01-16 07:19:21 +00:00
RadialControl * rc = sculpt_session ( ) - > radialcontrol ;
2007-06-24 22:28:28 +00:00
if ( sculpt_data ( ) - > flags & SCULPT_INPUT_SMOOTH )
sculpt_stroke_draw ( ) ;
2008-01-16 07:19:21 +00:00
if ( rc )
radialcontrol_draw ( rc ) ;
2007-06-24 23:02:58 +00:00
else if ( sculpt_data ( ) - > flags & SCULPT_DRAW_BRUSH ) {
2007-01-16 07:35:42 +00:00
short csc [ 2 ] , car [ 2 ] ;
getmouseco_sc ( csc ) ;
getmouseco_areawin ( car ) ;
if ( csc [ 0 ] > v3d - > area - > winrct . xmin & &
csc [ 1 ] > v3d - > area - > winrct . ymin & &
csc [ 0 ] < v3d - > area - > winrct . xmax & &
csc [ 1 ] < v3d - > area - > winrct . ymax )
fdrawXORcirc ( ( float ) car [ 0 ] , ( float ) car [ 1 ] , sculptmode_brush ( ) - > size ) ;
2006-11-06 01:08:26 +00:00
}
}
2007-12-18 21:56:17 +00:00
retopo_paint_view_update ( v3d ) ;
2006-11-06 01:08:26 +00:00
retopo_draw_paint_lines ( ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
if ( ! G . obedit & & OBACT & & G . f & G_PARTICLEEDIT & & area_is_active_area ( v3d - > area ) ) {
ParticleSystem * psys = PE_get_current ( OBACT ) ;
ParticleEditSettings * pset = PE_settings ( ) ;
short c [ 2 ] ;
2008-01-16 07:19:21 +00:00
if ( * PE_radialcontrol ( ) )
radialcontrol_draw ( * PE_radialcontrol ( ) ) ;
else if ( psys & & psys - > edit & & pset - > brushtype > = 0 ) {
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
getmouseco_areawin ( c ) ;
fdrawXORcirc ( ( float ) c [ 0 ] , ( float ) c [ 1 ] , ( float ) pset - > brush [ pset - > brushtype ] . size ) ;
}
}
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 ( v3d - > persp > 1 ) drawviewborder ( ) ;
2006-06-08 18:10:41 +00:00
if ( v3d - > flag2 & V3D_FLYMODE ) drawviewborder_flymode ( ) ;
2005-09-23 07:28:15 +00:00
if ( ! ( G . f & G_PLAYANIM ) ) drawcursor ( v3d ) ;
2006-04-25 12:26:46 +00:00
if ( U . uiflag & USER_SHOW_ROTVIEWICON )
draw_view_axis ( ) ;
else
draw_view_icon ( ) ;
2007-12-11 14:19:05 +00:00
if ( U . uiflag & USER_SHOW_FPS & & G . f & G_PLAYANIM ) {
draw_viewport_fps ( sa ) ;
} else if ( U . uiflag & USER_SHOW_VIEWPORTNAME ) {
2006-04-25 12:26:46 +00:00
draw_viewport_name ( sa ) ;
2007-12-11 14:19:05 +00:00
}
2003-04-28 11:17:21 +00:00
ob = OBACT ;
2005-07-27 10:37:20 +00:00
if ( ob & & ( U . uiflag & USER_DRAWVIEWINFO ) )
draw_selected_name ( ob ) ;
2002-10-12 11:37:38 +00:00
2003-10-04 20:35:50 +00:00
draw_area_emboss ( sa ) ;
2003-10-15 12:26:26 +00:00
/* it is important to end a view in a transform compatible with buttons */
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
bwin_scalematrix ( sa - > win , v3d - > blockscale , v3d - > blockscale , v3d - > blockscale ) ;
2003-10-15 12:26:26 +00:00
view3d_blockhandlers ( sa ) ;
2002-10-12 11:37:38 +00:00
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
sa - > win_swap = WIN_BACK_OK ;
2002-10-12 11:37:38 +00:00
2007-09-10 19:32:44 +00:00
if ( G . f & G_VERTEXPAINT | | G . f & G_WEIGHTPAINT | | G . f & G_TEXTUREPAINT ) {
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
v3d - > flag | = V3D_NEEDBACKBUFDRAW ;
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
addafterqueue ( sa - > win , BACKBUFDRAW , 1 ) ;
2002-10-12 11:37:38 +00:00
}
2004-09-28 09:43:37 +00:00
// test for backbuf select
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 . obedit & & v3d - > drawtype > OB_WIRE & & ( v3d - > flag & V3D_ZBUF_SELECT ) ) {
2004-09-29 18:08:04 +00:00
extern int afterqtest ( short win , unsigned short evt ) ; //editscreen.c
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
v3d - > flag | = V3D_NEEDBACKBUFDRAW ;
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
if ( afterqtest ( sa - > win , BACKBUFDRAW ) = = 0 ) {
addafterqueue ( sa - > win , BACKBUFDRAW , 1 ) ;
2004-09-29 18:08:04 +00:00
}
2004-09-28 09:43:37 +00:00
}
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
/* run any view3d draw handler script links */
if ( sa - > scriptlink . totscript )
BPY_do_spacehandlers ( sa , 0 , SPACEHANDLER_VIEW3D_DRAW ) ;
- Blender: added option 'scriptsdir' to Blender.Get();
- small updates to the docs;
- Object: small fix to getMatrix: check during_script() to avoid undesired loops; added old behavior (pre 2.34) as option: .getMatrix('oldlocal');
- tentative fix for bug #1275: scene REDRAW scriptlinks were not being executed (the call to do so was missing):
http://projects.blender.org/tracker/index.php?func=detail&aid=1275&group_id=9&atid=125
added the call in drawview.c, in drawview3dspace(). This causes the scriptlink to be called for each visible view3d, but that's what happens with object redraw scriptlinks, too. Anyway, this is still a test. The place was chosen based on the idea that a scene redraw scriptlink is like an object redraw one, but for all objs in the scene at once.
- Window.Theme: new submodule, to get/set theme options in Blender;
- Added the script save_theme.py (Help menu for now), to save the current theme in Blender as an executable script (currently shown in the Scripts->Misc menu).
There's more work to do for themes, like defining a proper place for them in the interface, adding documentation (for now the added script and the ones it generates can give a pretty good idea of how to use the new module), probably extending themes to support SpaceScript and so on.
2004-09-21 05:28:17 +00:00
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
/* run scene redraw script links */
if ( ( G . f & G_DOSCRIPTLINKS ) & & G . scene - > scriptlink . totscript & &
! during_script ( ) ) {
- Blender: added option 'scriptsdir' to Blender.Get();
- small updates to the docs;
- Object: small fix to getMatrix: check during_script() to avoid undesired loops; added old behavior (pre 2.34) as option: .getMatrix('oldlocal');
- tentative fix for bug #1275: scene REDRAW scriptlinks were not being executed (the call to do so was missing):
http://projects.blender.org/tracker/index.php?func=detail&aid=1275&group_id=9&atid=125
added the call in drawview.c, in drawview3dspace(). This causes the scriptlink to be called for each visible view3d, but that's what happens with object redraw scriptlinks, too. Anyway, this is still a test. The place was chosen based on the idea that a scene redraw scriptlink is like an object redraw one, but for all objs in the scene at once.
- Window.Theme: new submodule, to get/set theme options in Blender;
- Added the script save_theme.py (Help menu for now), to save the current theme in Blender as an executable script (currently shown in the Scripts->Misc menu).
There's more work to do for themes, like defining a proper place for them in the interface, adding documentation (for now the added script and the ones it generates can give a pretty good idea of how to use the new module), probably extending themes to support SpaceScript and so on.
2004-09-21 05:28:17 +00:00
BPY_do_pyscript ( ( ID * ) G . scene , SCRIPT_REDRAW ) ;
}
2007-01-25 22:47:47 +00:00
2002-10-12 11:37:38 +00:00
}
2007-12-01 19:29:50 +00:00
void drawview3d_render ( struct View3D * v3d , int winx , int winy , float winmat [ ] [ 4 ] )
2002-10-12 11:37:38 +00:00
{
Base * base ;
2006-05-15 10:46:04 +00:00
Scene * sce ;
2007-12-01 19:29:50 +00:00
float v3dwinmat [ 4 ] [ 4 ] ;
2002-10-12 11:37:38 +00:00
2007-12-02 14:48:24 +00:00
if ( ! winmat )
setwinmatrixview3d ( winx , winy , NULL ) ;
2002-10-12 11:37:38 +00:00
setviewmatrixview3d ( ) ;
2004-09-29 10:49:19 +00:00
myloadmatrix ( v3d - > viewmat ) ;
2007-12-01 19:29:50 +00:00
/* when winmat is not NULL, it overrides the regular window matrix */
2006-01-24 17:07:39 +00:00
glMatrixMode ( GL_PROJECTION ) ;
2007-12-01 19:29:50 +00:00
if ( winmat )
myloadmatrix ( winmat ) ;
mygetmatrix ( v3dwinmat ) ;
2006-01-24 17:07:39 +00:00
glMatrixMode ( GL_MODELVIEW ) ;
2007-12-01 19:29:50 +00:00
Mat4MulMat4 ( v3d - > persmat , v3d - > viewmat , v3dwinmat ) ;
2006-01-24 17:07:39 +00:00
Mat4Invert ( v3d - > persinv , v3d - > persmat ) ;
Mat4Invert ( v3d - > viewinv , v3d - > viewmat ) ;
2002-10-12 11:37:38 +00:00
2005-11-21 15:59:01 +00:00
free_all_realtime_images ( ) ;
reshadeall_displist ( ) ;
2002-10-12 11:37:38 +00:00
if ( v3d - > drawtype > OB_WIRE ) {
2005-07-14 12:44:33 +00:00
v3d - > zbuf = TRUE ;
2002-10-12 11:37:38 +00:00
glEnable ( GL_DEPTH_TEST ) ;
}
2005-08-20 19:18:35 +00:00
if ( v3d - > flag & V3D_CLIPPING )
view3d_set_clipping ( v3d ) ;
2002-10-12 11:37:38 +00:00
if ( v3d - > drawtype = = OB_TEXTURE & & G . scene - > world ) {
glClearColor ( G . scene - > world - > horr , G . scene - > world - > horg , G . scene - > world - > horb , 0.0 ) ;
} else {
2003-11-08 23:18:32 +00:00
float col [ 3 ] ;
BIF_GetThemeColor3fv ( TH_BACK , col ) ;
glClearColor ( col [ 0 ] , col [ 1 ] , col [ 2 ] , 0.0 ) ;
2002-10-12 11:37:38 +00:00
}
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
2002-10-12 11:37:38 +00:00
/* abuse! to make sure it doesnt draw the helpstuff */
G . f | = G_SIMULATION ;
2004-10-28 21:50:32 +00:00
/* first draw set */
2006-05-15 10:46:04 +00:00
if ( G . scene - > set ) {
2002-10-12 11:37:38 +00:00
2006-05-15 10:46:04 +00:00
for ( SETLOOPER ( G . scene - > set , base ) ) {
2002-10-12 11:37:38 +00:00
if ( v3d - > lay & base - > lay ) {
if ELEM3 ( base - > object - > type , OB_LAMP , OB_CAMERA , OB_LATTICE ) ;
else {
where_is_object ( base - > object ) ;
2005-11-20 13:43:08 +00:00
BIF_ThemeColorBlend ( TH_WIRE , TH_BACK , 0.6f ) ;
2005-11-28 16:59:12 +00:00
draw_object ( base , DRAW_CONSTCOLOR ) ;
2002-10-12 11:37:38 +00:00
if ( base - > object - > transflag & OB_DUPLI ) {
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
draw_dupli_objects ( v3d , base ) ;
2002-10-12 11:37:38 +00:00
}
}
}
}
2008-05-06 15:31:17 +00:00
/* Transp and X-ray afterdraw stuff for sets is done later */
2002-10-12 11:37:38 +00:00
}
2004-01-27 06:08:37 +00:00
2003-04-28 14:43:20 +00:00
/* first not selected and duplis */
2002-10-12 11:37:38 +00:00
base = G . scene - > base . first ;
while ( base ) {
if ( v3d - > lay & base - > lay ) {
if ELEM3 ( base - > object - > type , OB_LAMP , OB_CAMERA , OB_LATTICE ) ;
else {
if ( base - > object - > transflag & OB_DUPLI ) {
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
draw_dupli_objects ( v3d , base ) ;
2002-10-12 11:37:38 +00:00
}
else if ( ( base - > flag & SELECT ) = = 0 ) {
2005-11-28 16:59:12 +00:00
draw_object ( base , 0 ) ;
2002-10-12 11:37:38 +00:00
}
}
}
base = base - > next ;
}
2003-04-28 14:43:20 +00:00
/* draw selected */
2002-10-12 11:37:38 +00:00
base = G . scene - > base . first ;
while ( base ) {
if ( ( ( base ) - > flag & SELECT ) & & ( ( base ) - > lay & v3d - > lay ) ) {
if ELEM3 ( base - > object - > type , OB_LAMP , OB_CAMERA , OB_LATTICE ) ;
2005-11-28 16:59:12 +00:00
else draw_object ( base , 0 ) ;
2002-10-12 11:37:38 +00:00
}
base = base - > next ;
}
2005-07-14 12:44:33 +00:00
if ( G . scene - > radio ) RAD_drawall ( v3d - > drawtype > = OB_SOLID ) ;
2004-09-29 10:49:19 +00:00
2005-07-14 12:44:33 +00:00
/* Transp and X-ray afterdraw stuff */
2008-05-06 15:31:17 +00:00
view3d_draw_xray ( v3d ) ; // clears zbuffer if it is used!
view3d_draw_transp ( v3d ) ;
2005-07-13 19:42:08 +00:00
2005-08-20 19:18:35 +00:00
if ( v3d - > flag & V3D_CLIPPING )
view3d_clr_clipping ( ) ;
2005-07-14 12:44:33 +00:00
if ( v3d - > zbuf ) {
v3d - > zbuf = FALSE ;
2002-10-12 11:37:38 +00:00
glDisable ( GL_DEPTH_TEST ) ;
}
G . f & = ~ G_SIMULATION ;
2004-06-16 11:34:45 +00:00
glFlush ( ) ;
2002-10-12 11:37:38 +00:00
glLoadIdentity ( ) ;
free_all_realtime_images ( ) ;
}
double tottime = 0.0 ;
2007-10-01 08:03:11 +00:00
static ScrArea * oldsa ;
static double swaptime ;
static int curmode ;
2002-10-12 11:37:38 +00:00
2007-12-11 14:19:05 +00:00
/* used for fps display */
2008-05-01 14:51:06 +00:00
# define REDRAW_FRAME_AVERAGE 8
2007-12-11 14:19:05 +00:00
static double redrawtime ;
static double lredrawtime ;
2008-05-01 14:51:06 +00:00
static float redrawtimes_fps [ REDRAW_FRAME_AVERAGE ] ;
static short redrawtime_index ;
2007-12-11 14:19:05 +00:00
2008-05-12 17:16:54 +00:00
int update_time ( int cfra )
2002-10-12 11:37:38 +00:00
{
static double ltime ;
double time ;
2008-05-12 17:16:54 +00:00
if ( ( audiostream_pos ( ) ! = cfra )
2007-10-01 08:03:11 +00:00
& & ( G . scene - > audio . flag & AUDIO_SYNC ) ) {
return 0 ;
}
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
2002-10-12 11:37:38 +00:00
time = PIL_check_seconds_timer ( ) ;
tottime + = ( time - ltime ) ;
ltime = time ;
return ( tottime < 0.0 ) ;
}
2007-12-11 14:19:05 +00:00
static void draw_viewport_fps ( ScrArea * sa )
{
2007-12-11 15:35:39 +00:00
float fps ;
2007-12-11 14:19:05 +00:00
char printable [ 16 ] ;
2008-05-01 14:51:06 +00:00
int i , tot ;
2007-12-11 23:05:10 +00:00
2008-05-07 18:33:10 +00:00
if ( ! lredrawtime | | ! redrawtime )
2007-12-11 14:19:05 +00:00
return ;
2007-12-11 23:05:10 +00:00
printable [ 0 ] = ' \0 ' ;
2008-05-01 14:51:06 +00:00
#if 0
/* this is too simple, better do an average */
fps = ( float ) ( 1.0 / ( lredrawtime - redrawtime ) )
# else
redrawtimes_fps [ redrawtime_index ] = ( float ) ( 1.0 / ( lredrawtime - redrawtime ) ) ;
for ( i = 0 , tot = 0 , fps = 0.0f ; i < REDRAW_FRAME_AVERAGE ; i + + ) {
if ( redrawtimes_fps [ i ] ) {
fps + = redrawtimes_fps [ i ] ;
tot + + ;
}
}
2008-05-05 06:30:19 +00:00
if ( tot ) {
redrawtime_index + + ;
if ( redrawtime_index > = REDRAW_FRAME_AVERAGE )
redrawtime_index = 0 ;
fps = fps / tot ;
}
2008-05-01 14:51:06 +00:00
# endif
2007-12-11 14:19:05 +00:00
/* is this more then half a frame behind? */
if ( fps + 0.5 < FPS ) {
BIF_ThemeColor ( TH_REDALERT ) ;
sprintf ( printable , " fps: %.2f " , ( float ) fps ) ;
} else {
BIF_ThemeColor ( TH_TEXT_HI ) ;
sprintf ( printable , " fps: %i " , ( int ) ( fps + 0.5 ) ) ;
}
glRasterPos2i ( 10 , sa - > winy - 20 ) ;
BMF_DrawString ( G . fonts , printable ) ;
}
2007-10-01 08:03:11 +00:00
static void inner_play_prefetch_frame ( int mode , int cfra )
2002-10-12 11:37:38 +00:00
{
ScrArea * sa ;
2007-10-01 08:03:11 +00:00
int oldcfra = CFRA ;
ScrArea * oldcurarea = curarea ;
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
2007-10-01 08:03:11 +00:00
if ( ! U . prefetchframes ) {
2002-10-12 11:37:38 +00:00
return ;
}
2007-10-01 08:03:11 +00:00
CFRA = cfra ;
2004-12-15 11:36:46 +00:00
2002-10-12 11:37:38 +00:00
sa = G . curscreen - > areabase . first ;
while ( sa ) {
if ( sa = = oldsa ) {
2007-10-01 08:03:11 +00:00
scrarea_do_winprefetchdraw ( sa ) ;
2002-10-12 11:37:38 +00:00
}
2007-10-01 08:03:11 +00:00
else if ( mode & 1 ) { /* all view3d and seq spaces */
2002-10-12 11:37:38 +00:00
if ELEM ( sa - > spacetype , SPACE_VIEW3D , SPACE_SEQ ) {
2007-10-01 08:03:11 +00:00
scrarea_do_winprefetchdraw ( sa ) ;
2002-10-12 11:37:38 +00:00
}
}
2007-10-01 08:03:11 +00:00
else if ( mode & 4 ) { /* all seq spaces */
2006-11-13 17:31:39 +00:00
if ( sa - > spacetype = = SPACE_SEQ ) {
2007-10-01 08:03:11 +00:00
scrarea_do_winprefetchdraw ( sa ) ;
2006-11-13 17:31:39 +00:00
}
}
2002-10-12 11:37:38 +00:00
sa = sa - > next ;
}
2007-10-01 08:03:11 +00:00
CFRA = oldcfra ;
curarea = oldcurarea ;
}
static void inner_play_prefetch_startup ( int mode )
{
int i ;
if ( ! U . prefetchframes ) {
return ;
}
seq_start_threads ( ) ;
for ( i = 0 ; i < = U . prefetchframes ; i + + ) {
int cfra = CFRA + i ;
inner_play_prefetch_frame ( mode , cfra ) ;
}
seq_wait_for_prefetch_ready ( ) ;
}
static void inner_play_prefetch_shutdown ( int mode )
{
if ( ! U . prefetchframes ) {
return ;
}
seq_stop_threads ( ) ;
}
2007-11-29 21:09:16 +00:00
static int cached_dynamics ( int sfra , int efra )
{
Base * base = G . scene - > base . first ;
Object * ob ;
ParticleSystem * psys ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
int i , cached = 1 ;
PTCacheID pid ;
2007-11-29 21:09:16 +00:00
while ( base & & cached ) {
ob = base - > object ;
if ( ob - > softflag & OB_SB_ENABLE & & ob - > soft ) {
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
BKE_ptcache_id_from_softbody ( & pid , ob , ob - > soft ) ;
2007-11-29 21:09:16 +00:00
for ( i = sfra ; i < = efra & & cached ; i + + )
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
cached & = BKE_ptcache_id_exist ( & pid , i ) ;
2007-11-29 21:09:16 +00:00
}
for ( psys = ob - > particlesystem . first ; psys ; psys = psys - > next ) {
if ( psys - > part - > type = = PART_HAIR ) {
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
if ( psys - > softflag & OB_SB_ENABLE & & psys - > soft ) {
BKE_ptcache_id_from_softbody ( & pid , ob , psys - > soft ) ;
2007-11-29 21:09:16 +00:00
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
for ( i = sfra ; i < = efra & & cached ; i + + )
cached & = BKE_ptcache_id_exist ( & pid , i ) ;
}
}
2007-11-29 21:09:16 +00:00
}
base = base - > next ;
}
return cached ;
}
2007-10-01 08:03:11 +00:00
void inner_play_anim_loop ( int init , int mode )
{
ScrArea * sa ;
static int last_cfra = - 1 ;
2007-11-29 21:09:16 +00:00
static int cached = 0 ;
2007-10-01 08:03:11 +00:00
/* init */
if ( init ) {
oldsa = curarea ;
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
swaptime = 1.0 / FPS ;
2007-10-01 08:03:11 +00:00
tottime = 0.0 ;
curmode = mode ;
last_cfra = - 1 ;
2007-11-29 21:09:16 +00:00
cached = cached_dynamics ( PSFRA , PEFRA ) ;
2007-12-11 14:19:05 +00:00
2008-05-07 18:33:10 +00:00
redrawtime = 0.0 ;
2008-05-01 14:51:06 +00:00
redrawtime_index = REDRAW_FRAME_AVERAGE ;
while ( redrawtime_index - - ) {
redrawtimes_fps [ redrawtime_index ] = 0.0 ;
}
2008-05-05 06:30:19 +00:00
redrawtime_index = 0 ;
2007-12-11 14:19:05 +00:00
lredrawtime = 0.0 ;
2007-10-01 08:03:11 +00:00
return ;
}
if ( CFRA ! = last_cfra ) {
int pf ;
set_timecursor ( CFRA ) ;
2002-10-12 11:37:38 +00:00
2007-10-01 08:03:11 +00:00
update_for_newframe_nodraw ( 1 ) ; /* adds no events in UI */
sa = G . curscreen - > areabase . first ;
while ( sa ) {
if ( sa = = oldsa ) {
scrarea_do_windraw ( sa ) ;
}
else if ( curmode & 1 ) { /* all view3d and seq spaces */
if ELEM ( sa - > spacetype , SPACE_VIEW3D , SPACE_SEQ ) {
scrarea_do_windraw ( sa ) ;
}
}
else if ( curmode & 4 ) { /* all seq spaces */
if ( sa - > spacetype = = SPACE_SEQ ) {
scrarea_do_windraw ( sa ) ;
}
}
sa = sa - > next ;
}
if ( last_cfra = = - 1 ) {
last_cfra = CFRA - 1 ;
}
if ( U . prefetchframes ) {
pf = last_cfra ;
if ( CFRA - last_cfra > = U . prefetchframes | |
CFRA - last_cfra < 0 ) {
pf = CFRA - U . prefetchframes ;
fprintf ( stderr ,
" SEQ-THREAD: Lost sync, "
" stopping threads, "
" back to skip mode... \n " ) ;
seq_stop_threads ( ) ;
} else {
while ( pf < CFRA ) {
int c ;
pf + + ;
c = pf + U . prefetchframes ;
if ( c > = PEFRA ) {
c - = PEFRA ;
c + = PSFRA ;
}
inner_play_prefetch_frame ( curmode , c ) ;
}
}
}
}
last_cfra = CFRA ;
2003-04-28 14:43:20 +00:00
/* make sure that swaptime passed by */
2002-10-12 11:37:38 +00:00
tottime - = swaptime ;
2008-05-12 17:16:54 +00:00
while ( update_time ( CFRA ) ) {
2007-10-01 08:03:11 +00:00
PIL_sleep_ms ( 1 ) ;
}
if ( CFRA > = PEFRA ) {
if ( tottime > 0.0 ) {
tottime = 0.0 ;
}
CFRA = PSFRA ;
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
audiostream_stop ( ) ;
audiostream_start ( CFRA ) ;
2007-11-29 21:09:16 +00:00
cached = cached_dynamics ( PSFRA , PEFRA ) ;
2007-10-01 08:03:11 +00:00
} else {
2007-11-29 21:09:16 +00:00
if ( cached
2007-10-01 08:03:11 +00:00
& & ( G . scene - > audio . flag & AUDIO_SYNC ) ) {
CFRA = audiostream_pos ( ) ;
} else {
CFRA + + ;
}
if ( CFRA < last_cfra ) {
fprintf ( stderr ,
" SEQ-THREAD: CFRA running backwards: %d \n " ,
CFRA ) ;
}
2002-10-12 11:37:38 +00:00
}
2007-10-01 08:03:11 +00:00
2002-10-12 11:37:38 +00:00
}
2006-11-13 17:31:39 +00:00
/* play_anim: 'mode' defines where to play and if repeat is on (now bitfield):
* - mode & 1 : All view3d and seq areas
* - mode & 2 : No replay
* - mode & 4 : All seq areas
*/
2002-10-12 11:37:38 +00:00
int play_anim ( int mode )
{
ScrArea * sa , * oldsa ;
int cfraont ;
unsigned short event = 0 ;
2008-01-05 19:11:10 +00:00
short val = 0 ; /* its possible qtest() wont run and val must be initialized */
2004-01-02 23:29:34 +00:00
2003-04-28 14:43:20 +00:00
/* patch for very very old scenes */
2002-10-12 11:37:38 +00:00
if ( SFRA = = 0 ) SFRA = 1 ;
if ( EFRA = = 0 ) EFRA = 250 ;
2004-06-26 18:18:11 +00:00
2007-03-19 07:32:36 +00:00
if ( PSFRA > PEFRA ) return 0 ;
2002-10-12 11:37:38 +00:00
/* waitcursor(1); */
2003-04-28 14:43:20 +00:00
G . f | = G_PLAYANIM ; /* in sequence.c and view.c this is handled */
2002-10-12 11:37:38 +00:00
cfraont = CFRA ;
oldsa = curarea ;
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
2006-11-13 17:31:39 +00:00
if ( curarea & & curarea - > spacetype = = SPACE_SEQ ) {
SpaceSeq * sseq = curarea - > spacedata . first ;
if ( sseq - > mainb = = 0 ) mode | = 4 ;
}
2007-10-01 08:03:11 +00:00
inner_play_prefetch_startup ( mode ) ;
2008-05-12 17:16:54 +00:00
update_time ( CFRA ) ;
2006-11-13 17:31:39 +00:00
2002-10-12 11:37:38 +00:00
inner_play_anim_loop ( 1 , mode ) ; /* 1==init */
2007-10-01 08:03:11 +00:00
audiostream_start ( CFRA ) ;
2004-05-07 11:59:41 +00:00
/* forces all buffers to be OK for current frame (otherwise other windows get redrawn with CFRA+1) */
curarea - > win_swap = WIN_BACK_OK ;
screen_swapbuffers ( ) ;
== Sequencer ==
Attention! Rather large sequencer rewrite:
* Implemented layer blending using implicit effects. (works like layers
in "The Gimp" or Photoshop.)
* Fixed Space-Bar start-stop in preview windows.
You can start playback using spacebar within a preview-window and it _works_!
* Fixed Flip Y (didn't work for float)
* Fixed premul (didn't work for float)
* Added IPOs to _all_ tracks. In blend-mode REPLACE it drives the
"mul"-parameter in all other blend modes it drives the effect.
* you can meta single tracks.
* moved "mute track" from "M" to "Shift-M"
* added "Shift-L" for "lock track"
* changed inner workings for Metas. Now all ImBufs have to use the
reference counting mechanism. (Only interesting for coders :)
!!! Really important change, that affects current files!
Since you can mute tracks and now there is real layer blending capabilities
in place, I changed the silly behaviour that chose the output track.
Old behaviour: if we have an effect track visible, use the uppermost effect
track. If there is _no_ effect track visible, use the lowest input track.
New behaviour: always use the uppermost track. With blend modes active:
work our way down starting from the uppermost track to the first
"replace"-mode track. This is the way the gimp, photoshop, basically _all_
other applications work...
So if this change ruins your day: please try to fix your files using
"mute". If this doesn't work out, I can still restore the old behaviour,
but I really hope, that this is _not_ necessary!
Rational: most people won't get affected by this change, since you can't
really do anything usefull with the (old) sequencer without at least one
effect track and then you are on the safe side...
2008-01-01 11:44:42 +00:00
2002-10-12 11:37:38 +00:00
while ( TRUE ) {
2007-12-11 14:19:05 +00:00
if ( U . uiflag & USER_SHOW_FPS )
lredrawtime = PIL_check_seconds_timer ( ) ;
2002-10-12 11:37:38 +00:00
while ( qtest ( ) ) {
2005-05-08 20:10:59 +00:00
/* we test events first because of MKEY event */
2002-10-12 11:37:38 +00:00
event = extern_qread ( & val ) ;
if ( event = = ESCKEY ) break ;
else if ( event = = MIDDLEMOUSE ) {
2004-01-13 14:50:45 +00:00
if ( U . flag & USER_VIEWMOVE ) {
2002-10-12 11:37:38 +00:00
if ( G . qual & LR_SHIFTKEY ) viewmove ( 0 ) ;
else if ( G . qual & LR_CTRLKEY ) viewmove ( 2 ) ;
else viewmove ( 1 ) ;
}
else {
if ( G . qual & LR_SHIFTKEY ) viewmove ( 1 ) ;
else if ( G . qual & LR_CTRLKEY ) viewmove ( 2 ) ;
else viewmove ( 0 ) ;
}
2008-05-10 19:05:46 +00:00
} else if ( event = = WHEELDOWNMOUSE | | ( val & & event = = PADMINUS ) ) { /* copied from persptoetsen */
2008-05-28 21:15:40 +00:00
if ( G . vd ) { /* when using the sequencer this can be NULL */
/* this min and max is also in viewmove() */
if ( G . vd - > persp = = V3D_CAMOB ) {
G . vd - > camzoom - = 10 ;
if ( G . vd - > camzoom < - 30 ) G . vd - > camzoom = - 30 ;
}
else if ( G . vd - > dist < 10.0 * G . vd - > far ) G . vd - > dist * = 1.2f ;
2008-05-10 19:05:46 +00:00
}
} else if ( event = = WHEELUPMOUSE | | ( val & & event = = PADPLUSKEY ) ) { /* copied from persptoetsen */
2008-05-28 21:15:40 +00:00
if ( G . vd ) {
if ( G . vd - > persp = = V3D_CAMOB ) {
G . vd - > camzoom + = 10 ;
if ( G . vd - > camzoom > 300 ) G . vd - > camzoom = 300 ;
}
else if ( G . vd - > dist > 0.001 * G . vd - > grid ) G . vd - > dist * = .83333f ;
2008-05-10 19:05:46 +00:00
}
} else if ( event = = MKEY ) {
Big Commit.
Now time-markers work in all time-related spaces (i.e. Ipo,
Action Editor, NLA editor, TimeLine, Sound). The hotkeys and
functionality set should be the same for each of these modes
(with a few exceptions still). I've had to change a few hotkeys
here and there, so hopefully they aren't too bad.
Marker Operations:
MKEY - Add Marker
SHIFT MKEY - Rename marker (was CTRL MKEY)
XKEY - Delete Marker
PAGE UP - Jump to next marker
PAGE DOWN - Jump to previous marker
CTRL A - Select all markers
SHIFT G - Transform markers (NLA, IPO, Action)
G - Transform markers (Sound, Timeline)
CTRL SHIFT D - Duplicate markers (NLA, IPO, Action)
SHIFT D - Duplicate markers (Sound, Timeline)
BKEY - select markers and other keyframes (if any)
I've also made a few little tool additions to NLA and Action editors:
* NLA editor - Snap To Frame.
Now with the option to offset strip so that it starts at the current frame.
Added menus for this.
* Action editor - Snap To Frame
A few new menus for this too
2006-11-30 01:57:14 +00:00
if ( val ) add_marker ( CFRA - 1 ) ;
2005-05-08 20:10:59 +00:00
}
2002-10-12 11:37:38 +00:00
}
== Sequencer ==
Attention! Rather large sequencer rewrite:
* Implemented layer blending using implicit effects. (works like layers
in "The Gimp" or Photoshop.)
* Fixed Space-Bar start-stop in preview windows.
You can start playback using spacebar within a preview-window and it _works_!
* Fixed Flip Y (didn't work for float)
* Fixed premul (didn't work for float)
* Added IPOs to _all_ tracks. In blend-mode REPLACE it drives the
"mul"-parameter in all other blend modes it drives the effect.
* you can meta single tracks.
* moved "mute track" from "M" to "Shift-M"
* added "Shift-L" for "lock track"
* changed inner workings for Metas. Now all ImBufs have to use the
reference counting mechanism. (Only interesting for coders :)
!!! Really important change, that affects current files!
Since you can mute tracks and now there is real layer blending capabilities
in place, I changed the silly behaviour that chose the output track.
Old behaviour: if we have an effect track visible, use the uppermost effect
track. If there is _no_ effect track visible, use the lowest input track.
New behaviour: always use the uppermost track. With blend modes active:
work our way down starting from the uppermost track to the first
"replace"-mode track. This is the way the gimp, photoshop, basically _all_
other applications work...
So if this change ruins your day: please try to fix your files using
"mute". If this doesn't work out, I can still restore the old behaviour,
but I really hope, that this is _not_ necessary!
Rational: most people won't get affected by this change, since you can't
really do anything usefull with the (old) sequencer without at least one
effect track and then you are on the safe side...
2008-01-01 11:44:42 +00:00
if ( val & & ELEM3 ( event , ESCKEY , SPACEKEY , RIGHTMOUSE ) ) break ;
2005-05-08 20:10:59 +00:00
inner_play_anim_loop ( 0 , 0 ) ;
2007-12-11 14:19:05 +00:00
2005-05-08 20:10:59 +00:00
screen_swapbuffers ( ) ;
2007-12-11 14:19:05 +00:00
if ( U . uiflag & USER_SHOW_FPS )
redrawtime = lredrawtime ;
2007-03-19 07:32:36 +00:00
if ( ( mode & 2 ) & & CFRA = = PEFRA ) break ; /* no replay */
2002-10-12 11:37:38 +00:00
}
if ( event = = SPACEKEY ) ;
else CFRA = cfraont ;
2004-04-08 12:00:58 +00:00
2007-10-01 08:03:11 +00:00
inner_play_prefetch_shutdown ( mode ) ;
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
audiostream_stop ( ) ;
2002-10-12 11:37:38 +00:00
if ( oldsa ! = curarea ) areawinset ( oldsa - > win ) ;
/* restore all areas */
sa = G . curscreen - > areabase . first ;
while ( sa ) {
2006-11-13 17:31:39 +00:00
if ( ( ( mode & 1 ) & & sa - > spacetype = = SPACE_VIEW3D ) | | sa = = curarea ) addqueue ( sa - > win , REDRAW , 1 ) ;
2002-10-12 11:37:38 +00:00
sa = sa - > next ;
}
/* groups could have changed ipo */
allspace ( REMAKEIPO , 0 ) ;
allqueue ( REDRAWIPO , 0 ) ;
allqueue ( REDRAWNLA , 0 ) ;
allqueue ( REDRAWACTION , 0 ) ;
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
/* restore for cfra */
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
update_for_newframe_muted ( ) ;
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
2002-10-12 11:37:38 +00:00
waitcursor ( 0 ) ;
G . f & = ~ G_PLAYANIM ;
if ( event = = ESCKEY | | event = = SPACEKEY ) return 1 ;
else return 0 ;
}