2003-04-26 13:07:59 +00:00
|
|
|
/* object.c
|
|
|
|
*
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-01-07 19:13:47 +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-01-07 19:13:47 +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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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-01-07 19:13:47 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdio.h>
|
2002-11-25 12:02:15 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
#include "DNA_camera_types.h"
|
|
|
|
#include "DNA_constraint_types.h"
|
|
|
|
#include "DNA_group_types.h"
|
2009-12-28 15:26:36 +00:00
|
|
|
#include "DNA_key_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_lamp_types.h"
|
|
|
|
#include "DNA_lattice_types.h"
|
|
|
|
#include "DNA_material_types.h"
|
2008-04-01 11:14:34 +00:00
|
|
|
#include "DNA_meta_types.h"
|
2004-03-20 22:55:42 +00:00
|
|
|
#include "DNA_meshdata_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
2010-03-09 13:52:52 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_world_types.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_editVert.h"
|
2010-03-22 11:59:36 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
#include "BLI_pbvh.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#include "BKE_armature.h"
|
|
|
|
#include "BKE_action.h"
|
|
|
|
#include "BKE_bullet.h"
|
|
|
|
#include "BKE_colortools.h"
|
|
|
|
#include "BKE_deform.h"
|
|
|
|
#include "BKE_DerivedMesh.h"
|
|
|
|
#include "BKE_animsys.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_anim.h"
|
|
|
|
#include "BKE_constraint.h"
|
|
|
|
#include "BKE_curve.h"
|
|
|
|
#include "BKE_displist.h"
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
#include "BKE_effect.h"
|
2009-08-03 12:11:50 +00:00
|
|
|
#include "BKE_fcurve.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_group.h"
|
2005-12-21 22:21:43 +00:00
|
|
|
#include "BKE_icons.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_key.h"
|
|
|
|
#include "BKE_lattice.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_library.h"
|
|
|
|
#include "BKE_mesh.h"
|
|
|
|
#include "BKE_mball.h"
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
#include "BKE_modifier.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_object.h"
|
2009-08-28 21:47:11 +00:00
|
|
|
#include "BKE_paint.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"
|
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
|
|
|
#include "BKE_pointcache.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_property.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_sca.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_scene.h"
|
2010-03-09 13:52:52 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2004-10-01 14:04:17 +00:00
|
|
|
#include "BKE_softbody.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-01-28 20:17:48 +00:00
|
|
|
#include "LBM_fluidsim.h"
|
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2003-11-23 14:28:46 +00:00
|
|
|
#include "BPY_extern.h"
|
2008-10-28 18:47:13 +00:00
|
|
|
#endif
|
2003-11-23 14:28:46 +00:00
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
#include "GPU_material.h"
|
2003-11-23 14:28:46 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* Local function protos */
|
2009-01-10 19:34:23 +00:00
|
|
|
static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
float originmat[3][3]; /* after where_is_object(), can be used in other functions (bad!) */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-24 11:08:15 +00:00
|
|
|
void clear_workob(Object *workob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2008-12-24 11:08:15 +00:00
|
|
|
memset(workob, 0, sizeof(Object));
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
workob->size[0]= workob->size[1]= workob->size[2]= 1.0f;
|
|
|
|
workob->rotmode= ROT_MODE_EUL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
void copy_baseflags(struct Scene *scene)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2009-01-04 14:14:06 +00:00
|
|
|
Base *base= scene->base.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
while(base) {
|
|
|
|
base->object->flag= base->flag;
|
|
|
|
base= base->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
void copy_objectflags(struct Scene *scene)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2009-01-04 14:14:06 +00:00
|
|
|
Base *base= scene->base.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
while(base) {
|
|
|
|
base->flag= base->object->flag;
|
|
|
|
base= base->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
void update_base_layer(struct Scene *scene, Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2009-01-04 14:14:06 +00:00
|
|
|
Base *base= scene->base.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
while (base) {
|
|
|
|
if (base->object == ob) base->lay= ob->lay;
|
|
|
|
base= base->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-27 17:04:58 +00:00
|
|
|
void object_free_particlesystems(Object *ob)
|
|
|
|
{
|
|
|
|
while(ob->particlesystem.first){
|
|
|
|
ParticleSystem *psys = ob->particlesystem.first;
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
|
2008-02-27 17:04:58 +00:00
|
|
|
BLI_remlink(&ob->particlesystem,psys);
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
|
2008-02-27 17:04:58 +00:00
|
|
|
psys_free(ob,psys);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void object_free_softbody(Object *ob)
|
|
|
|
{
|
|
|
|
if(ob->soft) {
|
|
|
|
sbFree(ob->soft);
|
|
|
|
ob->soft= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-27 21:52:20 +00:00
|
|
|
void object_free_bulletsoftbody(Object *ob)
|
|
|
|
{
|
|
|
|
if(ob->bsoft) {
|
2008-09-29 23:46:01 +00:00
|
|
|
bsbFree(ob->bsoft);
|
2008-09-27 21:52:20 +00:00
|
|
|
ob->bsoft= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-09 16:02:23 +00:00
|
|
|
void object_free_modifiers(Object *ob)
|
2005-07-19 20:14:17 +00:00
|
|
|
{
|
2005-08-09 16:02:23 +00:00
|
|
|
while (ob->modifiers.first) {
|
|
|
|
ModifierData *md = ob->modifiers.first;
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
|
2005-08-09 16:02:23 +00:00
|
|
|
BLI_remlink(&ob->modifiers, md);
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
modifier_free(md);
|
2005-07-19 20:14:17 +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
|
|
|
|
|
|
|
/* particle modifiers were freed, so free the particlesystems as well */
|
2008-02-27 17:04:58 +00:00
|
|
|
object_free_particlesystems(ob);
|
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
|
|
|
|
2008-02-27 17:04:58 +00:00
|
|
|
/* same for softbody */
|
|
|
|
object_free_softbody(ob);
|
2005-07-19 20:14:17 +00:00
|
|
|
}
|
|
|
|
|
2010-01-04 16:26:07 +00:00
|
|
|
void object_link_modifiers(struct Object *ob, struct Object *from)
|
|
|
|
{
|
|
|
|
ModifierData *md;
|
|
|
|
object_free_modifiers(ob);
|
|
|
|
|
|
|
|
for (md=from->modifiers.first; md; md=md->next) {
|
|
|
|
ModifierData *nmd = NULL;
|
|
|
|
|
|
|
|
if(ELEM4(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance, eModifierType_Collision)) continue;
|
|
|
|
|
|
|
|
nmd = modifier_new(md->type);
|
|
|
|
modifier_copyData(md, nmd);
|
|
|
|
BLI_addtail(&ob->modifiers, nmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_object_particlesystems(from, ob);
|
|
|
|
copy_object_softbody(from, ob);
|
|
|
|
|
|
|
|
// TODO: smoke?, cloth?
|
|
|
|
}
|
|
|
|
|
2005-11-27 20:49:25 +00:00
|
|
|
/* here we will collect all local displist stuff */
|
|
|
|
/* also (ab)used in depsgraph */
|
|
|
|
void object_free_display(Object *ob)
|
|
|
|
{
|
|
|
|
if(ob->derivedDeform) {
|
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
|
|
|
ob->derivedDeform->needsFree = 1;
|
2005-11-27 20:49:25 +00:00
|
|
|
ob->derivedDeform->release(ob->derivedDeform);
|
|
|
|
ob->derivedDeform= NULL;
|
|
|
|
}
|
|
|
|
if(ob->derivedFinal) {
|
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
|
|
|
ob->derivedFinal->needsFree = 1;
|
2005-11-27 20:49:25 +00:00
|
|
|
ob->derivedFinal->release(ob->derivedFinal);
|
|
|
|
ob->derivedFinal= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
freedisplist(&ob->disp);
|
|
|
|
}
|
|
|
|
|
2010-03-22 11:59:36 +00:00
|
|
|
void free_sculptsession(Object *ob)
|
2009-08-15 18:58:01 +00:00
|
|
|
{
|
2010-03-22 11:59:36 +00:00
|
|
|
if(ob && ob->sculpt) {
|
|
|
|
SculptSession *ss = ob->sculpt;
|
|
|
|
DerivedMesh *dm= ob->derivedFinal;
|
|
|
|
|
|
|
|
if(ss->pbvh)
|
|
|
|
BLI_pbvh_free(ss->pbvh);
|
|
|
|
if(dm && dm->getPBVH)
|
|
|
|
dm->getPBVH(NULL, dm); /* signal to clear */
|
2009-08-15 18:58:01 +00:00
|
|
|
|
|
|
|
if(ss->texcache)
|
|
|
|
MEM_freeN(ss->texcache);
|
|
|
|
|
2009-11-04 21:10:28 +00:00
|
|
|
if(ss->layer_co)
|
|
|
|
MEM_freeN(ss->layer_co);
|
2009-10-27 19:53:34 +00:00
|
|
|
|
2009-08-15 18:58:01 +00:00
|
|
|
MEM_freeN(ss);
|
|
|
|
|
2010-03-22 11:59:36 +00:00
|
|
|
ob->sculpt = NULL;
|
2009-08-15 18:58:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* do not free object itself */
|
2002-10-12 11:37:38 +00:00
|
|
|
void free_object(Object *ob)
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
|
2005-11-27 20:49:25 +00:00
|
|
|
object_free_display(ob);
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* disconnect specific data */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->data) {
|
|
|
|
ID *id= ob->data;
|
|
|
|
id->us--;
|
|
|
|
if(id->us==0) {
|
|
|
|
if(ob->type==OB_MESH) unlink_mesh(ob->data);
|
|
|
|
else if(ob->type==OB_CURVE) unlink_curve(ob->data);
|
|
|
|
else if(ob->type==OB_MBALL) unlink_mball(ob->data);
|
|
|
|
}
|
|
|
|
ob->data= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(a=0; a<ob->totcol; a++) {
|
|
|
|
if(ob->mat[a]) ob->mat[a]->id.us--;
|
|
|
|
}
|
|
|
|
if(ob->mat) MEM_freeN(ob->mat);
|
2009-07-13 00:40:20 +00:00
|
|
|
if(ob->matbits) MEM_freeN(ob->matbits);
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->mat= 0;
|
2009-07-13 00:40:20 +00:00
|
|
|
ob->matbits= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->bb) MEM_freeN(ob->bb);
|
|
|
|
ob->bb= 0;
|
|
|
|
if(ob->path) free_path(ob->path);
|
|
|
|
ob->path= 0;
|
2009-01-18 10:41:45 +00:00
|
|
|
if(ob->adt) BKE_free_animdata((ID *)ob);
|
== PoseLib - Overhauled Implementation ==
Based on feedback from Ton, I've recoded the way "PoseLibs" are implemented/exposed. Therefore, quite a bit of code has been changed to fit this in better.
Now, ANY ACTION can be a "PoseLib". A set of Markers which belong to the Action (it's taken a year, but they're finally back), are used to tag "poses" in the Action. These markers are shown using diamond-shaped blue icons (designed by Matt Ebb) in three shades - unselected/normal, selected, active.
Notes:
* Each Armature Object has an Action which acts as a PoseLib.
* Improved UI presented in buttons panel for this
-- added proper buttons for action assigning
-- renamed "Validate PoseLib" to "Auto-Sync PoseLib" (this option auto-tags poses based on keyframes found)
Like in the 3d-view, use the hotkeys:
* Shift-L to add a local marker
* Ctrl-Shift-L to rename a local marker
* Alt-L to delete selected local markers
Note: transforms, etc. are not currently available with these markers
== PoseLib Preview ==
Added a few features here:
* Left/Right-Arrow keys now change the poses too (previous and next respectively)
* Up/Down-Arrow keys also change the poses, but "jump" to a pose 5 steps away in their respective directions
2007-12-30 12:08:28 +00:00
|
|
|
if(ob->poselib) ob->poselib->id.us--;
|
2010-08-04 04:01:27 +00:00
|
|
|
if(ob->gpd) ((ID *)ob->gpd)->us--;
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->defbase.first)
|
|
|
|
BLI_freelistN(&ob->defbase);
|
== Bone Groups ==
I'm committing some work-in-progress code for "bone groups" now, as I there have been are some major bugs caused by the timeoffset stuff (some of my test files were not loading, and other files were showing all sorts of weird problems).
Anyway, in this commit, the following things for "bone groups" have been done:
* Bone groups are stored per armature (internally, this is per bPose block)
* Added controls for editing bone-groups per armature - "add", "remove", "rename". These can be found in the "Links and Materials" panel in PoseMode, beside the settings for PoseLib.
* Reorganised buttons for editing selected bones in PoseMode. I've replaced the "dist" and "weight" buttons (they existed in EditMode anyway) with a menu to choose the bone-group and the custom-shape-ob field. In the place of the old custom-shape-ob field, I've restored the "Hide" button. This might break muscle-memory a bit, but there isn't a lot of space to play with there.
Some stuff I'd been originally planning to do before committing:
* When adding keyframes for bones, an action-group with the same name as the bone's group will be added to the action, and the action-channel will be made a member of that.
* New action/bone groups have unique names (renaming/adding new should check if name exists before assigning it)
* There's a setting under Bone-Groups stuff which sets which custom-colour set is used to colour that group's bones. Currently, this is non-functional, as the necessary drawing code for armatures is not in place yet.
2008-01-20 02:55:35 +00:00
|
|
|
if(ob->pose)
|
|
|
|
free_pose(ob->pose);
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
if(ob->mpath)
|
|
|
|
animviz_free_motionpath(ob->mpath);
|
2002-10-12 11:37:38 +00:00
|
|
|
free_properties(&ob->prop);
|
2005-08-09 16:02:23 +00:00
|
|
|
object_free_modifiers(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
free_sensors(&ob->sensors);
|
|
|
|
free_controllers(&ob->controllers);
|
|
|
|
free_actuators(&ob->actuators);
|
|
|
|
|
|
|
|
free_constraints(&ob->constraints);
|
2004-06-26 18:18:11 +00:00
|
|
|
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
free_partdeflect(ob->pd);
|
|
|
|
|
2005-04-02 13:57:23 +00:00
|
|
|
if(ob->soft) sbFree(ob->soft);
|
2008-09-27 21:52:20 +00:00
|
|
|
if(ob->bsoft) bsbFree(ob->bsoft);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
if(ob->gpulamp.first) GPU_lamp_free(ob);
|
2009-08-15 18:58:01 +00:00
|
|
|
|
2010-03-22 11:59:36 +00:00
|
|
|
free_sculptsession(ob);
|
2009-08-25 18:41:36 +00:00
|
|
|
|
|
|
|
if(ob->pc_ids.first) BLI_freelistN(&ob->pc_ids);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin)
|
|
|
|
{
|
|
|
|
Object *unlinkOb = userData;
|
|
|
|
|
|
|
|
if (*obpoin==unlinkOb) {
|
|
|
|
*obpoin = NULL;
|
2010-07-05 03:55:28 +00:00
|
|
|
ob->recalc |= OB_RECALC_ALL; // XXX: should this just be OB_RECALC_DATA?
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-09 15:35:10 +00:00
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
void unlink_object(Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2010-08-13 14:23:44 +00:00
|
|
|
Main *bmain= G.main;
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *obt;
|
|
|
|
Material *mat;
|
|
|
|
World *wrld;
|
|
|
|
bScreen *sc;
|
|
|
|
Scene *sce;
|
|
|
|
Curve *cu;
|
|
|
|
Tex *tex;
|
|
|
|
Group *group;
|
2007-09-23 18:27:01 +00:00
|
|
|
Camera *camera;
|
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
|
|
|
bConstraint *con;
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
//bActionStrip *strip; // XXX animsys
|
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
|
|
|
ModifierData *md;
|
2010-06-09 15:35:10 +00:00
|
|
|
ARegion *ar;
|
|
|
|
RegionView3D *rv3d;
|
2010-06-18 15:23:39 +00:00
|
|
|
int a, found;
|
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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
unlink_controllers(&ob->controllers);
|
|
|
|
unlink_actuators(&ob->actuators);
|
|
|
|
|
2006-11-13 21:43:09 +00:00
|
|
|
/* check all objects: parents en bevels and fields, also from libraries */
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
// FIXME: need to check all animation blocks (drivers)
|
2010-08-13 14:23:44 +00:00
|
|
|
obt= bmain->object.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(obt) {
|
2006-11-14 18:50:23 +00:00
|
|
|
if(obt->proxy==ob)
|
|
|
|
obt->proxy= NULL;
|
2006-11-30 15:54:21 +00:00
|
|
|
if(obt->proxy_from==ob) {
|
|
|
|
obt->proxy_from= NULL;
|
|
|
|
obt->recalc |= OB_RECALC_OB;
|
|
|
|
}
|
2006-11-14 18:50:23 +00:00
|
|
|
if(obt->proxy_group==ob)
|
|
|
|
obt->proxy_group= NULL;
|
2006-11-13 21:43:09 +00:00
|
|
|
|
|
|
|
if(obt->parent==ob) {
|
|
|
|
obt->parent= NULL;
|
2010-07-05 03:55:28 +00:00
|
|
|
obt->recalc |= OB_RECALC_ALL;
|
2006-11-11 16:45:17 +00:00
|
|
|
}
|
2006-11-13 21:43:09 +00:00
|
|
|
|
|
|
|
modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
|
|
|
|
|
|
|
|
if ELEM(obt->type, OB_CURVE, OB_FONT) {
|
|
|
|
cu= obt->data;
|
2006-12-09 06:17:14 +00:00
|
|
|
|
2006-11-13 21:43:09 +00:00
|
|
|
if(cu->bevobj==ob) {
|
|
|
|
cu->bevobj= NULL;
|
2010-07-05 03:55:28 +00:00
|
|
|
obt->recalc |= OB_RECALC_ALL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-11-13 21:43:09 +00:00
|
|
|
if(cu->taperobj==ob) {
|
|
|
|
cu->taperobj= NULL;
|
2010-07-05 03:55:28 +00:00
|
|
|
obt->recalc |= OB_RECALC_ALL;
|
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-11-13 21:43:09 +00:00
|
|
|
if(cu->textoncurve==ob) {
|
|
|
|
cu->textoncurve= NULL;
|
2010-07-05 03:55:28 +00:00
|
|
|
obt->recalc |= OB_RECALC_ALL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2006-11-13 21:43:09 +00:00
|
|
|
}
|
|
|
|
else if(obt->type==OB_ARMATURE && obt->pose) {
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
for(pchan= obt->pose->chanbase.first; pchan; pchan= pchan->next) {
|
|
|
|
for (con = pchan->constraints.first; con; con=con->next) {
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
|
|
|
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
|
|
|
|
ListBase targets = {NULL, NULL};
|
|
|
|
bConstraintTarget *ct;
|
|
|
|
|
|
|
|
if (cti && cti->get_constraint_targets) {
|
|
|
|
cti->get_constraint_targets(con, &targets);
|
|
|
|
|
|
|
|
for (ct= targets.first; ct; ct= ct->next) {
|
|
|
|
if (ct->tar == ob) {
|
|
|
|
ct->tar = NULL;
|
|
|
|
strcpy(ct->subtarget, "");
|
|
|
|
obt->recalc |= OB_RECALC_DATA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cti->flush_constraint_targets)
|
|
|
|
cti->flush_constraint_targets(con, &targets, 0);
|
2005-07-07 07:03:35 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-13 21:43:09 +00:00
|
|
|
if(pchan->custom==ob)
|
|
|
|
pchan->custom= NULL;
|
2005-07-07 07:03:35 +00:00
|
|
|
}
|
2010-06-27 12:45:09 +00:00
|
|
|
} else if(ELEM(OB_MBALL, ob->type, obt->type)) {
|
|
|
|
if(is_mball_basis_for(obt, ob))
|
|
|
|
obt->recalc|= OB_RECALC_DATA;
|
2006-11-13 21:43:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sca_remove_ob_poin(obt, ob);
|
|
|
|
|
|
|
|
for (con = obt->constraints.first; con; con=con->next) {
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
|
|
|
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
|
|
|
|
ListBase targets = {NULL, NULL};
|
|
|
|
bConstraintTarget *ct;
|
|
|
|
|
|
|
|
if (cti && cti->get_constraint_targets) {
|
|
|
|
cti->get_constraint_targets(con, &targets);
|
|
|
|
|
|
|
|
for (ct= targets.first; ct; ct= ct->next) {
|
|
|
|
if (ct->tar == ob) {
|
|
|
|
ct->tar = NULL;
|
|
|
|
strcpy(ct->subtarget, "");
|
|
|
|
obt->recalc |= OB_RECALC_DATA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cti->flush_constraint_targets)
|
|
|
|
cti->flush_constraint_targets(con, &targets, 0);
|
2005-11-11 10:46:26 +00:00
|
|
|
}
|
2006-11-13 21:43:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* object is deflector or field */
|
|
|
|
if(ob->pd) {
|
2008-04-27 18:26:20 +00:00
|
|
|
if(obt->soft)
|
2006-11-13 21:43:09 +00:00
|
|
|
obt->recalc |= OB_RECALC_DATA;
|
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
|
|
|
|
|
|
|
/* cloth */
|
|
|
|
for(md=obt->modifiers.first; md; md=md->next)
|
|
|
|
if(md->type == eModifierType_Cloth)
|
|
|
|
obt->recalc |= OB_RECALC_DATA;
|
2006-11-13 21:43:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* strips */
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#if 0 // XXX old animation system
|
2006-12-27 10:21:33 +00:00
|
|
|
for(strip= obt->nlastrips.first; strip; strip= strip->next) {
|
2006-11-13 21:43:09 +00:00
|
|
|
if(strip->object==ob)
|
|
|
|
strip->object= NULL;
|
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-11-13 21:43:09 +00:00
|
|
|
if(strip->modifiers.first) {
|
|
|
|
bActionModifier *amod;
|
|
|
|
for(amod= strip->modifiers.first; amod; amod= amod->next)
|
|
|
|
if(amod->ob==ob)
|
|
|
|
amod->ob= NULL;
|
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
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2006-11-13 21:43:09 +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
|
|
|
/* particle systems */
|
|
|
|
if(obt->particlesystem.first) {
|
|
|
|
ParticleSystem *tpsys= obt->particlesystem.first;
|
|
|
|
for(; tpsys; tpsys=tpsys->next) {
|
2009-07-20 23:52:53 +00:00
|
|
|
BoidState *state = NULL;
|
|
|
|
BoidRule *rule = NULL;
|
|
|
|
|
|
|
|
ParticleTarget *pt = tpsys->targets.first;
|
|
|
|
for(; pt; pt=pt->next) {
|
|
|
|
if(pt->ob==ob) {
|
|
|
|
pt->ob = NULL;
|
2009-07-12 23:38:47 +00:00
|
|
|
obt->recalc |= OB_RECALC_DATA;
|
|
|
|
break;
|
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(tpsys->target_ob==ob) {
|
|
|
|
tpsys->target_ob= NULL;
|
|
|
|
obt->recalc |= OB_RECALC_DATA;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(tpsys->part->dup_ob==ob)
|
|
|
|
tpsys->part->dup_ob= NULL;
|
|
|
|
|
2009-09-04 23:06:15 +00:00
|
|
|
if(tpsys->part->phystype==PART_PHYS_BOIDS) {
|
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
|
|
|
ParticleData *pa;
|
2009-09-04 23:06:15 +00:00
|
|
|
BoidParticle *bpa;
|
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
|
|
|
int p;
|
|
|
|
|
|
|
|
for(p=0,pa=tpsys->particles; p<tpsys->totpart; p++,pa++) {
|
2009-09-04 23:06:15 +00:00
|
|
|
bpa = pa->boid;
|
|
|
|
if(bpa->ground == ob)
|
|
|
|
bpa->ground = NULL;
|
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
|
|
|
}
|
|
|
|
}
|
2009-07-20 23:52:53 +00:00
|
|
|
if(tpsys->part->boids) {
|
|
|
|
for(state = tpsys->part->boids->states.first; state; state=state->next) {
|
|
|
|
for(rule = state->rules.first; rule; rule=rule->next) {
|
|
|
|
if(rule->type==eBoidRuleType_Avoid) {
|
|
|
|
BoidRuleGoalAvoid *gabr = (BoidRuleGoalAvoid*)rule;
|
|
|
|
if(gabr->ob==ob)
|
|
|
|
gabr->ob= NULL;
|
|
|
|
}
|
|
|
|
else if(rule->type==eBoidRuleType_FollowLeader) {
|
|
|
|
BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader*)rule;
|
|
|
|
if(flbr->ob==ob)
|
|
|
|
flbr->ob= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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(ob->pd)
|
|
|
|
obt->recalc |= OB_RECALC_DATA;
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
obt= obt->id.next;
|
|
|
|
}
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* materials */
|
2010-08-13 14:23:44 +00:00
|
|
|
mat= bmain->mat.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(mat) {
|
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(mat->mtex[a] && ob==mat->mtex[a]->object) {
|
2003-04-26 13:07:59 +00:00
|
|
|
/* actually, test for lib here... to do */
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
mat->mtex[a]->object= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mat= mat->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* textures */
|
2010-09-27 05:02:54 +00:00
|
|
|
for(tex= bmain->tex.first; tex; tex= tex->id.next) {
|
|
|
|
if(tex->env && (ob==tex->env->object)) tex->env->object= NULL;
|
|
|
|
if(tex->pd && (ob==tex->pd->object)) tex->pd->object= NULL;
|
|
|
|
if(tex->vd && (ob==tex->vd->object)) tex->vd->object= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2010-06-27 12:45:09 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* worlds */
|
2010-08-13 14:23:44 +00:00
|
|
|
wrld= bmain->world.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(wrld) {
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
if(wrld->id.lib==NULL) {
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(wrld->mtex[a] && ob==wrld->mtex[a]->object)
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
wrld->mtex[a]->object= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wrld= wrld->id.next;
|
|
|
|
}
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* scenes */
|
2010-08-13 14:23:44 +00:00
|
|
|
sce= bmain->scene.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(sce) {
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
if(sce->id.lib==NULL) {
|
|
|
|
if(sce->camera==ob) sce->camera= NULL;
|
2008-11-13 18:57:10 +00:00
|
|
|
if(sce->toolsettings->skgen_template==ob) sce->toolsettings->skgen_template = NULL;
|
2010-02-09 20:03:05 +00:00
|
|
|
if(sce->toolsettings->particle.object==ob) sce->toolsettings->particle.object= NULL;
|
2009-12-16 19:49:33 +00:00
|
|
|
|
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
{
|
|
|
|
TimeMarker *m;
|
|
|
|
|
|
|
|
for (m= sce->markers.first; m; m= m->next) {
|
|
|
|
if(m->camera==ob)
|
|
|
|
m->camera= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2010-03-09 13:52:52 +00:00
|
|
|
if(sce->ed) {
|
|
|
|
Sequence *seq;
|
|
|
|
SEQ_BEGIN(sce->ed, seq)
|
|
|
|
if(seq->scene_camera==ob) {
|
|
|
|
seq->scene_camera= NULL;
|
|
|
|
}
|
|
|
|
SEQ_END
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2010-03-09 13:52:52 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
|
|
|
|
#if 0 // XXX old animation system
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
/* ipos */
|
2010-08-13 14:23:44 +00:00
|
|
|
ipo= bmain->ipo.first;
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
while(ipo) {
|
|
|
|
if(ipo->id.lib==NULL) {
|
|
|
|
IpoCurve *icu;
|
|
|
|
for(icu= ipo->curve.first; icu; icu= icu->next) {
|
|
|
|
if(icu->driver && icu->driver->ob==ob)
|
|
|
|
icu->driver->ob= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ipo= ipo->id.next;
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/* screens */
|
2010-08-13 14:23:44 +00:00
|
|
|
sc= bmain->screen.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(sc) {
|
|
|
|
ScrArea *sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D*) sl;
|
|
|
|
|
2010-06-18 15:23:39 +00:00
|
|
|
found= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
if(v3d->camera==ob) {
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
v3d->camera= NULL;
|
2010-06-18 15:23:39 +00:00
|
|
|
found= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(v3d->localvd && v3d->localvd->camera==ob ) {
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
v3d->localvd->camera= NULL;
|
2010-06-18 15:23:39 +00:00
|
|
|
found += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found) {
|
|
|
|
if (sa->spacetype == SPACE_VIEW3D) {
|
|
|
|
for (ar= sa->regionbase.first; ar; ar= ar->next) {
|
|
|
|
if (ar->regiontype==RGN_TYPE_WINDOW) {
|
|
|
|
rv3d= (RegionView3D *)ar->regiondata;
|
|
|
|
if (found == 1 || found == 3) {
|
|
|
|
if (rv3d->persp == RV3D_CAMOB)
|
|
|
|
rv3d->persp= RV3D_PERSP;
|
|
|
|
}
|
|
|
|
if (found == 2 || found == 3) {
|
|
|
|
if (rv3d->localvd && rv3d->localvd->persp == RV3D_CAMOB)
|
|
|
|
rv3d->localvd->persp= RV3D_PERSP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-26 14:05:33 +00:00
|
|
|
else if(sl->spacetype==SPACE_OUTLINER) {
|
2004-09-05 13:43:51 +00:00
|
|
|
SpaceOops *so= (SpaceOops *)sl;
|
2004-10-10 11:33:19 +00:00
|
|
|
|
|
|
|
if(so->treestore) {
|
|
|
|
TreeStoreElem *tselem= so->treestore->data;
|
|
|
|
int a;
|
|
|
|
for(a=0; a<so->treestore->usedelem; a++, tselem++) {
|
|
|
|
if(tselem->id==(ID *)ob) tselem->id= NULL;
|
|
|
|
}
|
|
|
|
}
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
2010-06-25 11:41:39 +00:00
|
|
|
else if(sl->spacetype==SPACE_BUTS) {
|
|
|
|
SpaceButs *sbuts= (SpaceButs *)sl;
|
|
|
|
|
|
|
|
if(sbuts->pinid==(ID *)ob) {
|
|
|
|
sbuts->flag&= ~SB_PIN_CONTEXT;
|
|
|
|
sbuts->pinid= NULL;
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* groups */
|
2010-08-13 14:23:44 +00:00
|
|
|
group= bmain->group.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(group) {
|
2009-11-11 16:28:53 +00:00
|
|
|
rem_from_group(group, ob, NULL, NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
group= group->id.next;
|
|
|
|
}
|
2007-09-23 18:27:01 +00:00
|
|
|
|
|
|
|
/* cameras */
|
2010-08-13 14:23:44 +00:00
|
|
|
camera= bmain->camera.first;
|
2007-09-23 18:27:01 +00:00
|
|
|
while(camera) {
|
|
|
|
if (camera->dof_ob==ob) {
|
|
|
|
camera->dof_ob = NULL;
|
|
|
|
}
|
|
|
|
camera= camera->id.next;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int exist_object(Object *obtest)
|
|
|
|
{
|
|
|
|
Object *ob;
|
|
|
|
|
2005-08-24 20:18:03 +00:00
|
|
|
if(obtest==NULL) return 0;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob= G.main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
if(ob==obtest) return 1;
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-17 09:45:45 +00:00
|
|
|
void *add_camera(const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Camera *cam;
|
|
|
|
|
2007-03-11 16:25:17 +00:00
|
|
|
cam= alloc_libblock(&G.main->camera, ID_CA, name);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
cam->lens= 35.0f;
|
|
|
|
cam->clipsta= 0.1f;
|
|
|
|
cam->clipend= 100.0f;
|
|
|
|
cam->drawsize= 0.5f;
|
2005-01-30 11:25:27 +00:00
|
|
|
cam->ortho_scale= 6.0;
|
2010-06-07 20:08:03 +00:00
|
|
|
cam->flag |= CAM_SHOWPASSEPARTOUT;
|
|
|
|
cam->passepartalpha = 0.5f;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
return cam;
|
|
|
|
}
|
|
|
|
|
|
|
|
Camera *copy_camera(Camera *cam)
|
|
|
|
{
|
|
|
|
Camera *camn;
|
|
|
|
|
|
|
|
camn= copy_libblock(cam);
|
2009-07-22 09:41:41 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return camn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void make_local_camera(Camera *cam)
|
|
|
|
{
|
2010-08-13 14:23:44 +00:00
|
|
|
Main *bmain= G.main;
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *ob;
|
|
|
|
Camera *camn;
|
|
|
|
int local=0, lib=0;
|
2003-04-26 13:07:59 +00:00
|
|
|
|
|
|
|
/* - only lib users: do nothing
|
2010-03-22 09:30:00 +00:00
|
|
|
* - only local users: set flag
|
|
|
|
* - mixed: make copy
|
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(cam->id.lib==0) return;
|
|
|
|
if(cam->id.us==1) {
|
|
|
|
cam->id.lib= 0;
|
|
|
|
cam->id.flag= LIB_LOCAL;
|
|
|
|
new_id(0, (ID *)cam, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-08-13 14:23:44 +00:00
|
|
|
ob= bmain->object.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(ob) {
|
|
|
|
if(ob->data==cam) {
|
|
|
|
if(ob->id.lib) lib= 1;
|
|
|
|
else local= 1;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(local && lib==0) {
|
|
|
|
cam->id.lib= 0;
|
|
|
|
cam->id.flag= LIB_LOCAL;
|
|
|
|
new_id(0, (ID *)cam, 0);
|
|
|
|
}
|
|
|
|
else if(local && lib) {
|
|
|
|
camn= copy_camera(cam);
|
|
|
|
camn->id.us= 0;
|
|
|
|
|
2010-08-13 14:23:44 +00:00
|
|
|
ob= bmain->object.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(ob) {
|
|
|
|
if(ob->data==cam) {
|
|
|
|
|
|
|
|
if(ob->id.lib==0) {
|
|
|
|
ob->data= camn;
|
|
|
|
camn->id.us++;
|
|
|
|
cam->id.us--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-23 18:27:01 +00:00
|
|
|
/* get the camera's dof value, takes the dof object into account */
|
|
|
|
float dof_camera(Object *ob)
|
|
|
|
{
|
|
|
|
Camera *cam = (Camera *)ob->data;
|
|
|
|
if (ob->type != OB_CAMERA)
|
2009-02-10 09:18:04 +00:00
|
|
|
return 0.0f;
|
2007-09-23 18:27:01 +00:00
|
|
|
if (cam->dof_ob) {
|
|
|
|
/* too simple, better to return the distance on the view axis only
|
2009-11-10 20:43:45 +00:00
|
|
|
* return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */
|
2009-12-09 02:55:19 +00:00
|
|
|
float mat[4][4], imat[4][4], obmat[4][4];
|
2007-09-23 18:27:01 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(obmat, ob->obmat);
|
|
|
|
normalize_m4(obmat);
|
2009-12-09 02:55:19 +00:00
|
|
|
invert_m4_m4(imat, obmat);
|
|
|
|
mul_m4_m4m4(mat, cam->dof_ob->obmat, imat);
|
2009-02-10 09:18:04 +00:00
|
|
|
return (float)fabs(mat[3][2]);
|
2007-09-23 18:27:01 +00:00
|
|
|
}
|
|
|
|
return cam->YF_dofdist;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-11-17 09:45:45 +00:00
|
|
|
void *add_lamp(const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Lamp *la;
|
|
|
|
|
2007-03-11 16:25:17 +00:00
|
|
|
la= alloc_libblock(&G.main->lamp, ID_LA, name);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-02-10 09:18:04 +00:00
|
|
|
la->r= la->g= la->b= la->k= 1.0f;
|
|
|
|
la->haint= la->energy= 1.0f;
|
2009-07-17 02:43:15 +00:00
|
|
|
la->dist= 25.0f;
|
2009-02-10 09:18:04 +00:00
|
|
|
la->spotsize= 45.0f;
|
|
|
|
la->spotblend= 0.15f;
|
|
|
|
la->att2= 1.0f;
|
2006-10-14 10:21:19 +00:00
|
|
|
la->mode= LA_SHAD_BUF;
|
2002-10-12 11:37:38 +00:00
|
|
|
la->bufsize= 512;
|
2009-02-10 09:18:04 +00:00
|
|
|
la->clipsta= 0.5f;
|
|
|
|
la->clipend= 40.0f;
|
|
|
|
la->shadspotsize= 45.0f;
|
2002-10-12 11:37:38 +00:00
|
|
|
la->samp= 3;
|
2009-02-10 09:18:04 +00:00
|
|
|
la->bias= 1.0f;
|
|
|
|
la->soft= 3.0f;
|
Deep Shadow Buffer
Since the deep shadow buffer summer of code project is not actively under
development anymore, I decided to build my own DSM implementation from
scratch, based on reusing as much existing shadow buffer code as possible.
It's not very advanced, but implements the basic algorithm. Just enough so
we can do shading tests with it, optimizations and other improvements can
be done later.
Supported:
* Classical shadow buffer options: filter, soft, bias, ..
* Multiple sample buffers, merged into one.
* Halfway trick to support lower bias.
* Compression with user defined threshold.
* Non-textured alpha transparency, using Casting Alpha value.
* Strand render.
Not Supported:
* Tiling disk cache, so can use a lot of memory.
* Per part rendering for lower memory usage during creation.
* Colored shadow.
* Textured color/alpha shadow.
* Mipmaps for faster filtering.
* Volume shadows.
Usage Hints:
* Use sample buffers + smaller size rather than large size.
* For example 512 size x 9 sample buffers instead of 2048 x 1.
* Compression threshold 0.05 works, but is on the conservative side.
2009-10-12 19:41:40 +00:00
|
|
|
la->compressthresh= 0.05f;
|
Area lights and more...
- New lamp type added "Area". This uses the radiosity formula (Stoke) to
calculate the amount of energy which is received from a plane. Result
is very nice local light, which nicely spreads out.
- Area lamps have a 'gamma' option to control the light spread
- Area lamp builtin sizes: square, rect, cube & box. Only first 2 are
implemented. Set a type, and define area size
- Button area size won't affect the amount of energy. But scaling the lamp
in 3d window will do. This is to cover the case when you scale an entire
scene, the light then will remain identical
If you just want to change area lamp size, use buttons when you dont want
to make the scene too bright or too dark
- Since area lights realistically are sensitive for distance (quadratic), the
effect it has is quickly too much, or too less. For this the "Dist" value
in Lamp can be used. Set it at Dist=10 to have reasonable light on distance
10 Blender units (assumed you didnt scale lamp object).
- I tried square sized specularity, but this looked totally weird. Not
committed
- Plan is to extend area light with 3d dimensions, boxes and cubes.
- Note that area light is one-sided, towards negative Z. I need to design
a nice drawing method for it.
Area Shadow
- Since there are a lot of variables associated with soft shadow, they now
only are available for Area lights. Allowing spot & normal lamp to have
soft shadow is possible though, but will require a reorganisation of the
Lamp buttons. Is a point of research & feedback still.
- Apart from area size, you now can individually set amount of samples in
X and Y direction (for area lamp type 'Rect'). For box type area lamp,
this will become 3 dimensions
- Area shadows have four options:
"Clip circle" : only uses a circular shape of samples, gives smoother
results
"Dither" : use a 2x2 dither mask
"Jitter" : applys a pseudo-random offset to samples
"Umbra" : extra emphasis on area that's fully in shadow.
Raytrace speedup
- improved filling in faces in Octree. Large faces occupied too many nodes
- added a coherence check; rays fired sequentially that begin and end in
same octree nodes, and that don't intersect, are quickly rejected
- rendering shadow scenes benefits from this 20-40%. My statue test monkey
file now renders in 19 seconds (was 30).
Plus:
- adjusted specular max to 511, and made sure Blinn spec has again this
incredible small spec size
- for UI rounded theme: the color "button" displayed RGB color too dark
- fixed countall() function, to also include Subsurf totals
- removed setting the 'near' clipping for pressing dot-key numpad
- when you press the buttons-window icon for 'Shading Context' the context
automaticilly switches as with F5 hotkey
Please be warned that this is not a release... settings in files might not
work as it did, nor guaranteed to work when we do a release. :)
2003-12-29 16:52:51 +00:00
|
|
|
la->ray_samp= la->ray_sampy= la->ray_sampz= 1;
|
2009-02-10 09:18:04 +00:00
|
|
|
la->area_size=la->area_sizey=la->area_sizez= 1.0f;
|
2006-02-19 14:55:16 +00:00
|
|
|
la->buffers= 1;
|
2006-10-15 11:50:46 +00:00
|
|
|
la->buftype= LA_SHADBUF_HALFWAY;
|
2007-09-07 03:48:50 +00:00
|
|
|
la->ray_samp_method = LA_SAMP_HALTON;
|
2009-02-10 09:18:04 +00:00
|
|
|
la->adapt_thresh = 0.001f;
|
2007-09-02 17:25:03 +00:00
|
|
|
la->preview=NULL;
|
2009-07-17 02:43:15 +00:00
|
|
|
la->falloff_type = LA_FALLOFF_INVSQUARE;
|
* Extra lamp falloff options, including custom curve!
This adds some new lamp attenuation options to the Lamp panel, replacing the old 'Quad' button. Yes, the panel layout is still nasty here, but I've ignored it for now to address properly in the panels cleanup work.
* Constant
http://mke3.net/blender/devel/rendering/falloff-constant.jpg
Lamp doesn't decay with distance
* Inverse Linear
http://mke3.net/blender/devel/rendering/falloff-invlinear.jpg
Default, and same as in older Blender without 'Quad' on. Decays linearly, with 'Dist' value as the lamp's half-energy-distance
* Inverse Square
http://mke3.net/blender/devel/rendering/falloff-invsquare.jpg
A sharper, more realistic decay, good for most electric lights (i.e. not sunlight). This is similar to the old Quad option with slight changes.
* Lin/Quad weighted
Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting.
But much better for precise control over the lamp falloff now is:
* Custom Curve
This shows an extra 'Falloff Curve' panel, where you can use the standard Blender curve UI control to precisely control how the light falls off. The Y axis is intensity, and the X axis is distance, stretched over the length of the 'Dist' value.
Some example curves and renders:
http://mke3.net/blender/devel/rendering/falloff-curve1-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve1.jpg
http://mke3.net/blender/devel/rendering/falloff-curve2-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve2.jpg
http://mke3.net/blender/devel/rendering/falloff-curve3-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve3.jpg (whee)
2007-09-16 13:50:34 +00:00
|
|
|
la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
|
2008-07-03 10:38:35 +00:00
|
|
|
la->sun_effect_type = 0;
|
|
|
|
la->horizon_brightness = 1.0;
|
|
|
|
la->spread = 1.0;
|
|
|
|
la->sun_brightness = 1.0;
|
|
|
|
la->sun_size = 1.0;
|
2009-02-10 09:18:04 +00:00
|
|
|
la->backscattered_light = 1.0f;
|
|
|
|
la->atm_turbidity = 2.0f;
|
|
|
|
la->atm_inscattering_factor = 1.0f;
|
|
|
|
la->atm_extinction_factor = 1.0f;
|
|
|
|
la->atm_distance_factor = 1.0f;
|
|
|
|
la->sun_intensity = 1.0f;
|
2008-09-21 16:04:33 +00:00
|
|
|
la->skyblendtype= MA_RAMP_ADD;
|
|
|
|
la->skyblendfac= 1.0f;
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
la->sky_colorspace= BLI_XYZ_CIE;
|
2008-09-29 17:03:24 +00:00
|
|
|
la->sky_exposure= 1.0f;
|
|
|
|
|
* Extra lamp falloff options, including custom curve!
This adds some new lamp attenuation options to the Lamp panel, replacing the old 'Quad' button. Yes, the panel layout is still nasty here, but I've ignored it for now to address properly in the panels cleanup work.
* Constant
http://mke3.net/blender/devel/rendering/falloff-constant.jpg
Lamp doesn't decay with distance
* Inverse Linear
http://mke3.net/blender/devel/rendering/falloff-invlinear.jpg
Default, and same as in older Blender without 'Quad' on. Decays linearly, with 'Dist' value as the lamp's half-energy-distance
* Inverse Square
http://mke3.net/blender/devel/rendering/falloff-invsquare.jpg
A sharper, more realistic decay, good for most electric lights (i.e. not sunlight). This is similar to the old Quad option with slight changes.
* Lin/Quad weighted
Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting.
But much better for precise control over the lamp falloff now is:
* Custom Curve
This shows an extra 'Falloff Curve' panel, where you can use the standard Blender curve UI control to precisely control how the light falls off. The Y axis is intensity, and the X axis is distance, stretched over the length of the 'Dist' value.
Some example curves and renders:
http://mke3.net/blender/devel/rendering/falloff-curve1-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve1.jpg
http://mke3.net/blender/devel/rendering/falloff-curve2-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve2.jpg
http://mke3.net/blender/devel/rendering/falloff-curve3-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve3.jpg (whee)
2007-09-16 13:50:34 +00:00
|
|
|
curvemapping_initialize(la->curfalloff);
|
2002-10-12 11:37:38 +00:00
|
|
|
return la;
|
|
|
|
}
|
|
|
|
|
|
|
|
Lamp *copy_lamp(Lamp *la)
|
|
|
|
{
|
|
|
|
Lamp *lan;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
lan= copy_libblock(la);
|
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(lan->mtex[a]) {
|
|
|
|
lan->mtex[a]= MEM_mallocN(sizeof(MTex), "copylamptex");
|
|
|
|
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
|
|
|
|
id_us_plus((ID *)lan->mtex[a]->tex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
* Extra lamp falloff options, including custom curve!
This adds some new lamp attenuation options to the Lamp panel, replacing the old 'Quad' button. Yes, the panel layout is still nasty here, but I've ignored it for now to address properly in the panels cleanup work.
* Constant
http://mke3.net/blender/devel/rendering/falloff-constant.jpg
Lamp doesn't decay with distance
* Inverse Linear
http://mke3.net/blender/devel/rendering/falloff-invlinear.jpg
Default, and same as in older Blender without 'Quad' on. Decays linearly, with 'Dist' value as the lamp's half-energy-distance
* Inverse Square
http://mke3.net/blender/devel/rendering/falloff-invsquare.jpg
A sharper, more realistic decay, good for most electric lights (i.e. not sunlight). This is similar to the old Quad option with slight changes.
* Lin/Quad weighted
Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting.
But much better for precise control over the lamp falloff now is:
* Custom Curve
This shows an extra 'Falloff Curve' panel, where you can use the standard Blender curve UI control to precisely control how the light falls off. The Y axis is intensity, and the X axis is distance, stretched over the length of the 'Dist' value.
Some example curves and renders:
http://mke3.net/blender/devel/rendering/falloff-curve1-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve1.jpg
http://mke3.net/blender/devel/rendering/falloff-curve2-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve2.jpg
http://mke3.net/blender/devel/rendering/falloff-curve3-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve3.jpg (whee)
2007-09-16 13:50:34 +00:00
|
|
|
lan->curfalloff = curvemapping_copy(la->curfalloff);
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#if 0 // XXX old animation system
|
2002-10-12 11:37:38 +00:00
|
|
|
id_us_plus((ID *)lan->ipo);
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-09-02 17:25:03 +00:00
|
|
|
if (la->preview) lan->preview = BKE_previewimg_copy(la->preview);
|
2009-07-22 09:41:41 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return lan;
|
|
|
|
}
|
|
|
|
|
|
|
|
void make_local_lamp(Lamp *la)
|
|
|
|
{
|
2010-08-13 14:23:44 +00:00
|
|
|
Main *bmain= G.main;
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *ob;
|
|
|
|
Lamp *lan;
|
|
|
|
int local=0, lib=0;
|
2003-04-26 13:07:59 +00:00
|
|
|
|
|
|
|
/* - only lib users: do nothing
|
2010-03-22 09:30:00 +00:00
|
|
|
* - only local users: set flag
|
|
|
|
* - mixed: make copy
|
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(la->id.lib==0) return;
|
|
|
|
if(la->id.us==1) {
|
|
|
|
la->id.lib= 0;
|
|
|
|
la->id.flag= LIB_LOCAL;
|
|
|
|
new_id(0, (ID *)la, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-08-13 14:23:44 +00:00
|
|
|
ob= bmain->object.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(ob) {
|
|
|
|
if(ob->data==la) {
|
|
|
|
if(ob->id.lib) lib= 1;
|
|
|
|
else local= 1;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(local && lib==0) {
|
|
|
|
la->id.lib= 0;
|
|
|
|
la->id.flag= LIB_LOCAL;
|
|
|
|
new_id(0, (ID *)la, 0);
|
|
|
|
}
|
|
|
|
else if(local && lib) {
|
|
|
|
lan= copy_lamp(la);
|
|
|
|
lan->id.us= 0;
|
|
|
|
|
2010-08-13 14:23:44 +00:00
|
|
|
ob= bmain->object.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(ob) {
|
|
|
|
if(ob->data==la) {
|
|
|
|
|
|
|
|
if(ob->id.lib==0) {
|
|
|
|
ob->data= lan;
|
|
|
|
lan->id.us++;
|
|
|
|
la->id.us--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void free_camera(Camera *ca)
|
|
|
|
{
|
2009-01-18 10:41:45 +00:00
|
|
|
BKE_free_animdata((ID *)ca);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void free_lamp(Lamp *la)
|
|
|
|
{
|
|
|
|
MTex *mtex;
|
|
|
|
int a;
|
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
mtex= la->mtex[a];
|
|
|
|
if(mtex && mtex->tex) mtex->tex->id.us--;
|
|
|
|
if(mtex) MEM_freeN(mtex);
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
|
2009-01-18 10:41:45 +00:00
|
|
|
BKE_free_animdata((ID *)la);
|
* Extra lamp falloff options, including custom curve!
This adds some new lamp attenuation options to the Lamp panel, replacing the old 'Quad' button. Yes, the panel layout is still nasty here, but I've ignored it for now to address properly in the panels cleanup work.
* Constant
http://mke3.net/blender/devel/rendering/falloff-constant.jpg
Lamp doesn't decay with distance
* Inverse Linear
http://mke3.net/blender/devel/rendering/falloff-invlinear.jpg
Default, and same as in older Blender without 'Quad' on. Decays linearly, with 'Dist' value as the lamp's half-energy-distance
* Inverse Square
http://mke3.net/blender/devel/rendering/falloff-invsquare.jpg
A sharper, more realistic decay, good for most electric lights (i.e. not sunlight). This is similar to the old Quad option with slight changes.
* Lin/Quad weighted
Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting.
But much better for precise control over the lamp falloff now is:
* Custom Curve
This shows an extra 'Falloff Curve' panel, where you can use the standard Blender curve UI control to precisely control how the light falls off. The Y axis is intensity, and the X axis is distance, stretched over the length of the 'Dist' value.
Some example curves and renders:
http://mke3.net/blender/devel/rendering/falloff-curve1-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve1.jpg
http://mke3.net/blender/devel/rendering/falloff-curve2-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve2.jpg
http://mke3.net/blender/devel/rendering/falloff-curve3-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve3.jpg (whee)
2007-09-16 13:50:34 +00:00
|
|
|
|
|
|
|
curvemapping_free(la->curfalloff);
|
2007-09-02 17:25:03 +00:00
|
|
|
|
|
|
|
BKE_previewimg_free(&la->preview);
|
2005-12-21 23:39:20 +00:00
|
|
|
BKE_icon_delete(&la->id);
|
2005-12-21 22:21:43 +00:00
|
|
|
la->id.icon_id = 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* *************************************************** */
|
|
|
|
|
|
|
|
static void *add_obdata_from_type(int type)
|
|
|
|
{
|
|
|
|
switch (type) {
|
2009-01-15 15:01:39 +00:00
|
|
|
case OB_MESH: return add_mesh("Mesh");
|
|
|
|
case OB_CURVE: return add_curve("Curve", OB_CURVE);
|
|
|
|
case OB_SURF: return add_curve("Surf", OB_SURF);
|
2007-03-11 16:25:17 +00:00
|
|
|
case OB_FONT: return add_curve("Text", OB_FONT);
|
|
|
|
case OB_MBALL: return add_mball("Meta");
|
|
|
|
case OB_CAMERA: return add_camera("Camera");
|
2009-01-15 15:01:39 +00:00
|
|
|
case OB_LAMP: return add_lamp("Lamp");
|
2007-03-11 16:25:17 +00:00
|
|
|
case OB_LATTICE: return add_lattice("Lattice");
|
|
|
|
case OB_ARMATURE: return add_armature("Armature");
|
2002-10-12 11:37:38 +00:00
|
|
|
case OB_EMPTY: return NULL;
|
|
|
|
default:
|
|
|
|
printf("add_obdata_from_type: Internal error, bad type: %d\n", type);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-03 17:05:21 +00:00
|
|
|
static const char *get_obdata_defname(int type)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case OB_MESH: return "Mesh";
|
|
|
|
case OB_CURVE: return "Curve";
|
|
|
|
case OB_SURF: return "Surf";
|
2010-06-27 07:45:57 +00:00
|
|
|
case OB_FONT: return "Text";
|
2002-10-12 11:37:38 +00:00
|
|
|
case OB_MBALL: return "Mball";
|
|
|
|
case OB_CAMERA: return "Camera";
|
|
|
|
case OB_LAMP: return "Lamp";
|
|
|
|
case OB_LATTICE: return "Lattice";
|
|
|
|
case OB_ARMATURE: return "Armature";
|
|
|
|
case OB_EMPTY: return "Empty";
|
|
|
|
default:
|
|
|
|
printf("get_obdata_defname: Internal error, bad type: %d\n", type);
|
|
|
|
return "Empty";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-11 17:55:52 +00:00
|
|
|
/* more general add: creates minimum required data, but without vertices etc. */
|
2010-11-17 09:45:45 +00:00
|
|
|
Object *add_only_object(int type, const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Object *ob;
|
|
|
|
|
|
|
|
ob= alloc_libblock(&G.main->object, ID_OB, name);
|
2006-09-11 17:55:52 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* default object vars */
|
|
|
|
ob->type= type;
|
2009-11-29 23:54:41 +00:00
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
ob->col[0]= ob->col[1]= ob->col[2]= 1.0;
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->col[3]= 1.0;
|
2009-11-29 23:54:41 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
|
2009-11-29 23:54:41 +00:00
|
|
|
|
|
|
|
/* objects should default to having Euler XYZ rotations,
|
|
|
|
* but rotations default to quaternions
|
|
|
|
*/
|
|
|
|
ob->rotmode= ROT_MODE_EUL;
|
|
|
|
/* axis-angle must not have a 0,0,0 axis, so set y-axis as default... */
|
|
|
|
ob->rotAxis[1]= ob->drotAxis[1]= 1.0f;
|
|
|
|
/* quaternions should be 1,0,0,0 by default.... */
|
|
|
|
ob->quat[0]= ob->dquat[0]= 1.0f;
|
|
|
|
/* rotation locks should be 4D for 4 component rotations by default... */
|
|
|
|
ob->protectflag = OB_LOCK_ROT4D;
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(ob->constinv);
|
|
|
|
unit_m4(ob->parentinv);
|
|
|
|
unit_m4(ob->obmat);
|
2009-12-07 10:28:36 +00:00
|
|
|
ob->dt= OB_TEXTURE;
|
2006-01-13 15:50:32 +00:00
|
|
|
ob->empty_drawtype= OB_ARROWS;
|
|
|
|
ob->empty_drawsize= 1.0;
|
2006-09-11 17:55:52 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(type==OB_CAMERA || type==OB_LAMP) {
|
|
|
|
ob->trackflag= OB_NEGZ;
|
|
|
|
ob->upflag= OB_POSY;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ob->trackflag= OB_POSY;
|
|
|
|
ob->upflag= OB_POSZ;
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->dupon= 1; ob->dupoff= 0;
|
|
|
|
ob->dupsta= 1; ob->dupend= 100;
|
2007-11-30 14:10:36 +00:00
|
|
|
ob->dupfacesca = 1.0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* Game engine defaults*/
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->mass= ob->inertia= 1.0f;
|
|
|
|
ob->formfactor= 0.4f;
|
|
|
|
ob->damping= 0.04f;
|
|
|
|
ob->rdamping= 0.1f;
|
|
|
|
ob->anisotropicFriction[0] = 1.0f;
|
|
|
|
ob->anisotropicFriction[1] = 1.0f;
|
|
|
|
ob->anisotropicFriction[2] = 1.0f;
|
2008-09-16 22:52:42 +00:00
|
|
|
ob->gameflag= OB_PROP|OB_COLLISION;
|
BGE patch: new Physics button and margin parameter in Logic panel. Change subversion.
The Physics button controls the creation of a physics representation
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.
The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through
Python. By default, the collision margin is set to 0.0 on static
objects and 0.06 on dynamic objects.
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.
Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is
now kept "inside" the object for box, sphere and cylinder bound
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding.
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects.
The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions.
This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects:
center, shape, size, position of children, etc.
2008-09-14 19:34:06 +00:00
|
|
|
ob->margin = 0.0;
|
2010-06-09 08:00:45 +00:00
|
|
|
ob->init_state=1;
|
|
|
|
ob->state=1;
|
2009-06-08 20:08:19 +00:00
|
|
|
/* ob->pad3 == Contact Processing Threshold */
|
|
|
|
ob->m_contactProcessingThreshold = 1.;
|
2008-09-25 16:48:25 +00:00
|
|
|
|
2005-09-18 13:27:12 +00:00
|
|
|
/* NT fluid sim defaults */
|
|
|
|
ob->fluidsimFlag = 0;
|
|
|
|
ob->fluidsimSettings = NULL;
|
2006-09-11 17:55:52 +00:00
|
|
|
|
2009-08-25 18:41:36 +00:00
|
|
|
ob->pc_ids.first = ob->pc_ids.last = NULL;
|
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
|
|
|
|
|
|
|
/* Animation Visualisation defaults */
|
|
|
|
animviz_settings_init(&ob->avs);
|
2009-08-25 18:41:36 +00:00
|
|
|
|
2006-09-11 17:55:52 +00:00
|
|
|
return ob;
|
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
/* general add: to scene, with layer from area and default name */
|
2006-09-11 17:55:52 +00:00
|
|
|
/* creates minimum required data, but without vertices etc. */
|
2009-01-04 14:14:06 +00:00
|
|
|
Object *add_object(struct Scene *scene, int type)
|
2006-09-11 17:55:52 +00:00
|
|
|
{
|
|
|
|
Object *ob;
|
|
|
|
Base *base;
|
|
|
|
char name[32];
|
|
|
|
|
|
|
|
strcpy(name, get_obdata_defname(type));
|
|
|
|
ob = add_only_object(type, name);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->data= add_obdata_from_type(type);
|
2006-09-11 17:55:52 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
ob->lay= scene->lay;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
base= scene_add_base(scene, ob);
|
|
|
|
scene_select_base(scene, base);
|
2010-07-05 03:55:28 +00:00
|
|
|
ob->recalc |= OB_RECALC_ALL;
|
2006-09-11 17:55:52 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return ob;
|
|
|
|
}
|
|
|
|
|
2005-04-16 15:06:02 +00:00
|
|
|
SoftBody *copy_softbody(SoftBody *sb)
|
|
|
|
{
|
|
|
|
SoftBody *sbn;
|
|
|
|
|
2005-04-16 16:56:06 +00:00
|
|
|
if (sb==NULL) return(NULL);
|
|
|
|
|
2005-04-16 15:06:02 +00:00
|
|
|
sbn= MEM_dupallocN(sb);
|
|
|
|
sbn->totspring= sbn->totpoint= 0;
|
|
|
|
sbn->bpoint= NULL;
|
|
|
|
sbn->bspring= NULL;
|
|
|
|
|
2005-05-12 14:00:12 +00:00
|
|
|
sbn->keys= NULL;
|
|
|
|
sbn->totkey= sbn->totpointkey= 0;
|
|
|
|
|
2006-11-12 16:51:29 +00:00
|
|
|
sbn->scratch= NULL;
|
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
|
|
|
|
2009-08-14 16:25:59 +00:00
|
|
|
sbn->pointcache= BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches);
|
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
|
|
|
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
if(sb->effector_weights)
|
|
|
|
sbn->effector_weights = MEM_dupallocN(sb->effector_weights);
|
|
|
|
|
2005-04-16 15:06:02 +00:00
|
|
|
return sbn;
|
|
|
|
}
|
2004-10-14 08:52:12 +00:00
|
|
|
|
2008-09-27 21:52:20 +00:00
|
|
|
BulletSoftBody *copy_bulletsoftbody(BulletSoftBody *bsb)
|
|
|
|
{
|
|
|
|
BulletSoftBody *bsbn;
|
|
|
|
|
|
|
|
if (bsb == NULL)
|
|
|
|
return NULL;
|
|
|
|
bsbn = MEM_dupallocN(bsb);
|
|
|
|
/* no pointer in this structure yet */
|
|
|
|
return bsbn;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
ParticleSystem *copy_particlesystem(ParticleSystem *psys)
|
|
|
|
{
|
|
|
|
ParticleSystem *psysn;
|
2007-12-01 20:08:31 +00:00
|
|
|
ParticleData *pa;
|
2009-09-04 23:06:15 +00:00
|
|
|
int p;
|
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
|
|
|
|
|
|
|
psysn= MEM_dupallocN(psys);
|
|
|
|
psysn->particles= MEM_dupallocN(psys->particles);
|
|
|
|
psysn->child= MEM_dupallocN(psys->child);
|
2009-09-04 23:06:15 +00:00
|
|
|
|
|
|
|
if(psys->part->type == PART_HAIR) {
|
|
|
|
for(p=0, pa=psysn->particles; p<psysn->totpart; p++, pa++)
|
|
|
|
pa->hair = MEM_dupallocN(pa->hair);
|
|
|
|
}
|
|
|
|
|
2009-10-15 09:00:40 +00:00
|
|
|
if(psysn->particles && (psysn->particles->keys || psysn->particles->boid)) {
|
2009-09-04 23:06:15 +00:00
|
|
|
ParticleKey *key = psysn->particles->keys;
|
|
|
|
BoidParticle *boid = psysn->particles->boid;
|
|
|
|
|
|
|
|
if(key)
|
|
|
|
key = MEM_dupallocN(key);
|
|
|
|
|
|
|
|
if(boid)
|
|
|
|
boid = MEM_dupallocN(boid);
|
|
|
|
|
|
|
|
for(p=0, pa=psysn->particles; p<psysn->totpart; p++, pa++) {
|
|
|
|
if(boid)
|
|
|
|
pa->boid = boid++;
|
|
|
|
if(key) {
|
|
|
|
pa->keys = key;
|
|
|
|
key += pa->totkey;
|
|
|
|
}
|
|
|
|
}
|
2007-12-01 20:08:31 +00:00
|
|
|
}
|
|
|
|
|
2009-09-10 22:32:33 +00:00
|
|
|
if(psys->clmd) {
|
2010-02-04 09:59:05 +00:00
|
|
|
psysn->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth);
|
|
|
|
modifier_copyData((ModifierData*)psys->clmd, (ModifierData*)psysn->clmd);
|
2009-09-10 22:32:33 +00:00
|
|
|
psys->hair_in_dm = psys->hair_out_dm = NULL;
|
2008-02-17 12:46:09 +00:00
|
|
|
}
|
2009-07-12 23:38:47 +00:00
|
|
|
|
2009-09-04 23:06:15 +00:00
|
|
|
BLI_duplicatelist(&psysn->targets, &psys->targets);
|
2010-05-06 21:31:16 +00:00
|
|
|
|
2007-12-01 20:08:31 +00:00
|
|
|
psysn->pathcache= NULL;
|
|
|
|
psysn->childcache= NULL;
|
|
|
|
psysn->edit= NULL;
|
2009-10-19 13:21:37 +00:00
|
|
|
psysn->frand= NULL;
|
2009-10-19 13:17:47 +00:00
|
|
|
psysn->pdd= NULL;
|
2010-05-06 21:31:16 +00:00
|
|
|
psysn->effectors= NULL;
|
2008-05-11 11:34:39 +00:00
|
|
|
|
|
|
|
psysn->pathcachebufs.first = psysn->pathcachebufs.last = NULL;
|
2008-05-14 13:30:36 +00:00
|
|
|
psysn->childcachebufs.first = psysn->childcachebufs.last = NULL;
|
2008-05-11 11:34:39 +00:00
|
|
|
psysn->renderdata = NULL;
|
|
|
|
|
2009-08-14 16:25:59 +00:00
|
|
|
psysn->pointcache= BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches);
|
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
|
|
|
|
2010-02-04 16:54:25 +00:00
|
|
|
/* XXX - from reading existing code this seems correct but intended usage of
|
|
|
|
* pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
|
|
|
|
if(psysn->clmd) {
|
|
|
|
psysn->clmd->point_cache= psysn->pointcache;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
id_us_plus((ID *)psysn->part);
|
|
|
|
|
|
|
|
return psysn;
|
|
|
|
}
|
|
|
|
|
2008-02-27 17:04:58 +00:00
|
|
|
void copy_object_particlesystems(Object *obn, Object *ob)
|
|
|
|
{
|
|
|
|
ParticleSystemModifierData *psmd;
|
|
|
|
ParticleSystem *psys, *npsys;
|
|
|
|
ModifierData *md;
|
|
|
|
|
|
|
|
obn->particlesystem.first= obn->particlesystem.last= NULL;
|
|
|
|
for(psys=ob->particlesystem.first; psys; psys=psys->next) {
|
|
|
|
npsys= copy_particlesystem(psys);
|
|
|
|
|
|
|
|
BLI_addtail(&obn->particlesystem, npsys);
|
|
|
|
|
|
|
|
/* need to update particle modifiers too */
|
|
|
|
for(md=obn->modifiers.first; md; md=md->next) {
|
|
|
|
if(md->type==eModifierType_ParticleSystem) {
|
|
|
|
psmd= (ParticleSystemModifierData*)md;
|
|
|
|
if(psmd->psys==psys)
|
|
|
|
psmd->psys= npsys;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void copy_object_softbody(Object *obn, Object *ob)
|
|
|
|
{
|
|
|
|
if(ob->soft)
|
|
|
|
obn->soft= copy_softbody(ob->soft);
|
|
|
|
}
|
|
|
|
|
2006-11-11 16:45:17 +00:00
|
|
|
static void copy_object_pose(Object *obn, Object *ob)
|
|
|
|
{
|
|
|
|
bPoseChannel *chan;
|
|
|
|
|
2008-06-14 03:00:38 +00:00
|
|
|
/* note: need to clear obn->pose pointer first, so that copy_pose works (otherwise there's a crash) */
|
|
|
|
obn->pose= NULL;
|
2007-12-02 18:33:14 +00:00
|
|
|
copy_pose(&obn->pose, ob->pose, 1); /* 1 = copy constraints */
|
2006-11-11 16:45:17 +00:00
|
|
|
|
|
|
|
for (chan = obn->pose->chanbase.first; chan; chan=chan->next){
|
|
|
|
bConstraint *con;
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
|
|
|
|
2006-11-11 16:45:17 +00:00
|
|
|
chan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE);
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
|
|
|
|
|
|
|
for (con= chan->constraints.first; con; con= con->next) {
|
|
|
|
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
|
|
|
|
ListBase targets = {NULL, NULL};
|
|
|
|
bConstraintTarget *ct;
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#if 0 // XXX old animation system
|
2008-11-02 00:25:39 +00:00
|
|
|
/* note that we can't change lib linked ipo blocks. for making
|
|
|
|
* proxies this still works correct however because the object
|
|
|
|
* is changed to object->proxy_from when evaluating the driver. */
|
|
|
|
if(con->ipo && !con->ipo->id.lib) {
|
2007-12-02 18:33:14 +00:00
|
|
|
IpoCurve *icu;
|
2009-06-08 20:08:19 +00:00
|
|
|
|
|
|
|
con->ipo= copy_ipo(con->ipo);
|
|
|
|
|
2007-12-02 18:33:14 +00:00
|
|
|
for(icu= con->ipo->curve.first; icu; icu= icu->next) {
|
|
|
|
if(icu->driver && icu->driver->ob==ob)
|
|
|
|
icu->driver->ob= obn;
|
|
|
|
}
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2007-12-02 18:33:14 +00:00
|
|
|
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
|
|
|
if (cti && cti->get_constraint_targets) {
|
|
|
|
cti->get_constraint_targets(con, &targets);
|
|
|
|
|
|
|
|
for (ct= targets.first; ct; ct= ct->next) {
|
2007-10-28 01:01:46 +00:00
|
|
|
if (ct->tar == ob)
|
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
|
|
|
ct->tar = obn;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cti->flush_constraint_targets)
|
|
|
|
cti->flush_constraint_targets(con, &targets, 0);
|
|
|
|
}
|
2006-11-11 16:45:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-12 21:47:13 +00:00
|
|
|
static void copy_object_transform(Object *ob_tar, Object *ob_src)
|
|
|
|
{
|
|
|
|
copy_v3_v3(ob_tar->loc, ob_src->loc);
|
|
|
|
copy_v3_v3(ob_tar->rot, ob_src->rot);
|
|
|
|
copy_v3_v3(ob_tar->quat, ob_src->quat);
|
|
|
|
copy_v3_v3(ob_tar->rotAxis, ob_src->rotAxis);
|
|
|
|
ob_tar->rotAngle= ob_src->rotAngle;
|
|
|
|
ob_tar->rotmode= ob_src->rotmode;
|
|
|
|
copy_v3_v3(ob_tar->size, ob_src->size);
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *copy_object(Object *ob)
|
|
|
|
{
|
|
|
|
Object *obn;
|
2005-07-27 20:16:41 +00:00
|
|
|
ModifierData *md;
|
2002-10-12 11:37:38 +00:00
|
|
|
int a;
|
|
|
|
|
|
|
|
obn= copy_libblock(ob);
|
|
|
|
|
|
|
|
if(ob->totcol) {
|
|
|
|
obn->mat= MEM_dupallocN(ob->mat);
|
2009-07-13 00:40:20 +00:00
|
|
|
obn->matbits= MEM_dupallocN(ob->matbits);
|
2009-10-08 09:22:39 +00:00
|
|
|
obn->totcol= ob->totcol;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(ob->bb) obn->bb= MEM_dupallocN(ob->bb);
|
2006-11-11 16:45:17 +00:00
|
|
|
obn->path= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
obn->flag &= ~OB_FROMGROUP;
|
|
|
|
|
2005-07-27 20:16:41 +00:00
|
|
|
obn->modifiers.first = obn->modifiers.last= NULL;
|
|
|
|
|
|
|
|
for (md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
ModifierData *nmd = modifier_new(md->type);
|
2010-06-10 21:23:09 +00:00
|
|
|
BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
|
2005-07-27 20:16:41 +00:00
|
|
|
modifier_copyData(md, nmd);
|
|
|
|
BLI_addtail(&obn->modifiers, nmd);
|
|
|
|
}
|
2009-07-22 09:41:41 +00:00
|
|
|
|
2008-09-22 07:17:39 +00:00
|
|
|
obn->prop.first = obn->prop.last = NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
copy_properties(&obn->prop, &ob->prop);
|
2008-09-22 07:17:39 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
copy_sensors(&obn->sensors, &ob->sensors);
|
|
|
|
copy_controllers(&obn->controllers, &ob->controllers);
|
|
|
|
copy_actuators(&obn->actuators, &ob->actuators);
|
|
|
|
|
2005-09-29 16:37:37 +00:00
|
|
|
if(ob->pose) {
|
2006-11-11 16:45:17 +00:00
|
|
|
copy_object_pose(obn, ob);
|
2006-04-17 14:26:41 +00:00
|
|
|
/* backwards compat... non-armatures can get poses in older files? */
|
|
|
|
if(ob->type==OB_ARMATURE)
|
|
|
|
armature_rebuild_pose(obn, obn->data);
|
2005-09-29 16:37:37 +00:00
|
|
|
}
|
2010-01-26 13:50:17 +00:00
|
|
|
defgroup_copy_list(&obn->defbase, &ob->defbase);
|
2010-04-29 15:31:53 +00:00
|
|
|
copy_constraints(&obn->constraints, &ob->constraints, TRUE);
|
2004-06-26 18:18:11 +00:00
|
|
|
|
2009-08-15 18:58:01 +00:00
|
|
|
obn->mode = 0;
|
|
|
|
obn->sculpt = NULL;
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* increase user numbers */
|
2002-10-12 11:37:38 +00:00
|
|
|
id_us_plus((ID *)obn->data);
|
2010-07-13 16:53:17 +00:00
|
|
|
id_lib_extern((ID *)obn->dup_group);
|
2009-09-30 04:59:14 +00:00
|
|
|
|
2006-01-05 19:16:28 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<obn->totcol; a++) id_us_plus((ID *)obn->mat[a]);
|
|
|
|
|
2004-09-14 19:03:11 +00:00
|
|
|
obn->disp.first= obn->disp.last= NULL;
|
2005-04-16 15:06:02 +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(ob->pd){
|
|
|
|
obn->pd= MEM_dupallocN(ob->pd);
|
|
|
|
if(obn->pd->tex)
|
|
|
|
id_us_plus(&(obn->pd->tex->id));
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
if(obn->pd->rng)
|
|
|
|
obn->pd->rng = MEM_dupallocN(ob->pd->rng);
|
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
|
|
|
}
|
2005-04-16 15:06:02 +00:00
|
|
|
obn->soft= copy_softbody(ob->soft);
|
2008-09-27 21:52:20 +00:00
|
|
|
obn->bsoft = copy_bulletsoftbody(ob->bsoft);
|
2005-09-18 13:27:12 +00:00
|
|
|
|
2008-02-27 17:04:58 +00:00
|
|
|
copy_object_particlesystems(obn, ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Three new features:
1) Stride Bone
For walkcycles, you could already set an NLA strip to cycle over a path
based on a preset distance value. This cycling happens based on a linear
interpolation, with constant speed.
Not all cycles have a constant speed however, like hopping or jumping.
To ensure a perfect slipping-less foot contact, you now can set a Bone
in an Armature to define the stride. This "Stride Bone" then becomes a
sort-of ruler, a conveyor belt, on which the character walks. When using
the NLA "Use Path" option, it then tries to keep the Stride Bone entirely
motionless on the path, by cancelling out its motion (for the entire
Armature). This means that the animation keys for a Stride Bone have to be
exactly negative of the desired path. Only, at choice, the X,Y or Z Ipo
curve is used for this stride.
Examples:
http://www.blender.org/bf/0001_0040.avi
The top armature shows the actual Action, the bottom armature has been
parented to a Path, using the Stride Bone feature.
http://www.blender.org/bf/0001_0080.avi
Here the Stride Bone has a number of children, creating a ruler to be
used as reference while animating.
Test .blend:
http://www.blender.org/bf/motionblender1.blend
Notes:
- Note that action keys for Bones work local, based on the Bone's
orientation as set in EditMode. Therefore, an Y translation always
goes in the Bone's direction.
- To be able to get a "solvable" stride, the animation curve has
to be inverse evaluated, using a Newton Raphson root solver. That
means you can only create stride curves that keep moving forward, and
cannot return halfway.
- Set the Stride Bone in the Editing Buttons, Bone Panel. You can set
change the name or set the axis in the NLA Window, Strip Properties Panel.
- Files in this commit will move to the blender.org release section.
2) Armature Ghosting
In EditButtons, Armature Panel, you can set an armature to draw ghosts.
The number value denotes the amount of frames that have to be drawn extra
(for the active action!) around the current frame.
Ghosts only evaluate its own Pose, executing it's Actions, Constraints and
IK. No external dependencies are re-evaluated for it.
3) NLA/Action time control
If you click in the NLA window on the action (linked to Object), it makes
sure the Timing as drawn in the Action editor is not corrected for NLA.
If you also set the Object to "Action", this timing will be executed on the
Object as well (not NLA time).
(It's a bit confusing... will make a good doc & maybe review UI!)
2005-11-01 12:44:30 +00:00
|
|
|
obn->derivedDeform = NULL;
|
|
|
|
obn->derivedFinal = NULL;
|
2005-07-17 05:34:35 +00:00
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
obn->gpulamp.first = obn->gpulamp.last = NULL;
|
2009-08-25 18:41:36 +00:00
|
|
|
obn->pc_ids.first = obn->pc_ids.last = NULL;
|
2010-09-18 04:08:40 +00:00
|
|
|
|
|
|
|
obn->mpath= NULL;
|
2009-08-25 18:41:36 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return obn;
|
|
|
|
}
|
|
|
|
|
|
|
|
void expand_local_object(Object *ob)
|
|
|
|
{
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
//bActionStrip *strip;
|
2008-04-30 13:29:57 +00:00
|
|
|
ParticleSystem *psys;
|
2002-10-12 11:37:38 +00:00
|
|
|
int a;
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
|
|
|
|
#if 0 // XXX old animation system
|
2002-10-12 11:37:38 +00:00
|
|
|
id_lib_extern((ID *)ob->action);
|
|
|
|
id_lib_extern((ID *)ob->ipo);
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2002-10-12 11:37:38 +00:00
|
|
|
id_lib_extern((ID *)ob->data);
|
2008-02-11 03:16:22 +00:00
|
|
|
id_lib_extern((ID *)ob->dup_group);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
for(a=0; a<ob->totcol; a++) {
|
|
|
|
id_lib_extern((ID *)ob->mat[a]);
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#if 0 // XXX old animation system
|
2005-12-05 17:06:58 +00:00
|
|
|
for (strip=ob->nlastrips.first; strip; strip=strip->next) {
|
|
|
|
id_lib_extern((ID *)strip->act);
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2008-04-30 13:29:57 +00:00
|
|
|
for(psys=ob->particlesystem.first; psys; psys=psys->next)
|
|
|
|
id_lib_extern((ID *)psys->part);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void make_local_object(Object *ob)
|
|
|
|
{
|
2010-08-13 14:23:44 +00:00
|
|
|
Main *bmain= G.main;
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *obn;
|
|
|
|
Scene *sce;
|
|
|
|
Base *base;
|
|
|
|
int local=0, lib=0;
|
2003-04-26 13:07:59 +00:00
|
|
|
|
|
|
|
/* - only lib users: do nothing
|
2010-03-22 09:30:00 +00:00
|
|
|
* - only local users: set flag
|
|
|
|
* - mixed: make copy
|
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-11-11 16:45:17 +00:00
|
|
|
if(ob->id.lib==NULL) return;
|
2006-11-30 15:54:21 +00:00
|
|
|
|
|
|
|
ob->proxy= ob->proxy_from= NULL;
|
2006-11-11 16:45:17 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->id.us==1) {
|
2006-11-11 16:45:17 +00:00
|
|
|
ob->id.lib= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->id.flag= LIB_LOCAL;
|
|
|
|
new_id(0, (ID *)ob, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
2010-08-13 14:23:44 +00:00
|
|
|
sce= bmain->scene.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(sce) {
|
|
|
|
base= sce->base.first;
|
|
|
|
while(base) {
|
|
|
|
if(base->object==ob) {
|
|
|
|
if(sce->id.lib) lib++;
|
|
|
|
else local++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
base= base->next;
|
|
|
|
}
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(local && lib==0) {
|
|
|
|
ob->id.lib= 0;
|
|
|
|
ob->id.flag= LIB_LOCAL;
|
|
|
|
new_id(0, (ID *)ob, 0);
|
|
|
|
}
|
|
|
|
else if(local && lib) {
|
|
|
|
obn= copy_object(ob);
|
|
|
|
obn->id.us= 0;
|
|
|
|
|
2010-08-13 14:23:44 +00:00
|
|
|
sce= bmain->scene.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(sce) {
|
|
|
|
if(sce->id.lib==0) {
|
|
|
|
base= sce->base.first;
|
|
|
|
while(base) {
|
|
|
|
if(base->object==ob) {
|
|
|
|
base->object= obn;
|
|
|
|
obn->id.us++;
|
|
|
|
ob->id.us--;
|
|
|
|
}
|
|
|
|
base= base->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expand_local_object(ob);
|
|
|
|
}
|
|
|
|
|
2009-07-19 00:49:44 +00:00
|
|
|
/*
|
|
|
|
* Returns true if the Object is a from an external blend file (libdata)
|
|
|
|
*/
|
|
|
|
int object_is_libdata(Object *ob)
|
|
|
|
{
|
|
|
|
if (!ob) return 0;
|
|
|
|
if (ob->proxy) return 0;
|
|
|
|
if (ob->id.lib) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns true if the Object data is a from an external blend file (libdata) */
|
2009-05-21 15:34:09 +00:00
|
|
|
int object_data_is_libdata(Object *ob)
|
|
|
|
{
|
|
|
|
if(!ob) return 0;
|
2010-02-18 11:49:17 +00:00
|
|
|
if(ob->proxy && (ob->data==NULL || ((ID *)ob->data)->lib==NULL)) return 0;
|
2009-05-21 15:34:09 +00:00
|
|
|
if(ob->id.lib) return 1;
|
2010-02-18 11:49:17 +00:00
|
|
|
if(ob->data==NULL) return 0;
|
2009-05-21 15:34:09 +00:00
|
|
|
if(((ID *)ob->data)->lib) return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-11-11 16:45:17 +00:00
|
|
|
/* *************** PROXY **************** */
|
|
|
|
|
2007-11-15 12:15:28 +00:00
|
|
|
/* when you make proxy, ensure the exposed layers are extern */
|
2009-09-14 16:52:06 +00:00
|
|
|
static void armature_set_id_extern(Object *ob)
|
2007-11-15 12:15:28 +00:00
|
|
|
{
|
|
|
|
bArmature *arm= ob->data;
|
|
|
|
bPoseChannel *pchan;
|
2010-10-19 01:21:22 +00:00
|
|
|
unsigned int lay= arm->layer_protected;
|
2007-11-15 12:15:28 +00:00
|
|
|
|
|
|
|
for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
if(!(pchan->bone->layer & lay))
|
|
|
|
id_lib_extern((ID *)pchan->custom);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-01-20 14:28:49 +00:00
|
|
|
void object_copy_proxy_drivers(Object *ob, Object *target)
|
|
|
|
{
|
|
|
|
if ((target->adt) && (target->adt->drivers.first)) {
|
|
|
|
FCurve *fcu;
|
|
|
|
|
|
|
|
/* add new animdata block */
|
|
|
|
if(!ob->adt)
|
|
|
|
ob->adt= BKE_id_add_animdata(&ob->id);
|
|
|
|
|
|
|
|
/* make a copy of all the drivers (for now), then correct any links that need fixing */
|
|
|
|
free_fcurves(&ob->adt->drivers);
|
|
|
|
copy_fcurves(&ob->adt->drivers, &target->adt->drivers);
|
|
|
|
|
|
|
|
for (fcu= ob->adt->drivers.first; fcu; fcu= fcu->next) {
|
|
|
|
ChannelDriver *driver= fcu->driver;
|
|
|
|
DriverVar *dvar;
|
|
|
|
|
|
|
|
for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
|
|
|
|
/* all drivers */
|
|
|
|
DRIVER_TARGETS_LOOPER(dvar)
|
|
|
|
{
|
2010-04-25 00:19:10 +00:00
|
|
|
if(dtar->id) {
|
|
|
|
if ((Object *)dtar->id == target)
|
|
|
|
dtar->id= (ID *)ob;
|
|
|
|
else {
|
|
|
|
/* only on local objects because this causes indirect links a -> b -> c,blend to point directly to a.blend
|
|
|
|
* when a.blend has a proxy thats linked into c.blend */
|
|
|
|
if(ob->id.lib==NULL)
|
|
|
|
id_lib_extern((ID *)dtar->id);
|
|
|
|
}
|
|
|
|
}
|
2010-01-20 14:28:49 +00:00
|
|
|
}
|
|
|
|
DRIVER_TARGETS_LOOPER_END
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-30 15:54:21 +00:00
|
|
|
/* proxy rule: lib_object->proxy_from == the one we borrow from, set temporally while object_update */
|
2006-11-11 16:45:17 +00:00
|
|
|
/* local_object->proxy == pointer to library object, saved in files and read */
|
2006-11-14 15:27:43 +00:00
|
|
|
/* local_object->proxy_group == pointer to group dupli-object, saved in files and read */
|
2006-11-11 16:45:17 +00:00
|
|
|
|
2006-11-14 15:27:43 +00:00
|
|
|
void object_make_proxy(Object *ob, Object *target, Object *gob)
|
2006-11-11 16:45:17 +00:00
|
|
|
{
|
|
|
|
/* paranoia checks */
|
|
|
|
if(ob->id.lib || target->id.lib==NULL) {
|
|
|
|
printf("cannot make proxy\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ob->proxy= target;
|
2006-11-14 15:27:43 +00:00
|
|
|
ob->proxy_group= gob;
|
|
|
|
id_lib_extern(&target->id);
|
2006-11-11 16:45:17 +00:00
|
|
|
|
2010-07-05 03:55:28 +00:00
|
|
|
ob->recalc= target->recalc= OB_RECALC_ALL;
|
2006-11-11 16:45:17 +00:00
|
|
|
|
2010-10-12 21:47:13 +00:00
|
|
|
/* copy transform
|
|
|
|
* - gob means this proxy comes from a group, just apply the matrix
|
|
|
|
* so the object wont move from its dupli-transform.
|
|
|
|
*
|
|
|
|
* - no gob means this is being made from a linked object,
|
|
|
|
* this is closer to making a copy of the object - in-place. */
|
2006-11-14 15:27:43 +00:00
|
|
|
if(gob) {
|
2010-10-12 21:47:13 +00:00
|
|
|
ob->rotmode= target->rotmode;
|
|
|
|
mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
|
2010-11-08 22:32:28 +00:00
|
|
|
object_apply_mat4(ob, ob->obmat, FALSE, TRUE);
|
2006-11-14 15:27:43 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-10-12 21:47:13 +00:00
|
|
|
copy_object_transform(ob, target);
|
|
|
|
ob->parent= target->parent; /* libdata */
|
|
|
|
copy_m4_m4(ob->parentinv, target->parentinv);
|
2006-11-14 15:27:43 +00:00
|
|
|
}
|
2006-11-11 16:45:17 +00:00
|
|
|
|
2009-08-03 12:11:50 +00:00
|
|
|
/* copy animdata stuff - drivers only for now... */
|
2010-01-20 14:28:49 +00:00
|
|
|
object_copy_proxy_drivers(ob, target);
|
|
|
|
|
2009-08-03 12:11:50 +00:00
|
|
|
/* skip constraints? */
|
|
|
|
// FIXME: this is considered by many as a bug
|
2006-11-11 16:45:17 +00:00
|
|
|
|
2008-04-19 11:23:50 +00:00
|
|
|
/* set object type and link to data */
|
2006-11-11 16:45:17 +00:00
|
|
|
ob->type= target->type;
|
|
|
|
ob->data= target->data;
|
|
|
|
id_us_plus((ID *)ob->data); /* ensures lib data becomes LIB_EXTERN */
|
|
|
|
|
2008-04-19 11:23:50 +00:00
|
|
|
/* copy material and index information */
|
|
|
|
ob->actcol= ob->totcol= 0;
|
|
|
|
if(ob->mat) MEM_freeN(ob->mat);
|
2009-07-13 00:40:20 +00:00
|
|
|
if(ob->matbits) MEM_freeN(ob->matbits);
|
2008-04-19 11:23:50 +00:00
|
|
|
ob->mat = NULL;
|
2009-07-13 00:40:20 +00:00
|
|
|
ob->matbits= NULL;
|
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
|
|
|
if ((target->totcol) && (target->mat) && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) { //XXX OB_SUPPORT_MATERIAL
|
2008-04-19 11:23:50 +00:00
|
|
|
int i;
|
|
|
|
ob->colbits = target->colbits;
|
|
|
|
|
|
|
|
ob->actcol= target->actcol;
|
|
|
|
ob->totcol= target->totcol;
|
|
|
|
|
|
|
|
ob->mat = MEM_dupallocN(target->mat);
|
2009-07-13 00:40:20 +00:00
|
|
|
ob->matbits = MEM_dupallocN(target->matbits);
|
2008-04-19 11:23:50 +00:00
|
|
|
for(i=0; i<target->totcol; i++) {
|
|
|
|
/* dont need to run test_object_materials since we know this object is new and not used elsewhere */
|
2008-04-23 14:04:05 +00:00
|
|
|
id_us_plus((ID *)ob->mat[i]);
|
2008-04-19 11:23:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-11 16:45:17 +00:00
|
|
|
/* type conversions */
|
|
|
|
if(target->type == OB_ARMATURE) {
|
|
|
|
copy_object_pose(ob, target); /* data copy, object pointers in constraints */
|
|
|
|
rest_pose(ob->pose); /* clear all transforms in channels */
|
|
|
|
armature_rebuild_pose(ob, ob->data); /* set all internal links */
|
2007-11-15 12:15:28 +00:00
|
|
|
|
|
|
|
armature_set_id_extern(ob);
|
2006-11-11 16:45:17 +00:00
|
|
|
}
|
2009-08-03 12:11:50 +00:00
|
|
|
|
|
|
|
/* copy drawtype info */
|
|
|
|
ob->dt= target->dt;
|
2006-11-11 16:45:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* *************** CALC ****************** */
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* there is also a timing calculation in drawobject() */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
int no_speed_curve= 0;
|
|
|
|
|
|
|
|
void disable_speed_curve(int val)
|
|
|
|
{
|
|
|
|
no_speed_curve= val;
|
|
|
|
}
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
// XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP!
|
2004-12-11 12:41:51 +00:00
|
|
|
/* ob can be NULL */
|
2010-10-16 14:32:17 +00:00
|
|
|
float bsystem_time(struct Scene *scene, Object *UNUSED(ob), float cfra, float ofs)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2010-06-27 05:39:55 +00:00
|
|
|
/* returns float ( see BKE_curframe in scene.c) */
|
|
|
|
cfra += scene->r.subframe;
|
2007-08-05 09:21:29 +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
|
|
|
/* global time */
|
2009-09-22 11:45:30 +00:00
|
|
|
if (scene)
|
|
|
|
cfra*= scene->r.framelen;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#if 0 // XXX old animation system
|
2007-08-05 09:21:29 +00:00
|
|
|
if (ob) {
|
|
|
|
/* ofset frames */
|
|
|
|
if ((ob->ipoflag & OB_OFFS_PARENT) && (ob->partype & PARSLOW)==0)
|
2008-01-19 16:32:29 +00:00
|
|
|
cfra-= give_timeoffset(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
cfra-= ofs;
|
|
|
|
|
|
|
|
return cfra;
|
|
|
|
}
|
|
|
|
|
2008-09-29 20:13:40 +00:00
|
|
|
void object_scale_to_mat3(Object *ob, float mat[][3])
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2008-09-29 20:13:40 +00:00
|
|
|
float vec[3];
|
2010-08-06 08:27:07 +00:00
|
|
|
add_v3_v3v3(vec, ob->size, ob->dsize);
|
2009-11-10 20:43:45 +00:00
|
|
|
size_to_mat3( mat,vec);
|
2008-09-29 20:13:40 +00:00
|
|
|
}
|
|
|
|
|
2010-10-16 11:52:30 +00:00
|
|
|
|
2008-09-29 20:13:40 +00:00
|
|
|
void object_rot_to_mat3(Object *ob, float mat[][3])
|
|
|
|
{
|
2009-09-28 10:19:20 +00:00
|
|
|
float rmat[3][3], dmat[3][3];
|
|
|
|
|
|
|
|
/* initialise the delta-rotation matrix, which will get (pre)multiplied
|
|
|
|
* with the rotation matrix to yield the appropriate rotation
|
|
|
|
*/
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(dmat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
|
|
|
|
if (ob->rotmode > 0) {
|
|
|
|
/* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
|
2009-11-10 20:43:45 +00:00
|
|
|
eulO_to_mat3( rmat,ob->rot, ob->rotmode);
|
|
|
|
eulO_to_mat3( dmat,ob->drot, ob->rotmode);
|
2009-09-28 10:19:20 +00:00
|
|
|
}
|
|
|
|
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
|
2009-10-08 00:57:00 +00:00
|
|
|
/* axis-angle - not really that great for 3D-changing orientations */
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_mat3( rmat,ob->rotAxis, ob->rotAngle);
|
|
|
|
axis_angle_to_mat3( dmat,ob->drotAxis, ob->drotAngle);
|
2009-09-28 10:19:20 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* quats are normalised before use to eliminate scaling issues */
|
2010-12-07 01:56:32 +00:00
|
|
|
float tquat[4];
|
|
|
|
|
|
|
|
normalize_qt_qt(tquat, ob->quat);
|
|
|
|
quat_to_mat3(rmat, tquat);
|
|
|
|
|
|
|
|
normalize_qt_qt(tquat, ob->quat);
|
|
|
|
quat_to_mat3(dmat, tquat);
|
2009-09-28 10:19:20 +00:00
|
|
|
}
|
2009-09-22 11:45:30 +00:00
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
/* combine these rotations */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, dmat, rmat);
|
2008-09-29 20:13:40 +00:00
|
|
|
}
|
|
|
|
|
2010-10-25 07:12:29 +00:00
|
|
|
void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
|
2009-12-19 10:27:23 +00:00
|
|
|
{
|
2010-10-26 12:48:07 +00:00
|
|
|
switch(ob->rotmode) {
|
|
|
|
case ROT_MODE_QUAT:
|
2009-12-19 10:27:23 +00:00
|
|
|
mat3_to_quat(ob->quat, mat);
|
2010-11-12 11:16:04 +00:00
|
|
|
sub_v4_v4(ob->quat, ob->dquat);
|
2010-10-26 12:48:07 +00:00
|
|
|
break;
|
|
|
|
case ROT_MODE_AXISANGLE:
|
2009-12-19 10:27:23 +00:00
|
|
|
mat3_to_axis_angle(ob->rotAxis, &ob->rotAngle, mat);
|
2010-11-12 11:16:04 +00:00
|
|
|
sub_v3_v3(ob->rotAxis, ob->drotAxis);
|
|
|
|
ob->rotAngle -= ob->drotAngle;
|
2010-10-26 12:48:07 +00:00
|
|
|
break;
|
|
|
|
default: /* euler */
|
|
|
|
if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, mat);
|
|
|
|
else mat3_to_eulO(ob->rot, ob->rotmode, mat);
|
2010-11-12 11:16:04 +00:00
|
|
|
sub_v3_v3(ob->rot, ob->drot);
|
2009-12-19 10:27:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-19 15:34:26 +00:00
|
|
|
/* see pchan_apply_mat4() for the equivalent 'pchan' function */
|
2010-11-08 22:32:28 +00:00
|
|
|
void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const short use_parent)
|
2009-12-19 10:27:23 +00:00
|
|
|
{
|
2010-10-26 12:48:07 +00:00
|
|
|
float rot[3][3];
|
2010-11-08 22:32:28 +00:00
|
|
|
|
|
|
|
if(use_parent && ob->parent) {
|
|
|
|
float rmat[4][4], diff_mat[4][4], imat[4][4];
|
|
|
|
mul_m4_m4m4(diff_mat, ob->parentinv, ob->parent->obmat);
|
|
|
|
invert_m4_m4(imat, diff_mat);
|
|
|
|
mul_m4_m4m4(rmat, mat, imat); /* get the parent relative matrix */
|
|
|
|
object_apply_mat4(ob, rmat, use_compat, FALSE);
|
|
|
|
|
|
|
|
/* same as below, use rmat rather then mat */
|
|
|
|
mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat);
|
|
|
|
object_mat3_to_rot(ob, rot, use_compat);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mat4_to_loc_rot_size(ob->loc, rot, ob->size, mat);
|
|
|
|
object_mat3_to_rot(ob, rot, use_compat);
|
|
|
|
}
|
2010-11-12 11:16:04 +00:00
|
|
|
|
|
|
|
sub_v3_v3(ob->loc, ob->dloc);
|
|
|
|
sub_v3_v3(ob->size, ob->dsize);
|
|
|
|
/* object_mat3_to_rot handles delta rotations */
|
2009-12-19 10:27:23 +00:00
|
|
|
}
|
|
|
|
|
2008-09-29 20:13:40 +00:00
|
|
|
void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
|
|
|
|
{
|
|
|
|
float smat[3][3];
|
|
|
|
float rmat[3][3];
|
|
|
|
/*float q1[4];*/
|
|
|
|
|
|
|
|
/* size */
|
|
|
|
object_scale_to_mat3(ob, smat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/* rot */
|
2009-09-28 10:19:20 +00:00
|
|
|
object_rot_to_mat3(ob, rmat);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, rmat, smat);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void object_to_mat4(Object *ob, float mat[][4])
|
|
|
|
{
|
|
|
|
float tmat[3][3];
|
|
|
|
|
|
|
|
object_to_mat3(ob, tmat);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m3(mat, tmat);
|
2010-07-03 17:47:06 +00:00
|
|
|
|
|
|
|
add_v3_v3v3(mat[3], ob->loc, ob->dloc);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int enable_cu_speed= 1;
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Curve *cu;
|
2010-10-10 07:01:56 +00:00
|
|
|
float vec[4], dir[3], quat[4], radius, ctime;
|
== Bone Groups ==
I'm committing some work-in-progress code for "bone groups" now, as I there have been are some major bugs caused by the timeoffset stuff (some of my test files were not loading, and other files were showing all sorts of weird problems).
Anyway, in this commit, the following things for "bone groups" have been done:
* Bone groups are stored per armature (internally, this is per bPose block)
* Added controls for editing bone-groups per armature - "add", "remove", "rename". These can be found in the "Links and Materials" panel in PoseMode, beside the settings for PoseLib.
* Reorganised buttons for editing selected bones in PoseMode. I've replaced the "dist" and "weight" buttons (they existed in EditMode anyway) with a menu to choose the bone-group and the custom-shape-ob field. In the place of the old custom-shape-ob field, I've restored the "Hide" button. This might break muscle-memory a bit, but there isn't a lot of space to play with there.
Some stuff I'd been originally planning to do before committing:
* When adding keyframes for bones, an action-group with the same name as the bone's group will be added to the action, and the action-channel will be made a member of that.
* New action/bone groups have unique names (renaming/adding new should check if name exists before assigning it)
* There's a setting under Bone-Groups stuff which sets which custom-colour set is used to colour that group's bones. Currently, this is non-functional, as the necessary drawing code for armatures is not in place yet.
2008-01-20 02:55:35 +00:00
|
|
|
float timeoffs = 0.0, sf_orig = 0.0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(mat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
cu= par->data;
|
2005-12-21 17:49:43 +00:00
|
|
|
if(cu->path==NULL || cu->path->data==NULL) /* only happens on reload file, but violates depsgraph still... fix! */
|
2009-01-04 14:14:06 +00:00
|
|
|
makeDispListCurveTypes(scene, par, 0);
|
2005-02-11 12:42:02 +00:00
|
|
|
if(cu->path==NULL) return;
|
|
|
|
|
|
|
|
/* exception, timeoffset is regarded as distance offset */
|
|
|
|
if(cu->flag & CU_OFFS_PATHDIST) {
|
2008-01-19 16:32:29 +00:00
|
|
|
timeoffs = give_timeoffset(ob);
|
|
|
|
SWAP(float, sf_orig, ob->sf);
|
2005-02-11 12:42:02 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-11-15 22:39:20 +00:00
|
|
|
/* catch exceptions: feature for nla stride editing */
|
|
|
|
if(ob->ipoflag & OB_DISABLE_PATH) {
|
|
|
|
ctime= 0.0f;
|
|
|
|
}
|
2003-04-26 13:07:59 +00:00
|
|
|
/* catch exceptions: curve paths used as a duplicator */
|
2005-11-15 22:39:20 +00:00
|
|
|
else if(enable_cu_speed) {
|
2009-06-20 11:44:56 +00:00
|
|
|
/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
|
|
|
|
* but this will only work if it actually is animated...
|
|
|
|
*
|
2009-12-14 06:25:42 +00:00
|
|
|
* we divide the curvetime calculated in the previous step by the length of the path, to get a time
|
|
|
|
* factor, which then gets clamped to lie within 0.0 - 1.0 range
|
2009-06-20 11:44:56 +00:00
|
|
|
*/
|
2009-12-14 06:25:42 +00:00
|
|
|
ctime= cu->ctime / cu->pathlen;
|
2009-06-20 11:44:56 +00:00
|
|
|
CLAMP(ctime, 0.0, 1.0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-01-04 14:14:06 +00:00
|
|
|
ctime= scene->r.cfra - give_timeoffset(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
ctime /= cu->pathlen;
|
|
|
|
|
|
|
|
CLAMP(ctime, 0.0, 1.0);
|
|
|
|
}
|
2005-02-11 12:42:02 +00:00
|
|
|
|
|
|
|
/* time calculus is correct, now apply distance offset */
|
|
|
|
if(cu->flag & CU_OFFS_PATHDIST) {
|
|
|
|
ctime += timeoffs/cu->path->totdist;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-02-11 12:42:02 +00:00
|
|
|
/* restore */
|
2008-01-19 16:32:29 +00:00
|
|
|
SWAP(float, sf_orig, ob->sf);
|
2005-02-11 12:42:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-21 10:42:42 +00:00
|
|
|
/* vec: 4 items! */
|
2010-10-08 07:29:08 +00:00
|
|
|
if( where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL) ) {
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(cu->flag & CU_FOLLOW) {
|
2010-10-08 07:29:08 +00:00
|
|
|
#if 0
|
2010-10-10 07:01:56 +00:00
|
|
|
float x1, q[4];
|
2009-11-10 20:43:45 +00:00
|
|
|
vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
|
2004-09-14 19:03:11 +00:00
|
|
|
|
|
|
|
/* the tilt */
|
2009-11-10 20:43:45 +00:00
|
|
|
normalize_v3(dir);
|
2002-10-12 11:37:38 +00:00
|
|
|
q[0]= (float)cos(0.5*vec[3]);
|
|
|
|
x1= (float)sin(0.5*vec[3]);
|
|
|
|
q[1]= -x1*dir[0];
|
|
|
|
q[2]= -x1*dir[1];
|
|
|
|
q[3]= -x1*dir[2];
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(quat, q, quat);
|
2010-10-08 07:29:08 +00:00
|
|
|
#else
|
|
|
|
quat_apply_track(quat, ob->trackflag, ob->upflag);
|
|
|
|
#endif
|
2010-12-07 01:56:32 +00:00
|
|
|
normalize_qt(quat);
|
|
|
|
quat_to_mat4(mat, quat);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2009-09-12 16:25:49 +00:00
|
|
|
if(cu->flag & CU_PATH_RADIUS) {
|
|
|
|
float tmat[4][4], rmat[4][4];
|
2009-11-10 20:43:45 +00:00
|
|
|
scale_m4_fl(tmat, radius);
|
|
|
|
mul_m4_m4m4(rmat, mat, tmat);
|
|
|
|
copy_m4_m4(mat, rmat);
|
2009-09-12 16:25:49 +00:00
|
|
|
}
|
|
|
|
|
2010-08-06 08:27:07 +00:00
|
|
|
copy_v3_v3(mat[3], vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-02 11:48:22 +00:00
|
|
|
static void ob_parbone(Object *ob, Object *par, float mat[][4])
|
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
|
|
|
bPoseChannel *pchan;
|
|
|
|
float vec[3];
|
|
|
|
|
2009-01-27 02:31:39 +00:00
|
|
|
if (par->type!=OB_ARMATURE) {
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(mat);
|
2002-10-12 11:37:38 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* Make sure the bone is still valid */
|
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
|
|
|
pchan= get_pose_channel(par->pose, ob->parsubstr);
|
|
|
|
if (!pchan){
|
2006-11-01 11:41:29 +00:00
|
|
|
printf ("Object %s with Bone parent: bone %s doesn't exist\n", ob->id.name+2, ob->parsubstr);
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(mat);
|
2002-10-12 11:37:38 +00:00
|
|
|
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
|
|
|
/* get bone transform */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(mat, pchan->pose_mat);
|
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
|
|
|
/* but for backwards compatibility, the child has to move to the tail */
|
2010-08-06 08:27:07 +00:00
|
|
|
copy_v3_v3(vec, mat[1]);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, pchan->bone->length);
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(mat[3], vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-04-02 11:48:22 +00:00
|
|
|
static void give_parvert(Object *par, int nr, float *vec)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2009-03-30 07:28:37 +00:00
|
|
|
EditMesh *em;
|
2002-10-12 11:37:38 +00:00
|
|
|
int a, count;
|
|
|
|
|
2006-09-08 12:05:36 +00:00
|
|
|
vec[0]=vec[1]=vec[2]= 0.0f;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(par->type==OB_MESH) {
|
2008-12-31 17:11:42 +00:00
|
|
|
Mesh *me= par->data;
|
2010-07-28 16:47:12 +00:00
|
|
|
DerivedMesh *dm;
|
2009-03-30 07:28:37 +00:00
|
|
|
|
2010-07-28 16:47:12 +00:00
|
|
|
em = BKE_mesh_get_editmesh(me);
|
|
|
|
dm = (em)? em->derivedFinal: par->derivedFinal;
|
2006-09-08 12:05:36 +00:00
|
|
|
|
2010-07-28 16:47:12 +00:00
|
|
|
if(dm) {
|
|
|
|
MVert *mvert= dm->getVertArray(dm);
|
|
|
|
int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
|
|
|
|
int i, count = 0, vindex, numVerts = dm->getNumVerts(dm);
|
|
|
|
|
|
|
|
/* get the average of all verts with (original index == nr) */
|
|
|
|
for(i = 0; i < numVerts; i++) {
|
|
|
|
vindex= (index)? index[i]: i;
|
|
|
|
|
|
|
|
if(vindex == nr) {
|
|
|
|
add_v3_v3(vec, mvert[i].co);
|
|
|
|
count++;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-04 16:36:39 +00:00
|
|
|
|
2010-07-28 16:47:12 +00:00
|
|
|
if (count==0) {
|
|
|
|
/* keep as 0,0,0 */
|
|
|
|
} else if(count > 0) {
|
|
|
|
mul_v3_fl(vec, 1.0f / count);
|
|
|
|
} else {
|
|
|
|
/* use first index if its out of range */
|
|
|
|
dm->getVertCo(dm, 0, vec);
|
2005-11-16 18:26:56 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2010-07-28 16:47:12 +00:00
|
|
|
|
|
|
|
if(em)
|
|
|
|
BKE_mesh_end_editmesh(me, em);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2009-01-02 19:10:35 +00:00
|
|
|
else if (ELEM(par->type, OB_CURVE, OB_SURF)) {
|
2006-09-08 12:05:36 +00:00
|
|
|
Nurb *nu;
|
|
|
|
Curve *cu;
|
|
|
|
BPoint *bp;
|
|
|
|
BezTriple *bezt;
|
2008-05-28 18:11:45 +00:00
|
|
|
int found= 0;
|
2010-07-25 11:57:36 +00:00
|
|
|
ListBase *nurbs;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cu= par->data;
|
2010-07-25 11:57:36 +00:00
|
|
|
nurbs= BKE_curve_nurbs(cu);
|
|
|
|
nu= nurbs->first;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
count= 0;
|
2008-05-28 18:11:45 +00:00
|
|
|
while(nu && !found) {
|
2009-09-08 00:23:33 +00:00
|
|
|
if(nu->type == CU_BEZIER) {
|
2002-10-12 11:37:38 +00:00
|
|
|
bezt= nu->bezt;
|
|
|
|
a= nu->pntsu;
|
|
|
|
while(a--) {
|
|
|
|
if(count==nr) {
|
2008-05-28 18:11:45 +00:00
|
|
|
found= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
VECCOPY(vec, bezt->vec[1]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
count++;
|
|
|
|
bezt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bp= nu->bp;
|
|
|
|
a= nu->pntsu*nu->pntsv;
|
|
|
|
while(a--) {
|
|
|
|
if(count==nr) {
|
2008-05-28 18:11:45 +00:00
|
|
|
found= 1;
|
|
|
|
memcpy(vec, bp->vec, sizeof(float)*3);
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
count++;
|
|
|
|
bp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nu= nu->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2006-09-08 12:05:36 +00:00
|
|
|
else if(par->type==OB_LATTICE) {
|
|
|
|
Lattice *latt= par->data;
|
|
|
|
BPoint *bp;
|
2006-09-16 10:46:53 +00:00
|
|
|
DispList *dl = find_displist(&par->disp, DL_VERTS);
|
|
|
|
float *co = dl?dl->verts:NULL;
|
2006-09-08 12:05:36 +00:00
|
|
|
|
2010-08-10 06:36:42 +00:00
|
|
|
if(latt->editlatt) latt= latt->editlatt->latt;
|
2006-09-08 12:05:36 +00:00
|
|
|
|
|
|
|
a= latt->pntsu*latt->pntsv*latt->pntsw;
|
|
|
|
count= 0;
|
|
|
|
bp= latt->def;
|
|
|
|
while(a--) {
|
|
|
|
if(count==nr) {
|
2006-09-16 10:46:53 +00:00
|
|
|
if(co)
|
|
|
|
memcpy(vec, co, 3*sizeof(float));
|
|
|
|
else
|
|
|
|
memcpy(vec, bp->vec, 3*sizeof(float));
|
2006-09-08 12:05:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
count++;
|
2006-09-16 10:46:53 +00:00
|
|
|
if(co) co+= 3;
|
|
|
|
else bp++;
|
2006-09-08 12:05:36 +00:00
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-04-02 11:48:22 +00:00
|
|
|
static void ob_parvert3(Object *ob, Object *par, float mat[][4])
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
float cmat[3][3], v1[3], v2[3], v3[3], q[4];
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* in local ob space */
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(mat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-01-02 19:10:35 +00:00
|
|
|
if (ELEM4(par->type, OB_MESH, OB_SURF, OB_CURVE, OB_LATTICE)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
give_parvert(par, ob->par1, v1);
|
|
|
|
give_parvert(par, ob->par2, v2);
|
|
|
|
give_parvert(par, ob->par3, v3);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
tri_to_quat( q,v1, v2, v3);
|
|
|
|
quat_to_mat3( cmat,q);
|
|
|
|
copy_m4_m3(mat, cmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(ob->type==OB_CURVE) {
|
|
|
|
VECCOPY(mat[3], v1);
|
|
|
|
}
|
|
|
|
else {
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(mat[3], v1, v2);
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(mat[3], v3);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(mat[3], 0.3333333f);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
// XXX what the hell is this?
|
2002-10-12 11:37:38 +00:00
|
|
|
static int no_parent_ipo=0;
|
|
|
|
void set_no_parent_ipo(int val)
|
|
|
|
{
|
|
|
|
no_parent_ipo= val;
|
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
void where_is_object_time(Scene *scene, Object *ob, float ctime)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
float *fp1, *fp2, slowmat[4][4] = MAT4_UNITY;
|
2010-01-30 13:15:39 +00:00
|
|
|
float stime=ctime, fac1, fac2;
|
2002-10-12 11:37:38 +00:00
|
|
|
int a;
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* new version: correct parent+vertexparent and track+parent */
|
|
|
|
/* this one only calculates direct attached parent and track */
|
2005-04-03 16:57:16 +00:00
|
|
|
/* is faster, but should keep track of timeoffs */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-13 13:56:15 +00:00
|
|
|
if(ob==NULL) return;
|
2005-07-22 19:24:10 +00:00
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
/* execute drivers only, as animation has already been done */
|
2009-01-17 14:56:12 +00:00
|
|
|
BKE_animsys_evaluate_animdata(&ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS);
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->parent) {
|
2006-11-11 16:45:17 +00:00
|
|
|
Object *par= ob->parent;
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
// XXX depreceated - animsys
|
2008-01-19 16:32:29 +00:00
|
|
|
if(ob->ipoflag & OB_OFFS_PARENT) ctime-= give_timeoffset(ob);
|
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
|
|
|
/* hurms, code below conflicts with depgraph... (ton) */
|
2006-09-17 11:40:28 +00:00
|
|
|
/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
|
|
|
|
if(no_parent_ipo==0 && stime != par->ctime) {
|
2005-05-20 20:44:33 +00:00
|
|
|
// only for ipo systems?
|
2010-01-22 11:03:55 +00:00
|
|
|
Object tmp= *par;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-11-30 15:54:21 +00:00
|
|
|
if(par->proxy_from); // was a copied matrix, no where_is! bad...
|
2009-01-04 14:14:06 +00:00
|
|
|
else where_is_object_time(scene, par, ctime);
|
2010-01-22 11:03:55 +00:00
|
|
|
|
|
|
|
solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
|
|
|
|
|
|
|
|
*par= tmp;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2010-01-22 11:03:55 +00:00
|
|
|
else
|
|
|
|
solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(ob->partype & PARSLOW) {
|
2005-05-20 20:44:33 +00:00
|
|
|
// include framerate
|
2009-02-10 09:18:04 +00:00
|
|
|
fac1= ( 1.0f / (1.0f + (float)fabs(give_timeoffset(ob))) );
|
|
|
|
if(fac1 >= 1.0f) return;
|
2002-10-12 11:37:38 +00:00
|
|
|
fac2= 1.0f-fac1;
|
|
|
|
|
|
|
|
fp1= ob->obmat[0];
|
|
|
|
fp2= slowmat[0];
|
|
|
|
for(a=0; a<16; a++, fp1++, fp2++) {
|
|
|
|
fp1[0]= fac1*fp1[0] + fac2*fp2[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
object_to_mat4(ob, ob->obmat);
|
|
|
|
}
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
/* solve constraints */
|
2010-01-12 19:51:26 +00:00
|
|
|
if (ob->constraints.first && !(ob->flag & OB_NO_CONSTRAINTS)) {
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
bConstraintOb *cob;
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
|
|
|
|
/* constraints need ctime, not stime. Some call where_is_object_time and bsystem_time */
|
|
|
|
solve_constraints (&ob->constraints, cob, ctime);
|
|
|
|
|
|
|
|
constraints_clear_evalob(cob);
|
|
|
|
}
|
2004-05-29 16:17:46 +00:00
|
|
|
|
|
|
|
/* set negative scale flag in object */
|
2010-01-30 13:15:39 +00:00
|
|
|
if(is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
|
|
|
|
else ob->transflag &= ~OB_NEG_SCALE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2009-01-10 19:34:23 +00:00
|
|
|
static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
float totmat[4][4];
|
|
|
|
float tmat[4][4];
|
2006-11-11 16:45:17 +00:00
|
|
|
float locmat[4][4];
|
2002-10-12 11:37:38 +00:00
|
|
|
float vec[3];
|
|
|
|
int ok;
|
2009-01-10 19:34:23 +00:00
|
|
|
|
2006-11-11 16:45:17 +00:00
|
|
|
object_to_mat4(ob, locmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
if(ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
switch(ob->partype & PARTYPE) {
|
|
|
|
case PAROBJECT:
|
|
|
|
ok= 0;
|
|
|
|
if(par->type==OB_CURVE) {
|
|
|
|
if( ((Curve *)par->data)->flag & CU_PATH ) {
|
2009-01-04 14:14:06 +00:00
|
|
|
ob_parcurve(scene, ob, par, tmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
ok= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
if(ok) mul_serie_m4(totmat, par->obmat, tmat,
|
2002-10-12 11:37:38 +00:00
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
2009-11-10 20:43:45 +00:00
|
|
|
else copy_m4_m4(totmat, par->obmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case PARBONE:
|
|
|
|
ob_parbone(ob, par, tmat);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m4(totmat, par->obmat, tmat,
|
2002-10-12 11:37:38 +00:00
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARVERT1:
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(totmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
if (simul){
|
|
|
|
VECCOPY(totmat[3], par->obmat[3]);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
give_parvert(par, ob->par1, vec);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_m4v3(totmat[3], par->obmat, vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PARVERT3:
|
|
|
|
ob_parvert3(ob, par, tmat);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m4(totmat, par->obmat, tmat,
|
2002-10-12 11:37:38 +00:00
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSKEL:
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(totmat, par->obmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-05-20 20:44:33 +00:00
|
|
|
// total
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m4(tmat, totmat, ob->parentinv,
|
2002-10-12 11:37:38 +00:00
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m4(obmat, tmat, locmat,
|
2002-10-12 11:37:38 +00:00
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
2006-11-11 16:45:17 +00:00
|
|
|
if (simul) {
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else{
|
2005-05-20 20:44:33 +00:00
|
|
|
// external usable originmat
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(originmat, tmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-05-20 20:44:33 +00:00
|
|
|
// origin, voor help line
|
2010-11-08 22:32:28 +00:00
|
|
|
if( (ob->partype & PARTYPE)==PARSKEL ) {
|
2002-10-12 11:37:38 +00:00
|
|
|
VECCOPY(ob->orig, par->obmat[3]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(ob->orig, totmat[3]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
void where_is_object(struct Scene *scene, Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2009-01-04 14:14:06 +00:00
|
|
|
where_is_object_time(scene, ob, (float)scene->r.cfra);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
void where_is_object_simul(Scene *scene, Object *ob)
|
2003-04-26 13:07:59 +00:00
|
|
|
/* was written for the old game engine (until 2.04) */
|
2002-10-12 11:37:38 +00:00
|
|
|
/* It seems that this function is only called
|
|
|
|
for a lamp that is the child of another object */
|
|
|
|
{
|
|
|
|
Object *par;
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
//Ipo *ipo;
|
2002-10-12 11:37:38 +00:00
|
|
|
float *fp1, *fp2;
|
|
|
|
float slowmat[4][4];
|
|
|
|
float fac1, fac2;
|
|
|
|
int a;
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* NO TIMEOFFS */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->parent) {
|
|
|
|
par= ob->parent;
|
|
|
|
|
2009-01-10 19:34:23 +00:00
|
|
|
solve_parenting(scene, ob, par, ob->obmat, slowmat, 1);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(ob->partype & PARSLOW) {
|
|
|
|
|
2008-01-19 16:32:29 +00:00
|
|
|
fac1= (float)(1.0/(1.0+ fabs(give_timeoffset(ob))));
|
2002-10-12 11:37:38 +00:00
|
|
|
fac2= 1.0f-fac1;
|
|
|
|
fp1= ob->obmat[0];
|
|
|
|
fp2= slowmat[0];
|
|
|
|
for(a=0; a<16; a++, fp1++, fp2++) {
|
|
|
|
fp1[0]= fac1*fp1[0] + fac2*fp2[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
object_to_mat4(ob, ob->obmat);
|
|
|
|
}
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
/* solve constraints */
|
|
|
|
if (ob->constraints.first) {
|
|
|
|
bConstraintOb *cob;
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
|
2009-02-10 09:18:04 +00:00
|
|
|
solve_constraints(&ob->constraints, cob, (float)scene->r.cfra);
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
constraints_clear_evalob(cob);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-03-09 17:21: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
|
|
|
/* for calculation of the inverse parent transform, only used for editor */
|
2009-01-04 14:14:06 +00:00
|
|
|
void what_does_parent(Scene *scene, Object *ob, Object *workob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2008-12-24 11:08:15 +00:00
|
|
|
clear_workob(workob);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(workob->obmat);
|
|
|
|
unit_m4(workob->parentinv);
|
|
|
|
unit_m4(workob->constinv);
|
2008-12-24 11:08:15 +00:00
|
|
|
workob->parent= ob->parent;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-24 11:08:15 +00:00
|
|
|
workob->trackflag= ob->trackflag;
|
|
|
|
workob->upflag= ob->upflag;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-24 11:08:15 +00:00
|
|
|
workob->partype= ob->partype;
|
|
|
|
workob->par1= ob->par1;
|
|
|
|
workob->par2= ob->par2;
|
|
|
|
workob->par3= ob->par3;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-24 11:08:15 +00:00
|
|
|
workob->constraints.first = ob->constraints.first;
|
|
|
|
workob->constraints.last = ob->constraints.last;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-24 11:08:15 +00:00
|
|
|
strcpy(workob->parsubstr, ob->parsubstr);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
where_is_object(scene, workob);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BoundBox *unit_boundbox()
|
|
|
|
{
|
|
|
|
BoundBox *bb;
|
2009-02-10 09:18:04 +00:00
|
|
|
float min[3] = {-1.0f,-1.0f,-1.0f}, max[3] = {-1.0f,-1.0f,-1.0f};
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-01-05 19:11:10 +00:00
|
|
|
bb= MEM_callocN(sizeof(BoundBox), "bb");
|
2005-07-18 17:33:51 +00:00
|
|
|
boundbox_set_from_min_max(bb, min, max);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-18 17:33:51 +00:00
|
|
|
return bb;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-18 17:33:51 +00:00
|
|
|
void boundbox_set_from_min_max(BoundBox *bb, float min[3], float max[3])
|
|
|
|
{
|
|
|
|
bb->vec[0][0]=bb->vec[1][0]=bb->vec[2][0]=bb->vec[3][0]= min[0];
|
|
|
|
bb->vec[4][0]=bb->vec[5][0]=bb->vec[6][0]=bb->vec[7][0]= max[0];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-18 17:33:51 +00:00
|
|
|
bb->vec[0][1]=bb->vec[1][1]=bb->vec[4][1]=bb->vec[5][1]= min[1];
|
|
|
|
bb->vec[2][1]=bb->vec[3][1]=bb->vec[6][1]=bb->vec[7][1]= max[1];
|
|
|
|
|
|
|
|
bb->vec[0][2]=bb->vec[3][2]=bb->vec[4][2]=bb->vec[7][2]= min[2];
|
|
|
|
bb->vec[1][2]=bb->vec[2][2]=bb->vec[5][2]=bb->vec[6][2]= max[2];
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-06-14 08:50:41 +00:00
|
|
|
BoundBox *object_get_boundbox(Object *ob)
|
|
|
|
{
|
|
|
|
BoundBox *bb= NULL;
|
|
|
|
|
|
|
|
if(ob->type==OB_MESH) {
|
2007-12-05 21:50:23 +00:00
|
|
|
bb = mesh_get_bb(ob);
|
2006-06-14 08:50:41 +00:00
|
|
|
}
|
2009-01-02 19:10:35 +00:00
|
|
|
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
|
2010-03-05 16:47:52 +00:00
|
|
|
bb= ob->bb ? ob->bb : ( (Curve *)ob->data )->bb;
|
2006-06-14 08:50:41 +00:00
|
|
|
}
|
|
|
|
else if(ob->type==OB_MBALL) {
|
|
|
|
bb= ob->bb;
|
|
|
|
}
|
|
|
|
return bb;
|
|
|
|
}
|
|
|
|
|
2006-11-29 12:44:48 +00:00
|
|
|
/* used to temporally disable/enable boundbox */
|
|
|
|
void object_boundbox_flag(Object *ob, int flag, int set)
|
|
|
|
{
|
|
|
|
BoundBox *bb= object_get_boundbox(ob);
|
|
|
|
if(bb) {
|
|
|
|
if(set) bb->flag |= flag;
|
|
|
|
else bb->flag &= ~flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-25 06:27:25 +00:00
|
|
|
void object_get_dimensions(Object *ob, float *value)
|
|
|
|
{
|
|
|
|
BoundBox *bb = NULL;
|
|
|
|
|
|
|
|
bb= object_get_boundbox(ob);
|
|
|
|
if (bb) {
|
|
|
|
float scale[3];
|
|
|
|
|
|
|
|
mat4_to_size( scale,ob->obmat);
|
|
|
|
|
|
|
|
value[0] = fabs(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
|
|
|
|
value[1] = fabs(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
|
|
|
|
value[2] = fabs(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
|
|
|
|
} else {
|
|
|
|
value[0] = value[1] = value[2] = 0.f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void object_set_dimensions(Object *ob, const float *value)
|
|
|
|
{
|
|
|
|
BoundBox *bb = NULL;
|
|
|
|
|
|
|
|
bb= object_get_boundbox(ob);
|
|
|
|
if (bb) {
|
|
|
|
float scale[3], len[3];
|
|
|
|
|
|
|
|
mat4_to_size( scale,ob->obmat);
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
if (len[0] > 0.f) ob->size[0] = value[0] / len[0];
|
|
|
|
if (len[1] > 0.f) ob->size[1] = value[1] / len[1];
|
|
|
|
if (len[2] > 0.f) ob->size[2] = value[2] / len[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
void minmax_object(Object *ob, float *min, float *max)
|
|
|
|
{
|
|
|
|
BoundBox bb;
|
|
|
|
Mesh *me;
|
|
|
|
Curve *cu;
|
|
|
|
float vec[3];
|
|
|
|
int a;
|
|
|
|
|
|
|
|
switch(ob->type) {
|
|
|
|
|
|
|
|
case OB_CURVE:
|
|
|
|
case OB_FONT:
|
|
|
|
case OB_SURF:
|
|
|
|
cu= ob->data;
|
|
|
|
|
2006-06-14 08:50:41 +00:00
|
|
|
if(cu->bb==NULL) tex_space_curve(cu);
|
2002-10-12 11:37:38 +00:00
|
|
|
bb= *(cu->bb);
|
|
|
|
|
|
|
|
for(a=0; a<8; a++) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(ob->obmat, bb.vec[a]);
|
2002-10-12 11:37:38 +00:00
|
|
|
DO_MINMAX(bb.vec[a], min, max);
|
|
|
|
}
|
|
|
|
break;
|
2005-07-11 17:12:33 +00:00
|
|
|
case OB_ARMATURE:
|
|
|
|
if(ob->pose) {
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
2010-07-26 06:34:56 +00:00
|
|
|
mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
|
2005-07-11 17:12:33 +00:00
|
|
|
DO_MINMAX(vec, min, max);
|
2010-07-26 06:34:56 +00:00
|
|
|
mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
|
2005-07-11 17:12:33 +00:00
|
|
|
DO_MINMAX(vec, min, max);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* no break, get_mesh will give NULL and it passes on to default */
|
2002-10-12 11:37:38 +00:00
|
|
|
case OB_MESH:
|
|
|
|
me= get_mesh(ob);
|
|
|
|
|
|
|
|
if(me) {
|
2007-12-05 21:50:23 +00:00
|
|
|
bb = *mesh_get_bb(ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
for(a=0; a<8; a++) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(ob->obmat, bb.vec[a]);
|
2002-10-12 11:37:38 +00:00
|
|
|
DO_MINMAX(bb.vec[a], min, max);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(min[0] < max[0] ) break;
|
|
|
|
|
|
|
|
/* else here no break!!!, mesh can be zero sized */
|
|
|
|
|
|
|
|
default:
|
|
|
|
DO_MINMAX(ob->obmat[3], min, max);
|
|
|
|
|
2010-04-23 23:57:00 +00:00
|
|
|
copy_v3_v3(vec, ob->obmat[3]);
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, ob->size);
|
2002-10-12 11:37:38 +00:00
|
|
|
DO_MINMAX(vec, min, max);
|
|
|
|
|
2010-04-23 23:57:00 +00:00
|
|
|
copy_v3_v3(vec, ob->obmat[3]);
|
|
|
|
sub_v3_v3(vec, ob->size);
|
2002-10-12 11:37:38 +00:00
|
|
|
DO_MINMAX(vec, min, max);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-24 20:11:35 +00:00
|
|
|
int minmax_object_duplis(Scene *scene, Object *ob, float *min, float *max)
|
2007-04-14 13:18:24 +00:00
|
|
|
{
|
2010-02-24 20:11:35 +00:00
|
|
|
int ok= 0;
|
2007-04-14 13:18:24 +00:00
|
|
|
if ((ob->transflag & OB_DUPLI)==0) {
|
2010-02-24 20:11:35 +00:00
|
|
|
return ok;
|
2007-04-14 13:18:24 +00:00
|
|
|
} else {
|
|
|
|
ListBase *lb;
|
|
|
|
DupliObject *dob;
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
lb= object_duplilist(scene, ob);
|
2007-04-14 13:18:24 +00:00
|
|
|
for(dob= lb->first; dob; dob= dob->next) {
|
2010-02-24 20:11:35 +00:00
|
|
|
if(dob->no_draw == 0) {
|
|
|
|
BoundBox *bb= object_get_boundbox(dob->ob);
|
|
|
|
|
|
|
|
if(bb) {
|
|
|
|
int i;
|
|
|
|
for(i=0; i<8; i++) {
|
|
|
|
float vec[3];
|
|
|
|
mul_v3_m4v3(vec, dob->mat, bb->vec[i]);
|
|
|
|
DO_MINMAX(vec, min, max);
|
|
|
|
}
|
|
|
|
|
|
|
|
ok= 1;
|
|
|
|
}
|
2007-04-14 13:18:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
free_object_duplilist(lb); /* does restore */
|
|
|
|
}
|
2010-02-24 20:11:35 +00:00
|
|
|
|
|
|
|
return ok;
|
2007-04-14 13:18:24 +00:00
|
|
|
}
|
|
|
|
|
2010-02-26 08:47:20 +00:00
|
|
|
/* copied from DNA_object_types.h */
|
|
|
|
typedef struct ObTfmBack {
|
|
|
|
float loc[3], dloc[3], orig[3];
|
|
|
|
float size[3], dsize[3]; /* scale and delta scale */
|
|
|
|
float rot[3], drot[3]; /* euler rotation */
|
|
|
|
float quat[4], dquat[4]; /* quaternion rotation */
|
|
|
|
float rotAxis[3], drotAxis[3]; /* axis angle rotation - axis part */
|
|
|
|
float rotAngle, drotAngle; /* axis angle rotation - angle part */
|
|
|
|
float obmat[4][4]; /* final worldspace matrix with constraints & animsys applied */
|
|
|
|
float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
|
|
|
|
float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
|
|
|
|
float imat[4][4]; /* inverse matrix of 'obmat' for during render, old game engine, temporally: ipokeys of transform */
|
|
|
|
} ObTfmBack;
|
|
|
|
|
|
|
|
void *object_tfm_backup(Object *ob)
|
|
|
|
{
|
|
|
|
ObTfmBack *obtfm= MEM_mallocN(sizeof(ObTfmBack), "ObTfmBack");
|
|
|
|
copy_v3_v3(obtfm->loc, ob->loc);
|
|
|
|
copy_v3_v3(obtfm->dloc, ob->dloc);
|
|
|
|
copy_v3_v3(obtfm->orig, ob->orig);
|
|
|
|
copy_v3_v3(obtfm->size, ob->size);
|
|
|
|
copy_v3_v3(obtfm->dsize, ob->dsize);
|
|
|
|
copy_v3_v3(obtfm->rot, ob->rot);
|
|
|
|
copy_v3_v3(obtfm->drot, ob->drot);
|
|
|
|
copy_qt_qt(obtfm->quat, ob->quat);
|
|
|
|
copy_qt_qt(obtfm->dquat, ob->dquat);
|
|
|
|
copy_v3_v3(obtfm->rotAxis, ob->rotAxis);
|
|
|
|
copy_v3_v3(obtfm->drotAxis, ob->drotAxis);
|
|
|
|
obtfm->rotAngle= ob->rotAngle;
|
|
|
|
obtfm->drotAngle= ob->drotAngle;
|
|
|
|
copy_m4_m4(obtfm->obmat, ob->obmat);
|
|
|
|
copy_m4_m4(obtfm->parentinv, ob->parentinv);
|
|
|
|
copy_m4_m4(obtfm->constinv, ob->constinv);
|
|
|
|
copy_m4_m4(obtfm->imat, ob->imat);
|
|
|
|
|
|
|
|
return (void *)obtfm;
|
|
|
|
}
|
|
|
|
|
|
|
|
void object_tfm_restore(Object *ob, void *obtfm_pt)
|
|
|
|
{
|
|
|
|
ObTfmBack *obtfm= (ObTfmBack *)obtfm_pt;
|
|
|
|
copy_v3_v3(ob->loc, obtfm->loc);
|
|
|
|
copy_v3_v3(ob->dloc, obtfm->dloc);
|
|
|
|
copy_v3_v3(ob->orig, obtfm->orig);
|
|
|
|
copy_v3_v3(ob->size, obtfm->size);
|
|
|
|
copy_v3_v3(ob->dsize, obtfm->dsize);
|
|
|
|
copy_v3_v3(ob->rot, obtfm->rot);
|
|
|
|
copy_v3_v3(ob->drot, obtfm->drot);
|
|
|
|
copy_qt_qt(ob->quat, obtfm->quat);
|
|
|
|
copy_qt_qt(ob->dquat, obtfm->dquat);
|
|
|
|
copy_v3_v3(ob->rotAxis, obtfm->rotAxis);
|
|
|
|
copy_v3_v3(ob->drotAxis, obtfm->drotAxis);
|
|
|
|
ob->rotAngle= obtfm->rotAngle;
|
|
|
|
ob->drotAngle= obtfm->drotAngle;
|
|
|
|
copy_m4_m4(ob->obmat, obtfm->obmat);
|
|
|
|
copy_m4_m4(ob->parentinv, obtfm->parentinv);
|
|
|
|
copy_m4_m4(ob->constinv, obtfm->constinv);
|
|
|
|
copy_m4_m4(ob->imat, obtfm->imat);
|
|
|
|
}
|
2007-04-14 13:18:24 +00:00
|
|
|
|
2006-11-30 15:54:21 +00:00
|
|
|
/* proxy rule: lib_object->proxy_from == the one we borrow from, only set temporal and cleared here */
|
|
|
|
/* local_object->proxy == pointer to library object, saved in files and read */
|
2006-11-11 16:45:17 +00:00
|
|
|
|
2006-11-14 15:27:43 +00:00
|
|
|
/* function below is polluted with proxy exceptions, cleanup will follow! */
|
2006-11-11 16:45:17 +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
|
|
|
/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
|
|
|
|
/* requires flags to be set! */
|
2009-01-04 14:14:06 +00:00
|
|
|
void object_handle_update(Scene *scene, Object *ob)
|
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
|
|
|
{
|
2010-07-05 03:55:28 +00:00
|
|
|
if(ob->recalc & OB_RECALC_ALL) {
|
2010-03-26 10:33:53 +00:00
|
|
|
/* speed optimization for animation lookups */
|
|
|
|
if(ob->pose)
|
|
|
|
make_pose_channels_hash(ob->pose);
|
|
|
|
|
2010-07-07 18:47:49 +00:00
|
|
|
if(ob->recalc & OB_RECALC_DATA) {
|
|
|
|
if(ob->type==OB_ARMATURE) {
|
|
|
|
/* this happens for reading old files and to match library armatures
|
|
|
|
with poses we do it ahead of where_is_object to ensure animation
|
|
|
|
is evaluated on the rebuilt pose, otherwise we get incorrect poses
|
|
|
|
on file load */
|
|
|
|
if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
|
|
|
|
armature_rebuild_pose(ob, ob->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-20 16:18:37 +00:00
|
|
|
/* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers,
|
|
|
|
which is only in where_is_object now */
|
2010-07-05 03:55:28 +00:00
|
|
|
// XXX: should this case be OB_RECALC_OB instead?
|
|
|
|
if(ob->recalc & OB_RECALC_ALL) {
|
2009-01-29 23:27:24 +00:00
|
|
|
|
|
|
|
if (G.f & G_DEBUG)
|
|
|
|
printf("recalcob %s\n", ob->id.name+2);
|
2006-11-30 15:54:21 +00:00
|
|
|
|
|
|
|
/* handle proxy copy for target */
|
|
|
|
if(ob->id.lib && ob->proxy_from) {
|
|
|
|
// printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
|
|
|
|
if(ob->proxy_from->proxy_group) {/* transform proxy into group space */
|
|
|
|
Object *obg= ob->proxy_from->proxy_group;
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(obg->imat, obg->obmat);
|
|
|
|
mul_m4_m4m4(ob->obmat, ob->proxy_from->obmat, obg->imat);
|
2006-11-14 15:27:43 +00:00
|
|
|
}
|
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(ob->obmat, ob->proxy_from->obmat);
|
2006-11-14 15:27:43 +00:00
|
|
|
}
|
2006-11-11 16:45:17 +00:00
|
|
|
else
|
2009-01-04 14:14:06 +00:00
|
|
|
where_is_object(scene, ob);
|
2006-11-11 16:45:17 +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(ob->recalc & OB_RECALC_DATA) {
|
2009-11-26 03:43:39 +00:00
|
|
|
ID *data_id= (ID *)ob->data;
|
|
|
|
AnimData *adt= BKE_animdata_from_id(data_id);
|
|
|
|
float ctime= (float)scene->r.cfra; // XXX this is bad...
|
2010-04-13 20:06:55 +00:00
|
|
|
ListBase pidlist;
|
|
|
|
PTCacheID *pid;
|
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
|
|
|
|
2009-01-29 23:27:24 +00:00
|
|
|
if (G.f & G_DEBUG)
|
|
|
|
printf("recalcdata %s\n", ob->id.name+2);
|
2010-11-19 07:40:17 +00:00
|
|
|
|
|
|
|
if(adt) {
|
2009-01-22 10:53:22 +00:00
|
|
|
/* evaluate drivers */
|
2010-11-19 07:40:17 +00:00
|
|
|
// XXX: for mesh types, should we push this to derivedmesh instead?
|
2009-01-22 10:53:22 +00:00
|
|
|
BKE_animsys_evaluate_animdata(data_id, adt, ctime, ADT_RECALC_DRIVERS);
|
2008-04-19 02:19:46 +00:00
|
|
|
}
|
2010-11-19 07:40:17 +00:00
|
|
|
|
|
|
|
/* includes all keys and modifiers */
|
|
|
|
switch(ob->type) {
|
|
|
|
case OB_MESH:
|
|
|
|
{
|
|
|
|
EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
|
|
|
|
// here was vieweditdatamask? XXX
|
|
|
|
if(em) {
|
|
|
|
makeDerivedMesh(scene, ob, em, CD_MASK_BAREMESH);
|
|
|
|
BKE_mesh_end_editmesh(ob->data, em);
|
|
|
|
} else
|
|
|
|
makeDerivedMesh(scene, ob, NULL, CD_MASK_BAREMESH);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OB_ARMATURE:
|
2006-11-30 15:54:21 +00:00
|
|
|
if(ob->id.lib && ob->proxy_from) {
|
|
|
|
// printf("pose proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
|
2010-11-19 07:40:17 +00:00
|
|
|
copy_pose_result(ob->pose, ob->proxy_from->pose);
|
2006-11-30 15:54:21 +00:00
|
|
|
}
|
2006-11-11 16:45:17 +00:00
|
|
|
else {
|
2009-01-04 14:14:06 +00:00
|
|
|
where_is_pose(scene, ob);
|
2006-11-11 16:45:17 +00:00
|
|
|
}
|
2010-11-19 07:40:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OB_MBALL:
|
|
|
|
makeDispListMBall(scene, ob);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OB_CURVE:
|
|
|
|
case OB_SURF:
|
|
|
|
case OB_FONT:
|
|
|
|
makeDispListCurveTypes(scene, ob, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OB_LATTICE:
|
|
|
|
lattice_calc_modifiers(scene, ob);
|
|
|
|
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
|
|
|
}
|
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
|
|
|
|
2010-11-19 07:40:17 +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(ob->particlesystem.first) {
|
|
|
|
ParticleSystem *tpsys, *psys;
|
2008-01-17 12:02:15 +00:00
|
|
|
DerivedMesh *dm;
|
2009-07-20 23:52:53 +00:00
|
|
|
ob->transflag &= ~OB_DUPLIPARTS;
|
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
|
|
|
|
|
|
|
psys= ob->particlesystem.first;
|
|
|
|
while(psys) {
|
2007-12-18 16:55:09 +00:00
|
|
|
if(psys_check_enabled(ob, psys)) {
|
2009-07-20 23:52:53 +00:00
|
|
|
/* check use of dupli objects here */
|
2010-09-02 07:24:38 +00:00
|
|
|
if(psys->part && (psys->part->draw_as == PART_DRAW_REND || G.rendering) &&
|
2009-07-20 23:52:53 +00:00
|
|
|
((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob)
|
|
|
|
|| (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
|
|
|
|
ob->transflag |= OB_DUPLIPARTS;
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
particle_system_update(scene, ob, psys);
|
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
|
|
|
psys= psys->next;
|
|
|
|
}
|
|
|
|
else if(psys->flag & PSYS_DELETE) {
|
|
|
|
tpsys=psys->next;
|
|
|
|
BLI_remlink(&ob->particlesystem, psys);
|
|
|
|
psys_free(ob,psys);
|
|
|
|
psys= tpsys;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
psys= psys->next;
|
|
|
|
}
|
2008-01-17 12:02:15 +00:00
|
|
|
|
|
|
|
if(G.rendering && ob->transflag & OB_DUPLIPARTS) {
|
|
|
|
/* this is to make sure we get render level duplis in groups:
|
|
|
|
* the derivedmesh must be created before init_render_mesh,
|
|
|
|
* since object_duplilist does dupliparticles before that */
|
2009-01-04 14:14:06 +00:00
|
|
|
dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
|
2008-01-17 12:02:15 +00:00
|
|
|
dm->release(dm);
|
2008-01-18 14:30:26 +00:00
|
|
|
|
|
|
|
for(psys=ob->particlesystem.first; psys; psys=psys->next)
|
|
|
|
psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
|
2008-01-17 12:02:15 +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
|
|
|
}
|
2010-04-13 20:06:55 +00:00
|
|
|
|
|
|
|
/* check if quick cache is needed */
|
|
|
|
BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
|
|
|
|
|
|
|
|
for(pid=pidlist.first; pid; pid=pid->next) {
|
|
|
|
if((pid->cache->flag & PTCACHE_BAKED)
|
|
|
|
|| (pid->cache->flag & PTCACHE_QUICK_CACHE)==0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID)==0) {
|
|
|
|
scene->physics_settings.quick_cache_step =
|
|
|
|
scene->physics_settings.quick_cache_step ?
|
|
|
|
MIN2(scene->physics_settings.quick_cache_step, pid->cache->step) :
|
|
|
|
pid->cache->step;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_freelistN(&pidlist);
|
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
|
|
|
}
|
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
|
|
|
|
2006-11-14 15:27:43 +00:00
|
|
|
/* the no-group proxy case, we call update */
|
2006-11-30 15:54:21 +00:00
|
|
|
if(ob->proxy && ob->proxy_group==NULL) {
|
2006-11-14 15:27:43 +00:00
|
|
|
/* set pointer in library proxy target, for copying, but restore it */
|
2006-11-30 15:54:21 +00:00
|
|
|
ob->proxy->proxy_from= ob;
|
|
|
|
// printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name);
|
2009-01-04 14:14:06 +00:00
|
|
|
object_handle_update(scene, ob->proxy);
|
2006-11-14 15:27:43 +00:00
|
|
|
}
|
|
|
|
|
2010-07-05 03:55:28 +00:00
|
|
|
ob->recalc &= ~OB_RECALC_ALL;
|
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-11-14 15:27:43 +00:00
|
|
|
|
|
|
|
/* the case when this is a group proxy, object_update is called in group.c */
|
2006-11-30 15:54:21 +00:00
|
|
|
if(ob->proxy) {
|
|
|
|
ob->proxy->proxy_from= ob;
|
|
|
|
// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
|
2006-11-14 15:27:43 +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
|
|
|
}
|
2008-01-19 16:32:29 +00:00
|
|
|
|
|
|
|
float give_timeoffset(Object *ob) {
|
|
|
|
if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) {
|
|
|
|
return ob->sf + give_timeoffset(ob->parent);
|
|
|
|
} else {
|
|
|
|
return ob->sf;
|
|
|
|
}
|
== Bone Groups ==
I'm committing some work-in-progress code for "bone groups" now, as I there have been are some major bugs caused by the timeoffset stuff (some of my test files were not loading, and other files were showing all sorts of weird problems).
Anyway, in this commit, the following things for "bone groups" have been done:
* Bone groups are stored per armature (internally, this is per bPose block)
* Added controls for editing bone-groups per armature - "add", "remove", "rename". These can be found in the "Links and Materials" panel in PoseMode, beside the settings for PoseLib.
* Reorganised buttons for editing selected bones in PoseMode. I've replaced the "dist" and "weight" buttons (they existed in EditMode anyway) with a menu to choose the bone-group and the custom-shape-ob field. In the place of the old custom-shape-ob field, I've restored the "Hide" button. This might break muscle-memory a bit, but there isn't a lot of space to play with there.
Some stuff I'd been originally planning to do before committing:
* When adding keyframes for bones, an action-group with the same name as the bone's group will be added to the action, and the action-channel will be made a member of that.
* New action/bone groups have unique names (renaming/adding new should check if name exists before assigning it)
* There's a setting under Bone-Groups stuff which sets which custom-colour set is used to colour that group's bones. Currently, this is non-functional, as the necessary drawing code for armatures is not in place yet.
2008-01-20 02:55:35 +00:00
|
|
|
}
|
2008-04-01 11:14:34 +00:00
|
|
|
|
2009-10-15 09:00:40 +00:00
|
|
|
int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, float **rot) {
|
2008-04-01 11:14:34 +00:00
|
|
|
|
|
|
|
if (ob->data==NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (GS(((ID *)ob->data)->name)) {
|
|
|
|
case ID_ME:
|
|
|
|
{
|
|
|
|
Mesh *me= ob->data;
|
|
|
|
if (texflag) *texflag = &me->texflag;
|
|
|
|
if (loc) *loc = me->loc;
|
|
|
|
if (size) *size = me->size;
|
|
|
|
if (rot) *rot = me->rot;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ID_CU:
|
|
|
|
{
|
|
|
|
Curve *cu= ob->data;
|
|
|
|
if (texflag) *texflag = &cu->texflag;
|
|
|
|
if (loc) *loc = cu->loc;
|
|
|
|
if (size) *size = cu->size;
|
|
|
|
if (rot) *rot = cu->rot;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ID_MB:
|
|
|
|
{
|
|
|
|
MetaBall *mb= ob->data;
|
|
|
|
if (texflag) *texflag = &mb->texflag;
|
|
|
|
if (loc) *loc = mb->loc;
|
|
|
|
if (size) *size = mb->size;
|
|
|
|
if (rot) *rot = mb->rot;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2008-06-09 17:50:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Test a bounding box for ray intersection
|
|
|
|
* assumes the ray is already local to the boundbox space
|
|
|
|
*/
|
|
|
|
int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3])
|
|
|
|
{
|
|
|
|
static int triangle_indexes[12][3] = {{0, 1, 2}, {0, 2, 3},
|
|
|
|
{3, 2, 6}, {3, 6, 7},
|
|
|
|
{1, 2, 6}, {1, 6, 5},
|
|
|
|
{5, 6, 7}, {4, 5, 7},
|
|
|
|
{0, 3, 7}, {0, 4, 7},
|
|
|
|
{0, 1, 5}, {0, 4, 5}};
|
|
|
|
int result = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 12 && result == 0; i++)
|
|
|
|
{
|
|
|
|
float lambda;
|
|
|
|
int v1, v2, v3;
|
|
|
|
v1 = triangle_indexes[i][0];
|
|
|
|
v2 = triangle_indexes[i][1];
|
|
|
|
v3 = triangle_indexes[i][2];
|
2009-11-10 20:43:45 +00:00
|
|
|
result = isect_ray_tri_v3(ray_start, ray_normal, bb->vec[v1], bb->vec[v2], bb->vec[v3], &lambda, NULL);
|
2008-06-09 17:50:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2009-08-25 18:41:36 +00:00
|
|
|
|
|
|
|
static int pc_cmp(void *a, void *b)
|
|
|
|
{
|
|
|
|
LinkData *ad = a, *bd = b;
|
2009-09-17 14:46:22 +00:00
|
|
|
if(GET_INT_FROM_POINTER(ad->data) > GET_INT_FROM_POINTER(bd->data))
|
2009-08-25 18:41:36 +00:00
|
|
|
return 1;
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-25 18:53:20 +00:00
|
|
|
int object_insert_ptcache(Object *ob)
|
2009-08-25 18:41:36 +00:00
|
|
|
{
|
|
|
|
LinkData *link = NULL;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
BLI_sortlist(&ob->pc_ids, pc_cmp);
|
|
|
|
|
|
|
|
for(link=ob->pc_ids.first, i = 0; link; link=link->next, i++)
|
|
|
|
{
|
2009-09-17 14:46:22 +00:00
|
|
|
int index = GET_INT_FROM_POINTER(link->data);
|
2009-08-25 18:41:36 +00:00
|
|
|
|
|
|
|
if(i < index)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
link = MEM_callocN(sizeof(LinkData), "PCLink");
|
2009-09-17 14:46:22 +00:00
|
|
|
link->data = SET_INT_IN_POINTER(i);
|
2009-08-25 18:41:36 +00:00
|
|
|
BLI_addtail(&ob->pc_ids, link);
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2010-03-05 14:06:39 +00:00
|
|
|
/* 'lens' may be set for envmap only */
|
|
|
|
void object_camera_matrix(
|
|
|
|
RenderData *rd, Object *camera, int winx, int winy, short field_second,
|
|
|
|
float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens, float *ycor,
|
|
|
|
float *viewdx, float *viewdy
|
|
|
|
) {
|
|
|
|
Camera *cam=NULL;
|
|
|
|
float pixsize;
|
|
|
|
float shiftx=0.0, shifty=0.0, winside, viewfac;
|
|
|
|
|
2010-07-09 19:20:57 +00:00
|
|
|
rd->mode &= ~(R_ORTHO|R_PANORAMA);
|
2010-03-05 19:57:10 +00:00
|
|
|
|
2010-03-05 14:06:39 +00:00
|
|
|
/* question mark */
|
|
|
|
(*ycor)= rd->yasp / rd->xasp;
|
|
|
|
if(rd->mode & R_FIELDS)
|
|
|
|
(*ycor) *= 2.0f;
|
|
|
|
|
|
|
|
if(camera->type==OB_CAMERA) {
|
|
|
|
cam= camera->data;
|
|
|
|
|
|
|
|
if(cam->type==CAM_ORTHO) rd->mode |= R_ORTHO;
|
|
|
|
if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
|
|
|
|
|
|
|
|
/* solve this too... all time depending stuff is in convertblender.c?
|
|
|
|
* Need to update the camera early because it's used for projection matrices
|
|
|
|
* and other stuff BEFORE the animation update loop is done
|
|
|
|
* */
|
|
|
|
#if 0 // XXX old animation system
|
|
|
|
if(cam->ipo) {
|
|
|
|
calc_ipo(cam->ipo, frame_to_float(re->scene, re->r.cfra));
|
|
|
|
execute_ipo(&cam->id, cam->ipo);
|
|
|
|
}
|
|
|
|
#endif // XXX old animation system
|
|
|
|
shiftx=cam->shiftx;
|
|
|
|
shifty=cam->shifty;
|
|
|
|
(*lens)= cam->lens;
|
|
|
|
(*clipsta)= cam->clipsta;
|
|
|
|
(*clipend)= cam->clipend;
|
|
|
|
}
|
|
|
|
else if(camera->type==OB_LAMP) {
|
|
|
|
Lamp *la= camera->data;
|
|
|
|
float fac= cos( M_PI*la->spotsize/360.0 );
|
|
|
|
float phi= acos(fac);
|
|
|
|
|
|
|
|
(*lens)= 16.0*fac/sin(phi);
|
|
|
|
if((*lens)==0.0f)
|
|
|
|
(*lens)= 35.0;
|
|
|
|
(*clipsta)= la->clipsta;
|
|
|
|
(*clipend)= la->clipend;
|
|
|
|
}
|
|
|
|
else { /* envmap exception... */;
|
|
|
|
if((*lens)==0.0f)
|
|
|
|
(*lens)= 16.0;
|
|
|
|
|
|
|
|
if((*clipsta)==0.0f || (*clipend)==0.0f) {
|
|
|
|
(*clipsta)= 0.1f;
|
|
|
|
(*clipend)= 1000.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ortho only with camera available */
|
|
|
|
if(cam && rd->mode & R_ORTHO) {
|
|
|
|
if(rd->xasp*winx >= rd->yasp*winy) {
|
|
|
|
viewfac= winx;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
viewfac= (*ycor) * winy;
|
|
|
|
}
|
|
|
|
/* ortho_scale == 1.0 means exact 1 to 1 mapping */
|
|
|
|
pixsize= cam->ortho_scale/viewfac;
|
|
|
|
}
|
|
|
|
else {
|
2010-03-05 22:01:42 +00:00
|
|
|
if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx)/32.0;
|
|
|
|
else viewfac= (*ycor) * ((*lens) * winy)/32.0;
|
2010-03-05 14:06:39 +00:00
|
|
|
pixsize= (*clipsta) / viewfac;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */
|
|
|
|
winside= MAX2(winx, winy);
|
|
|
|
viewplane->xmin= -0.5f*(float)winx + shiftx*winside;
|
|
|
|
viewplane->ymin= -0.5f*(*ycor)*(float)winy + shifty*winside;
|
|
|
|
viewplane->xmax= 0.5f*(float)winx + shiftx*winside;
|
|
|
|
viewplane->ymax= 0.5f*(*ycor)*(float)winy + shifty*winside;
|
|
|
|
|
|
|
|
if(field_second) {
|
|
|
|
if(rd->mode & R_ODDFIELD) {
|
2010-03-05 22:01:42 +00:00
|
|
|
viewplane->ymin-= 0.5 * (*ycor);
|
|
|
|
viewplane->ymax-= 0.5 * (*ycor);
|
2010-03-05 14:06:39 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-03-05 22:01:42 +00:00
|
|
|
viewplane->ymin+= 0.5 * (*ycor);
|
|
|
|
viewplane->ymax+= 0.5 * (*ycor);
|
2010-03-05 14:06:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* the window matrix is used for clipping, and not changed during OSA steps */
|
|
|
|
/* using an offset of +0.5 here would give clip errors on edges */
|
2010-03-05 22:01:42 +00:00
|
|
|
viewplane->xmin *= pixsize;
|
|
|
|
viewplane->xmax *= pixsize;
|
|
|
|
viewplane->ymin *= pixsize;
|
|
|
|
viewplane->ymax *= pixsize;
|
2010-03-05 14:06:39 +00:00
|
|
|
|
|
|
|
(*viewdx)= pixsize;
|
|
|
|
(*viewdy)= (*ycor) * pixsize;
|
|
|
|
|
|
|
|
if(rd->mode & R_ORTHO)
|
|
|
|
orthographic_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
|
|
|
|
else
|
|
|
|
perspective_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-08-26 00:38:43 +00:00
|
|
|
#if 0
|
2009-08-25 18:41:36 +00:00
|
|
|
static int pc_findindex(ListBase *listbase, int index)
|
|
|
|
{
|
|
|
|
LinkData *link= NULL;
|
|
|
|
int number= 0;
|
|
|
|
|
|
|
|
if (listbase == NULL) return -1;
|
|
|
|
|
|
|
|
link= listbase->first;
|
|
|
|
while (link) {
|
|
|
|
if ((int)link->data == index)
|
|
|
|
return number;
|
|
|
|
|
|
|
|
number++;
|
|
|
|
link= link->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-08-25 18:53:20 +00:00
|
|
|
void object_delete_ptcache(Object *ob, int index)
|
2009-08-25 18:41:36 +00:00
|
|
|
{
|
|
|
|
int list_index = pc_findindex(&ob->pc_ids, index);
|
|
|
|
LinkData *link = BLI_findlink(&ob->pc_ids, list_index);
|
|
|
|
BLI_freelinkN(&ob->pc_ids, link);
|
|
|
|
}
|
2009-08-26 00:38:43 +00:00
|
|
|
#endif
|
2009-12-28 15:26:36 +00:00
|
|
|
|
|
|
|
/* shape key utility function */
|
|
|
|
|
|
|
|
/************************* Mesh ************************/
|
2010-11-17 09:45:45 +00:00
|
|
|
static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int from_mix)
|
2009-12-28 15:26:36 +00:00
|
|
|
{
|
|
|
|
Mesh *me= ob->data;
|
|
|
|
Key *key= me->key;
|
|
|
|
KeyBlock *kb;
|
|
|
|
int newkey= 0;
|
|
|
|
|
|
|
|
if(key == NULL) {
|
|
|
|
key= me->key= add_key((ID *)me);
|
|
|
|
key->type= KEY_RELATIVE;
|
|
|
|
newkey= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(newkey || from_mix==FALSE) {
|
|
|
|
/* create from mesh */
|
2010-05-27 14:00:32 +00:00
|
|
|
kb= add_keyblock(key, name);
|
2009-12-28 15:26:36 +00:00
|
|
|
mesh_to_key(me, kb);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* copy from current values */
|
2010-05-27 14:00:32 +00:00
|
|
|
float *data= do_ob_key(scene, ob);
|
|
|
|
|
|
|
|
/* create new block with prepared data */
|
|
|
|
kb= add_keyblock(key, name);
|
|
|
|
kb->data= data;
|
2009-12-28 15:26:36 +00:00
|
|
|
kb->totelem= me->totvert;
|
|
|
|
}
|
2009-12-28 18:03:04 +00:00
|
|
|
|
|
|
|
return kb;
|
2009-12-28 15:26:36 +00:00
|
|
|
}
|
|
|
|
/************************* Lattice ************************/
|
2010-11-17 09:45:45 +00:00
|
|
|
static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int from_mix)
|
2009-12-28 15:26:36 +00:00
|
|
|
{
|
|
|
|
Lattice *lt= ob->data;
|
|
|
|
Key *key= lt->key;
|
|
|
|
KeyBlock *kb;
|
|
|
|
int newkey= 0;
|
|
|
|
|
|
|
|
if(key==NULL) {
|
|
|
|
key= lt->key= add_key( (ID *)lt);
|
|
|
|
key->type= KEY_RELATIVE;
|
|
|
|
newkey= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(newkey || from_mix==FALSE) {
|
2010-05-27 14:00:32 +00:00
|
|
|
kb= add_keyblock(key, name);
|
|
|
|
|
2009-12-28 15:26:36 +00:00
|
|
|
/* create from lattice */
|
|
|
|
latt_to_key(lt, kb);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* copy from current values */
|
2010-05-27 14:00:32 +00:00
|
|
|
float *data= do_ob_key(scene, ob);
|
|
|
|
|
|
|
|
/* create new block with prepared data */
|
|
|
|
kb= add_keyblock(key, name);
|
2009-12-28 15:26:36 +00:00
|
|
|
kb->totelem= lt->pntsu*lt->pntsv*lt->pntsw;
|
2010-05-27 14:00:32 +00:00
|
|
|
kb->data= data;
|
2009-12-28 15:26:36 +00:00
|
|
|
}
|
2009-12-28 18:03:04 +00:00
|
|
|
|
|
|
|
return kb;
|
2009-12-28 15:26:36 +00:00
|
|
|
}
|
|
|
|
/************************* Curve ************************/
|
2010-11-17 09:45:45 +00:00
|
|
|
static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int from_mix)
|
2009-12-28 15:26:36 +00:00
|
|
|
{
|
|
|
|
Curve *cu= ob->data;
|
|
|
|
Key *key= cu->key;
|
|
|
|
KeyBlock *kb;
|
2010-07-25 11:57:36 +00:00
|
|
|
ListBase *lb= BKE_curve_nurbs(cu);
|
2009-12-28 15:26:36 +00:00
|
|
|
int newkey= 0;
|
|
|
|
|
|
|
|
if(key==NULL) {
|
|
|
|
key= cu->key= add_key( (ID *)cu);
|
|
|
|
key->type = KEY_RELATIVE;
|
|
|
|
newkey= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(newkey || from_mix==FALSE) {
|
|
|
|
/* create from curve */
|
2010-05-27 14:00:32 +00:00
|
|
|
kb= add_keyblock(key, name);
|
2010-07-26 19:07:33 +00:00
|
|
|
if (!newkey) {
|
|
|
|
KeyBlock *basekb= (KeyBlock *)key->block.first;
|
|
|
|
kb->data= MEM_dupallocN(basekb->data);
|
|
|
|
kb->totelem= basekb->totelem;
|
|
|
|
} else curve_to_key(cu, kb, lb);
|
2009-12-28 15:26:36 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* copy from current values */
|
2010-05-27 14:00:32 +00:00
|
|
|
float *data= do_ob_key(scene, ob);
|
|
|
|
|
|
|
|
/* create new block with prepared data */
|
|
|
|
kb= add_keyblock(key, name);
|
2009-12-28 15:26:36 +00:00
|
|
|
kb->totelem= count_curveverts(lb);
|
2010-05-27 14:00:32 +00:00
|
|
|
kb->data= data;
|
2009-12-28 15:26:36 +00:00
|
|
|
}
|
|
|
|
|
2009-12-28 18:03:04 +00:00
|
|
|
return kb;
|
2009-12-28 15:26:36 +00:00
|
|
|
}
|
|
|
|
|
2010-11-17 09:45:45 +00:00
|
|
|
KeyBlock *object_insert_shape_key(Scene *scene, Object *ob, const char *name, int from_mix)
|
2009-12-28 15:26:36 +00:00
|
|
|
{
|
2009-12-28 18:03:04 +00:00
|
|
|
if(ob->type==OB_MESH) return insert_meshkey(scene, ob, name, from_mix);
|
|
|
|
else if ELEM(ob->type, OB_CURVE, OB_SURF)return insert_curvekey(scene, ob, name, from_mix);
|
|
|
|
else if(ob->type==OB_LATTICE) return insert_lattkey(scene, ob, name, from_mix);
|
|
|
|
else return NULL;
|
2009-12-28 15:26:36 +00:00
|
|
|
}
|
|
|
|
|