2011-02-23 10:52:22 +00:00
|
|
|
/* anim.c
|
2003-04-26 16:13:58 +00:00
|
|
|
*
|
|
|
|
*
|
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
|
|
|
*/
|
|
|
|
|
2011-02-27 20:40:57 +00:00
|
|
|
/** \file blender/blenkernel/intern/anim.c
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
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
|
|
|
#include <stdio.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2009-03-30 07:28:37 +00:00
|
|
|
#include "BLI_editVert.h"
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.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 "BLI_rand.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
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
|
|
|
|
|
|
|
#include "DNA_anim_types.h"
|
2010-01-07 22:54:05 +00:00
|
|
|
#include "DNA_armature_types.h"
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
#include "DNA_group_types.h"
|
|
|
|
#include "DNA_key_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"
|
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
|
|
|
#include "DNA_vfont_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-02-16 09:59:29 +00:00
|
|
|
#include "BKE_animsys.h"
|
2008-09-23 06:26:48 +00:00
|
|
|
#include "BKE_curve.h"
|
2005-07-17 05:20:57 +00:00
|
|
|
#include "BKE_DerivedMesh.h"
|
2010-05-27 04:54:53 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
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
|
|
|
#include "BKE_font.h"
|
|
|
|
#include "BKE_group.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_key.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_lattice.h"
|
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
|
|
|
#include "BKE_main.h"
|
2008-01-16 23:08:19 +00:00
|
|
|
#include "BKE_mesh.h"
|
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
|
|
|
#include "BKE_object.h"
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
#include "BKE_particle.h"
|
2010-01-07 22:54:05 +00:00
|
|
|
#include "BKE_scene.h"
|
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
|
|
|
#include "BKE_utildefines.h"
|
2010-05-25 05:56:31 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
2011-02-13 10:52:18 +00:00
|
|
|
#include "BKE_anim.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-07-25 11:57:36 +00:00
|
|
|
|
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
|
|
|
// XXX bad level call...
|
2009-03-30 07:28:37 +00:00
|
|
|
|
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
|
|
|
/* --------------------- */
|
|
|
|
/* forward declarations */
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated);
|
2007-12-27 20:33:29 +00:00
|
|
|
|
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 */
|
|
|
|
|
|
|
|
/* Initialise the default settings for animation visualisation */
|
|
|
|
void animviz_settings_init(bAnimVizSettings *avs)
|
|
|
|
{
|
|
|
|
/* sanity check */
|
|
|
|
if (avs == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ghosting settings */
|
|
|
|
avs->ghost_bc= avs->ghost_ac= 10;
|
|
|
|
|
|
|
|
avs->ghost_sf= 1; // xxx - take from scene instead?
|
|
|
|
avs->ghost_ef= 250; // xxx - take from scene instead?
|
|
|
|
|
|
|
|
avs->ghost_step= 1;
|
|
|
|
|
|
|
|
|
|
|
|
/* path settings */
|
|
|
|
avs->path_bc= avs->path_ac= 10;
|
|
|
|
|
|
|
|
avs->path_sf= 1; // xxx - take from scene instead?
|
|
|
|
avs->path_ef= 250; // xxx - take from scene instead?
|
|
|
|
|
|
|
|
avs->path_viewflag= (MOTIONPATH_VIEW_KFRAS|MOTIONPATH_VIEW_KFNOS);
|
|
|
|
|
|
|
|
avs->path_step= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------- */
|
|
|
|
|
|
|
|
/* Free the given motion path's cache */
|
|
|
|
void animviz_free_motionpath_cache(bMotionPath *mpath)
|
|
|
|
{
|
|
|
|
/* sanity check */
|
|
|
|
if (mpath == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* free the path if necessary */
|
|
|
|
if (mpath->points)
|
|
|
|
MEM_freeN(mpath->points);
|
|
|
|
|
|
|
|
/* reset the relevant parameters */
|
|
|
|
mpath->points= NULL;
|
|
|
|
mpath->length= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the given motion path instance and its data
|
|
|
|
* NOTE: this frees the motion path given!
|
|
|
|
*/
|
|
|
|
void animviz_free_motionpath(bMotionPath *mpath)
|
|
|
|
{
|
|
|
|
/* sanity check */
|
|
|
|
if (mpath == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* free the cache first */
|
|
|
|
animviz_free_motionpath_cache(mpath);
|
|
|
|
|
|
|
|
/* now the instance itself */
|
|
|
|
MEM_freeN(mpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------- */
|
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
/* Setup motion paths for the given data
|
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
|
|
|
* - scene: current scene (for frame ranges, etc.)
|
|
|
|
* - ob: object to add paths for (must be provided)
|
|
|
|
* - pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed)
|
|
|
|
*/
|
|
|
|
bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel *pchan)
|
|
|
|
{
|
|
|
|
bAnimVizSettings *avs;
|
|
|
|
bMotionPath *mpath, **dst;
|
|
|
|
|
|
|
|
/* sanity checks */
|
|
|
|
if (ELEM(NULL, scene, ob))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* get destination data */
|
|
|
|
if (pchan) {
|
|
|
|
/* paths for posechannel - assume that posechannel belongs to the object */
|
|
|
|
avs= &ob->pose->avs;
|
|
|
|
dst= &pchan->mpath;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* paths for object */
|
|
|
|
avs= &ob->avs;
|
|
|
|
dst= &ob->mpath;
|
|
|
|
}
|
2011-06-20 17:50:59 +00:00
|
|
|
|
|
|
|
/* avoid 0 size allocs */
|
|
|
|
if(avs->path_sf >= avs->path_ef) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-01-07 22:54:05 +00:00
|
|
|
/* if there is already a motionpath, just return that,
|
|
|
|
* but provided it's settings are ok
|
|
|
|
*/
|
|
|
|
if (*dst != NULL) {
|
|
|
|
mpath= *dst;
|
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
|
|
|
|
2010-01-07 22:54:05 +00:00
|
|
|
/* if range is not invalid, and/or length is set ok, just return */
|
|
|
|
if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0))
|
|
|
|
return mpath;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* create a new motionpath, and assign it */
|
|
|
|
mpath= MEM_callocN(sizeof(bMotionPath), "bMotionPath");
|
|
|
|
*dst= mpath;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
/* set settings from the viz settings */
|
|
|
|
mpath->start_frame= avs->path_sf;
|
|
|
|
mpath->end_frame= avs->path_ef;
|
|
|
|
|
|
|
|
mpath->length= mpath->end_frame - mpath->start_frame;
|
|
|
|
|
|
|
|
if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS)
|
|
|
|
mpath->flag |= MOTIONPATH_FLAG_BHEAD;
|
2010-05-20 12:34:32 +00:00
|
|
|
else
|
|
|
|
mpath->flag &= ~MOTIONPATH_FLAG_BHEAD;
|
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
|
|
|
|
|
|
|
/* allocate a cache */
|
|
|
|
mpath->points= MEM_callocN(sizeof(bMotionPathVert)*mpath->length, "bMotionPathVerts");
|
|
|
|
|
2010-03-11 11:15:25 +00:00
|
|
|
/* tag viz settings as currently having some path(s) which use it */
|
|
|
|
avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS;
|
|
|
|
|
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
|
|
|
/* return it */
|
|
|
|
return mpath;
|
|
|
|
}
|
|
|
|
|
2010-01-07 22:54:05 +00:00
|
|
|
/* ------------------- */
|
|
|
|
|
|
|
|
/* Motion path needing to be baked (mpt) */
|
|
|
|
typedef struct MPathTarget {
|
|
|
|
struct MPathTarget *next, *prev;
|
|
|
|
|
|
|
|
bMotionPath *mpath; /* motion path in question */
|
|
|
|
|
|
|
|
Object *ob; /* source object */
|
|
|
|
bPoseChannel *pchan; /* source posechannel (if applicable) */
|
|
|
|
} MPathTarget;
|
|
|
|
|
|
|
|
/* ........ */
|
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
/* get list of motion paths to be baked for the given object
|
|
|
|
* - assumes the given list is ready to be used
|
|
|
|
*/
|
|
|
|
void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
|
2010-01-07 22:54:05 +00:00
|
|
|
{
|
|
|
|
MPathTarget *mpt;
|
|
|
|
|
|
|
|
/* object itself first */
|
|
|
|
if ((ob->avs.recalc & ANIMVIZ_RECALC_PATHS) && (ob->mpath)) {
|
|
|
|
/* new target for object */
|
|
|
|
mpt= MEM_callocN(sizeof(MPathTarget), "MPathTarget Ob");
|
|
|
|
BLI_addtail(targets, mpt);
|
|
|
|
|
|
|
|
mpt->mpath= ob->mpath;
|
|
|
|
mpt->ob= ob;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bones */
|
|
|
|
if ((ob->pose) && (ob->pose->avs.recalc & ANIMVIZ_RECALC_PATHS)) {
|
|
|
|
bArmature *arm= ob->data;
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
|
|
|
|
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
|
|
|
if ((pchan->bone) && (arm->layer & pchan->bone->layer) && (pchan->mpath)) {
|
|
|
|
/* new target for bone */
|
|
|
|
mpt= MEM_callocN(sizeof(MPathTarget), "MPathTarget PoseBone");
|
|
|
|
BLI_addtail(targets, mpt);
|
|
|
|
|
|
|
|
mpt->mpath= pchan->mpath;
|
|
|
|
mpt->ob= ob;
|
|
|
|
mpt->pchan= pchan;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
/* ........ */
|
|
|
|
|
2010-05-21 12:17:34 +00:00
|
|
|
/* Note on evaluation optimisations:
|
|
|
|
* Optimisations currently used here play tricks with the depsgraph in order to try and
|
|
|
|
* evaluate as few objects as strictly necessary to get nicer performance under standard
|
|
|
|
* production conditions. For those people who really need the accurate version,
|
2010-05-21 13:01:18 +00:00
|
|
|
* disable the ifdef (i.e. 1 -> 0) and comment out the call to motionpaths_calc_optimise_depsgraph()
|
2010-05-21 12:17:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* tweak the object ordering to trick depsgraph into making MotionPath calculations run faster */
|
|
|
|
static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets)
|
|
|
|
{
|
|
|
|
Base *base, *baseNext;
|
|
|
|
MPathTarget *mpt;
|
|
|
|
|
|
|
|
/* make sure our temp-tag isn't already in use */
|
|
|
|
for (base= scene->base.first; base; base= base->next)
|
|
|
|
base->object->flag &= ~BA_TEMP_TAG;
|
|
|
|
|
|
|
|
/* for each target, dump its object to the start of the list if it wasn't moved already */
|
|
|
|
for (mpt= targets->first; mpt; mpt= mpt->next) {
|
|
|
|
for (base=scene->base.first; base; base=baseNext) {
|
|
|
|
baseNext = base->next;
|
|
|
|
|
|
|
|
if ((base->object == mpt->ob) && !(mpt->ob->flag & BA_TEMP_TAG)) {
|
|
|
|
BLI_remlink(&scene->base, base);
|
|
|
|
BLI_addhead(&scene->base, base);
|
|
|
|
|
|
|
|
mpt->ob->flag |= BA_TEMP_TAG;
|
|
|
|
break; // we really don't need to continue anymore once this happens, but this line might really 'break'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* "brew me a list that's sorted a bit faster now depsy" */
|
2010-08-01 12:47:49 +00:00
|
|
|
DAG_scene_sort(G.main, scene);
|
2010-05-21 12:17:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* update scene for current frame */
|
|
|
|
static void motionpaths_calc_update_scene(Scene *scene)
|
|
|
|
{
|
|
|
|
#if 1 // 'production' optimisations always on
|
|
|
|
Base *base, *last=NULL;
|
|
|
|
|
|
|
|
/* only stuff that moves or needs display still */
|
2010-12-16 19:26:54 +00:00
|
|
|
DAG_scene_update_flags(G.main, scene, scene->lay, TRUE);
|
2010-05-21 12:17:34 +00:00
|
|
|
|
|
|
|
/* find the last object with the tag
|
|
|
|
* - all those afterwards are assumed to not be relevant for our calculations
|
|
|
|
*/
|
|
|
|
// optimise further by moving out...
|
|
|
|
for (base=scene->base.first; base; base=base->next) {
|
|
|
|
if (base->object->flag & BA_TEMP_TAG)
|
|
|
|
last = base;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* perform updates for tagged objects */
|
|
|
|
// XXX: this will break if rigs depend on scene or other data that
|
|
|
|
// is animated but not attached to/updatable from objects
|
|
|
|
for (base=scene->base.first; base; base=base->next) {
|
|
|
|
/* update this object */
|
|
|
|
object_handle_update(scene, base->object);
|
|
|
|
|
|
|
|
/* if this is the last one we need to update, let's stop to save some time */
|
|
|
|
if (base == last)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#else // original, 'always correct' version
|
|
|
|
/* do all updates
|
|
|
|
* - if this is too slow, resort to using a more efficient way
|
|
|
|
* that doesn't force complete update, but for now, this is the
|
|
|
|
* most accurate way!
|
|
|
|
*/
|
2010-08-01 12:47:49 +00:00
|
|
|
scene_update_for_newframe(G.main, scene, scene->lay); // XXX this is the best way we can get anything moving
|
2010-05-21 12:17:34 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ........ */
|
|
|
|
|
2010-01-07 22:54:05 +00:00
|
|
|
/* perform baking for the targets on the current frame */
|
|
|
|
static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
|
|
|
|
{
|
|
|
|
MPathTarget *mpt;
|
|
|
|
|
|
|
|
/* for each target, check if it can be baked on the current frame */
|
|
|
|
for (mpt= targets->first; mpt; mpt= mpt->next) {
|
|
|
|
bMotionPath *mpath= mpt->mpath;
|
|
|
|
bMotionPathVert *mpv;
|
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
/* current frame must be within the range the cache works for
|
|
|
|
* - is inclusive of the first frame, but not the last otherwise we get buffer overruns
|
|
|
|
*/
|
|
|
|
if ((CFRA < mpath->start_frame) || (CFRA >= mpath->end_frame))
|
2010-01-07 22:54:05 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* get the relevant cache vert to write to */
|
|
|
|
mpv= mpath->points + (CFRA - mpath->start_frame);
|
|
|
|
|
|
|
|
/* pose-channel or object path baking? */
|
|
|
|
if (mpt->pchan) {
|
|
|
|
/* heads or tails */
|
|
|
|
if (mpath->flag & MOTIONPATH_FLAG_BHEAD) {
|
|
|
|
VECCOPY(mpv->co, mpt->pchan->pose_head);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(mpv->co, mpt->pchan->pose_tail);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* result must be in worldspace */
|
|
|
|
mul_m4_v3(mpt->ob->obmat, mpv->co);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* worldspace object location */
|
|
|
|
VECCOPY(mpv->co, mpt->ob->obmat[3]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* Perform baking of the given object's and/or its bones' transforms to motion paths
|
|
|
|
* - scene: current scene
|
|
|
|
* - ob: object whose flagged motionpaths should get calculated
|
|
|
|
* - recalc: whether we need to
|
|
|
|
*/
|
2010-01-07 22:54:05 +00:00
|
|
|
// TODO: include reports pointer?
|
2010-01-19 11:31:49 +00:00
|
|
|
void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
|
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
|
|
|
{
|
2010-01-07 22:54:05 +00:00
|
|
|
MPathTarget *mpt;
|
|
|
|
int sfra, efra;
|
|
|
|
int cfra;
|
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
/* sanity check */
|
|
|
|
if (ELEM(NULL, targets, targets->first))
|
2010-01-07 22:54:05 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* set frame values */
|
|
|
|
cfra = CFRA;
|
|
|
|
sfra = efra = cfra;
|
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
// TODO: this method could be improved...
|
|
|
|
// 1) max range for standard baking
|
2010-05-21 12:17:34 +00:00
|
|
|
// 2) minimum range for recalc baking (i.e. between keyframes, but how?)
|
2010-01-19 11:31:49 +00:00
|
|
|
for (mpt= targets->first; mpt; mpt= mpt->next) {
|
2010-01-07 22:54:05 +00:00
|
|
|
/* try to increase area to do (only as much as needed) */
|
|
|
|
sfra= MIN2(sfra, mpt->mpath->start_frame);
|
|
|
|
efra= MAX2(efra, mpt->mpath->end_frame);
|
|
|
|
}
|
|
|
|
if (efra <= sfra) return;
|
|
|
|
|
2010-05-21 12:17:34 +00:00
|
|
|
/* optimise the depsgraph for faster updates */
|
|
|
|
// TODO: whether this is used should depend on some setting for the level of optimisations used
|
|
|
|
motionpaths_calc_optimise_depsgraph(scene, targets);
|
|
|
|
|
2010-01-07 22:54:05 +00:00
|
|
|
/* calculate path over requested range */
|
|
|
|
for (CFRA=sfra; CFRA<=efra; CFRA++) {
|
2010-05-21 12:17:34 +00:00
|
|
|
/* update relevant data for new frame */
|
|
|
|
motionpaths_calc_update_scene(scene);
|
2010-01-07 22:54:05 +00:00
|
|
|
|
|
|
|
/* perform baking for targets */
|
2010-01-19 11:31:49 +00:00
|
|
|
motionpaths_calc_bake_targets(scene, targets);
|
2010-01-07 22:54:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* reset original environment */
|
|
|
|
CFRA= cfra;
|
2010-05-21 12:17:34 +00:00
|
|
|
motionpaths_calc_update_scene(scene);
|
2010-01-07 22:54:05 +00:00
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
/* clear recalc flags from targets */
|
|
|
|
for (mpt= targets->first; mpt; mpt= mpt->next) {
|
|
|
|
bAnimVizSettings *avs;
|
|
|
|
|
|
|
|
/* get pointer to animviz settings for each target */
|
|
|
|
if (mpt->pchan)
|
|
|
|
avs= &mpt->ob->pose->avs;
|
|
|
|
else
|
|
|
|
avs= &mpt->ob->avs;
|
|
|
|
|
|
|
|
/* clear the flag requesting recalculation of targets */
|
|
|
|
avs->recalc &= ~ANIMVIZ_RECALC_PATHS;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************************************************************** */
|
|
|
|
/* Curve Paths - for curve deforms and/or curve following */
|
|
|
|
|
|
|
|
/* free curve path data
|
|
|
|
* NOTE: frees the path itself!
|
2010-11-10 04:58:37 +00:00
|
|
|
* NOTE: this is increasingly innacurate with non-uniform BevPoint subdivisions [#24633]
|
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
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
void free_path(Path *path)
|
|
|
|
{
|
|
|
|
if(path->data) MEM_freeN(path->data);
|
|
|
|
MEM_freeN(path);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* calculate a curve-deform path for a curve
|
2010-11-10 04:58:37 +00:00
|
|
|
* - only called from displist.c -> do_makeDispListCurveTypes
|
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
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
void calc_curvepath(Object *ob)
|
|
|
|
{
|
|
|
|
BevList *bl;
|
2009-09-12 14:12:37 +00:00
|
|
|
BevPoint *bevp, *bevpn, *bevpfirst, *bevplast;
|
|
|
|
PathPoint *pp;
|
2002-10-12 11:37:38 +00:00
|
|
|
Curve *cu;
|
|
|
|
Nurb *nu;
|
|
|
|
Path *path;
|
2009-09-10 02:57:25 +00:00
|
|
|
float *fp, *dist, *maxdist, xyz[3];
|
2002-10-12 11:37:38 +00:00
|
|
|
float fac, d=0, fac1, fac2;
|
|
|
|
int a, tot, cycl=0;
|
2010-07-25 11:57:36 +00:00
|
|
|
ListBase *nurbs;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* in a path vertices are with equal differences: path->len = number of verts */
|
|
|
|
/* NOW WITH BEVELCURVE!!! */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
if(ob==NULL || ob->type != OB_CURVE) return;
|
2002-10-12 11:37:38 +00:00
|
|
|
cu= ob->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
|
|
|
if(cu->path) free_path(cu->path);
|
2004-09-27 10:39:18 +00:00
|
|
|
cu->path= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
bl= cu->bev.first;
|
2007-12-03 22:42:48 +00:00
|
|
|
if(bl==NULL || !bl->nr) return;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-06-14 03:52:10 +00:00
|
|
|
cu->path=path= MEM_callocN(sizeof(Path), "calc_curvepath");
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* if POLY: last vertice != first vertice */
|
2002-10-12 11:37:38 +00:00
|
|
|
cycl= (bl->poly!= -1);
|
|
|
|
|
|
|
|
if(cycl) tot= bl->nr;
|
|
|
|
else tot= bl->nr-1;
|
|
|
|
|
|
|
|
path->len= tot+1;
|
2006-11-21 13:07:16 +00:00
|
|
|
/* exception: vector handle paths and polygon paths should be subdivided at least a factor resolu */
|
2008-09-23 06:26:48 +00:00
|
|
|
if(path->len<nu->resolu*SEGMENTSU(nu)) path->len= nu->resolu*SEGMENTSU(nu);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
dist= (float *)MEM_mallocN((tot+1)*4, "calcpathdist");
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* all lengths in *dist */
|
2002-10-12 11:37:38 +00:00
|
|
|
bevp= bevpfirst= (BevPoint *)(bl+1);
|
|
|
|
fp= dist;
|
|
|
|
*fp= 0;
|
|
|
|
for(a=0; a<tot; a++) {
|
|
|
|
fp++;
|
2009-09-10 02:57:25 +00:00
|
|
|
if(cycl && a==tot-1)
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec);
|
2009-09-10 02:57:25 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(xyz, (bevp+1)->vec, bevp->vec);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
*fp= *(fp-1)+len_v3(xyz);
|
2002-10-12 11:37:38 +00:00
|
|
|
bevp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
path->totdist= *fp;
|
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
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* the path verts in path->data */
|
|
|
|
/* now also with TILT value */
|
2010-11-10 04:58:37 +00:00
|
|
|
pp= path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint)*path->len, "pathdata");
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
bevp= bevpfirst;
|
|
|
|
bevpn= bevp+1;
|
|
|
|
bevplast= bevpfirst + (bl->nr-1);
|
|
|
|
fp= dist+1;
|
|
|
|
maxdist= dist+tot;
|
|
|
|
fac= 1.0f/((float)path->len-1.0f);
|
2010-03-22 09:30:00 +00:00
|
|
|
fac = fac * path->totdist;
|
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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<path->len; a++) {
|
|
|
|
|
2002-10-30 00:37:19 +00:00
|
|
|
d= ((float)a)*fac;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* we're looking for location (distance) 'd' in the array */
|
2002-10-12 11:37:38 +00:00
|
|
|
while((d>= *fp) && fp<maxdist) {
|
|
|
|
fp++;
|
|
|
|
if(bevp<bevplast) bevp++;
|
|
|
|
bevpn= bevp+1;
|
|
|
|
if(bevpn>bevplast) {
|
|
|
|
if(cycl) bevpn= bevpfirst;
|
|
|
|
else bevpn= bevplast;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fac1= *(fp)- *(fp-1);
|
|
|
|
fac2= *(fp)-d;
|
|
|
|
fac1= fac2/fac1;
|
|
|
|
fac2= 1.0f-fac1;
|
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
|
|
|
interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2);
|
2009-09-12 14:12:37 +00:00
|
|
|
pp->vec[3]= fac1*bevp->alfa + fac2*bevpn->alfa;
|
|
|
|
pp->radius= fac1*bevp->radius + fac2*bevpn->radius;
|
2010-04-21 11:59:47 +00:00
|
|
|
pp->weight= fac1*bevp->weight + fac2*bevpn->weight;
|
2009-11-10 20:43:45 +00:00
|
|
|
interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2);
|
|
|
|
normalize_qt(pp->quat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-09-12 14:12:37 +00:00
|
|
|
pp++;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MEM_freeN(dist);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
/* is this only used internally?*/
|
2002-10-12 11:37:38 +00:00
|
|
|
int interval_test(int min, int max, int p1, int cycl)
|
|
|
|
{
|
|
|
|
if(cycl) {
|
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(p1 < min)
|
2002-10-12 11:37:38 +00:00
|
|
|
p1= ((p1 -min) % (max-min+1)) + max+1;
|
|
|
|
else if(p1 > max)
|
|
|
|
p1= ((p1 -min) % (max-min+1)) + min;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(p1 < min) p1= min;
|
|
|
|
else if(p1 > max) p1= max;
|
|
|
|
}
|
|
|
|
return p1;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
/* calculate the deformation implied by the curve path at a given parametric position, and returns whether this operation succeeded
|
|
|
|
* - *vec needs FOUR items!
|
|
|
|
* - ctime is normalized range <0-1>
|
|
|
|
*/
|
2010-04-21 11:59:47 +00:00
|
|
|
int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat, float *radius, float *weight) /* returns OK */
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Curve *cu;
|
|
|
|
Nurb *nu;
|
|
|
|
BevList *bl;
|
|
|
|
Path *path;
|
2009-09-12 14:12:37 +00:00
|
|
|
PathPoint *pp, *p0, *p1, *p2, *p3;
|
|
|
|
float fac;
|
2002-10-12 11:37:38 +00:00
|
|
|
float data[4];
|
|
|
|
int cycl=0, s0, s1, s2, s3;
|
2004-09-14 19:03:11 +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==NULL || ob->type != OB_CURVE) return 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
cu= ob->data;
|
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(cu->path==NULL || cu->path->data==NULL) {
|
|
|
|
printf("no path!\n");
|
2009-04-20 15:06:46 +00:00
|
|
|
return 0;
|
2004-09-14 19:03:11 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
path= cu->path;
|
2009-09-12 14:12:37 +00:00
|
|
|
pp= path->data;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* test for cyclic */
|
2002-10-12 11:37:38 +00:00
|
|
|
bl= cu->bev.first;
|
2009-04-20 15:06:46 +00:00
|
|
|
if (!bl) return 0;
|
2007-12-03 22:42:48 +00:00
|
|
|
if (!bl->nr) return 0;
|
2009-04-20 15:06:46 +00:00
|
|
|
if(bl->poly> -1) cycl= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
ctime *= (path->len-1);
|
|
|
|
|
|
|
|
s1= (int)floor(ctime);
|
|
|
|
fac= (float)(s1+1)-ctime;
|
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* path->len is corected for cyclic */
|
2002-10-12 11:37:38 +00:00
|
|
|
s0= interval_test(0, path->len-1-cycl, s1-1, cycl);
|
|
|
|
s1= interval_test(0, path->len-1-cycl, s1, cycl);
|
|
|
|
s2= interval_test(0, path->len-1-cycl, s1+1, cycl);
|
|
|
|
s3= interval_test(0, path->len-1-cycl, s1+2, cycl);
|
|
|
|
|
2009-09-12 14:12:37 +00:00
|
|
|
p0= pp + s0;
|
|
|
|
p1= pp + s1;
|
|
|
|
p2= pp + s2;
|
|
|
|
p3= pp + s3;
|
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
|
|
|
/* note, commented out for follow constraint */
|
|
|
|
//if(cu->flag & CU_FOLLOW) {
|
2009-11-21 14:35:28 +00:00
|
|
|
|
2009-09-09 18:09:03 +00:00
|
|
|
key_curve_tangent_weights(1.0f-fac, data, KEY_BSPLINE);
|
2009-11-21 14:35:28 +00:00
|
|
|
|
|
|
|
interp_v3_v3v3v3v3(dir, p0->vec, p1->vec, p2->vec, p3->vec, data);
|
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* make compatible with vectoquat */
|
2009-11-21 14:35:28 +00:00
|
|
|
negate_v3(dir);
|
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
|
|
|
|
|
|
|
nu= cu->nurb.first;
|
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* make sure that first and last frame are included in the vectors here */
|
2009-09-11 03:00:09 +00:00
|
|
|
if(nu->type == CU_POLY) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
|
|
|
|
else if(nu->type == CU_BEZIER) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
|
2009-09-09 18:09:03 +00:00
|
|
|
else if(s0==s1 || p2==p3) key_curve_position_weights(1.0f-fac, data, KEY_CARDINAL);
|
|
|
|
else key_curve_position_weights(1.0f-fac, data, KEY_BSPLINE);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-09-12 14:12:37 +00:00
|
|
|
vec[0]= data[0]*p0->vec[0] + data[1]*p1->vec[0] + data[2]*p2->vec[0] + data[3]*p3->vec[0] ; /* X */
|
|
|
|
vec[1]= data[0]*p0->vec[1] + data[1]*p1->vec[1] + data[2]*p2->vec[1] + data[3]*p3->vec[1] ; /* Y */
|
|
|
|
vec[2]= data[0]*p0->vec[2] + data[1]*p1->vec[2] + data[2]*p2->vec[2] + data[3]*p3->vec[2] ; /* Z */
|
|
|
|
vec[3]= data[0]*p0->vec[3] + data[1]*p1->vec[3] + data[2]*p2->vec[3] + data[3]*p3->vec[3] ; /* Tilt, should not be needed since we have quat still used */
|
|
|
|
|
|
|
|
if (quat) {
|
2010-09-20 09:09:00 +00:00
|
|
|
float totfac, q1[4], q2[4];
|
2009-09-12 14:12:37 +00:00
|
|
|
|
2010-09-20 09:09:00 +00:00
|
|
|
totfac= data[0]+data[3];
|
|
|
|
if(totfac>FLT_EPSILON) interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
|
|
|
|
else QUATCOPY(q1, p1->quat);
|
2009-09-30 23:31:10 +00:00
|
|
|
|
2010-09-20 09:09:00 +00:00
|
|
|
totfac= data[1]+data[2];
|
|
|
|
if(totfac>FLT_EPSILON) interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
|
2010-10-07 10:04:07 +00:00
|
|
|
else QUATCOPY(q2, p3->quat);
|
2009-09-12 14:12:37 +00:00
|
|
|
|
|
|
|
totfac = data[0]+data[1]+data[2]+data[3];
|
2010-09-20 09:09:00 +00:00
|
|
|
if(totfac>FLT_EPSILON) interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
|
|
|
|
else QUATCOPY(quat, q2);
|
2009-09-12 14:12:37 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-09-12 14:12:37 +00:00
|
|
|
if(radius)
|
|
|
|
*radius= data[0]*p0->radius + data[1]*p1->radius + data[2]*p2->radius + data[3]*p3->radius;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-04-21 11:59:47 +00:00
|
|
|
if(weight)
|
|
|
|
*weight= data[0]*p0->weight + data[1]*p1->weight + data[2]*p2->weight + data[3]*p3->weight;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* ******************************************************************** */
|
|
|
|
/* Dupli-Geometry */
|
2004-10-14 22:20:42 +00:00
|
|
|
|
2008-01-21 22:10:14 +00:00
|
|
|
static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int type, int animated)
|
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-14 20:41:38 +00:00
|
|
|
DupliObject *dob= MEM_callocN(sizeof(DupliObject), "dupliobject");
|
2006-06-09 11:15:52 +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
|
|
|
BLI_addtail(lb, dob);
|
|
|
|
dob->ob= ob;
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(dob->mat, mat);
|
|
|
|
copy_m4_m4(dob->omat, ob->obmat);
|
2006-02-02 19:31:15 +00:00
|
|
|
dob->origlay= ob->lay;
|
iImage based Vector Blur
After a couple of experiments with variable blur filters, I tried
a more interesting, and who knows... original approach. :)
First watch results here:
http://www.blender.org/bf/rt0001_0030.avi
http://www.blender.org/bf/hand0001_0060.avi
These are the steps in producing such results:
- In preprocess, the speed vectors to previous and next frame are
calculated. Speed vectors are screen-aligned and in pixel size.
- while rendering, these vectors get calculated per sample, and
accumulated in the vector buffer checking for "minimum speed".
(on start the vector buffer is initialized on max speed).
- After render:
- The entire image, all pixels, then is converted to quad polygons.
- Also the z value of the pixels is assigned to the polygons
- The vertices for the quads use averaged speed vectors (of the 4
corner faces), using a 'minimum but non-zero' speed rule.
This minimal speed trick works very well to prevent 'tearing' apart
when multiple faces move in different directions in a pixel, or to
be able to separate moving pixels clearly from non-moving ones
- So, now we have a sort of 'mask' of quad polygons. The previous steps
guaranteed that this mask doesn't have antialias color info, and has
speed vectors that ensure individual parts to move nicely without
tearing effects. The Z allows multiple layers of moving masks.
- Then, in temporal buffer, faces get tagged if they move or not
- These tags then go to an anti-alias routine, which assigns alpha
values to edge faces, based on the method we used in past to antialias
bitmaps (still in our code, check the antialias.c in imbuf!)
- finally, the tag buffer is used to tag which z values of the original
image have to be included (to allow blur go behind stuff).
- OK, now we're ready for accumulating! In a loop, all faces then get
drawn (with zbuffer) with increasing influence of their speed vectors.
The resulting image then is accumulated on top of the original with a
decreasing weighting value.
It sounds all quite complex... but the speed is still encouraging. Above
images have 64 mblur steps, which takes about 1-3 seconds per frame.
Usage notes:
- Make sure the render-layer has passes 'Vector' and 'Z' on.
- add in Compositor the VectorBlur node, and connect the image, Z and
speed to the inputs.
- The node allows to set amount of steps (10 steps = 10 forward, 10 back).
and to set a maximum speed in pixels... to prevent extreme moving things
to blur too wide.
2006-02-06 22:11:50 +00:00
|
|
|
dob->index= index;
|
2008-01-04 17:48:07 +00:00
|
|
|
dob->type= type;
|
2008-01-21 22:10:14 +00:00
|
|
|
dob->animated= (type == OB_DUPLIGROUP) && animated;
|
2006-02-02 19:31:15 +00:00
|
|
|
ob->lay= lay;
|
2006-06-09 11:15:52 +00:00
|
|
|
|
2006-11-08 21:20:38 +00:00
|
|
|
return dob;
|
2004-10-14 22:20:42 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, int animated)
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
{
|
2006-02-28 20:43:21 +00:00
|
|
|
DupliObject *dob;
|
2006-11-14 17:16:15 +00:00
|
|
|
Group *group;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
GroupObject *go;
|
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
|
|
|
float mat[4][4], tmat[4][4];
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
|
|
|
|
if(ob->dup_group==NULL) return;
|
2006-11-14 17:16:15 +00:00
|
|
|
group= ob->dup_group;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
|
2006-11-08 21:20:38 +00:00
|
|
|
/* simple preventing of too deep nested groups */
|
2007-12-27 22:58:32 +00:00
|
|
|
if(level>MAX_DUPLI_RECUR) return;
|
2006-11-08 21:20:38 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
/* handles animated groups, and */
|
|
|
|
/* we need to check update for objects that are not in scene... */
|
2009-01-04 14:14:06 +00:00
|
|
|
group_handle_recalc_and_update(scene, ob, group);
|
2008-01-21 22:10:14 +00:00
|
|
|
animated= animated || group_is_animated(ob, group);
|
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-14 17:16:15 +00:00
|
|
|
for(go= group->gobject.first; go; go= go->next) {
|
2006-11-14 20:41:38 +00:00
|
|
|
/* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */
|
|
|
|
if(go->ob!=ob) {
|
2007-12-27 20:33:29 +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
|
|
|
/* Group Dupli Offset, should apply after everything else */
|
|
|
|
if (group->dupli_ofs[0] || group->dupli_ofs[1] || group->dupli_ofs[2]) {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, go->ob->obmat);
|
|
|
|
sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs);
|
|
|
|
mul_m4_m4m4(mat, tmat, ob->obmat);
|
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
|
|
|
} else {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(mat, go->ob->obmat, ob->obmat);
|
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
|
|
|
}
|
|
|
|
|
2008-01-21 22:10:14 +00:00
|
|
|
dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP, animated);
|
2010-04-15 10:28:32 +00:00
|
|
|
|
|
|
|
/* check the group instance and object layers match, also that the object visible flags are ok. */
|
|
|
|
if( (dob->origlay & group->layer)==0 ||
|
|
|
|
(G.rendering==0 && dob->ob->restrictflag & OB_RESTRICT_VIEW) ||
|
|
|
|
(G.rendering && dob->ob->restrictflag & OB_RESTRICT_RENDER)
|
|
|
|
) {
|
|
|
|
dob->no_draw= 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dob->no_draw= 0;
|
|
|
|
}
|
|
|
|
|
2007-12-27 20:33:29 +00:00
|
|
|
if(go->ob->transflag & OB_DUPLI) {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(dob->ob->obmat, dob->mat);
|
2010-07-13 16:53:17 +00:00
|
|
|
object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, level+1, animated);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(dob->ob->obmat, dob->omat);
|
2006-11-08 21:20:38 +00:00
|
|
|
}
|
2005-12-06 15:39:25 +00:00
|
|
|
}
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, int animated)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
extern int enable_cu_speed; /* object.c */
|
2011-02-16 21:54:41 +00:00
|
|
|
Object copyob = {{NULL}};
|
2011-02-16 09:59:29 +00:00
|
|
|
int cfrao = scene->r.cfra;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-02-16 09:59:29 +00:00
|
|
|
/* simple prevention of too deep nested groups */
|
|
|
|
if (level > MAX_DUPLI_RECUR) return;
|
2007-12-27 22:58:32 +00:00
|
|
|
|
2011-02-16 09:59:29 +00:00
|
|
|
/* if we don't have any data/settings which will lead to object movement,
|
|
|
|
* don't waste time trying, as it will all look the same...
|
|
|
|
*/
|
|
|
|
if (ob->parent==NULL && ob->constraints.first==NULL && ob->adt==NULL)
|
|
|
|
return;
|
|
|
|
|
2011-02-16 21:54:41 +00:00
|
|
|
/* make a copy of the object's original data (before any dupli-data overwrites it)
|
|
|
|
* as we'll need this to keep track of unkeyed data
|
|
|
|
* - this doesn't take into account other data that can be reached from the object,
|
|
|
|
* for example it's shapekeys or bones, hence the need for an update flush at the end
|
|
|
|
*/
|
|
|
|
copyob = *ob;
|
2011-02-16 09:59:29 +00:00
|
|
|
|
|
|
|
/* duplicate over the required range */
|
|
|
|
if (ob->transflag & OB_DUPLINOSPEED) enable_cu_speed= 0;
|
|
|
|
|
|
|
|
for (scene->r.cfra= ob->dupsta; scene->r.cfra<=ob->dupend; scene->r.cfra++) {
|
|
|
|
short ok= 1;
|
|
|
|
|
|
|
|
/* - dupoff = how often a frames within the range shouldn't be made into duplis
|
|
|
|
* - dupon = the length of each "skipping" block in frames
|
|
|
|
*/
|
|
|
|
if (ob->dupoff) {
|
2009-01-04 14:14:06 +00:00
|
|
|
ok= scene->r.cfra - ob->dupsta;
|
2002-10-12 11:37:38 +00:00
|
|
|
ok= ok % (ob->dupon+ob->dupoff);
|
2011-02-16 09:59:29 +00:00
|
|
|
ok= (ok < ob->dupon);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2011-02-16 09:59:29 +00:00
|
|
|
|
|
|
|
if (ok) {
|
|
|
|
DupliObject *dob;
|
|
|
|
|
|
|
|
/* WARNING: doing animation updates in this way is not terribly accurate, as the dependencies
|
|
|
|
* and/or other objects which may affect this object's transforms are not updated either.
|
|
|
|
* However, this has always been the way that this worked (i.e. pre 2.5), so I guess that it'll be fine!
|
|
|
|
*/
|
|
|
|
BKE_animsys_evaluate_animdata(&ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */
|
2009-01-04 14:14:06 +00:00
|
|
|
where_is_object_time(scene, ob, (float)scene->r.cfra);
|
2011-02-16 09:59:29 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
dob= new_dupli_object(lb, ob, ob->obmat, ob->lay, scene->r.cfra, OB_DUPLIFRAMES, animated);
|
2011-02-16 21:54:41 +00:00
|
|
|
copy_m4_m4(dob->omat, copyob.obmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enable_cu_speed= 1;
|
2011-02-16 09:59:29 +00:00
|
|
|
|
|
|
|
/* reset frame to original frame, then re-evaluate animation as above
|
|
|
|
* as 2.5 animation data may have far-reaching consequences
|
|
|
|
*/
|
|
|
|
scene->r.cfra= cfrao;
|
|
|
|
|
|
|
|
BKE_animsys_evaluate_animdata(&ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */
|
|
|
|
where_is_object_time(scene, ob, (float)scene->r.cfra);
|
2011-02-16 21:54:41 +00:00
|
|
|
|
|
|
|
/* but, to make sure unkeyed object transforms are still sane,
|
|
|
|
* let's copy object's original data back over
|
|
|
|
*/
|
|
|
|
*ob = copyob;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
typedef struct vertexDupliData {
|
2007-12-27 22:58:32 +00:00
|
|
|
ID *id; /* scene or group, for recursive loops */
|
|
|
|
int level;
|
2008-01-21 22:10:14 +00:00
|
|
|
int animated;
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
ListBase *lb;
|
2005-10-11 22:10:17 +00:00
|
|
|
float pmat[4][4];
|
2007-12-27 20:33:29 +00:00
|
|
|
float obmat[4][4]; /* Only used for dupliverts inside dupligroups, where the ob->obmat is modified */
|
2009-01-04 14:14:06 +00:00
|
|
|
Scene *scene;
|
|
|
|
Object *ob, *par;
|
2008-01-09 14:40:25 +00:00
|
|
|
float (*orco)[3];
|
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
|
|
|
} vertexDupliData;
|
|
|
|
|
|
|
|
/* ------------- */
|
2005-10-11 22:10:17 +00:00
|
|
|
|
|
|
|
static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
|
|
|
|
{
|
2008-01-09 14:40:25 +00:00
|
|
|
DupliObject *dob;
|
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
|
|
|
vertexDupliData *vdd= userData;
|
2008-02-27 14:17:32 +00:00
|
|
|
float vec[3], q2[4], mat[3][3], tmat[4][4], obmat[4][4];
|
2010-11-03 16:51:25 +00:00
|
|
|
int origlay;
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2010-04-23 23:57:00 +00:00
|
|
|
mul_v3_m4v3(vec, vdd->pmat, co);
|
|
|
|
sub_v3_v3(vec, vdd->pmat[3]);
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, vdd->obmat[3]);
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(obmat, vdd->obmat);
|
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
|
|
|
VECCOPY(obmat[3], vec);
|
2005-10-11 22:10:17 +00:00
|
|
|
|
|
|
|
if(vdd->par->transflag & OB_DUPLIROT) {
|
2007-07-16 12:20:57 +00:00
|
|
|
if(no_f) {
|
|
|
|
vec[0]= -no_f[0]; vec[1]= -no_f[1]; vec[2]= -no_f[2];
|
|
|
|
}
|
|
|
|
else if(no_s) {
|
|
|
|
vec[0]= -no_s[0]; vec[1]= -no_s[1]; vec[2]= -no_s[2];
|
|
|
|
}
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
vec_to_quat( q2,vec, vdd->ob->trackflag, vdd->ob->upflag);
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_mat3( mat,q2);
|
|
|
|
copy_m4_m4(tmat, obmat);
|
|
|
|
mul_m4_m4m3(obmat, tmat, mat);
|
2005-10-11 22:10:17 +00:00
|
|
|
}
|
2010-11-03 16:51:25 +00:00
|
|
|
|
|
|
|
origlay = vdd->ob->lay;
|
|
|
|
|
2008-01-21 22:10:14 +00:00
|
|
|
dob= new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay, index, OB_DUPLIVERTS, vdd->animated);
|
2010-11-03 16:51:25 +00:00
|
|
|
|
|
|
|
/* restore the original layer so that each dupli will have proper dob->origlay */
|
|
|
|
vdd->ob->lay = origlay;
|
|
|
|
|
2008-01-09 14:40:25 +00:00
|
|
|
if(vdd->orco)
|
|
|
|
VECCOPY(dob->orco, vdd->orco[index]);
|
2007-12-27 22:58:32 +00:00
|
|
|
|
|
|
|
if(vdd->ob->transflag & OB_DUPLI) {
|
|
|
|
float tmpmat[4][4];
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmpmat, vdd->ob->obmat);
|
|
|
|
copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
|
2009-01-04 14:14:06 +00:00
|
|
|
object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->level+1, vdd->animated);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(vdd->ob->obmat, tmpmat);
|
2007-12-27 22:58:32 +00:00
|
|
|
}
|
2005-10-11 22:10:17 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int level, int animated)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2007-12-27 20:33:29 +00:00
|
|
|
Object *ob, *ob_iter;
|
2008-12-31 17:11:42 +00:00
|
|
|
Mesh *me= par->data;
|
2007-12-27 20:33:29 +00:00
|
|
|
Base *base = NULL;
|
2005-07-17 05:20:57 +00:00
|
|
|
DerivedMesh *dm;
|
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
|
|
|
vertexDupliData vdd;
|
2007-12-27 20:33:29 +00:00
|
|
|
Scene *sce = NULL;
|
|
|
|
Group *group = NULL;
|
|
|
|
GroupObject * go = NULL;
|
2009-03-30 07:28:37 +00:00
|
|
|
EditMesh *em;
|
2008-12-31 17:11:42 +00:00
|
|
|
float vec[3], no[3], pmat[4][4];
|
2010-10-19 01:21:22 +00:00
|
|
|
int totvert, a, oblay;
|
|
|
|
unsigned int lay;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(pmat, par->obmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-12-27 22:58:32 +00:00
|
|
|
/* simple preventing of too deep nested groups */
|
|
|
|
if(level>MAX_DUPLI_RECUR) return;
|
2009-03-30 07:28:37 +00:00
|
|
|
|
2009-04-11 08:26:51 +00:00
|
|
|
em = BKE_mesh_get_editmesh(me);
|
2009-03-30 07:28:37 +00:00
|
|
|
|
|
|
|
if(em) {
|
|
|
|
dm= editmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
|
2009-04-11 08:26:51 +00:00
|
|
|
BKE_mesh_end_editmesh(me, em);
|
2009-03-30 07:28:37 +00:00
|
|
|
} else
|
2009-01-04 14:14:06 +00:00
|
|
|
dm= mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
|
2009-03-30 07:28:37 +00:00
|
|
|
|
2008-01-16 23:08:19 +00:00
|
|
|
if(G.rendering) {
|
|
|
|
vdd.orco= (float(*)[3])get_mesh_orco_verts(par);
|
|
|
|
transform_mesh_orco_verts(me, vdd.orco, me->totvert, 0);
|
|
|
|
}
|
2005-10-11 22:10:17 +00:00
|
|
|
else
|
2008-01-09 14:40:25 +00:00
|
|
|
vdd.orco= NULL;
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2005-07-17 16:16:22 +00:00
|
|
|
totvert = dm->getNumVerts(dm);
|
|
|
|
|
2007-12-27 20:33:29 +00:00
|
|
|
/* having to loop on scene OR group objects is NOT FUN */
|
|
|
|
if (GS(id->name) == ID_SCE) {
|
|
|
|
sce = (Scene *)id;
|
|
|
|
lay= sce->lay;
|
|
|
|
base= sce->base.first;
|
|
|
|
} else {
|
|
|
|
group = (Group *)id;
|
|
|
|
lay= group->layer;
|
|
|
|
go = group->gobject.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start looping on Scene OR Group objects */
|
|
|
|
while (base || go) {
|
|
|
|
if (sce) {
|
|
|
|
ob_iter= base->object;
|
|
|
|
oblay = base->lay;
|
|
|
|
} else {
|
|
|
|
ob_iter= go->ob;
|
|
|
|
oblay = ob_iter->lay;
|
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
if (lay & oblay && scene->obedit!=ob_iter) {
|
2007-12-27 20:33:29 +00:00
|
|
|
ob=ob_iter->parent;
|
2005-07-17 16:16:22 +00:00
|
|
|
while(ob) {
|
|
|
|
if(ob==par) {
|
2007-12-27 20:33:29 +00:00
|
|
|
ob = ob_iter;
|
|
|
|
/* End Scene/Group object loop, below is generic */
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2007-12-27 22:58:32 +00:00
|
|
|
|
2007-12-27 20:33:29 +00:00
|
|
|
/* par_space_mat - only used for groups so we can modify the space dupli's are in
|
|
|
|
when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
|
|
|
|
*/
|
2008-01-07 16:26:41 +00:00
|
|
|
if(par_space_mat)
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(vdd.obmat, ob->obmat, par_space_mat);
|
2008-01-07 16:26:41 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(vdd.obmat, ob->obmat);
|
2008-01-07 16:26:41 +00:00
|
|
|
|
2007-12-27 22:58:32 +00:00
|
|
|
vdd.id= id;
|
|
|
|
vdd.level= level;
|
2008-01-21 22:10:14 +00:00
|
|
|
vdd.animated= animated;
|
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
|
|
|
vdd.lb= lb;
|
2005-10-11 22:10:17 +00:00
|
|
|
vdd.ob= ob;
|
2009-01-04 14:14:06 +00:00
|
|
|
vdd.scene= scene;
|
2005-10-11 22:10:17 +00:00
|
|
|
vdd.par= par;
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(vdd.pmat, pmat);
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2005-07-17 16:16:22 +00:00
|
|
|
/* mballs have a different dupli handling */
|
|
|
|
if(ob->type!=OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */
|
|
|
|
|
2010-04-04 10:37:47 +00:00
|
|
|
if(me->edit_mesh) {
|
2005-10-11 22:10:17 +00:00
|
|
|
dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void*) &vdd);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(a=0; a<totvert; a++) {
|
|
|
|
dm->getVertCo(dm, a, vec);
|
|
|
|
dm->getVertNo(dm, a, no);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-10-11 22:10:17 +00:00
|
|
|
vertex_dupli__mapFunc(&vdd, a, vec, no, NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-03 16:51:25 +00:00
|
|
|
if(sce) {
|
|
|
|
/* Set proper layer in case of scene looping,
|
|
|
|
* in case of groups the object layer will be
|
|
|
|
* changed when it's duplicated due to the
|
|
|
|
* group duplication.
|
|
|
|
*/
|
|
|
|
ob->lay = vdd.par->lay;
|
|
|
|
}
|
2005-10-11 22:10:17 +00:00
|
|
|
|
2005-07-17 16:16:22 +00:00
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-07-17 16:16:22 +00:00
|
|
|
ob= ob->parent;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-27 20:33:29 +00:00
|
|
|
if (sce) base= base->next; /* scene loop */
|
|
|
|
else go= go->next; /* group loop */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-07-17 16:16:22 +00:00
|
|
|
|
2008-01-16 23:08:19 +00:00
|
|
|
if(vdd.orco)
|
|
|
|
MEM_freeN(vdd.orco);
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
dm->release(dm);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], int level, int animated)
|
2006-11-29 08:57:32 +00:00
|
|
|
{
|
2007-12-27 20:33:29 +00:00
|
|
|
Object *ob, *ob_iter;
|
|
|
|
Base *base = NULL;
|
2008-01-09 14:40:25 +00:00
|
|
|
DupliObject *dob;
|
2006-11-29 08:57:32 +00:00
|
|
|
DerivedMesh *dm;
|
2008-12-31 17:11:42 +00:00
|
|
|
Mesh *me= par->data;
|
2008-01-09 14:40:25 +00:00
|
|
|
MTFace *mtface;
|
2006-11-29 08:57:32 +00:00
|
|
|
MFace *mface;
|
|
|
|
MVert *mvert;
|
2008-01-16 23:08:19 +00:00
|
|
|
float pmat[4][4], imat[3][3], (*orco)[3] = NULL, w;
|
2007-12-27 20:33:29 +00:00
|
|
|
int lay, oblay, totface, a;
|
|
|
|
Scene *sce = NULL;
|
|
|
|
Group *group = NULL;
|
|
|
|
GroupObject *go = NULL;
|
2009-03-30 07:28:37 +00:00
|
|
|
EditMesh *em;
|
2007-12-27 20:33:29 +00:00
|
|
|
float ob__obmat[4][4]; /* needed for groups where the object matrix needs to be modified */
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2007-12-27 22:58:32 +00:00
|
|
|
/* simple preventing of too deep nested groups */
|
|
|
|
if(level>MAX_DUPLI_RECUR) return;
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(pmat, par->obmat);
|
2009-03-30 07:28:37 +00:00
|
|
|
|
2009-04-11 08:26:51 +00:00
|
|
|
em = BKE_mesh_get_editmesh(me);
|
2009-03-30 07:28:37 +00:00
|
|
|
if(em) {
|
2006-11-29 08:57:32 +00:00
|
|
|
int totvert;
|
2008-12-31 17:11:42 +00:00
|
|
|
|
2009-03-30 07:28:37 +00:00
|
|
|
dm= editmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
|
|
|
totface= dm->getNumFaces(dm);
|
|
|
|
mface= MEM_mallocN(sizeof(MFace)*totface, "mface temp");
|
|
|
|
dm->copyFaceArray(dm, mface);
|
|
|
|
totvert= dm->getNumVerts(dm);
|
|
|
|
mvert= MEM_mallocN(sizeof(MVert)*totvert, "mvert temp");
|
|
|
|
dm->copyVertArray(dm, mvert);
|
2009-03-30 07:28:37 +00:00
|
|
|
|
2009-04-11 08:26:51 +00:00
|
|
|
BKE_mesh_end_editmesh(me, em);
|
2006-11-29 08:57:32 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-01-04 14:14:06 +00:00
|
|
|
dm = mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
|
|
|
totface= dm->getNumFaces(dm);
|
|
|
|
mface= dm->getFaceArray(dm);
|
|
|
|
mvert= dm->getVertArray(dm);
|
|
|
|
}
|
2008-01-09 14:40:25 +00:00
|
|
|
|
|
|
|
if(G.rendering) {
|
2008-01-16 23:08:19 +00:00
|
|
|
|
|
|
|
orco= (float(*)[3])get_mesh_orco_verts(par);
|
|
|
|
transform_mesh_orco_verts(me, orco, me->totvert, 0);
|
2008-01-09 14:40:25 +00:00
|
|
|
mtface= me->mtface;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
orco= NULL;
|
|
|
|
mtface= NULL;
|
|
|
|
}
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2007-12-27 20:33:29 +00:00
|
|
|
/* having to loop on scene OR group objects is NOT FUN */
|
|
|
|
if (GS(id->name) == ID_SCE) {
|
|
|
|
sce = (Scene *)id;
|
|
|
|
lay= sce->lay;
|
|
|
|
base= sce->base.first;
|
|
|
|
} else {
|
|
|
|
group = (Group *)id;
|
|
|
|
lay= group->layer;
|
|
|
|
go = group->gobject.first;
|
|
|
|
}
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2007-12-27 20:33:29 +00:00
|
|
|
/* Start looping on Scene OR Group objects */
|
|
|
|
while (base || go) {
|
|
|
|
if (sce) {
|
|
|
|
ob_iter= base->object;
|
|
|
|
oblay = base->lay;
|
|
|
|
} else {
|
|
|
|
ob_iter= go->ob;
|
|
|
|
oblay = ob_iter->lay;
|
|
|
|
}
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
if (lay & oblay && scene->obedit!=ob_iter) {
|
2007-12-27 20:33:29 +00:00
|
|
|
ob=ob_iter->parent;
|
2006-11-29 08:57:32 +00:00
|
|
|
while(ob) {
|
|
|
|
if(ob==par) {
|
2007-12-27 20:33:29 +00:00
|
|
|
ob = ob_iter;
|
|
|
|
/* End Scene/Group object loop, below is generic */
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2007-12-27 20:33:29 +00:00
|
|
|
/* par_space_mat - only used for groups so we can modify the space dupli's are in
|
|
|
|
when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
|
|
|
|
*/
|
2008-01-07 16:26:41 +00:00
|
|
|
if(par_space_mat)
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(ob__obmat, ob->obmat, par_space_mat);
|
2008-01-07 16:26:41 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(ob__obmat, ob->obmat);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(imat, ob->parentinv);
|
2007-12-27 20:33:29 +00:00
|
|
|
|
2006-11-29 08:57:32 +00:00
|
|
|
/* mballs have a different dupli handling */
|
|
|
|
if(ob->type!=OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */
|
|
|
|
|
|
|
|
for(a=0; a<totface; a++) {
|
2008-01-09 14:40:25 +00:00
|
|
|
int mv1 = mface[a].v1;
|
|
|
|
int mv2 = mface[a].v2;
|
|
|
|
int mv3 = mface[a].v3;
|
|
|
|
int mv4 = mface[a].v4;
|
|
|
|
float *v1= mvert[mv1].co;
|
|
|
|
float *v2= mvert[mv2].co;
|
|
|
|
float *v3= mvert[mv3].co;
|
|
|
|
float *v4= (mv4)? mvert[mv4].co: NULL;
|
2006-11-29 12:44:48 +00:00
|
|
|
float cent[3], quat[4], mat[3][3], mat3[3][3], tmat[4][4], obmat[4][4];
|
2006-11-29 08:57:32 +00:00
|
|
|
|
|
|
|
/* translation */
|
|
|
|
if(v4)
|
2009-11-10 20:43:45 +00:00
|
|
|
cent_quad_v3(cent, v1, v2, v3, v4);
|
2006-11-29 08:57:32 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
cent_tri_v3(cent, v1, v2, v3);
|
|
|
|
mul_m4_v3(pmat, cent);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(cent, cent, pmat[3]);
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(cent, ob__obmat[3]);
|
2007-12-27 20:33:29 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(obmat, ob__obmat);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
|
|
|
VECCOPY(obmat[3], cent);
|
|
|
|
|
|
|
|
/* rotation */
|
2009-11-10 20:43:45 +00:00
|
|
|
tri_to_quat( quat,v1, v2, v3);
|
|
|
|
quat_to_mat3( mat,quat);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
|
|
|
/* scale */
|
|
|
|
if(par->transflag & OB_DUPLIFACES_SCALE) {
|
2009-11-10 20:43:45 +00:00
|
|
|
float size= v4? area_quad_v3(v1, v2, v3, v4): area_tri_v3(v1, v2, v3);
|
2011-03-27 17:22:04 +00:00
|
|
|
size= sqrtf(size) * par->dupfacesca;
|
2009-11-10 20:50:34 +00:00
|
|
|
mul_m3_fl(mat, size);
|
2006-11-29 08:57:32 +00:00
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(mat3, mat);
|
|
|
|
mul_m3_m3m3(mat, imat, mat3);
|
2006-11-29 12:44:48 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, obmat);
|
|
|
|
mul_m4_m4m3(obmat, tmat, mat);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
2010-04-15 10:28:32 +00:00
|
|
|
dob= new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIFACES, animated);
|
2008-01-09 14:40:25 +00:00
|
|
|
if(G.rendering) {
|
|
|
|
w= (mv4)? 0.25f: 1.0f/3.0f;
|
|
|
|
|
|
|
|
if(orco) {
|
|
|
|
VECADDFAC(dob->orco, dob->orco, orco[mv1], w);
|
|
|
|
VECADDFAC(dob->orco, dob->orco, orco[mv2], w);
|
|
|
|
VECADDFAC(dob->orco, dob->orco, orco[mv3], w);
|
|
|
|
if(mv4)
|
|
|
|
VECADDFAC(dob->orco, dob->orco, orco[mv4], w);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(mtface) {
|
|
|
|
dob->uv[0] += w*mtface[a].uv[0][0];
|
|
|
|
dob->uv[1] += w*mtface[a].uv[0][1];
|
|
|
|
dob->uv[0] += w*mtface[a].uv[1][0];
|
|
|
|
dob->uv[1] += w*mtface[a].uv[1][1];
|
|
|
|
dob->uv[0] += w*mtface[a].uv[2][0];
|
|
|
|
dob->uv[1] += w*mtface[a].uv[2][1];
|
|
|
|
|
|
|
|
if(mv4) {
|
|
|
|
dob->uv[0] += w*mtface[a].uv[3][0];
|
|
|
|
dob->uv[1] += w*mtface[a].uv[3][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-12-27 22:58:32 +00:00
|
|
|
|
|
|
|
if(ob->transflag & OB_DUPLI) {
|
|
|
|
float tmpmat[4][4];
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmpmat, ob->obmat);
|
|
|
|
copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
|
2009-01-04 14:14:06 +00:00
|
|
|
object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, level+1, animated);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(ob->obmat, tmpmat);
|
2007-12-27 22:58:32 +00:00
|
|
|
}
|
2006-11-29 08:57:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ob= ob->parent;
|
|
|
|
}
|
|
|
|
}
|
2007-12-27 20:33:29 +00:00
|
|
|
if (sce) base= base->next; /* scene loop */
|
|
|
|
else go= go->next; /* group loop */
|
2006-11-29 08:57:32 +00:00
|
|
|
}
|
|
|
|
|
2010-04-04 10:37:47 +00:00
|
|
|
if(em) {
|
2006-11-29 08:57:32 +00:00
|
|
|
MEM_freeN(mface);
|
|
|
|
MEM_freeN(mvert);
|
|
|
|
}
|
2008-01-16 23:08:19 +00:00
|
|
|
|
|
|
|
if(orco)
|
|
|
|
MEM_freeN(orco);
|
2006-11-29 08:57:32 +00:00
|
|
|
|
|
|
|
dm->release(dm);
|
|
|
|
}
|
|
|
|
|
2011-02-06 15:50:00 +00:00
|
|
|
static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated)
|
2002-10-12 11:37: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
|
|
|
GroupObject *go;
|
2011-02-13 10:52:18 +00:00
|
|
|
Object *ob=NULL, **oblist=NULL, obcopy, *obcopylist=NULL;
|
2008-01-09 14:40:25 +00:00
|
|
|
DupliObject *dob;
|
2009-10-05 13:25:56 +00:00
|
|
|
ParticleDupliWeight *dw;
|
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
|
|
|
ParticleSettings *part;
|
|
|
|
ParticleData *pa;
|
2011-02-13 10:52:18 +00:00
|
|
|
ChildParticle *cpa=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
|
|
|
ParticleKey state;
|
2008-01-07 16:26:41 +00:00
|
|
|
ParticleCacheKey *cache;
|
2008-01-07 18:15:57 +00:00
|
|
|
float ctime, pa_time, scale = 1.0f;
|
2009-10-05 13:25:56 +00:00
|
|
|
float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size=0.0;
|
2010-03-30 12:01:17 +00:00
|
|
|
float (*obmat)[4], (*oldobmat)[4];
|
2010-10-19 01:21:22 +00:00
|
|
|
int a, b, counter, hair = 0;
|
2011-05-22 16:29:51 +00:00
|
|
|
int totpart, totchild, totgroup=0 /*, pa_num */;
|
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
|
|
|
|
2011-02-12 21:54:50 +00:00
|
|
|
int no_draw_flag = PARS_UNEXIST;
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
if(psys==NULL) return;
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
|
2007-12-27 22:58:32 +00:00
|
|
|
/* simple preventing of too deep nested groups */
|
|
|
|
if(level>MAX_DUPLI_RECUR) return;
|
|
|
|
|
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
|
|
|
part=psys->part;
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
if(part==NULL)
|
2008-02-25 17:20:35 +00:00
|
|
|
return;
|
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-25 17:20:35 +00:00
|
|
|
if(!psys_check_enabled(par, psys))
|
|
|
|
return;
|
2011-02-12 21:54:50 +00:00
|
|
|
|
|
|
|
if(G.rendering == 0)
|
|
|
|
no_draw_flag |= PARS_NO_DISP;
|
2010-02-06 20:59:09 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
ctime = bsystem_time(scene, par, (float)scene->r.cfra, 0.0);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
|
|
|
|
totpart = psys->totpart;
|
|
|
|
totchild = psys->totchild;
|
|
|
|
|
|
|
|
BLI_srandom(31415926 + psys->seed);
|
2011-01-13 04:53:55 +00:00
|
|
|
|
2010-05-30 16:09:16 +00:00
|
|
|
if((psys->renderdata || part->draw_as==PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
|
2011-02-13 10:52:18 +00:00
|
|
|
ParticleSimulationData sim= {NULL};
|
2010-11-02 13:12:30 +00:00
|
|
|
sim.scene= scene;
|
|
|
|
sim.ob= par;
|
|
|
|
sim.psys= psys;
|
|
|
|
sim.psmd= psys_get_modifier(par, psys);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-05-30 16:09:16 +00:00
|
|
|
/* first check for loops (particle system object used as dupli object) */
|
|
|
|
if(part->ren_as == PART_DRAW_OB) {
|
|
|
|
if(ELEM(part->dup_ob, NULL, par))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else { /*PART_DRAW_GR */
|
|
|
|
if(part->dup_group == NULL || part->dup_group->gobject.first == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for(go=part->dup_group->gobject.first; go; go=go->next)
|
|
|
|
if(go->ob == par)
|
|
|
|
return;
|
|
|
|
}
|
2009-10-05 13:25:56 +00:00
|
|
|
|
2008-02-12 17:24:15 +00:00
|
|
|
/* if we have a hair particle system, use the path cache */
|
|
|
|
if(part->type == PART_HAIR) {
|
|
|
|
if(psys->flag & PSYS_HAIR_DONE)
|
|
|
|
hair= (totchild == 0 || psys->childcache) && psys->pathcache;
|
|
|
|
if(!hair)
|
|
|
|
return;
|
2008-09-10 15:25:06 +00:00
|
|
|
|
|
|
|
/* we use cache, update totchild according to cached data */
|
|
|
|
totchild = psys->totchildcache;
|
|
|
|
totpart = psys->totcached;
|
2008-02-12 17:24:15 +00:00
|
|
|
}
|
2008-01-07 16:26:41 +00:00
|
|
|
|
2010-05-30 16:09:16 +00:00
|
|
|
psys_check_group_weights(part);
|
|
|
|
|
2009-09-17 22:00:49 +00:00
|
|
|
psys->lattice = psys_get_lattice(&sim);
|
2004-10-14 22:20:42 +00:00
|
|
|
|
2008-05-09 10:26:49 +00:00
|
|
|
/* gather list of objects or single object */
|
2009-07-04 03:50:12 +00:00
|
|
|
if(part->ren_as==PART_DRAW_GR) {
|
2009-01-04 14:14:06 +00:00
|
|
|
group_handle_recalc_and_update(scene, par, part->dup_group);
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
|
2009-10-05 13:25:56 +00:00
|
|
|
if(part->draw & PART_DRAW_COUNT_GR) {
|
|
|
|
for(dw=part->dupliweights.first; dw; dw=dw->next)
|
|
|
|
totgroup += dw->count;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(go=part->dup_group->gobject.first; go; go=go->next)
|
|
|
|
totgroup++;
|
|
|
|
}
|
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-05-09 10:26:49 +00:00
|
|
|
/* we also copy the actual objects to restore afterwards, since
|
|
|
|
* where_is_object_time will change the object which breaks transform */
|
|
|
|
oblist = MEM_callocN(totgroup*sizeof(Object *), "dupgroup object list");
|
|
|
|
obcopylist = MEM_callocN(totgroup*sizeof(Object), "dupgroup copy list");
|
|
|
|
|
2009-10-05 13:25:56 +00:00
|
|
|
|
|
|
|
if(part->draw & PART_DRAW_COUNT_GR && totgroup) {
|
|
|
|
dw = part->dupliweights.first;
|
|
|
|
|
|
|
|
for(a=0; a<totgroup; dw=dw->next) {
|
|
|
|
for(b=0; b<dw->count; b++, a++) {
|
|
|
|
oblist[a] = dw->ob;
|
|
|
|
obcopylist[a] = *dw->ob;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
go = part->dup_group->gobject.first;
|
|
|
|
for(a=0; a<totgroup; a++, go=go->next) {
|
|
|
|
oblist[a] = go->ob;
|
|
|
|
obcopylist[a] = *go->ob;
|
|
|
|
}
|
2008-05-09 10:26:49 +00:00
|
|
|
}
|
2008-01-07 16:26:41 +00:00
|
|
|
}
|
2008-05-09 10:26:49 +00:00
|
|
|
else {
|
2008-01-07 16:26:41 +00:00
|
|
|
ob = part->dup_ob;
|
2008-05-09 10:26:49 +00:00
|
|
|
obcopy = *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
|
|
|
}
|
|
|
|
|
|
|
|
if(totchild==0 || part->draw & PART_DRAW_PARENT)
|
2008-05-09 10:26:49 +00:00
|
|
|
a = 0;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
else
|
2008-05-09 10:26:49 +00:00
|
|
|
a = totpart;
|
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
|
|
|
|
|
|
|
for(pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) {
|
|
|
|
if(a<totpart) {
|
2008-05-09 10:26:49 +00:00
|
|
|
/* handle parent particle */
|
2011-02-12 21:54:50 +00:00
|
|
|
if(pa->flag & no_draw_flag)
|
2008-01-07 16:26:41 +00:00
|
|
|
continue;
|
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
|
|
|
|
2011-05-22 16:29:51 +00:00
|
|
|
/* pa_num = pa->num; */ /* UNUSED */
|
2008-05-09 10:26:49 +00:00
|
|
|
pa_time = pa->time;
|
|
|
|
size = pa->size;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
}
|
|
|
|
else {
|
2008-05-09 10:26:49 +00:00
|
|
|
/* handle child particle */
|
|
|
|
cpa = &psys->child[a - totpart];
|
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
|
|
|
|
2011-05-22 16:29:51 +00:00
|
|
|
/* pa_num = a; */ /* UNUSED */
|
2008-01-09 14:40:25 +00:00
|
|
|
pa_time = psys->particles[cpa->parent].time;
|
2011-02-13 10:52:18 +00:00
|
|
|
size = psys_get_child_size(psys, cpa, ctime, 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
|
|
|
}
|
|
|
|
|
2010-09-03 06:18:23 +00:00
|
|
|
/* some hair paths might be non-existent so they can't be used for duplication */
|
|
|
|
if(hair &&
|
|
|
|
((a < totpart && psys->pathcache[a]->steps < 0) ||
|
|
|
|
(a >= totpart && psys->childcache[a-totpart]->steps < 0)))
|
|
|
|
continue;
|
|
|
|
|
2009-07-04 03:50:12 +00:00
|
|
|
if(part->ren_as==PART_DRAW_GR) {
|
2008-05-09 10:26:49 +00:00
|
|
|
/* for groups, pick the object based on settings */
|
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(part->draw&PART_DRAW_RAND_GR)
|
2008-01-07 16:26:41 +00:00
|
|
|
b= BLI_rand() % totgroup;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
else
|
2008-01-07 16:26:41 +00:00
|
|
|
b= a % totgroup;
|
|
|
|
|
|
|
|
ob = oblist[b];
|
2008-05-09 10:26:49 +00:00
|
|
|
obmat = oblist[b]->obmat;
|
|
|
|
oldobmat = obcopylist[b].obmat;
|
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-05-09 10:26:49 +00:00
|
|
|
else {
|
2008-04-29 09:56:52 +00:00
|
|
|
obmat= ob->obmat;
|
2008-05-09 10:26:49 +00:00
|
|
|
oldobmat= obcopy.obmat;
|
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-04-20 15:06:46 +00:00
|
|
|
if(hair) {
|
|
|
|
/* hair we handle separate and compute transform based on hair keys */
|
|
|
|
if(a < totpart) {
|
|
|
|
cache = psys->pathcache[a];
|
2011-02-13 10:52:18 +00:00
|
|
|
psys_get_dupli_path_transform(&sim, pa, NULL, cache, pamat, &scale);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-04-20 15:06:46 +00:00
|
|
|
cache = psys->childcache[a-totpart];
|
2011-02-13 10:52:18 +00:00
|
|
|
psys_get_dupli_path_transform(&sim, NULL, cpa, cache, pamat, &scale);
|
2008-01-07 16:26:41 +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
|
|
|
|
2009-04-20 15:06:46 +00:00
|
|
|
VECCOPY(pamat[3], cache->co);
|
|
|
|
pamat[3][3]= 1.0f;
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* first key */
|
|
|
|
state.time = ctime;
|
2010-12-07 01:56:32 +00:00
|
|
|
if(psys_get_particle_state(&sim, a, &state, 0) == 0) {
|
2009-04-20 15:06:46 +00:00
|
|
|
continue;
|
2010-12-07 01:56:32 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
float tquat[4];
|
|
|
|
normalize_qt_qt(tquat, state.rot);
|
|
|
|
quat_to_mat4(pamat, tquat);
|
|
|
|
copy_v3_v3(pamat[3], state.co);
|
|
|
|
pamat[3][3]= 1.0f;
|
|
|
|
}
|
2009-04-20 15:06:46 +00:00
|
|
|
}
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
|
2009-07-04 03:50:12 +00:00
|
|
|
if(part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
|
2009-04-20 15:06:46 +00:00
|
|
|
for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(tmat, oblist[b]->obmat, pamat);
|
2009-11-10 20:50:34 +00:00
|
|
|
mul_mat3_m4_fl(tmat, size*scale);
|
2008-01-07 16:26:41 +00:00
|
|
|
if(par_space_mat)
|
2010-03-30 12:01:17 +00:00
|
|
|
mul_m4_m4m4(mat, tmat, par_space_mat);
|
2008-01-07 16:26:41 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(mat, tmat);
|
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-04-20 15:06:46 +00:00
|
|
|
dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(dob->omat, obcopylist[b].obmat);
|
2008-01-09 14:40:25 +00:00
|
|
|
if(G.rendering)
|
2011-03-09 14:18:33 +00:00
|
|
|
psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2009-04-20 15:06:46 +00:00
|
|
|
else {
|
|
|
|
/* to give ipos in object correct offset */
|
|
|
|
where_is_object_time(scene, ob, ctime-pa_time);
|
2009-10-05 13:25:56 +00:00
|
|
|
|
|
|
|
VECCOPY(vec, obmat[3]);
|
|
|
|
obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f;
|
2009-04-20 15:06:46 +00:00
|
|
|
|
2010-09-14 01:43:46 +00:00
|
|
|
/* Normal particles and cached hair live in global space so we need to
|
|
|
|
* remove the real emitter's transformation before 2nd order duplication.
|
|
|
|
*/
|
2011-02-06 15:50:00 +00:00
|
|
|
if(par_space_mat && GS(id->name) != ID_GR)
|
2010-09-14 01:43:46 +00:00
|
|
|
mul_m4_m4m4(mat, pamat, psys->imat);
|
|
|
|
else
|
|
|
|
copy_m4_m4(mat, pamat);
|
2009-04-20 15:06:46 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(tmat, obmat, mat);
|
2009-11-10 20:50:34 +00:00
|
|
|
mul_mat3_m4_fl(tmat, size*scale);
|
2009-10-05 13:25:56 +00:00
|
|
|
|
2009-04-20 15:06:46 +00:00
|
|
|
if(par_space_mat)
|
2010-03-30 12:01:17 +00:00
|
|
|
mul_m4_m4m4(mat, tmat, par_space_mat);
|
2009-04-20 15:06:46 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(mat, tmat);
|
2009-04-20 15:06:46 +00:00
|
|
|
|
2010-09-14 01:43:46 +00:00
|
|
|
if(part->draw & PART_DRAW_GLOBAL_OB)
|
|
|
|
VECADD(mat[3], mat[3], vec);
|
|
|
|
|
2011-02-06 15:50:00 +00:00
|
|
|
dob= new_dupli_object(lb, ob, mat, ob->lay, counter, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, animated);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(dob->omat, oldobmat);
|
2009-04-20 15:06:46 +00:00
|
|
|
if(G.rendering)
|
2011-03-09 14:18:33 +00:00
|
|
|
psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
|
2009-04-20 15:06:46 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2008-05-09 10:26:49 +00:00
|
|
|
|
|
|
|
/* restore objects since they were changed in where_is_object_time */
|
2009-07-04 03:50:12 +00:00
|
|
|
if(part->ren_as==PART_DRAW_GR) {
|
2008-05-09 10:26:49 +00:00
|
|
|
for(a=0; a<totgroup; a++)
|
|
|
|
*(oblist[a])= obcopylist[a];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*ob= obcopy;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2008-05-09 10:26:49 +00:00
|
|
|
|
|
|
|
/* clean up */
|
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(oblist)
|
|
|
|
MEM_freeN(oblist);
|
2008-05-09 10:26:49 +00:00
|
|
|
if(obcopylist)
|
|
|
|
MEM_freeN(obcopylist);
|
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(psys->lattice) {
|
2009-01-07 16:05:55 +00:00
|
|
|
end_latt_deform(psys->lattice);
|
|
|
|
psys->lattice = NULL;
|
2006-06-23 17:56:15 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
static Object *find_family_object(Object **obar, char *family, char ch)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Object *ob;
|
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
|
|
|
int flen;
|
|
|
|
|
2008-12-26 14:19:25 +00:00
|
|
|
if( obar[(int)ch] ) return obar[(int)ch];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
flen= strlen(family);
|
|
|
|
|
|
|
|
ob= G.main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
if( ob->id.name[flen+2]==ch ) {
|
|
|
|
if( strncmp(ob->id.name+2, family, flen)==0 ) break;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2008-12-26 14:19:25 +00:00
|
|
|
obar[(int)ch]= ob;
|
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
|
|
|
|
|
|
|
return ob;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, int animated)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2011-02-13 10:52:18 +00:00
|
|
|
Object *ob, *obar[256]= {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
|
|
|
Curve *cu;
|
|
|
|
struct chartrans *ct, *chartransdata;
|
|
|
|
float vec[3], obmat[4][4], pmat[4][4], fsize, xof, yof;
|
|
|
|
int slen, a;
|
|
|
|
|
2007-12-27 22:58:32 +00:00
|
|
|
/* simple preventing of too deep nested groups */
|
|
|
|
if(level>MAX_DUPLI_RECUR) return;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(pmat, par->obmat);
|
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
|
|
|
|
|
|
|
/* in par the family name is stored, use this to find the other objects */
|
|
|
|
|
2009-01-23 14:43:25 +00:00
|
|
|
chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI);
|
2011-02-13 10:52:18 +00:00
|
|
|
if(chartransdata==NULL) return;
|
2010-11-23 08:44:21 +00:00
|
|
|
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
cu= par->data;
|
|
|
|
slen= strlen(cu->str);
|
|
|
|
fsize= cu->fsize;
|
|
|
|
xof= cu->xof;
|
|
|
|
yof= cu->yof;
|
|
|
|
|
|
|
|
ct= chartransdata;
|
|
|
|
|
|
|
|
for(a=0; a<slen; a++, ct++) {
|
|
|
|
|
|
|
|
ob= find_family_object(obar, cu->family, cu->str[a]);
|
|
|
|
if(ob) {
|
|
|
|
vec[0]= fsize*(ct->xof - xof);
|
|
|
|
vec[1]= fsize*(ct->yof - yof);
|
|
|
|
vec[2]= 0.0;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(pmat, vec);
|
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
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(obmat, par->obmat);
|
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
|
|
|
VECCOPY(obmat[3], vec);
|
|
|
|
|
2008-01-21 22:10:14 +00:00
|
|
|
new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS, animated);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MEM_freeN(chartransdata);
|
|
|
|
}
|
|
|
|
|
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-01-04 14:14:06 +00:00
|
|
|
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated)
|
2007-12-27 22:58:32 +00:00
|
|
|
{
|
2007-12-31 12:47:10 +00:00
|
|
|
if((ob->transflag & OB_DUPLI)==0)
|
|
|
|
return;
|
|
|
|
|
2008-01-04 21:12:48 +00:00
|
|
|
/* Should the dupli's be generated for this object? - Respect restrict flags */
|
2007-12-31 12:47:10 +00:00
|
|
|
if (G.rendering) {
|
|
|
|
if (ob->restrictflag & OB_RESTRICT_RENDER) {
|
|
|
|
return;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
}
|
2007-12-31 12:47:10 +00:00
|
|
|
} else {
|
|
|
|
if (ob->restrictflag & OB_RESTRICT_VIEW) {
|
|
|
|
return;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2007-12-31 12:47:10 +00:00
|
|
|
}
|
2005-09-24 09:05:48 +00:00
|
|
|
|
2007-12-31 12:47:10 +00:00
|
|
|
if(ob->transflag & OB_DUPLIPARTS) {
|
|
|
|
ParticleSystem *psys = ob->particlesystem.first;
|
|
|
|
for(; psys; psys=psys->next)
|
2009-01-04 14:14:06 +00:00
|
|
|
new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, psys, level+1, animated);
|
2007-12-31 12:47:10 +00:00
|
|
|
}
|
|
|
|
else if(ob->transflag & OB_DUPLIVERTS) {
|
|
|
|
if(ob->type==OB_MESH) {
|
2009-01-04 14:14:06 +00:00
|
|
|
vertex_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
}
|
2007-12-31 12:47:10 +00:00
|
|
|
else if(ob->type==OB_FONT) {
|
2007-12-27 22:58:32 +00:00
|
|
|
if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
|
2009-01-04 14:14:06 +00:00
|
|
|
font_duplilist(duplilist, scene, ob, level+1, animated);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-31 12:47:10 +00:00
|
|
|
}
|
|
|
|
else if(ob->transflag & OB_DUPLIFACES) {
|
|
|
|
if(ob->type==OB_MESH)
|
2009-01-04 14:14:06 +00:00
|
|
|
face_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
|
2007-12-31 12:47:10 +00:00
|
|
|
}
|
|
|
|
else if(ob->transflag & OB_DUPLIFRAMES) {
|
|
|
|
if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
|
2009-01-04 14:14:06 +00:00
|
|
|
frames_duplilist(duplilist, scene, ob, level+1, animated);
|
2006-11-29 08:57:32 +00:00
|
|
|
}
|
2007-12-31 12:47:10 +00:00
|
|
|
} else if(ob->transflag & OB_DUPLIGROUP) {
|
|
|
|
DupliObject *dob;
|
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
group_duplilist(duplilist, scene, ob, level+1, animated); /* now recursive */
|
2007-12-04 13:57:28 +00:00
|
|
|
|
2007-12-31 12:47:10 +00:00
|
|
|
if (level==0) {
|
2007-03-12 10:30:39 +00:00
|
|
|
for(dob= duplilist->first; dob; dob= dob->next)
|
2008-01-04 21:12:48 +00:00
|
|
|
if(dob->type == OB_DUPLIGROUP)
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(dob->ob->obmat, dob->mat);
|
2006-11-08 21:20:38 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2007-12-27 22:58:32 +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
|
|
|
/* Returns a list of DupliObject
|
|
|
|
* note; group dupli's already set transform matrix. see note in group_duplilist() */
|
2007-12-27 22:58:32 +00:00
|
|
|
ListBase *object_duplilist(Scene *sce, Object *ob)
|
|
|
|
{
|
|
|
|
ListBase *duplilist= MEM_mallocN(sizeof(ListBase), "duplilist");
|
|
|
|
duplilist->first= duplilist->last= NULL;
|
2009-01-04 14:14:06 +00:00
|
|
|
object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, 0, 0);
|
2007-03-12 10:30:39 +00:00
|
|
|
return duplilist;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-02-02 19:31:15 +00:00
|
|
|
void free_object_duplilist(ListBase *lb)
|
|
|
|
{
|
|
|
|
DupliObject *dob;
|
|
|
|
|
2010-07-03 17:19:44 +00:00
|
|
|
/* loop in reverse order, if object is instanced multiple times
|
|
|
|
the original layer may not really be original otherwise, proper
|
|
|
|
solution is more complicated */
|
|
|
|
for(dob= lb->last; dob; dob= dob->prev) {
|
2006-02-02 19:31:15 +00:00
|
|
|
dob->ob->lay= dob->origlay;
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(dob->ob->obmat, dob->omat);
|
2006-02-28 20:43:21 +00:00
|
|
|
}
|
|
|
|
|
2006-02-02 19:31:15 +00:00
|
|
|
BLI_freelistN(lb);
|
2007-03-12 10:30:39 +00:00
|
|
|
MEM_freeN(lb);
|
2006-02-02 19:31:15 +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
|
|
|
|
2005-09-24 09:05:48 +00:00
|
|
|
int count_duplilist(Object *ob)
|
|
|
|
{
|
|
|
|
if(ob->transflag & OB_DUPLI) {
|
|
|
|
if(ob->transflag & OB_DUPLIVERTS) {
|
|
|
|
if(ob->type==OB_MESH) {
|
|
|
|
if(ob->transflag & OB_DUPLIVERTS) {
|
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 *psys = ob->particlesystem.first;
|
|
|
|
int pdup=0;
|
|
|
|
|
|
|
|
for(; psys; psys=psys->next)
|
|
|
|
pdup += psys->totpart;
|
|
|
|
|
|
|
|
if(pdup==0){
|
2005-09-24 09:05:48 +00:00
|
|
|
Mesh *me= ob->data;
|
|
|
|
return me->totvert;
|
|
|
|
}
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
else
|
|
|
|
return pdup;
|
2005-09-24 09:05:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(ob->transflag & OB_DUPLIFRAMES) {
|
|
|
|
int tot= ob->dupend - ob->dupsta;
|
|
|
|
tot/= (ob->dupon+ob->dupoff);
|
|
|
|
return tot*ob->dupon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|