2011-10-10 09:38:02 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
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-04-16 22:40:48 +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/scene.c
|
|
|
|
|
* \ingroup bke
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2009-12-11 05:23:00 +00:00
|
|
|
#include <stddef.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <stdio.h>
|
Phew, a lot of work, and no new features...
Main target was to make the inner rendering loop using no globals anymore.
This is essential for proper usage while raytracing, it caused a lot of
hacks in the raycode as well, which even didn't work correctly for all
situations (textures especially).
Done this by creating a new local struct RenderInput, which replaces usage
of the global struct Render R. The latter now only is used to denote
image size, viewmatrix, and the like.
Making the inner render loops using no globals caused 1000s of vars to
be changed... but the result definitely is much nicer code, which enables
making 'real' shaders in a next stage.
It also enabled me to remove the hacks from ray.c
Then i went to the task of removing redundant code. Especially the calculus
of texture coords took place (identical) in three locations.
Most obvious is the change in the unified render part, which is much less
code now; it uses the same rendering routines as normal render now.
(Note; not for halos yet!)
I also removed 6 files called 'shadowbuffer' something. This was experimen-
tal stuff from NaN days. And again saved a lot of double used code.
Finally I went over the blenkernel and blender/src calls to render stuff.
Here the same local data is used now, resulting in less dependency.
I also moved render-texture to the render module, this was still in Kernel.
(new file: texture.c)
So! After this commit I will check on the autofiles, to try to fix that.
MSVC people have to do it themselves.
This commit will need quite some testing help, but I'm around!
2003-12-21 21:52:51 +00:00
|
|
|
#include <string.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "DNA_anim_types.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "DNA_group_types.h"
|
2013-09-05 15:47:52 +00:00
|
|
|
#include "DNA_linestyle_types.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "DNA_mesh_types.h"
|
2011-11-18 07:11:54 +00:00
|
|
|
#include "DNA_node_types.h"
|
2010-08-04 04:01:27 +00:00
|
|
|
#include "DNA_object_types.h"
|
2013-01-23 05:56:22 +00:00
|
|
|
#include "DNA_rigidbody_types.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2010-06-24 10:04:18 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
2014-02-06 10:10:59 +01:00
|
|
|
#include "DNA_space_types.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
|
#include "DNA_windowmanager_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_utildefines.h"
|
2011-09-27 10:43:45 +00:00
|
|
|
#include "BLI_callbacks.h"
|
2012-10-08 06:38:34 +00:00
|
|
|
#include "BLI_string.h"
|
2013-05-08 13:23:17 +00:00
|
|
|
#include "BLI_threads.h"
|
2013-12-26 17:24:42 +06:00
|
|
|
#include "BLI_task.h"
|
2010-08-16 05:46:10 +00:00
|
|
|
|
2013-03-25 08:29:06 +00:00
|
|
|
#include "BLF_translation.h"
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_anim.h"
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "BKE_animsys.h"
|
2012-11-09 07:29:27 +00:00
|
|
|
#include "BKE_action.h"
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
#include "BKE_colortools.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "BKE_editmesh.h"
|
2012-11-09 07:29:27 +00:00
|
|
|
#include "BKE_fcurve.h"
|
2013-03-23 03:00:37 +00:00
|
|
|
#include "BKE_freestyle.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_global.h"
|
2010-03-26 10:52:55 +00:00
|
|
|
#include "BKE_group.h"
|
2008-05-11 20:40:55 +00:00
|
|
|
#include "BKE_idprop.h"
|
2013-05-22 22:17:07 +00:00
|
|
|
#include "BKE_image.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_library.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_main.h"
|
2012-06-04 16:42:58 +00:00
|
|
|
#include "BKE_mask.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#include "BKE_node.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_object.h"
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "BKE_paint.h"
|
2013-01-23 05:56:22 +00:00
|
|
|
#include "BKE_rigidbody.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_scene.h"
|
2009-12-13 14:56:45 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2010-02-07 23:41:17 +00:00
|
|
|
#include "BKE_sound.h"
|
2014-08-26 20:52:07 +10:00
|
|
|
#include "BKE_unit.h"
|
2013-03-25 08:29:06 +00:00
|
|
|
#include "BKE_world.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-11-02 19:24:30 +00:00
|
|
|
#include "RE_engine.h"
|
|
|
|
|
|
2013-12-26 17:24:42 +06:00
|
|
|
#include "PIL_time.h"
|
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
#include "IMB_colormanagement.h"
|
|
|
|
|
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "bmesh.h"
|
|
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
//XXX #include "BIF_previewrender.h"
|
|
|
|
|
//XXX #include "BIF_editseq.h"
|
2006-11-06 01:08:26 +00:00
|
|
|
|
2005-04-30 22:52:00 +00:00
|
|
|
#ifdef WIN32
|
2005-04-30 23:24:48 +00:00
|
|
|
#else
|
2014-01-05 16:00:54 +06:00
|
|
|
# include <sys/time.h>
|
2005-04-30 22:52:00 +00:00
|
|
|
#endif
|
2005-04-30 21:27:05 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
void free_avicodecdata(AviCodecData *acd)
|
|
|
|
|
{
|
|
|
|
|
if (acd) {
|
2012-02-23 02:17:50 +00:00
|
|
|
if (acd->lpFormat) {
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(acd->lpFormat);
|
|
|
|
|
acd->lpFormat = NULL;
|
|
|
|
|
acd->cbFormat = 0;
|
|
|
|
|
}
|
2012-02-23 02:17:50 +00:00
|
|
|
if (acd->lpParms) {
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(acd->lpParms);
|
|
|
|
|
acd->lpParms = NULL;
|
|
|
|
|
acd->cbParms = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-21 01:21:07 +00:00
|
|
|
void free_qtcodecdata(QuicktimeCodecData *qcd)
|
|
|
|
|
{
|
|
|
|
|
if (qcd) {
|
2012-02-23 02:17:50 +00:00
|
|
|
if (qcd->cdParms) {
|
2003-05-21 01:21:07 +00:00
|
|
|
MEM_freeN(qcd->cdParms);
|
|
|
|
|
qcd->cdParms = NULL;
|
|
|
|
|
qcd->cdSize = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-09 07:29:27 +00:00
|
|
|
static void remove_sequencer_fcurves(Scene *sce)
|
|
|
|
|
{
|
2012-11-09 09:57:35 +00:00
|
|
|
AnimData *adt = BKE_animdata_from_id(&sce->id);
|
2012-11-09 07:29:27 +00:00
|
|
|
|
2012-11-09 09:57:35 +00:00
|
|
|
if (adt && adt->action) {
|
2012-11-09 07:29:27 +00:00
|
|
|
FCurve *fcu, *nextfcu;
|
2012-11-09 09:57:35 +00:00
|
|
|
|
|
|
|
|
for (fcu = adt->action->curves.first; fcu; fcu = nextfcu) {
|
2012-11-09 07:29:27 +00:00
|
|
|
nextfcu = fcu->next;
|
2012-11-09 09:57:35 +00:00
|
|
|
|
2012-11-09 07:29:27 +00:00
|
|
|
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
|
2012-11-09 09:57:35 +00:00
|
|
|
action_groups_remove_channel(adt->action, fcu);
|
2012-11-09 07:29:27 +00:00
|
|
|
free_fcurve(fcu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
Scene *BKE_scene_copy(Scene *sce, int type)
|
2009-09-18 22:25:49 +00:00
|
|
|
{
|
|
|
|
|
Scene *scen;
|
2013-03-23 03:00:37 +00:00
|
|
|
SceneRenderLayer *srl, *new_srl;
|
2009-09-18 22:25:49 +00:00
|
|
|
ToolSettings *ts;
|
|
|
|
|
Base *base, *obase;
|
|
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (type == SCE_COPY_EMPTY) {
|
2009-09-18 22:25:49 +00:00
|
|
|
ListBase lb;
|
2012-12-13 01:17:22 +00:00
|
|
|
/* XXX. main should become an arg */
|
|
|
|
|
scen = BKE_scene_add(G.main, sce->id.name + 2);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
lb = scen->r.layers;
|
|
|
|
|
scen->r = sce->r;
|
|
|
|
|
scen->r.layers = lb;
|
2013-10-18 09:45:21 +00:00
|
|
|
scen->r.actlay = 0;
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->unit = sce->unit;
|
|
|
|
|
scen->physics_settings = sce->physics_settings;
|
|
|
|
|
scen->gm = sce->gm;
|
|
|
|
|
scen->audio = sce->audio;
|
2012-04-15 08:48:11 +00:00
|
|
|
|
2013-11-26 15:19:08 +01:00
|
|
|
if (sce->id.properties)
|
|
|
|
|
scen->id.properties = IDP_CopyProperty(sce->id.properties);
|
|
|
|
|
|
2012-04-15 08:48:11 +00:00
|
|
|
MEM_freeN(scen->toolsettings);
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-06 15:15:33 +00:00
|
|
|
scen = BKE_libblock_copy(&sce->id);
|
2009-09-18 22:25:49 +00:00
|
|
|
BLI_duplicatelist(&(scen->base), &(sce->base));
|
|
|
|
|
|
2013-12-30 13:25:27 +11:00
|
|
|
BKE_main_id_clear_newpoins(G.main);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
id_us_plus((ID *)scen->world);
|
|
|
|
|
id_us_plus((ID *)scen->set);
|
|
|
|
|
id_us_plus((ID *)scen->gm.dome.warptext);
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->ed = NULL;
|
|
|
|
|
scen->theDag = NULL;
|
|
|
|
|
scen->obedit = NULL;
|
|
|
|
|
scen->stats = NULL;
|
|
|
|
|
scen->fps_info = NULL;
|
2013-04-24 23:09:25 +00:00
|
|
|
|
2013-04-25 16:35:57 +00:00
|
|
|
if (sce->rigidbody_world)
|
2013-04-24 23:09:25 +00:00
|
|
|
scen->rigidbody_world = BKE_rigidbody_world_copy(sce->rigidbody_world);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
BLI_duplicatelist(&(scen->markers), &(sce->markers));
|
|
|
|
|
BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
|
|
|
|
|
BLI_duplicatelist(&(scen->r.layers), &(sce->r.layers));
|
|
|
|
|
BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets));
|
2010-08-05 10:50:38 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->nodetree) {
|
2012-08-22 09:10:16 +00:00
|
|
|
/* ID's are managed on both copy and switch */
|
|
|
|
|
scen->nodetree = ntreeCopyTree(sce->nodetree);
|
2010-08-05 10:50:38 +00:00
|
|
|
ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
obase = sce->base.first;
|
|
|
|
|
base = scen->base.first;
|
2012-02-23 02:17:50 +00:00
|
|
|
while (base) {
|
2009-09-18 22:25:49 +00:00
|
|
|
id_us_plus(&base->object->id);
|
2012-05-06 15:15:33 +00:00
|
|
|
if (obase == sce->basact) scen->basact = base;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
obase = obase->next;
|
|
|
|
|
base = base->next;
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
|
|
|
|
/* copy color management settings */
|
|
|
|
|
BKE_color_managed_display_settings_copy(&scen->display_settings, &sce->display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&scen->view_settings, &sce->view_settings);
|
2012-09-23 18:50:56 +00:00
|
|
|
BKE_color_managed_view_settings_copy(&scen->r.im_format.view_settings, &sce->r.im_format.view_settings);
|
2012-10-08 06:38:34 +00:00
|
|
|
|
|
|
|
|
BLI_strncpy(scen->sequencer_colorspace_settings.name, sce->sequencer_colorspace_settings.name,
|
|
|
|
|
sizeof(scen->sequencer_colorspace_settings.name));
|
2012-11-09 07:29:27 +00:00
|
|
|
|
2014-01-21 15:15:47 +01:00
|
|
|
/* copy action and remove animation used by sequencer */
|
|
|
|
|
BKE_copy_animdata_id_action(&scen->id);
|
|
|
|
|
|
2012-11-09 07:29:27 +00:00
|
|
|
if (type != SCE_COPY_FULL)
|
|
|
|
|
remove_sequencer_fcurves(scen);
|
2013-01-29 03:12:49 +00:00
|
|
|
|
2013-03-23 03:00:37 +00:00
|
|
|
/* copy Freestyle settings */
|
|
|
|
|
new_srl = scen->r.layers.first;
|
|
|
|
|
for (srl = sce->r.layers.first; srl; srl = srl->next) {
|
|
|
|
|
BKE_freestyle_config_copy(&new_srl->freestyleConfig, &srl->freestyleConfig);
|
|
|
|
|
new_srl = new_srl->next;
|
2013-01-29 03:12:49 +00:00
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
2012-04-15 08:48:11 +00:00
|
|
|
|
|
|
|
|
/* tool settings */
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->toolsettings = MEM_dupallocN(sce->toolsettings);
|
2012-04-15 08:48:11 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
ts = scen->toolsettings;
|
2012-04-15 08:48:11 +00:00
|
|
|
if (ts) {
|
|
|
|
|
if (ts->vpaint) {
|
2012-05-06 15:15:33 +00:00
|
|
|
ts->vpaint = MEM_dupallocN(ts->vpaint);
|
|
|
|
|
ts->vpaint->paintcursor = NULL;
|
|
|
|
|
ts->vpaint->vpaint_prev = NULL;
|
|
|
|
|
ts->vpaint->wpaint_prev = NULL;
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_copy(&ts->vpaint->paint, &ts->vpaint->paint);
|
2012-04-15 08:48:11 +00:00
|
|
|
}
|
|
|
|
|
if (ts->wpaint) {
|
2012-05-06 15:15:33 +00:00
|
|
|
ts->wpaint = MEM_dupallocN(ts->wpaint);
|
|
|
|
|
ts->wpaint->paintcursor = NULL;
|
|
|
|
|
ts->wpaint->vpaint_prev = NULL;
|
|
|
|
|
ts->wpaint->wpaint_prev = NULL;
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_copy(&ts->wpaint->paint, &ts->wpaint->paint);
|
2012-04-15 08:48:11 +00:00
|
|
|
}
|
|
|
|
|
if (ts->sculpt) {
|
2012-05-06 15:15:33 +00:00
|
|
|
ts->sculpt = MEM_dupallocN(ts->sculpt);
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_copy(&ts->sculpt->paint, &ts->sculpt->paint);
|
2012-04-15 08:48:11 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_copy(&ts->imapaint.paint, &ts->imapaint.paint);
|
2012-05-06 15:15:33 +00:00
|
|
|
ts->imapaint.paintcursor = NULL;
|
2014-08-15 11:44:31 +02:00
|
|
|
id_us_plus((ID *)ts->imapaint.stencil);
|
2012-05-06 15:15:33 +00:00
|
|
|
ts->particle.paintcursor = NULL;
|
2012-04-15 08:48:11 +00:00
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
/* make a private copy of the avicodecdata */
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->r.avicodecdata) {
|
2009-09-18 22:25:49 +00:00
|
|
|
scen->r.avicodecdata = MEM_dupallocN(sce->r.avicodecdata);
|
|
|
|
|
scen->r.avicodecdata->lpFormat = MEM_dupallocN(scen->r.avicodecdata->lpFormat);
|
|
|
|
|
scen->r.avicodecdata->lpParms = MEM_dupallocN(scen->r.avicodecdata->lpParms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* make a private copy of the qtcodecdata */
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->r.qtcodecdata) {
|
2009-09-18 22:25:49 +00:00
|
|
|
scen->r.qtcodecdata = MEM_dupallocN(sce->r.qtcodecdata);
|
|
|
|
|
scen->r.qtcodecdata->cdParms = MEM_dupallocN(scen->r.qtcodecdata->cdParms);
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->r.ffcodecdata.properties) { /* intentionally check scen not sce. */
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->r.ffcodecdata.properties = IDP_CopyProperty(sce->r.ffcodecdata.properties);
|
2010-06-25 12:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
/* NOTE: part of SCE_COPY_LINK_DATA and SCE_COPY_FULL operations
|
|
|
|
|
* are done outside of blenkernel with ED_objects_single_users! */
|
|
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* camera */
|
2012-02-23 02:17:50 +00:00
|
|
|
if (type == SCE_COPY_LINK_DATA || type == SCE_COPY_FULL) {
|
2010-03-22 09:30:00 +00:00
|
|
|
ID_NEW(scen->camera);
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
2010-10-04 15:31:04 +00:00
|
|
|
|
|
|
|
|
/* before scene copy */
|
|
|
|
|
sound_create_scene(scen);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
/* world */
|
2012-02-23 02:17:50 +00:00
|
|
|
if (type == SCE_COPY_FULL) {
|
|
|
|
|
if (scen->world) {
|
2010-03-22 09:30:00 +00:00
|
|
|
id_us_plus((ID *)scen->world);
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->world = BKE_world_copy(scen->world);
|
2010-11-09 09:53:17 +00:00
|
|
|
BKE_copy_animdata_id_action((ID *)scen->world);
|
2010-03-22 09:30:00 +00:00
|
|
|
}
|
2010-06-25 12:04:04 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->ed) {
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->ed = MEM_callocN(sizeof(Editing), "addseq");
|
|
|
|
|
scen->ed->seqbasep = &scen->ed->seqbase;
|
2012-08-08 11:15:40 +00:00
|
|
|
BKE_sequence_base_dupli_recursive(sce, scen, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL);
|
2010-06-25 12:04:04 +00:00
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return scen;
|
|
|
|
|
}
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
|
2013-04-24 23:09:25 +00:00
|
|
|
void BKE_scene_groups_relink(Scene *sce)
|
|
|
|
|
{
|
|
|
|
|
if (sce->rigidbody_world)
|
|
|
|
|
BKE_rigidbody_world_groups_relink(sce->rigidbody_world);
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* do not free scene itself */
|
2012-05-05 14:03:12 +00:00
|
|
|
void BKE_scene_free(Scene *sce)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
Base *base;
|
2013-03-23 03:00:37 +00:00
|
|
|
SceneRenderLayer *srl;
|
2012-12-11 22:00:22 +00:00
|
|
|
|
2013-02-28 14:25:09 +00:00
|
|
|
/* check all sequences */
|
|
|
|
|
BKE_sequencer_clear_scene_in_allseqs(G.main, sce);
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
base = sce->base.first;
|
2012-02-23 02:17:50 +00:00
|
|
|
while (base) {
|
2002-10-12 11:37:38 +00:00
|
|
|
base->object->id.us--;
|
2012-05-06 15:15:33 +00:00
|
|
|
base = base->next;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2003-04-26 13:07:59 +00:00
|
|
|
/* do not free objects! */
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->gpd) {
|
2012-07-07 22:51:57 +00:00
|
|
|
#if 0 /* removed since this can be invalid memory when freeing everything */
|
|
|
|
|
/* since the grease pencil data is freed before the scene.
|
|
|
|
|
* since grease pencil data is not (yet?), shared between objects
|
|
|
|
|
* its probably safe not to do this, some save and reload will free this. */
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->gpd->id.us--;
|
2009-12-25 23:50:35 +00:00
|
|
|
#endif
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->gpd = NULL;
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
BLI_freelistN(&sce->base);
|
2012-05-11 10:04:55 +00:00
|
|
|
BKE_sequencer_editing_free(sce);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
BKE_free_animdata((ID *)sce);
|
|
|
|
|
BKE_keyingsets_free(&sce->keyingsets);
|
2008-10-28 20:26:38 +00:00
|
|
|
|
2013-01-23 05:56:22 +00:00
|
|
|
if (sce->rigidbody_world)
|
|
|
|
|
BKE_rigidbody_free_world(sce->rigidbody_world);
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (sce->r.avicodecdata) {
|
|
|
|
|
free_avicodecdata(sce->r.avicodecdata);
|
|
|
|
|
MEM_freeN(sce->r.avicodecdata);
|
|
|
|
|
sce->r.avicodecdata = NULL;
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
|
|
|
|
if (sce->r.qtcodecdata) {
|
|
|
|
|
free_qtcodecdata(sce->r.qtcodecdata);
|
|
|
|
|
MEM_freeN(sce->r.qtcodecdata);
|
|
|
|
|
sce->r.qtcodecdata = NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2008-05-11 20:40:55 +00:00
|
|
|
if (sce->r.ffcodecdata.properties) {
|
|
|
|
|
IDP_FreeProperty(sce->r.ffcodecdata.properties);
|
|
|
|
|
MEM_freeN(sce->r.ffcodecdata.properties);
|
|
|
|
|
sce->r.ffcodecdata.properties = NULL;
|
|
|
|
|
}
|
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio
window... the audio window should restrict to own options. This way
functionality is nicely separated.
Since it's the first time I added a new space (since long!) I've made an
extensive tutorial as well. You can find that here:
http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html
Notes for using timewindow;
- Add time markers with MKey
- CTRL+M gives option to name Marker
- Markers cannot be moved yet...
- Pageup-Pagedown keys moves current frame to next-prev Marker
- Xkey removes Markers
- If an object has Ipos or an Action, it draws key lines
- CTRL+Pageup-Pagedown moves current frame to next-prev Key
- Press S or E to set start/end frame for playback
Notes about the implementation in Tuhopuu:
- Add new Marker now selects new, deselects others
- Selecting Marker didn't work like elsewhere in Blender, on click it
should deselect all, except the indicated Marker. Not when holding SHIFT
of course
- Not exported functions are static now
- Removed unused defines (MARKER_NONE NEXT_AVAIL)
- Drawing order was confusing, doing too many matrix calls
- Removed not needed scrollbar, added new function to draw time values.
(Has advantage the MMB scroll works not confusing on a scrollbar)
- Added proper support for 'frame mapping'
- The string button (name Marker) had a bug (checked str[64] while str
was only 64 long)
- String button itself didn't allow "OK on enter"
- Made frame buttons in header larger, the arrows overlapped
- Removed support for negative frame values, that won't work so simple!
2005-05-05 17:19:21 +00:00
|
|
|
|
2013-03-23 03:00:37 +00:00
|
|
|
for (srl = sce->r.layers.first; srl; srl = srl->next) {
|
|
|
|
|
BKE_freestyle_config_free(&srl->freestyleConfig);
|
2009-10-07 07:18:50 +00:00
|
|
|
}
|
|
|
|
|
|
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio
window... the audio window should restrict to own options. This way
functionality is nicely separated.
Since it's the first time I added a new space (since long!) I've made an
extensive tutorial as well. You can find that here:
http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html
Notes for using timewindow;
- Add time markers with MKey
- CTRL+M gives option to name Marker
- Markers cannot be moved yet...
- Pageup-Pagedown keys moves current frame to next-prev Marker
- Xkey removes Markers
- If an object has Ipos or an Action, it draws key lines
- CTRL+Pageup-Pagedown moves current frame to next-prev Key
- Press S or E to set start/end frame for playback
Notes about the implementation in Tuhopuu:
- Add new Marker now selects new, deselects others
- Selecting Marker didn't work like elsewhere in Blender, on click it
should deselect all, except the indicated Marker. Not when holding SHIFT
of course
- Not exported functions are static now
- Removed unused defines (MARKER_NONE NEXT_AVAIL)
- Drawing order was confusing, doing too many matrix calls
- Removed not needed scrollbar, added new function to draw time values.
(Has advantage the MMB scroll works not confusing on a scrollbar)
- Added proper support for 'frame mapping'
- The string button (name Marker) had a bug (checked str[64] while str
was only 64 long)
- String button itself didn't allow "OK on enter"
- Made frame buttons in header larger, the arrows overlapped
- Removed support for negative frame values, that won't work so simple!
2005-05-05 17:19:21 +00:00
|
|
|
BLI_freelistN(&sce->markers);
|
=== Custom Transform Orientation ===
Custom Orientations can be added with Ctrl-Shift-C (hotkey suggestions are welcomed), this adds and select the new alignment. Custom Orientations can also be added, deleted, selected from the Transform Orientations panel (View -> Transform Orientations). Standard orientations (global, local, normal, view) can also be selected from this panel.
If you plan on using only a single custom orientation and don't really need a list, I suggest you use the hotkey as it adds and selects at the same time.
Custom Orientations are save in the scene and are selected per 3D view (like normal orientation).
Adding from an object, the orientation is a normalized version of the object's orientation.
Adding from mesh data, a single element (vertex, edge, face) must be selected in its respective selection mode. Vertex orientation Z-axis is based on the normal, edge Z-axis on the edge itself (X-axis is on the XoY plane when possible, Y-axis is perpendicular to the rest). Face orientation Z-axis is the face normal, X-axis is perpendicular to the first edge, Y-axis is perpendicular to the rest.
(More logical orientations can be suggested).
I plan to add: 2 vertice (connected or not) => edge orientation , 3 vertice = face orientation
Differences from the patch:
- orientations no longer link back to the object they came from, everything is copy on creation.
- orientations are overwritten based on name (if you add an orientation with the same name as one that already exists, it overwrites the old one)
2008-01-13 18:24:09 +00:00
|
|
|
BLI_freelistN(&sce->transform_spaces);
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
BLI_freelistN(&sce->r.layers);
|
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio
window... the audio window should restrict to own options. This way
functionality is nicely separated.
Since it's the first time I added a new space (since long!) I've made an
extensive tutorial as well. You can find that here:
http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html
Notes for using timewindow;
- Add time markers with MKey
- CTRL+M gives option to name Marker
- Markers cannot be moved yet...
- Pageup-Pagedown keys moves current frame to next-prev Marker
- Xkey removes Markers
- If an object has Ipos or an Action, it draws key lines
- CTRL+Pageup-Pagedown moves current frame to next-prev Key
- Press S or E to set start/end frame for playback
Notes about the implementation in Tuhopuu:
- Add new Marker now selects new, deselects others
- Selecting Marker didn't work like elsewhere in Blender, on click it
should deselect all, except the indicated Marker. Not when holding SHIFT
of course
- Not exported functions are static now
- Removed unused defines (MARKER_NONE NEXT_AVAIL)
- Drawing order was confusing, doing too many matrix calls
- Removed not needed scrollbar, added new function to draw time values.
(Has advantage the MMB scroll works not confusing on a scrollbar)
- Added proper support for 'frame mapping'
- The string button (name Marker) had a bug (checked str[64] while str
was only 64 long)
- String button itself didn't allow "OK on enter"
- Made frame buttons in header larger, the arrows overlapped
- Removed support for negative frame values, that won't work so simple!
2005-05-05 17:19:21 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->toolsettings) {
|
|
|
|
|
if (sce->toolsettings->vpaint) {
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_free(&sce->toolsettings->vpaint->paint);
|
2009-09-18 22:25:49 +00:00
|
|
|
MEM_freeN(sce->toolsettings->vpaint);
|
|
|
|
|
}
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->toolsettings->wpaint) {
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_free(&sce->toolsettings->wpaint->paint);
|
2009-09-18 22:25:49 +00:00
|
|
|
MEM_freeN(sce->toolsettings->wpaint);
|
|
|
|
|
}
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->toolsettings->sculpt) {
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_free(&sce->toolsettings->sculpt->paint);
|
2009-09-18 22:25:49 +00:00
|
|
|
MEM_freeN(sce->toolsettings->sculpt);
|
|
|
|
|
}
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->toolsettings->uvsculpt) {
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_free(&sce->toolsettings->uvsculpt->paint);
|
2012-01-17 16:31:13 +00:00
|
|
|
MEM_freeN(sce->toolsettings->uvsculpt);
|
|
|
|
|
}
|
2012-07-25 22:37:52 +00:00
|
|
|
BKE_paint_free(&sce->toolsettings->imapaint.paint);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2005-08-24 20:37:25 +00:00
|
|
|
MEM_freeN(sce->toolsettings);
|
2012-10-21 05:46:41 +00:00
|
|
|
sce->toolsettings = NULL;
|
2005-08-24 20:37:25 +00:00
|
|
|
}
|
|
|
|
|
|
2013-02-26 20:34:37 +00:00
|
|
|
DAG_scene_free(sce);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->nodetree) {
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
ntreeFreeTree(sce->nodetree);
|
|
|
|
|
MEM_freeN(sce->nodetree);
|
|
|
|
|
}
|
2006-11-06 01:08:26 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->stats)
|
2009-09-18 22:25:49 +00:00
|
|
|
MEM_freeN(sce->stats);
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce->fps_info)
|
2010-02-12 00:44:26 +00:00
|
|
|
MEM_freeN(sce->fps_info);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
|
|
|
|
sound_destroy_scene(sce);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
|
|
|
|
BKE_color_managed_view_settings_free(&sce->view_settings);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2013-02-16 19:24:50 +00:00
|
|
|
Scene *BKE_scene_add(Main *bmain, const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
Scene *sce;
|
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
|
|
|
ParticleEditSettings *pset;
|
|
|
|
|
int a;
|
2012-10-08 06:38:34 +00:00
|
|
|
const char *colorspace_name;
|
2004-01-04 22:10:36 +00:00
|
|
|
|
2014-01-15 16:37:03 +01:00
|
|
|
sce = BKE_libblock_alloc(bmain, ID_SCE, name);
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->lay = sce->layact = 1;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.mode = R_GAMMA | R_OSA | R_SHADOW | R_SSS | R_ENVMAP | R_RAYTRACE;
|
|
|
|
|
sce->r.cfra = 1;
|
|
|
|
|
sce->r.sfra = 1;
|
|
|
|
|
sce->r.efra = 250;
|
|
|
|
|
sce->r.frame_step = 1;
|
|
|
|
|
sce->r.xsch = 1920;
|
|
|
|
|
sce->r.ysch = 1080;
|
|
|
|
|
sce->r.xasp = 1;
|
|
|
|
|
sce->r.yasp = 1;
|
2012-11-05 08:05:14 +00:00
|
|
|
sce->r.tilex = 256;
|
|
|
|
|
sce->r.tiley = 256;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.mblur_samples = 1;
|
|
|
|
|
sce->r.filtertype = R_FILTER_MITCH;
|
|
|
|
|
sce->r.size = 50;
|
|
|
|
|
|
2013-09-10 13:25:37 +00:00
|
|
|
sce->r.im_format.planes = R_IMF_PLANES_RGBA;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.im_format.imtype = R_IMF_IMTYPE_PNG;
|
2012-12-31 14:02:33 +00:00
|
|
|
sce->r.im_format.depth = R_IMF_CHAN_DEPTH_8;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.im_format.quality = 90;
|
2013-11-25 16:22:55 +06:00
|
|
|
sce->r.im_format.compress = 15;
|
2012-05-06 15:15:33 +00:00
|
|
|
|
|
|
|
|
sce->r.displaymode = R_OUTPUT_AREA;
|
|
|
|
|
sce->r.framapto = 100;
|
|
|
|
|
sce->r.images = 100;
|
|
|
|
|
sce->r.framelen = 1.0;
|
|
|
|
|
sce->r.blurfac = 0.5;
|
|
|
|
|
sce->r.frs_sec = 24;
|
|
|
|
|
sce->r.frs_sec_base = 1;
|
2014-01-27 19:58:54 +01:00
|
|
|
sce->r.edgeint = 10;
|
2007-09-10 22:52:32 +00:00
|
|
|
sce->r.ocres = 128;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2012-09-26 20:05:38 +00:00
|
|
|
/* OCIO_TODO: for forwards compatibility only, so if no tonecurve are used,
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
* images would look in the same way as in current blender
|
|
|
|
|
*
|
|
|
|
|
* perhaps at some point should be completely deprecated?
|
|
|
|
|
*/
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->r.color_mgt_flag |= R_COLOR_MANAGEMENT;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.gauss = 1.0;
|
2010-11-18 03:03:17 +00:00
|
|
|
|
|
|
|
|
/* deprecated but keep for upwards compat */
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.postgamma = 1.0;
|
|
|
|
|
sce->r.posthue = 0.0;
|
|
|
|
|
sce->r.postsat = 1.0;
|
|
|
|
|
|
|
|
|
|
sce->r.bake_mode = 1; /* prevent to include render stuff here */
|
2013-03-04 15:58:40 +00:00
|
|
|
sce->r.bake_filter = 16;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.bake_osa = 5;
|
|
|
|
|
sce->r.bake_flag = R_BAKE_CLEAR;
|
|
|
|
|
sce->r.bake_normal_space = R_BAKE_SPACE_TANGENT;
|
2012-12-19 12:30:39 +00:00
|
|
|
sce->r.bake_samples = 256;
|
2012-12-22 18:31:05 +00:00
|
|
|
sce->r.bake_biasdist = 0.001;
|
Bake API - bpy.ops.object.bake()
New operator that can calls a bake function to the current render engine when available. This commit provides no feature for the users, but allows external engines to be accessed by the operator and be integrated with the baking api.
The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an array of floats with the result.
The Blender Internal (and multires) system is still running independent, but we eventually will pipe it through the API as well. Cycles baking will come next as a separated commit
Python Operator:
----------------
The operator can be called with some arguments, or a user interface can be created for it. In that case the arguments can be ommited and the interface can expose the settings from bpy.context.scene.render.bake
bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_split_materials=False, use_automatic_name=False)
Note: external save mode is currently disabled.
Supported Features:
------------------
* Margin - Baked result is extended this many pixels beyond the border of each UV "island," to soften seams in the texture.
* Selected to Active - bake shading on the surface of selected object to the active object. The rays are cast from the lowpoly object inwards towards the highpoly object. If the highpoly object is not entirely involved by the lowpoly object, you can tweak the rays start point with Cage Extrusion. For even more control of the cage you can use a Cage object.
* Cage Extrusion - distance to use for the inward ray cast when using selected to active
* Custom Cage - object to use as cage (instead of the lowpoly object).
* Normal swizzle - change the axis that gets mapped to RGB
* Normal space - save as tangent or object normal spaces
Supported Passes:
-----------------
Any pass that is supported by Blender renderlayer system. Though it's up to the external engine to provide a valid enum with its supported passes. Normal passes get a special treatment since we post-process them to converted and "swizzled"
Development Notes for External Engines:
---------------------------------------
(read them in bake_api.c)
* For a complete implementation example look at the Cycles Bake commit (next).
Review: D421
Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge
Normal map pipeline "consulting" by Andy Davies (metalliandy)
Original design by Brecht van Lommel.
The entire commit history can be found on the branch: bake-cycles
2014-01-02 19:05:07 -02:00
|
|
|
|
|
|
|
|
sce->r.bake.flag = R_BAKE_CLEAR;
|
|
|
|
|
sce->r.bake.width = 512;
|
|
|
|
|
sce->r.bake.height = 512;
|
|
|
|
|
sce->r.bake.margin = 16;
|
|
|
|
|
sce->r.bake.normal_space = R_BAKE_SPACE_TANGENT;
|
|
|
|
|
sce->r.bake.normal_swizzle[0] = R_BAKE_POSX;
|
|
|
|
|
sce->r.bake.normal_swizzle[1] = R_BAKE_POSY;
|
|
|
|
|
sce->r.bake.normal_swizzle[2] = R_BAKE_POSZ;
|
|
|
|
|
BLI_strncpy(sce->r.bake.filepath, U.renderdir, sizeof(sce->r.bake.filepath));
|
|
|
|
|
|
|
|
|
|
sce->r.bake.im_format.planes = R_IMF_PLANES_RGBA;
|
|
|
|
|
sce->r.bake.im_format.imtype = R_IMF_IMTYPE_PNG;
|
|
|
|
|
sce->r.bake.im_format.depth = R_IMF_CHAN_DEPTH_8;
|
|
|
|
|
sce->r.bake.im_format.quality = 90;
|
|
|
|
|
sce->r.bake.im_format.compress = 15;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.scemode = R_DOCOMP | R_DOSEQ | R_EXTENSION;
|
|
|
|
|
sce->r.stamp = R_STAMP_TIME | R_STAMP_FRAME | R_STAMP_DATE | R_STAMP_CAMERA | R_STAMP_SCENE | R_STAMP_FILENAME | R_STAMP_RENDERTIME;
|
|
|
|
|
sce->r.stamp_font_id = 12;
|
|
|
|
|
sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
|
|
|
|
|
sce->r.fg_stamp[3] = 1.0f;
|
|
|
|
|
sce->r.bg_stamp[0] = sce->r.bg_stamp[1] = sce->r.bg_stamp[2] = 0.0f;
|
|
|
|
|
sce->r.bg_stamp[3] = 0.25f;
|
Raytrace modifications from the Render Branch.
These should not have any effect on render results, except in some cases with
you have overlapping faces, where the noise seems to be slightly reduced.
There are some performance improvements, for simple scenes I wouldn't expect
more than 5-10% to be cut off the render time, for sintel scenes we got about
50% on average, that's with millions of polygons on intel quad cores. This
because memory access / cache misses were the main bottleneck for those scenes,
and the optimizations improve that.
Interal changes:
* Remove RE_raytrace.h, raytracer is now only used by render engine again.
* Split non-public parts rayobject.h into rayobject_internal.h, hopefully
makes it clearer how the API is used.
* Added rayintersection.h to contain some of the stuff from RE_raytrace.h
* Change Isect.vec/labda to Isect.dir/dist, previously vec was sometimes
normalized and sometimes not, confusing... now dir is always normalized
and dist contains the distance.
* Change VECCOPY and similar to BLI_math functions.
* Force inlining of auxiliary functions for ray-triangle/quad intersection,
helps a few percentages.
* Reorganize svbvh code so all the traversal functions are in one file
* Don't do test for root so that push_childs can be inlined
* Make shadow a template parameter so it doesn't need to be runtime checked
* Optimization in raytree building, was computing bounding boxes more often
than necessary.
* Leave out logf() factor in SAH, makes tree build quicker with no
noticeable influence on raytracing on performance?
* Set max childs to 4, simplifies traversal code a bit, but also seems
to help slightly in general.
* Store child pointers and child bb just as fixed arrays of size 4 in nodes,
nearly all nodes have this many children, so overall it actually reduces
memory usage a bit and avoids a pointer indirection.
2011-02-05 13:41:29 +00:00
|
|
|
sce->r.raytrace_options = R_RAYTRACE_USE_INSTANCES;
|
2010-03-16 17:37:34 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.seq_prev_type = OB_SOLID;
|
|
|
|
|
sce->r.seq_rend_type = OB_SOLID;
|
|
|
|
|
sce->r.seq_flag = R_SEQ_GL_PREV;
|
2010-03-16 17:37:34 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.threads = 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.simplify_subsurf = 6;
|
|
|
|
|
sce->r.simplify_particles = 1.0f;
|
|
|
|
|
sce->r.simplify_shadowsamples = 16;
|
|
|
|
|
sce->r.simplify_aosss = 1.0f;
|
2008-02-13 11:18:08 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
sce->r.border.xmin = 0.0f;
|
|
|
|
|
sce->r.border.ymin = 0.0f;
|
|
|
|
|
sce->r.border.xmax = 1.0f;
|
|
|
|
|
sce->r.border.ymax = 1.0f;
|
2014-07-28 16:32:36 +06:00
|
|
|
|
|
|
|
|
sce->r.preview_start_resolution = 64;
|
2008-03-10 11:39:37 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
|
2005-08-24 20:37:25 +00:00
|
|
|
sce->toolsettings->doublimit = 0.001;
|
2012-10-15 17:56:51 +00:00
|
|
|
sce->toolsettings->uvcalc_margin = 0.001f;
|
2006-06-10 20:06:41 +00:00
|
|
|
sce->toolsettings->unwrapper = 1;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->toolsettings->select_thresh = 0.01f;
|
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
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->toolsettings->selectmode = SCE_SELECT_VERTEX;
|
|
|
|
|
sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX;
|
|
|
|
|
sce->toolsettings->normalsize = 0.1;
|
|
|
|
|
sce->toolsettings->autokey_mode = U.autokey_mode;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
|
|
|
|
|
|
2008-08-12 19:56:03 +00:00
|
|
|
sce->toolsettings->skgen_resolution = 100;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->toolsettings->skgen_threshold_internal = 0.01f;
|
|
|
|
|
sce->toolsettings->skgen_threshold_external = 0.01f;
|
|
|
|
|
sce->toolsettings->skgen_angle_limit = 45.0f;
|
|
|
|
|
sce->toolsettings->skgen_length_ratio = 1.3f;
|
|
|
|
|
sce->toolsettings->skgen_length_limit = 1.5f;
|
|
|
|
|
sce->toolsettings->skgen_correlation_limit = 0.98f;
|
|
|
|
|
sce->toolsettings->skgen_symmetry_limit = 0.1f;
|
2008-08-12 19:56:03 +00:00
|
|
|
sce->toolsettings->skgen_postpro = SKGEN_SMOOTH;
|
|
|
|
|
sce->toolsettings->skgen_postpro_passes = 1;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->toolsettings->skgen_options = SKGEN_FILTER_INTERNAL | SKGEN_FILTER_EXTERNAL | SKGEN_FILTER_SMART | SKGEN_HARMONIC | SKGEN_SUB_CORRELATION | SKGEN_STICK_TO_EMBEDDING;
|
2008-08-12 19:56:03 +00:00
|
|
|
sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
|
|
|
|
|
sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
|
|
|
|
|
sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
|
|
|
|
|
|
2013-04-17 09:27:23 +00:00
|
|
|
sce->toolsettings->statvis.overhang_axis = OB_NEGZ;
|
|
|
|
|
sce->toolsettings->statvis.overhang_min = 0;
|
|
|
|
|
sce->toolsettings->statvis.overhang_max = DEG2RADF(45.0f);
|
|
|
|
|
sce->toolsettings->statvis.thickness_max = 0.1f;
|
|
|
|
|
sce->toolsettings->statvis.thickness_samples = 1;
|
2013-04-18 04:24:18 +00:00
|
|
|
sce->toolsettings->statvis.distort_min = DEG2RADF(5.0f);
|
|
|
|
|
sce->toolsettings->statvis.distort_max = DEG2RADF(45.0f);
|
2013-04-17 09:27:23 +00:00
|
|
|
|
2013-04-18 17:09:56 +00:00
|
|
|
sce->toolsettings->statvis.sharp_min = DEG2RADF(90.0f);
|
|
|
|
|
sce->toolsettings->statvis.sharp_max = DEG2RADF(180.0f);
|
|
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->toolsettings->proportional_size = 1.0f;
|
|
|
|
|
|
2014-08-15 19:59:31 +10:00
|
|
|
sce->toolsettings->imapaint.paint.flags |= PAINT_SHOW_BRUSH;
|
2014-08-15 11:44:31 +02:00
|
|
|
sce->toolsettings->imapaint.normal_angle = 80;
|
|
|
|
|
sce->toolsettings->imapaint.seam_bleed = 2;
|
2014-03-10 18:42:35 +02:00
|
|
|
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
sce->physics_settings.gravity[0] = 0.0f;
|
|
|
|
|
sce->physics_settings.gravity[1] = 0.0f;
|
|
|
|
|
sce->physics_settings.gravity[2] = -9.81f;
|
|
|
|
|
sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
sce->unit.scale_length = 1.0f;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
pset = &sce->toolsettings->particle;
|
|
|
|
|
pset->flag = PE_KEEP_LENGTHS | PE_LOCK_FIRST | PE_DEFLECT_EMITTER | PE_AUTO_VELOCITY;
|
|
|
|
|
pset->emitterdist = 0.25f;
|
|
|
|
|
pset->totrekey = 5;
|
|
|
|
|
pset->totaddkey = 5;
|
|
|
|
|
pset->brushtype = PE_BRUSH_NONE;
|
|
|
|
|
pset->draw_step = 2;
|
|
|
|
|
pset->fade_frames = 2;
|
|
|
|
|
pset->selectmode = SCE_SELECT_PATH;
|
|
|
|
|
for (a = 0; a < PE_TOT_BRUSH; a++) {
|
|
|
|
|
pset->brush[a].strength = 0.5;
|
|
|
|
|
pset->brush[a].size = 50;
|
|
|
|
|
pset->brush[a].step = 10;
|
|
|
|
|
pset->brush[a].count = 10;
|
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
|
|
|
}
|
2012-05-06 15:15:33 +00:00
|
|
|
pset->brush[PE_BRUSH_CUT].strength = 100;
|
2010-11-09 10:40:03 +00:00
|
|
|
|
2009-09-20 14:00:00 +00:00
|
|
|
sce->r.ffcodecdata.audio_mixrate = 44100;
|
2010-11-18 03:03:17 +00:00
|
|
|
sce->r.ffcodecdata.audio_volume = 1.0f;
|
2011-05-30 18:57:28 +00:00
|
|
|
sce->r.ffcodecdata.audio_bitrate = 192;
|
2011-06-21 20:39:41 +00:00
|
|
|
sce->r.ffcodecdata.audio_channels = 2;
|
2010-11-18 03:03:17 +00:00
|
|
|
|
|
|
|
|
BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine));
|
2005-08-24 20:37:25 +00:00
|
|
|
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
sce->audio.distance_model = 2.0f;
|
|
|
|
|
sce->audio.doppler_factor = 1.0f;
|
|
|
|
|
sce->audio.speed_of_sound = 343.3f;
|
|
|
|
|
sce->audio.volume = 1.0f;
|
2005-08-24 20:37:25 +00:00
|
|
|
|
2011-06-10 10:13:50 +00:00
|
|
|
BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
|
2006-11-06 01:08:26 +00:00
|
|
|
|
2012-07-12 08:31:23 +00:00
|
|
|
BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.osa = 8;
|
2006-11-06 01:08:26 +00:00
|
|
|
|
2006-02-14 11:28:13 +00:00
|
|
|
/* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
|
2012-05-05 14:33:36 +00:00
|
|
|
BKE_scene_add_render_layer(sce, NULL);
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
/* game data */
|
|
|
|
|
sce->gm.stereoflag = STEREO_NOSTEREO;
|
|
|
|
|
sce->gm.stereomode = STEREO_ANAGLYPH;
|
2009-12-29 15:47:20 +00:00
|
|
|
sce->gm.eyeseparation = 0.10;
|
|
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->gm.dome.angle = 180;
|
|
|
|
|
sce->gm.dome.mode = DOME_FISHEYE;
|
|
|
|
|
sce->gm.dome.res = 4;
|
|
|
|
|
sce->gm.dome.resbuf = 1.0f;
|
|
|
|
|
sce->gm.dome.tilt = 0;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->gm.xplay = 640;
|
|
|
|
|
sce->gm.yplay = 480;
|
|
|
|
|
sce->gm.freqplay = 60;
|
|
|
|
|
sce->gm.depth = 32;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->gm.gravity = 9.8f;
|
|
|
|
|
sce->gm.physicsEngine = WOPHY_BULLET;
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->gm.mode = 32; //XXX ugly harcoding, still not sure we should drop mode. 32 == 1 << 5 == use_occlusion_culling
|
|
|
|
|
sce->gm.occlusionRes = 128;
|
|
|
|
|
sce->gm.ticrate = 60;
|
|
|
|
|
sce->gm.maxlogicstep = 5;
|
|
|
|
|
sce->gm.physubstep = 1;
|
|
|
|
|
sce->gm.maxphystep = 5;
|
2012-05-29 20:30:33 +00:00
|
|
|
sce->gm.lineardeactthreshold = 0.8f;
|
|
|
|
|
sce->gm.angulardeactthreshold = 1.0f;
|
|
|
|
|
sce->gm.deactivationtime = 0.0f;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
sce->gm.flag = GAME_DISPLAY_LISTS;
|
|
|
|
|
sce->gm.matmode = GAME_MAT_MULTITEX;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->gm.obstacleSimulation = OBSTSIMULATION_NONE;
|
2010-06-18 23:48:52 +00:00
|
|
|
sce->gm.levelHeight = 2.f;
|
2010-06-10 00:19:06 +00:00
|
|
|
|
2010-07-09 22:16:52 +00:00
|
|
|
sce->gm.recastData.cellsize = 0.3f;
|
|
|
|
|
sce->gm.recastData.cellheight = 0.2f;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->gm.recastData.agentmaxslope = M_PI / 2;
|
2010-07-09 22:16:52 +00:00
|
|
|
sce->gm.recastData.agentmaxclimb = 0.9f;
|
|
|
|
|
sce->gm.recastData.agentheight = 2.0f;
|
|
|
|
|
sce->gm.recastData.agentradius = 0.6f;
|
|
|
|
|
sce->gm.recastData.edgemaxlen = 12.0f;
|
|
|
|
|
sce->gm.recastData.edgemaxerror = 1.3f;
|
2011-09-29 21:38:57 +00:00
|
|
|
sce->gm.recastData.regionminsize = 8.f;
|
2010-07-09 22:16:52 +00:00
|
|
|
sce->gm.recastData.regionmergesize = 20.f;
|
|
|
|
|
sce->gm.recastData.vertsperpoly = 6;
|
|
|
|
|
sce->gm.recastData.detailsampledist = 6.0f;
|
|
|
|
|
sce->gm.recastData.detailsamplemaxerror = 1.0f;
|
|
|
|
|
|
2012-01-25 01:39:38 +00:00
|
|
|
sce->gm.exitkey = 218; // Blender key code for ESC
|
|
|
|
|
|
2010-02-07 23:41:17 +00:00
|
|
|
sound_create_scene(sce);
|
|
|
|
|
|
2012-10-08 06:38:34 +00:00
|
|
|
/* color management */
|
|
|
|
|
colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER);
|
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
BKE_color_managed_display_settings_init(&sce->display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_init(&sce->view_settings);
|
2012-10-08 06:38:34 +00:00
|
|
|
BLI_strncpy(sce->sequencer_colorspace_settings.name, colorspace_name,
|
|
|
|
|
sizeof(sce->sequencer_colorspace_settings.name));
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return sce;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
Base *BKE_scene_base_find(Scene *scene, Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2012-08-18 16:16:13 +00:00
|
|
|
return BLI_findptr(&scene->base, ob, offsetof(Base, object));
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_set_background(Main *bmain, Scene *scene)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2009-09-18 22:25:49 +00:00
|
|
|
Scene *sce;
|
2002-10-12 11:37:38 +00:00
|
|
|
Base *base;
|
|
|
|
|
Object *ob;
|
|
|
|
|
Group *group;
|
|
|
|
|
GroupObject *go;
|
|
|
|
|
int flag;
|
|
|
|
|
|
2006-05-15 10:46:04 +00:00
|
|
|
/* check for cyclic sets, for reading old files but also for definite security (py?) */
|
2012-05-05 14:33:36 +00:00
|
|
|
BKE_scene_validate_setscene(bmain, scene);
|
2006-05-15 10:46:04 +00:00
|
|
|
|
2010-07-23 18:42:15 +00:00
|
|
|
/* can happen when switching modes in other scenes */
|
2012-02-23 02:17:50 +00:00
|
|
|
if (scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT))
|
2012-05-06 15:15:33 +00:00
|
|
|
scene->obedit = NULL;
|
2010-07-23 18:42:15 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* deselect objects (for dataselect) */
|
2012-05-06 15:15:33 +00:00
|
|
|
for (ob = bmain->object.first; ob; ob = ob->id.next)
|
|
|
|
|
ob->flag &= ~(SELECT | OB_FROMGROUP);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
/* group flags again */
|
2012-05-06 15:15:33 +00:00
|
|
|
for (group = bmain->group.first; group; group = group->id.next) {
|
2012-08-18 16:16:13 +00:00
|
|
|
for (go = group->gobject.first; go; go = go->next) {
|
|
|
|
|
if (go->ob) {
|
|
|
|
|
go->ob->flag |= OB_FROMGROUP;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-10 16:46:13 +00:00
|
|
|
/* sort baselist for scene and sets */
|
2013-02-21 19:33:04 +00:00
|
|
|
for (sce = scene; sce; sce = sce->set)
|
2013-07-10 16:46:13 +00:00
|
|
|
DAG_scene_relations_rebuild(bmain, sce);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* copy layers and flags from bases to objects */
|
2012-05-06 15:15:33 +00:00
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
|
|
|
|
ob = base->object;
|
|
|
|
|
ob->lay = base->lay;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-06-17 18:31:42 +00:00
|
|
|
/* group patch... */
|
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
|
|
|
base->flag &= ~(OB_FROMGROUP);
|
2012-05-06 15:15:33 +00:00
|
|
|
flag = ob->flag & (OB_FROMGROUP);
|
2002-10-12 11:37:38 +00:00
|
|
|
base->flag |= flag;
|
|
|
|
|
|
2006-11-30 16:44:34 +00:00
|
|
|
/* not too nice... for recovering objects with lost data */
|
2012-05-27 19:40:36 +00:00
|
|
|
//if (ob->pose == NULL) base->flag &= ~OB_POSEMODE;
|
2012-05-06 15:15:33 +00:00
|
|
|
ob->flag = base->flag;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
More work on render stuff!
- Scene support in RenderLayers
You now can indicate in Compositor to use RenderLayer(s) from other scenes.
Use the new dropdown menu in the "Render Result" node. It will change the
title of the node to indicate that.
The other Scenes are rendered fully separate, creating own databases (and
octrees) after the current scene was finished. They use their own render
settings, with as exception the render output size (and optional border).
This makes the option an interesting memory saver and speedup.
Also note that the render-results of other scenes are kept in memory while
you work. So, after a render, you can tweak all composit effects.
- Render Stats
Added an 'info string' to stats, printed in renderwindow header. It gives
info now on steps "creating database", "shadow buffers", and "octree".
- Bug fixes
Added redraw event for Image window, when using compositor render.
Text objects were not rendered using background render (probably a bug
since depsgraph was added)
Dropdown buttons in Node editor were not refreshed after usage
Sometimes render window did not open, this due to wrong check for 'esc'.
Removed option that renders view-layers on F12, with mouse in 3d window.
Not only was it confusing, it's now more efficient with the Preview Panel,
which does this nicely.
2006-02-04 13:28:50 +00:00
|
|
|
/* no full animation update, this to enable render code to work (render code calls own animation updates) */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
More work on render stuff!
- Scene support in RenderLayers
You now can indicate in Compositor to use RenderLayer(s) from other scenes.
Use the new dropdown menu in the "Render Result" node. It will change the
title of the node to indicate that.
The other Scenes are rendered fully separate, creating own databases (and
octrees) after the current scene was finished. They use their own render
settings, with as exception the render output size (and optional border).
This makes the option an interesting memory saver and speedup.
Also note that the render-results of other scenes are kept in memory while
you work. So, after a render, you can tweak all composit effects.
- Render Stats
Added an 'info string' to stats, printed in renderwindow header. It gives
info now on steps "creating database", "shadow buffers", and "octree".
- Bug fixes
Added redraw event for Image window, when using compositor render.
Text objects were not rendered using background render (probably a bug
since depsgraph was added)
Dropdown buttons in Node editor were not refreshed after usage
Sometimes render window did not open, this due to wrong check for 'esc'.
Removed option that renders view-layers on F12, with mouse in 3d window.
Not only was it confusing, it's now more efficient with the Preview Panel,
which does this nicely.
2006-02-04 13:28:50 +00:00
|
|
|
/* called from creator.c */
|
2012-05-05 14:33:36 +00:00
|
|
|
Scene *BKE_scene_set_name(Main *bmain, const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2014-07-23 20:30:55 +10:00
|
|
|
Scene *sce = (Scene *)BKE_libblock_find_name_ex(bmain, ID_SCE, name);
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce) {
|
2012-05-05 14:33:36 +00:00
|
|
|
BKE_scene_set_background(bmain, sce);
|
2014-07-23 20:30:55 +10:00
|
|
|
printf("Scene switch: '%s' in file: '%s'\n", name, bmain->name);
|
2010-07-05 00:00:40 +00:00
|
|
|
return sce;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2010-07-05 00:00:40 +00:00
|
|
|
|
2014-07-23 20:30:55 +10:00
|
|
|
printf("Can't find scene: '%s' in file: '%s'\n", name, bmain->name);
|
2010-07-05 00:00:40 +00:00
|
|
|
return NULL;
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
|
|
|
|
|
2014-02-06 10:10:59 +01:00
|
|
|
static void scene_unlink_space_node(SpaceNode *snode, Scene *sce)
|
|
|
|
|
{
|
|
|
|
|
if (snode->id == &sce->id) {
|
|
|
|
|
/* nasty DNA logic for SpaceNode:
|
|
|
|
|
* ideally should be handled by editor code, but would be bad level call
|
|
|
|
|
*/
|
|
|
|
|
bNodeTreePath *path, *path_next;
|
|
|
|
|
for (path = snode->treepath.first; path; path = path_next) {
|
|
|
|
|
path_next = path->next;
|
|
|
|
|
MEM_freeN(path);
|
|
|
|
|
}
|
2014-02-08 06:07:10 +11:00
|
|
|
BLI_listbase_clear(&snode->treepath);
|
2014-02-06 10:10:59 +01:00
|
|
|
|
|
|
|
|
snode->id = NULL;
|
|
|
|
|
snode->from = NULL;
|
|
|
|
|
snode->nodetree = NULL;
|
|
|
|
|
snode->edittree = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-17 10:48:32 +02:00
|
|
|
static void scene_unlink_space_buts(SpaceButs *sbuts, Scene *sce)
|
|
|
|
|
{
|
|
|
|
|
if (sbuts->pinid == &sce->id) {
|
|
|
|
|
sbuts->pinid = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_unlink(Main *bmain, Scene *sce, Scene *newsce)
|
2009-09-18 22:25:49 +00:00
|
|
|
{
|
|
|
|
|
Scene *sce1;
|
2014-02-06 10:10:59 +01:00
|
|
|
bScreen *screen;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
/* check all sets */
|
2012-05-06 15:15:33 +00:00
|
|
|
for (sce1 = bmain->scene.first; sce1; sce1 = sce1->id.next)
|
2012-02-23 02:17:50 +00:00
|
|
|
if (sce1->set == sce)
|
2012-05-06 15:15:33 +00:00
|
|
|
sce1->set = NULL;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2014-02-05 13:51:51 +01:00
|
|
|
for (sce1 = bmain->scene.first; sce1; sce1 = sce1->id.next) {
|
|
|
|
|
bNode *node;
|
|
|
|
|
|
|
|
|
|
if (sce1 == sce || !sce1->nodetree)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for (node = sce1->nodetree->nodes.first; node; node = node->next) {
|
|
|
|
|
if (node->id == &sce->id)
|
|
|
|
|
node->id = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2014-02-06 10:10:59 +01:00
|
|
|
/* all screens */
|
|
|
|
|
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
|
|
|
|
ScrArea *area;
|
|
|
|
|
|
|
|
|
|
if (screen->scene == sce)
|
|
|
|
|
screen->scene = newsce;
|
|
|
|
|
|
|
|
|
|
for (area = screen->areabase.first; area; area = area->next) {
|
|
|
|
|
SpaceLink *space_link;
|
|
|
|
|
for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
|
2014-04-17 10:48:32 +02:00
|
|
|
switch (space_link->spacetype) {
|
|
|
|
|
case SPACE_NODE:
|
|
|
|
|
scene_unlink_space_node((SpaceNode *)space_link, sce);
|
2014-04-17 20:02:56 +10:00
|
|
|
break;
|
2014-04-17 10:48:32 +02:00
|
|
|
case SPACE_BUTS:
|
|
|
|
|
scene_unlink_space_buts((SpaceButs *)space_link, sce);
|
2014-04-17 20:02:56 +10:00
|
|
|
break;
|
2014-04-17 10:48:32 +02:00
|
|
|
}
|
2014-02-06 10:10:59 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2014-01-15 16:37:03 +01:00
|
|
|
BKE_libblock_free(bmain, sce);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2014-07-18 22:31:33 +02:00
|
|
|
/* Used by metaballs, return *all* objects (including duplis) existing in the scene (including scene's sets) */
|
2013-12-26 17:24:42 +06:00
|
|
|
int BKE_scene_base_iter_next(EvaluationContext *eval_ctx, SceneBaseIter *iter,
|
|
|
|
|
Scene **scene, int val, Base **base, Object **ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2014-02-03 18:55:59 +11:00
|
|
|
bool run_again = true;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
/* init */
|
2012-05-06 15:15:33 +00:00
|
|
|
if (val == 0) {
|
2014-01-23 10:20:42 +01:00
|
|
|
iter->phase = F_START;
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
iter->dupob = NULL;
|
|
|
|
|
iter->duplilist = NULL;
|
2014-07-18 22:31:33 +02:00
|
|
|
iter->dupli_refob = NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* run_again is set when a duplilist has been ended */
|
2012-02-23 02:17:50 +00:00
|
|
|
while (run_again) {
|
2014-07-18 22:31:33 +02:00
|
|
|
run_again = false;
|
2004-01-04 22:10:36 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* the first base */
|
2014-01-23 10:20:42 +01:00
|
|
|
if (iter->phase == F_START) {
|
2012-05-06 15:15:33 +00:00
|
|
|
*base = (*scene)->base.first;
|
2012-02-23 02:17:50 +00:00
|
|
|
if (*base) {
|
2012-05-06 15:15:33 +00:00
|
|
|
*ob = (*base)->object;
|
2014-01-23 10:20:42 +01:00
|
|
|
iter->phase = F_SCENE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2010-03-22 09:30:00 +00:00
|
|
|
/* exception: empty scene */
|
2012-02-23 02:17:50 +00:00
|
|
|
while ((*scene)->set) {
|
2012-05-06 15:15:33 +00:00
|
|
|
(*scene) = (*scene)->set;
|
2012-02-23 02:17:50 +00:00
|
|
|
if ((*scene)->base.first) {
|
2012-05-06 15:15:33 +00:00
|
|
|
*base = (*scene)->base.first;
|
|
|
|
|
*ob = (*base)->object;
|
2014-01-23 10:20:42 +01:00
|
|
|
iter->phase = F_SCENE;
|
2010-07-13 16:06:51 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2014-01-23 10:20:42 +01:00
|
|
|
if (*base && iter->phase != F_DUPLI) {
|
2012-05-06 15:15:33 +00:00
|
|
|
*base = (*base)->next;
|
2013-03-09 03:46:30 +00:00
|
|
|
if (*base) {
|
|
|
|
|
*ob = (*base)->object;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
else {
|
2014-01-23 10:20:42 +01:00
|
|
|
if (iter->phase == F_SCENE) {
|
2010-07-13 16:06:51 +00:00
|
|
|
/* (*scene) is finished, now do the set */
|
2012-02-23 02:17:50 +00:00
|
|
|
while ((*scene)->set) {
|
2012-05-06 15:15:33 +00:00
|
|
|
(*scene) = (*scene)->set;
|
2012-02-23 02:17:50 +00:00
|
|
|
if ((*scene)->base.first) {
|
2012-05-06 15:15:33 +00:00
|
|
|
*base = (*scene)->base.first;
|
|
|
|
|
*ob = (*base)->object;
|
2010-07-13 16:06:51 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-09 03:46:30 +00:00
|
|
|
if (*base == NULL) {
|
2014-01-23 10:20:42 +01:00
|
|
|
iter->phase = F_START;
|
2013-03-09 03:46:30 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
else {
|
2014-01-23 10:20:42 +01:00
|
|
|
if (iter->phase != F_DUPLI) {
|
2012-02-23 02:17:50 +00:00
|
|
|
if ( (*base)->object->transflag & OB_DUPLI) {
|
2006-11-03 12:38:21 +00:00
|
|
|
/* groups cannot be duplicated for mballs yet,
|
2012-03-03 20:19:11 +00:00
|
|
|
* this enters eternal loop because of
|
|
|
|
|
* makeDispListMBall getting called inside of group_duplilist */
|
2012-02-23 02:17:50 +00:00
|
|
|
if ((*base)->object->dup_group == NULL) {
|
2013-12-26 17:24:42 +06:00
|
|
|
iter->duplilist = object_duplilist_ex(eval_ctx, (*scene), (*base)->object, false);
|
2006-11-03 12:38:21 +00:00
|
|
|
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
iter->dupob = iter->duplilist->first;
|
2008-04-12 14:30:17 +00:00
|
|
|
|
2014-07-18 22:31:33 +02:00
|
|
|
if (!iter->dupob) {
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
free_object_duplilist(iter->duplilist);
|
2014-07-18 22:31:33 +02:00
|
|
|
iter->duplilist = NULL;
|
|
|
|
|
}
|
|
|
|
|
iter->dupli_refob = NULL;
|
2006-11-03 12:38:21 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-04-26 13:07:59 +00:00
|
|
|
/* handle dupli's */
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
if (iter->dupob) {
|
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
|
|
|
(*base)->flag |= OB_FROMDUPLI;
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
*ob = iter->dupob->ob;
|
2014-01-23 10:20:42 +01:00
|
|
|
iter->phase = F_DUPLI;
|
2014-07-18 22:31:33 +02:00
|
|
|
|
|
|
|
|
if (iter->dupli_refob != *ob) {
|
|
|
|
|
if (iter->dupli_refob) {
|
|
|
|
|
/* Restore previous object's real matrix. */
|
|
|
|
|
copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
|
|
|
|
|
}
|
|
|
|
|
/* Backup new object's real matrix. */
|
|
|
|
|
iter->dupli_refob = *ob;
|
|
|
|
|
copy_m4_m4(iter->omat, iter->dupli_refob->obmat);
|
|
|
|
|
}
|
|
|
|
|
copy_m4_m4((*ob)->obmat, iter->dupob->mat);
|
|
|
|
|
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
iter->dupob = iter->dupob->next;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2014-01-23 10:20:42 +01:00
|
|
|
else if (iter->phase == F_DUPLI) {
|
|
|
|
|
iter->phase = F_SCENE;
|
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
|
|
|
(*base)->flag &= ~OB_FROMDUPLI;
|
|
|
|
|
|
2014-07-18 22:31:33 +02:00
|
|
|
if (iter->dupli_refob) {
|
|
|
|
|
/* Restore last object's real matrix. */
|
|
|
|
|
copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
|
|
|
|
|
iter->dupli_refob = 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
|
|
|
}
|
|
|
|
|
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
free_object_duplilist(iter->duplilist);
|
|
|
|
|
iter->duplilist = NULL;
|
2014-07-18 22:31:33 +02:00
|
|
|
run_again = true;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-03-03 20:19:11 +00:00
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
if (ob && *ob) {
|
2012-05-06 15:15:33 +00:00
|
|
|
printf("Scene: '%s', '%s'\n", (*scene)->id.name + 2, (*ob)->id.name + 2);
|
2012-03-03 20:19:11 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
2010-07-13 16:06:51 +00:00
|
|
|
|
2014-01-23 10:20:42 +01:00
|
|
|
return iter->phase;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
Object *BKE_scene_camera_find(Scene *sc)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
for (base = sc->base.first; base; base = base->next)
|
|
|
|
|
if (base->object->type == OB_CAMERA)
|
2002-10-12 11:37:38 +00:00
|
|
|
return base->object;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-16 19:49:33 +00:00
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
2012-05-05 14:33:36 +00:00
|
|
|
Object *BKE_scene_camera_switch_find(Scene *scene)
|
2009-12-16 19:49:33 +00:00
|
|
|
{
|
|
|
|
|
TimeMarker *m;
|
|
|
|
|
int cfra = scene->r.cfra;
|
|
|
|
|
int frame = -(MAXFRAME + 1);
|
2013-10-17 14:10:03 +00:00
|
|
|
int min_frame = MAXFRAME + 1;
|
2012-05-06 15:15:33 +00:00
|
|
|
Object *camera = NULL;
|
2013-10-17 15:51:12 +00:00
|
|
|
Object *first_camera = NULL;
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
for (m = scene->markers.first; m; m = m->next) {
|
2013-10-17 14:10:03 +00:00
|
|
|
if (m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER) == 0) {
|
|
|
|
|
if ((m->frame <= cfra) && (m->frame > frame)) {
|
|
|
|
|
camera = m->camera;
|
|
|
|
|
frame = m->frame;
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2013-10-17 14:10:03 +00:00
|
|
|
if (frame == cfra)
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2013-10-17 14:10:03 +00:00
|
|
|
if (m->frame < min_frame) {
|
|
|
|
|
first_camera = m->camera;
|
|
|
|
|
min_frame = m->frame;
|
|
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-10-17 14:10:03 +00:00
|
|
|
|
|
|
|
|
if (camera == NULL) {
|
|
|
|
|
/* If there's no marker to the left of current frame,
|
|
|
|
|
* use camera from left-most marker to solve all sort
|
|
|
|
|
* of Schrodinger uncertainties.
|
|
|
|
|
*/
|
|
|
|
|
return first_camera;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-16 19:49:33 +00:00
|
|
|
return camera;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
int BKE_scene_camera_switch_update(Scene *scene)
|
2010-03-09 07:41:04 +00:00
|
|
|
{
|
|
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
2012-05-06 15:15:33 +00:00
|
|
|
Object *camera = BKE_scene_camera_switch_find(scene);
|
2012-02-23 02:17:50 +00:00
|
|
|
if (camera) {
|
2012-05-06 15:15:33 +00:00
|
|
|
scene->camera = camera;
|
2010-03-09 07:41:04 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
2011-11-05 14:26:18 +00:00
|
|
|
#else
|
|
|
|
|
(void)scene;
|
2010-03-09 07:41:04 +00:00
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
char *BKE_scene_find_marker_name(Scene *scene, int frame)
|
2009-12-16 19:49:33 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
ListBase *markers = &scene->markers;
|
2009-12-16 19:49:33 +00:00
|
|
|
TimeMarker *m1, *m2;
|
|
|
|
|
|
|
|
|
|
/* search through markers for match */
|
2012-05-06 15:15:33 +00:00
|
|
|
for (m1 = markers->first, m2 = markers->last; m1 && m2; m1 = m1->next, m2 = m2->prev) {
|
|
|
|
|
if (m1->frame == frame)
|
2009-12-16 19:49:33 +00:00
|
|
|
return m1->name;
|
|
|
|
|
|
|
|
|
|
if (m1 == m2)
|
|
|
|
|
break;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
if (m2->frame == frame)
|
2009-12-16 19:49:33 +00:00
|
|
|
return m2->name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-02-06 14:56:25 +00:00
|
|
|
/* return the current marker for this frame,
|
2013-04-07 15:09:06 +00:00
|
|
|
* we can have more than 1 marker per frame, this just returns the first :/ */
|
2012-05-05 14:33:36 +00:00
|
|
|
char *BKE_scene_find_last_marker_name(Scene *scene, int frame)
|
2010-02-06 14:56:25 +00:00
|
|
|
{
|
|
|
|
|
TimeMarker *marker, *best_marker = NULL;
|
2012-05-06 15:15:33 +00:00
|
|
|
int best_frame = -MAXFRAME * 2;
|
|
|
|
|
for (marker = scene->markers.first; marker; marker = marker->next) {
|
|
|
|
|
if (marker->frame == frame) {
|
2010-02-07 09:52:43 +00:00
|
|
|
return marker->name;
|
2010-02-06 14:56:25 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
if (marker->frame > best_frame && marker->frame < frame) {
|
2010-02-06 14:56:25 +00:00
|
|
|
best_marker = marker;
|
|
|
|
|
best_frame = marker->frame;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return best_marker ? best_marker->name : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-18 05:05:06 +00:00
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
Base *BKE_scene_base_add(Scene *sce, Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
Base *b = MEM_callocN(sizeof(*b), "BKE_scene_base_add");
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_addhead(&sce->base, b);
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
b->object = ob;
|
|
|
|
|
b->flag = ob->flag;
|
|
|
|
|
b->lay = ob->lay;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-26 17:38:45 +00:00
|
|
|
void BKE_scene_base_unlink(Scene *sce, Base *base)
|
2013-01-23 05:56:22 +00:00
|
|
|
{
|
2013-01-23 05:56:56 +00:00
|
|
|
/* remove rigid body constraint from world before removing object */
|
|
|
|
|
if (base->object->rigidbody_constraint)
|
|
|
|
|
BKE_rigidbody_remove_constraint(sce, base->object);
|
2013-01-23 05:56:22 +00:00
|
|
|
/* remove rigid body object from world before removing object */
|
|
|
|
|
if (base->object->rigidbody_object)
|
|
|
|
|
BKE_rigidbody_remove_object(sce, base->object);
|
|
|
|
|
|
|
|
|
|
BLI_remlink(&sce->base, base);
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_base_deselect_all(Scene *sce)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
Base *b;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
for (b = sce->base.first; b; b = b->next) {
|
|
|
|
|
b->flag &= ~SELECT;
|
|
|
|
|
b->object->flag = b->flag;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_base_select(Scene *sce, Base *selbase)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
selbase->flag |= SELECT;
|
2012-05-06 15:15:33 +00:00
|
|
|
selbase->object->flag = selbase->flag;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->basact = selbase;
|
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
|
|
|
|
2006-05-15 10:46:04 +00:00
|
|
|
/* checks for cycle, returns 1 if it's all OK */
|
2012-05-05 14:33:36 +00:00
|
|
|
int BKE_scene_validate_setscene(Main *bmain, Scene *sce)
|
2006-05-15 10:46:04 +00:00
|
|
|
{
|
|
|
|
|
Scene *scene;
|
2008-02-29 13:29:15 +00:00
|
|
|
int a, totscene;
|
2006-05-15 10:46:04 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
if (sce->set == NULL) return 1;
|
2006-05-15 10:46:04 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
totscene = 0;
|
|
|
|
|
for (scene = bmain->scene.first; scene; scene = scene->id.next)
|
2008-02-29 13:29:15 +00:00
|
|
|
totscene++;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
for (a = 0, scene = sce; scene->set; scene = scene->set, a++) {
|
2008-02-29 13:29:15 +00:00
|
|
|
/* more iterations than scenes means we have a cycle */
|
2012-02-23 02:17:50 +00:00
|
|
|
if (a > totscene) {
|
2008-02-29 13:29:15 +00:00
|
|
|
/* the tested scene gets zero'ed, that's typically current scene */
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->set = NULL;
|
2008-02-29 13:29:15 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2006-05-15 10:46:04 +00:00
|
|
|
}
|
2008-02-29 13:29:15 +00:00
|
|
|
|
2006-05-15 10:46:04 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-27 05:39:55 +00:00
|
|
|
/* This function is needed to cope with fractional frames - including two Blender rendering features
|
2011-11-06 06:08:18 +00:00
|
|
|
* mblur (motion blur that renders 'subframes' and blurs them together), and fields rendering.
|
|
|
|
|
*/
|
2012-05-05 14:33:36 +00:00
|
|
|
float BKE_scene_frame_get(Scene *scene)
|
2009-09-18 22:25:49 +00:00
|
|
|
{
|
2012-05-05 14:33:36 +00:00
|
|
|
return BKE_scene_frame_get_from_ctime(scene, scene->r.cfra);
|
2011-11-06 06:08:18 +00:00
|
|
|
}
|
2010-06-27 05:39:55 +00:00
|
|
|
|
2011-11-06 12:12:14 +00:00
|
|
|
/* This function is used to obtain arbitrary fractional frames */
|
2012-05-05 14:33:36 +00:00
|
|
|
float BKE_scene_frame_get_from_ctime(Scene *scene, const float frame)
|
2011-11-06 06:08:18 +00:00
|
|
|
{
|
2011-11-06 12:12:14 +00:00
|
|
|
float ctime = frame;
|
2011-11-06 06:08:18 +00:00
|
|
|
ctime += scene->r.subframe;
|
2012-10-21 05:46:41 +00:00
|
|
|
ctime *= scene->r.framelen;
|
2011-11-06 12:12:14 +00:00
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
return ctime;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-16 04:06:38 +00:00
|
|
|
/**
|
|
|
|
|
* Sets the frame int/float components.
|
|
|
|
|
*/
|
|
|
|
|
void BKE_scene_frame_set(struct Scene *scene, double cfra)
|
|
|
|
|
{
|
|
|
|
|
double intpart;
|
|
|
|
|
scene->r.subframe = modf(cfra, &intpart);
|
|
|
|
|
scene->r.cfra = (int)intpart;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-07 12:28:04 +00:00
|
|
|
/* drivers support/hacks
|
2012-05-06 15:15:33 +00:00
|
|
|
* - this method is called from scene_update_tagged_recursive(), so gets included in viewport + render
|
2011-02-07 12:28:04 +00:00
|
|
|
* - these are always run since the depsgraph can't handle non-object data
|
|
|
|
|
* - these happen after objects are all done so that we can read in their final transform values,
|
|
|
|
|
* though this means that objects can't refer to scene info for guidance...
|
|
|
|
|
*/
|
|
|
|
|
static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene)
|
|
|
|
|
{
|
2013-09-05 15:47:52 +00:00
|
|
|
SceneRenderLayer *srl;
|
2012-05-05 14:33:36 +00:00
|
|
|
float ctime = BKE_scene_frame_get(scene);
|
2011-02-07 12:28:04 +00:00
|
|
|
|
|
|
|
|
/* scene itself */
|
|
|
|
|
if (scene->adt && scene->adt->drivers.first) {
|
== RNA Property Updates get called by Animation System now ==
This fixes bug #26764 and several others like it, where modifier
properties (and others, but most visibly modifiers) would not do
anything when animated or driven, as modifier properties require the
RNA update calls to tag the modifiers to get recalculated.
While just adding a call to RNA_property_update() could have gotten
this working (as per the Campbell's patch attached in the report, and
also my own attempt #25881). However, on production rigs, the
performance cost of this is untenatable (on my own tests, without
these updates, I was getting ~5fps on such a rig, but only 0.9fps or
possibly even worse with the updates added).
Hence, this commit adds a property-update caching system to the RNA
level, which aims to reduce to the number of times that the update
functions end up needing to get called.
While this is much faster than without the caching, I also added an
optimisation for pose bones (which are numerous in production rigs) so
that their property updates are skipped, since they are useless to the
animsys (they only tag the depsgraph for updating). This gets things
moving at a more acceptable framerate.
2011-07-24 04:34:46 +00:00
|
|
|
BKE_animsys_evaluate_animdata(scene, &scene->id, scene->adt, ctime, ADT_RECALC_DRIVERS);
|
2011-02-07 12:28:04 +00:00
|
|
|
}
|
2012-07-06 23:56:59 +00:00
|
|
|
|
2011-02-07 12:28:04 +00:00
|
|
|
/* world */
|
2012-07-06 23:56:59 +00:00
|
|
|
/* TODO: what about world textures? but then those have nodes too... */
|
2011-02-07 12:28:04 +00:00
|
|
|
if (scene->world) {
|
|
|
|
|
ID *wid = (ID *)scene->world;
|
2012-05-06 15:15:33 +00:00
|
|
|
AnimData *adt = BKE_animdata_from_id(wid);
|
2011-02-07 12:28:04 +00:00
|
|
|
|
|
|
|
|
if (adt && adt->drivers.first)
|
== RNA Property Updates get called by Animation System now ==
This fixes bug #26764 and several others like it, where modifier
properties (and others, but most visibly modifiers) would not do
anything when animated or driven, as modifier properties require the
RNA update calls to tag the modifiers to get recalculated.
While just adding a call to RNA_property_update() could have gotten
this working (as per the Campbell's patch attached in the report, and
also my own attempt #25881). However, on production rigs, the
performance cost of this is untenatable (on my own tests, without
these updates, I was getting ~5fps on such a rig, but only 0.9fps or
possibly even worse with the updates added).
Hence, this commit adds a property-update caching system to the RNA
level, which aims to reduce to the number of times that the update
functions end up needing to get called.
While this is much faster than without the caching, I also added an
optimisation for pose bones (which are numerous in production rigs) so
that their property updates are skipped, since they are useless to the
animsys (they only tag the depsgraph for updating). This gets things
moving at a more acceptable framerate.
2011-07-24 04:34:46 +00:00
|
|
|
BKE_animsys_evaluate_animdata(scene, wid, adt, ctime, ADT_RECALC_DRIVERS);
|
2011-02-07 12:28:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* nodes */
|
|
|
|
|
if (scene->nodetree) {
|
|
|
|
|
ID *nid = (ID *)scene->nodetree;
|
2012-05-06 15:15:33 +00:00
|
|
|
AnimData *adt = BKE_animdata_from_id(nid);
|
2011-02-07 12:28:04 +00:00
|
|
|
|
|
|
|
|
if (adt && adt->drivers.first)
|
== RNA Property Updates get called by Animation System now ==
This fixes bug #26764 and several others like it, where modifier
properties (and others, but most visibly modifiers) would not do
anything when animated or driven, as modifier properties require the
RNA update calls to tag the modifiers to get recalculated.
While just adding a call to RNA_property_update() could have gotten
this working (as per the Campbell's patch attached in the report, and
also my own attempt #25881). However, on production rigs, the
performance cost of this is untenatable (on my own tests, without
these updates, I was getting ~5fps on such a rig, but only 0.9fps or
possibly even worse with the updates added).
Hence, this commit adds a property-update caching system to the RNA
level, which aims to reduce to the number of times that the update
functions end up needing to get called.
While this is much faster than without the caching, I also added an
optimisation for pose bones (which are numerous in production rigs) so
that their property updates are skipped, since they are useless to the
animsys (they only tag the depsgraph for updating). This gets things
moving at a more acceptable framerate.
2011-07-24 04:34:46 +00:00
|
|
|
BKE_animsys_evaluate_animdata(scene, nid, adt, ctime, ADT_RECALC_DRIVERS);
|
2011-02-07 12:28:04 +00:00
|
|
|
}
|
2013-04-09 15:30:15 +00:00
|
|
|
|
|
|
|
|
/* world nodes */
|
|
|
|
|
if (scene->world && scene->world->nodetree) {
|
|
|
|
|
ID *nid = (ID *)scene->world->nodetree;
|
|
|
|
|
AnimData *adt = BKE_animdata_from_id(nid);
|
|
|
|
|
|
|
|
|
|
if (adt && adt->drivers.first)
|
|
|
|
|
BKE_animsys_evaluate_animdata(scene, nid, adt, ctime, ADT_RECALC_DRIVERS);
|
|
|
|
|
}
|
2013-09-05 15:47:52 +00:00
|
|
|
|
|
|
|
|
/* freestyle */
|
|
|
|
|
for (srl = scene->r.layers.first; srl; srl = srl->next) {
|
|
|
|
|
FreestyleConfig *config = &srl->freestyleConfig;
|
|
|
|
|
FreestyleLineSet *lineset;
|
|
|
|
|
|
|
|
|
|
for (lineset = config->linesets.first; lineset; lineset = lineset->next) {
|
|
|
|
|
if (lineset->linestyle) {
|
|
|
|
|
ID *lid = &lineset->linestyle->id;
|
|
|
|
|
AnimData *adt = BKE_animdata_from_id(lid);
|
|
|
|
|
|
|
|
|
|
if (adt && adt->drivers.first)
|
|
|
|
|
BKE_animsys_evaluate_animdata(scene, lid, adt, ctime, ADT_RECALC_DRIVERS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-07 12:28:04 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-10 18:20:29 +00:00
|
|
|
/* deps hack - do extra recalcs at end */
|
2013-12-26 17:24:42 +06:00
|
|
|
static void scene_depsgraph_hack(EvaluationContext *eval_ctx, Scene *scene, Scene *scene_parent)
|
2013-01-10 18:20:29 +00:00
|
|
|
{
|
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
|
|
scene->customdata_mask = scene_parent->customdata_mask;
|
|
|
|
|
|
|
|
|
|
/* sets first, we allow per definition current scene to have
|
|
|
|
|
* dependencies on sets, but not the other way around. */
|
|
|
|
|
if (scene->set)
|
2013-12-26 17:24:42 +06:00
|
|
|
scene_depsgraph_hack(eval_ctx, scene->set, scene_parent);
|
2013-01-10 18:20:29 +00:00
|
|
|
|
|
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
|
|
|
|
Object *ob = base->object;
|
|
|
|
|
|
|
|
|
|
if (ob->depsflag) {
|
|
|
|
|
int recalc = 0;
|
2013-02-02 04:58:03 +00:00
|
|
|
// printf("depshack %s\n", ob->id.name + 2);
|
2013-01-10 18:20:29 +00:00
|
|
|
|
|
|
|
|
if (ob->depsflag & OB_DEPS_EXTRA_OB_RECALC)
|
|
|
|
|
recalc |= OB_RECALC_OB;
|
|
|
|
|
if (ob->depsflag & OB_DEPS_EXTRA_DATA_RECALC)
|
|
|
|
|
recalc |= OB_RECALC_DATA;
|
|
|
|
|
|
|
|
|
|
ob->recalc |= recalc;
|
2013-12-26 17:24:42 +06:00
|
|
|
BKE_object_handle_update(eval_ctx, scene_parent, ob);
|
2013-01-10 18:20:29 +00:00
|
|
|
|
|
|
|
|
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP)) {
|
|
|
|
|
GroupObject *go;
|
|
|
|
|
|
|
|
|
|
for (go = ob->dup_group->gobject.first; go; go = go->next) {
|
|
|
|
|
if (go->ob)
|
|
|
|
|
go->ob->recalc |= recalc;
|
|
|
|
|
}
|
2013-12-26 17:24:42 +06:00
|
|
|
BKE_group_handle_recalc_and_update(eval_ctx, scene_parent, ob, ob->dup_group);
|
2013-01-10 18:20:29 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-03 06:09:48 +00:00
|
|
|
static void scene_rebuild_rbw_recursive(Scene *scene, float ctime)
|
2013-02-15 23:48:36 +00:00
|
|
|
{
|
|
|
|
|
if (scene->set)
|
2013-03-03 06:09:48 +00:00
|
|
|
scene_rebuild_rbw_recursive(scene->set, ctime);
|
2013-02-15 23:48:36 +00:00
|
|
|
|
|
|
|
|
if (BKE_scene_check_rigidbody_active(scene))
|
2013-03-03 06:09:48 +00:00
|
|
|
BKE_rigidbody_rebuild_world(scene, ctime);
|
2013-02-15 23:48:36 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-03 06:09:48 +00:00
|
|
|
static void scene_do_rb_simulation_recursive(Scene *scene, float ctime)
|
2013-03-03 06:09:45 +00:00
|
|
|
{
|
|
|
|
|
if (scene->set)
|
2013-03-03 06:09:48 +00:00
|
|
|
scene_do_rb_simulation_recursive(scene->set, ctime);
|
2013-03-03 06:09:45 +00:00
|
|
|
|
|
|
|
|
if (BKE_scene_check_rigidbody_active(scene))
|
2013-03-03 06:09:48 +00:00
|
|
|
BKE_rigidbody_do_simulation(scene, ctime);
|
2013-02-15 23:48:36 +00:00
|
|
|
}
|
|
|
|
|
|
2013-12-26 17:24:42 +06:00
|
|
|
/* Used to visualize CPU threads activity during threaded object update,
|
|
|
|
|
* would pollute STDERR with whole bunch of timing information which then
|
|
|
|
|
* could be parsed and nicely visualized.
|
|
|
|
|
*/
|
|
|
|
|
#undef DETAILED_ANALYSIS_OUTPUT
|
|
|
|
|
|
|
|
|
|
/* Mballs evaluation uses BKE_scene_base_iter_next which calls
|
|
|
|
|
* duplilist for all objects in the scene. This leads to conflict
|
2013-12-27 17:09:19 +06:00
|
|
|
* accessing and writing same data from multiple threads.
|
2013-12-26 17:24:42 +06:00
|
|
|
*
|
|
|
|
|
* Ideally Mballs shouldn't do such an iteration and use DAG
|
|
|
|
|
* queries instead. For the time being we've got new DAG
|
|
|
|
|
* let's keep it simple and update mballs in a ingle thread.
|
|
|
|
|
*/
|
|
|
|
|
#define MBALL_SINGLETHREAD_HACK
|
|
|
|
|
|
|
|
|
|
typedef struct StatisicsEntry {
|
|
|
|
|
struct StatisicsEntry *next, *prev;
|
|
|
|
|
Object *object;
|
|
|
|
|
double start_time;
|
|
|
|
|
double duration;
|
|
|
|
|
} StatisicsEntry;
|
|
|
|
|
|
|
|
|
|
typedef struct ThreadedObjectUpdateState {
|
|
|
|
|
/* TODO(sergey): We might want this to be per-thread object. */
|
|
|
|
|
EvaluationContext *eval_ctx;
|
|
|
|
|
Scene *scene;
|
|
|
|
|
Scene *scene_parent;
|
|
|
|
|
double base_time;
|
|
|
|
|
|
|
|
|
|
/* Execution statistics */
|
|
|
|
|
ListBase statistics[BLENDER_MAX_THREADS];
|
|
|
|
|
bool has_updated_objects;
|
|
|
|
|
|
|
|
|
|
#ifdef MBALL_SINGLETHREAD_HACK
|
|
|
|
|
bool has_mballs;
|
|
|
|
|
#endif
|
|
|
|
|
} ThreadedObjectUpdateState;
|
|
|
|
|
|
|
|
|
|
static void scene_update_object_add_task(void *node, void *user_data);
|
|
|
|
|
|
|
|
|
|
static void scene_update_all_bases(EvaluationContext *eval_ctx, Scene *scene, Scene *scene_parent)
|
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
|
|
|
{
|
|
|
|
|
Base *base;
|
2010-06-18 14:14:13 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
2013-12-26 17:24:42 +06:00
|
|
|
Object *object = base->object;
|
|
|
|
|
|
2014-03-24 15:10:16 +06:00
|
|
|
BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world, true);
|
2013-12-26 17:24:42 +06:00
|
|
|
|
|
|
|
|
if (object->dup_group && (object->transflag & OB_DUPLIGROUP))
|
|
|
|
|
BKE_group_handle_recalc_and_update(eval_ctx, scene_parent, object, object->dup_group);
|
|
|
|
|
|
2012-11-06 18:07:17 +00:00
|
|
|
/* always update layer, so that animating layers works (joshua july 2010) */
|
|
|
|
|
/* XXX commented out, this has depsgraph issues anyway - and this breaks setting scenes
|
2012-11-18 01:22:31 +00:00
|
|
|
* (on scene-set, the base-lay is copied to ob-lay (ton nov 2012) */
|
2012-11-06 18:07:17 +00:00
|
|
|
// base->lay = ob->lay;
|
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
|
|
|
}
|
2013-12-26 17:24:42 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_update_object_func(TaskPool *pool, void *taskdata, int threadid)
|
|
|
|
|
{
|
|
|
|
|
/* Disable print for now in favor of summary statistics at the end of update. */
|
|
|
|
|
#define PRINT if (false) printf
|
|
|
|
|
|
|
|
|
|
ThreadedObjectUpdateState *state = (ThreadedObjectUpdateState *) BLI_task_pool_userdata(pool);
|
|
|
|
|
void *node = taskdata;
|
|
|
|
|
Object *object = DAG_get_node_object(node);
|
|
|
|
|
EvaluationContext *eval_ctx = state->eval_ctx;
|
|
|
|
|
Scene *scene = state->scene;
|
|
|
|
|
Scene *scene_parent = state->scene_parent;
|
|
|
|
|
|
|
|
|
|
#ifdef MBALL_SINGLETHREAD_HACK
|
|
|
|
|
if (object && object->type == OB_MBALL) {
|
|
|
|
|
state->has_mballs = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
if (object) {
|
|
|
|
|
double start_time = 0.0;
|
|
|
|
|
bool add_to_stats = false;
|
|
|
|
|
|
2014-01-29 17:37:45 +06:00
|
|
|
if (G.debug & G_DEBUG_DEPSGRAPH) {
|
2014-03-24 15:10:16 +06:00
|
|
|
if (object->recalc & OB_RECALC_ALL) {
|
|
|
|
|
printf("Thread %d: update object %s\n", threadid, object->id.name);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-26 17:24:42 +06:00
|
|
|
start_time = PIL_check_seconds_timer();
|
|
|
|
|
|
|
|
|
|
if (object->recalc & OB_RECALC_ALL) {
|
|
|
|
|
state->has_updated_objects = true;
|
|
|
|
|
add_to_stats = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We only update object itself here, dupli-group will be updated
|
|
|
|
|
* separately from main thread because of we've got no idea about
|
2014-01-17 17:35:03 +11:00
|
|
|
* dependencies inside the group.
|
2013-12-26 17:24:42 +06:00
|
|
|
*/
|
2014-03-24 15:10:16 +06:00
|
|
|
BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world, false);
|
2013-12-26 17:24:42 +06:00
|
|
|
|
|
|
|
|
/* Calculate statistics. */
|
|
|
|
|
if (add_to_stats) {
|
|
|
|
|
StatisicsEntry *entry;
|
|
|
|
|
|
|
|
|
|
entry = MEM_mallocN(sizeof(StatisicsEntry), "update thread statistics");
|
|
|
|
|
entry->object = object;
|
|
|
|
|
entry->start_time = start_time;
|
|
|
|
|
entry->duration = PIL_check_seconds_timer() - start_time;
|
|
|
|
|
|
|
|
|
|
BLI_addtail(&state->statistics[threadid], entry);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PRINT("Threda %d: update node %s\n", threadid,
|
2014-04-04 12:42:35 +06:00
|
|
|
DAG_get_node_name(scene, node));
|
2013-12-26 17:24:42 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Update will decrease child's valency and schedule child with zero valency. */
|
2013-12-27 14:20:46 +11:00
|
|
|
DAG_threaded_update_handle_node_updated(node, scene_update_object_add_task, pool);
|
2013-12-26 17:24:42 +06:00
|
|
|
|
|
|
|
|
#undef PRINT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_update_object_add_task(void *node, void *user_data)
|
|
|
|
|
{
|
|
|
|
|
TaskPool *task_pool = user_data;
|
|
|
|
|
|
|
|
|
|
BLI_task_pool_push(task_pool, scene_update_object_func, node, false, TASK_PRIORITY_LOW);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void print_threads_statistics(ThreadedObjectUpdateState *state)
|
|
|
|
|
{
|
|
|
|
|
int i, tot_thread;
|
|
|
|
|
|
2014-01-29 17:37:45 +06:00
|
|
|
if ((G.debug & G_DEBUG_DEPSGRAPH) == 0) {
|
2013-12-26 17:24:42 +06:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef DETAILED_ANALYSIS_OUTPUT
|
|
|
|
|
if (state->has_updated_objects) {
|
|
|
|
|
tot_thread = BLI_system_thread_count();
|
|
|
|
|
|
|
|
|
|
fprintf(stderr, "objects update base time %f\n", state->base_time);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < tot_thread; i++) {
|
|
|
|
|
StatisicsEntry *entry;
|
|
|
|
|
for (entry = state->statistics[i].first;
|
|
|
|
|
entry;
|
|
|
|
|
entry = entry->next)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "thread %d object %s start_time %f duration %f\n",
|
|
|
|
|
i, entry->object->id.name + 2,
|
|
|
|
|
entry->start_time, entry->duration);
|
|
|
|
|
}
|
|
|
|
|
BLI_freelistN(&state->statistics[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
tot_thread = BLI_system_thread_count();
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < tot_thread; i++) {
|
|
|
|
|
int total_objects = 0;
|
|
|
|
|
double total_time = 0.0;
|
|
|
|
|
StatisicsEntry *entry;
|
|
|
|
|
|
|
|
|
|
if (state->has_updated_objects) {
|
|
|
|
|
/* Don't pollute output if no objects were updated. */
|
|
|
|
|
for (entry = state->statistics[i].first;
|
|
|
|
|
entry;
|
|
|
|
|
entry = entry->next)
|
|
|
|
|
{
|
|
|
|
|
total_objects++;
|
|
|
|
|
total_time += entry->duration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("Thread %d: total %d objects in %f sec.\n", i, total_objects, total_time);
|
|
|
|
|
|
|
|
|
|
for (entry = state->statistics[i].first;
|
|
|
|
|
entry;
|
|
|
|
|
entry = entry->next)
|
|
|
|
|
{
|
|
|
|
|
printf(" %s in %f sec\n", entry->object->id.name + 2, entry->duration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_freelistN(&state->statistics[i]);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-09 19:13:26 +06:00
|
|
|
static bool scene_need_update_objects(Main *bmain)
|
|
|
|
|
{
|
|
|
|
|
return
|
|
|
|
|
/* Object datablocks themselves (for OB_RECALC_OB) */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_OB) ||
|
|
|
|
|
|
|
|
|
|
/* Objects data datablocks (for OB_RECALC_DATA) */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_ME) || /* Mesh */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_CU) || /* Curve */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_MB) || /* MetaBall */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_LA) || /* Lamp */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_LT) || /* Lattice */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_CA) || /* Camera */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_KE) || /* KE */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_SPK) || /* Speaker */
|
|
|
|
|
DAG_id_type_tagged(bmain, ID_AR); /* Armature */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_update_objects(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Scene *scene_parent)
|
2013-12-26 17:24:42 +06:00
|
|
|
{
|
|
|
|
|
TaskScheduler *task_scheduler = BLI_task_scheduler_get();
|
|
|
|
|
TaskPool *task_pool;
|
|
|
|
|
ThreadedObjectUpdateState state;
|
2014-01-10 15:39:06 +06:00
|
|
|
bool need_singlethread_pass;
|
2013-12-26 17:24:42 +06:00
|
|
|
|
2014-01-09 19:13:26 +06:00
|
|
|
/* Early check for whether we need to invoke all the task-based
|
2014-06-09 11:01:51 +10:00
|
|
|
* things (spawn new ppol, traverse dependency graph and so on).
|
2014-01-09 19:13:26 +06:00
|
|
|
*
|
|
|
|
|
* Basically if there's no ID datablocks tagged for update which
|
|
|
|
|
* corresponds to object->recalc flags (which are checked in
|
|
|
|
|
* BKE_object_handle_update() then we do nothing here.
|
|
|
|
|
*/
|
|
|
|
|
if (!scene_need_update_objects(bmain)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-26 17:24:42 +06:00
|
|
|
state.eval_ctx = eval_ctx;
|
|
|
|
|
state.scene = scene;
|
|
|
|
|
state.scene_parent = scene_parent;
|
2014-01-09 19:13:26 +06:00
|
|
|
|
|
|
|
|
/* Those are only needed when blender is run with --debug argument. */
|
2014-01-29 17:37:45 +06:00
|
|
|
if (G.debug & G_DEBUG_DEPSGRAPH) {
|
2014-01-09 19:13:26 +06:00
|
|
|
memset(state.statistics, 0, sizeof(state.statistics));
|
|
|
|
|
state.has_updated_objects = false;
|
|
|
|
|
state.base_time = PIL_check_seconds_timer();
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-26 17:24:42 +06:00
|
|
|
#ifdef MBALL_SINGLETHREAD_HACK
|
|
|
|
|
state.has_mballs = false;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
task_pool = BLI_task_pool_create(task_scheduler, &state);
|
|
|
|
|
|
|
|
|
|
DAG_threaded_update_begin(scene, scene_update_object_add_task, task_pool);
|
|
|
|
|
BLI_task_pool_work_and_wait(task_pool);
|
|
|
|
|
BLI_task_pool_free(task_pool);
|
|
|
|
|
|
2014-01-29 17:37:45 +06:00
|
|
|
if (G.debug & G_DEBUG_DEPSGRAPH) {
|
2013-12-26 17:24:42 +06:00
|
|
|
print_threads_statistics(&state);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-10 15:39:06 +06:00
|
|
|
/* We do single thread pass to update all the objects which are in cyclic dependency.
|
|
|
|
|
* Such objects can not be handled by a generic DAG traverse and it's really tricky
|
|
|
|
|
* to detect whether cycle could be solved or not.
|
|
|
|
|
*
|
|
|
|
|
* In this situation we simply update all remaining objects in a single thread and
|
|
|
|
|
* it'll happen in the same exact order as it was in single-threaded DAG.
|
|
|
|
|
*
|
|
|
|
|
* We couldn't use threaded update for objects which are in cycle because they might
|
|
|
|
|
* access data of each other which is being re-evaluated.
|
|
|
|
|
*
|
|
|
|
|
* Also, as was explained above, for now we also update all the mballs in single thread.
|
|
|
|
|
*
|
|
|
|
|
* - sergey -
|
|
|
|
|
*/
|
|
|
|
|
need_singlethread_pass = DAG_is_acyclic(scene) == false;
|
2013-12-26 17:24:42 +06:00
|
|
|
#ifdef MBALL_SINGLETHREAD_HACK
|
2014-01-10 15:39:06 +06:00
|
|
|
need_singlethread_pass |= state.has_mballs;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (need_singlethread_pass) {
|
2013-12-26 17:24:42 +06:00
|
|
|
scene_update_all_bases(eval_ctx, scene, scene_parent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_update_tagged_recursive(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Scene *scene_parent)
|
|
|
|
|
{
|
|
|
|
|
scene->customdata_mask = scene_parent->customdata_mask;
|
|
|
|
|
|
|
|
|
|
/* sets first, we allow per definition current scene to have
|
|
|
|
|
* dependencies on sets, but not the other way around. */
|
|
|
|
|
if (scene->set)
|
|
|
|
|
scene_update_tagged_recursive(eval_ctx, bmain, scene->set, scene_parent);
|
|
|
|
|
|
|
|
|
|
/* scene objects */
|
2014-01-09 19:13:26 +06:00
|
|
|
scene_update_objects(eval_ctx, bmain, scene, scene_parent);
|
2013-12-26 17:24:42 +06:00
|
|
|
|
2011-02-07 12:28:04 +00:00
|
|
|
/* scene drivers... */
|
|
|
|
|
scene_update_drivers(bmain, scene);
|
2011-08-09 08:38:14 +00:00
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
/* update masking curves */
|
2013-06-10 13:07:02 +00:00
|
|
|
BKE_mask_update_scene(bmain, scene);
|
2013-01-10 18:20:29 +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
|
|
|
}
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
|
2014-07-31 20:18:51 +06:00
|
|
|
static bool check_rendered_viewport_visible(Main *bmain)
|
|
|
|
|
{
|
|
|
|
|
wmWindowManager *wm = bmain->wm.first;
|
|
|
|
|
wmWindow *window;
|
|
|
|
|
for (window = wm->windows.first; window != NULL; window = window->next) {
|
|
|
|
|
bScreen *screen = window->screen;
|
|
|
|
|
ScrArea *area;
|
|
|
|
|
for (area = screen->areabase.first; area != NULL; area = area->next) {
|
|
|
|
|
View3D *v3d = area->spacedata.first;
|
|
|
|
|
if (area->spacetype != SPACE_VIEW3D) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (v3d->drawtype == OB_RENDER) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
/* This is needed to prepare mesh to be used by the render
|
|
|
|
|
* engine from the viewport rendering. We do loading here
|
|
|
|
|
* so all the objects which shares the same mesh datablock
|
|
|
|
|
* are nicely tagged for update and updated.
|
|
|
|
|
*
|
|
|
|
|
* This makes it so viewport render engine doesn't need to
|
|
|
|
|
* call loading of the edit data for the mesh objects.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Object *obedit = scene->obedit;
|
|
|
|
|
if (obedit) {
|
|
|
|
|
Mesh *mesh = obedit->data;
|
|
|
|
|
/* TODO(sergey): Check object recalc flags as well? */
|
|
|
|
|
if ((obedit->type == OB_MESH) &&
|
|
|
|
|
(mesh->id.flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)))
|
|
|
|
|
{
|
|
|
|
|
if (check_rendered_viewport_visible(bmain)) {
|
|
|
|
|
BMesh *bm = mesh->edit_btmesh->bm;
|
|
|
|
|
BM_mesh_bm_to_me(bm, mesh, false);
|
|
|
|
|
DAG_id_tag_update(&mesh->id, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-26 17:24:42 +06:00
|
|
|
void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *scene)
|
2009-12-10 11:08:38 +00:00
|
|
|
{
|
2013-02-21 19:33:04 +00:00
|
|
|
Scene *sce_iter;
|
|
|
|
|
|
2011-11-03 16:41:48 +00:00
|
|
|
/* keep this first */
|
2012-05-05 00:23:55 +00:00
|
|
|
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE);
|
2011-11-02 20:56:52 +00:00
|
|
|
|
2013-02-21 19:33:04 +00:00
|
|
|
/* (re-)build dependency graph if needed */
|
|
|
|
|
for (sce_iter = scene; sce_iter; sce_iter = sce_iter->set)
|
|
|
|
|
DAG_scene_relations_update(bmain, sce_iter);
|
|
|
|
|
|
2014-07-31 20:18:51 +06:00
|
|
|
/* flush editing data if needed */
|
|
|
|
|
prepare_mesh_for_viewport_render(bmain, scene);
|
|
|
|
|
|
2011-11-03 16:41:48 +00:00
|
|
|
/* flush recalc flags to dependencies */
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_ids_flush_tagged(bmain);
|
|
|
|
|
|
2012-10-23 14:07:32 +00:00
|
|
|
/* removed calls to quick_cache, see pointcache.c */
|
Bugfix [#32017] Infinite recursion in depsgraph material/node driver handling
When initially coding this functionality, I was aware of the potential for
infinite recursion here, just not how frequently such setups are actually
used/created out in the wild (nodetree.ma_node -> ma -> ma.nodetree is all too
common, and often even with several levels of indirection!).
However, the best fix for these problems was not immediately clear. Alternatives
considered included...
1) checking for common recursive cases. This was the solution employed for one
of the early patches committed to try and get around this. However, it's all too
easy to defeat these measures (with all the possible combinations of indirection
node groups bring).
2) arbitrarily restricting recursion to only go down 2/3 levels? Has the risk
of missing some deeply chained/nested drivers, but at least we're guaranteed to
not get too bad. (Plus, who creates such setups anyway ;)
*3) using the generic LIB_DOIT flag (check for tagged items and not recurse down
there). Not as future-proof if some new code suddenly decides to start adding
these tags to materials along the way, but is easiest to add, and should be
flexible enough to catch most cases, since we only care that at some point those
drivers will be evaluated if they're attached to stuff we're interested in.
4) introducing a separate flag for Materials indicating they've been checked
already. Similar to 3) and solves the future-proofing, but this leads to...
5) why bother with remembering to clear flags before traversing for drivers to
evaluate, when they should be tagged for evaluation like everything else?
Downside - requires depsgraph refactor so that we can actually track the fact
that there are dependencies to/from the material datablock, and not just to the
object using said material. (i.e. Currently infeasible)
2012-07-22 16:14:57 +00:00
|
|
|
|
|
|
|
|
/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later
|
|
|
|
|
* when trying to find materials with drivers that need evaluating [#32017]
|
|
|
|
|
*/
|
2013-12-30 13:25:27 +11:00
|
|
|
BKE_main_id_tag_idcode(bmain, ID_MA, false);
|
|
|
|
|
BKE_main_id_tag_idcode(bmain, ID_LA, false);
|
2010-04-13 20:06:55 +00:00
|
|
|
|
2009-12-10 11:08:38 +00:00
|
|
|
/* update all objects: drivers, matrices, displists, etc. flags set
|
2012-03-03 20:19:11 +00:00
|
|
|
* by depgraph or manual, no layer check here, gets correct flushed
|
|
|
|
|
*
|
|
|
|
|
* in the future this should handle updates for all datablocks, not
|
|
|
|
|
* only objects and scenes. - brecht */
|
2013-12-26 17:24:42 +06:00
|
|
|
scene_update_tagged_recursive(eval_ctx, bmain, scene, scene);
|
2014-03-11 14:44:13 +11:00
|
|
|
/* update sound system animation (TODO, move to depsgraph) */
|
|
|
|
|
sound_update_scene(bmain, scene);
|
2009-12-10 11:08:38 +00:00
|
|
|
|
2011-11-03 16:41:48 +00:00
|
|
|
/* extra call here to recalc scene animation (for sequencer) */
|
2009-12-10 11:08:38 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
AnimData *adt = BKE_animdata_from_id(&scene->id);
|
2012-05-05 14:33:36 +00:00
|
|
|
float ctime = BKE_scene_frame_get(scene);
|
2011-02-07 12:28:04 +00:00
|
|
|
|
|
|
|
|
if (adt && (adt->recalc & ADT_RECALC_ANIM))
|
== RNA Property Updates get called by Animation System now ==
This fixes bug #26764 and several others like it, where modifier
properties (and others, but most visibly modifiers) would not do
anything when animated or driven, as modifier properties require the
RNA update calls to tag the modifiers to get recalculated.
While just adding a call to RNA_property_update() could have gotten
this working (as per the Campbell's patch attached in the report, and
also my own attempt #25881). However, on production rigs, the
performance cost of this is untenatable (on my own tests, without
these updates, I was getting ~5fps on such a rig, but only 0.9fps or
possibly even worse with the updates added).
Hence, this commit adds a property-update caching system to the RNA
level, which aims to reduce to the number of times that the update
functions end up needing to get called.
While this is much faster than without the caching, I also added an
optimisation for pose bones (which are numerous in production rigs) so
that their property updates are skipped, since they are useless to the
animsys (they only tag the depsgraph for updating). This gets things
moving at a more acceptable framerate.
2011-07-24 04:34:46 +00:00
|
|
|
BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, 0);
|
2009-12-10 11:08:38 +00:00
|
|
|
}
|
2014-01-13 19:02:23 +06:00
|
|
|
|
2014-04-29 02:30:59 +12:00
|
|
|
/* Extra call here to recalc material animation.
|
2014-01-13 19:02:23 +06:00
|
|
|
*
|
|
|
|
|
* Need to do this so changing material settings from the graph/dopesheet
|
2014-04-29 02:30:59 +12:00
|
|
|
* will update stuff in the viewport.
|
2014-01-13 19:02:23 +06:00
|
|
|
*/
|
|
|
|
|
if (DAG_id_type_tagged(bmain, ID_MA)) {
|
|
|
|
|
Material *material;
|
|
|
|
|
float ctime = BKE_scene_frame_get(scene);
|
|
|
|
|
|
|
|
|
|
for (material = bmain->mat.first;
|
|
|
|
|
material;
|
|
|
|
|
material = material->id.next)
|
|
|
|
|
{
|
|
|
|
|
AnimData *adt = BKE_animdata_from_id(&material->id);
|
|
|
|
|
if (adt && (adt->recalc & ADT_RECALC_ANIM))
|
|
|
|
|
BKE_animsys_evaluate_animdata(scene, &material->id, adt, ctime, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-13 15:19:49 +02:00
|
|
|
|
|
|
|
|
/* Also do the same for node trees. */
|
|
|
|
|
if (DAG_id_type_tagged(bmain, ID_NT)) {
|
|
|
|
|
float ctime = BKE_scene_frame_get(scene);
|
|
|
|
|
|
|
|
|
|
FOREACH_NODETREE(bmain, ntree, id)
|
|
|
|
|
{
|
|
|
|
|
AnimData *adt = BKE_animdata_from_id(&ntree->id);
|
|
|
|
|
if (adt && (adt->recalc & ADT_RECALC_ANIM))
|
|
|
|
|
BKE_animsys_evaluate_animdata(scene, &ntree->id, adt, ctime, 0);
|
|
|
|
|
}
|
|
|
|
|
FOREACH_NODETREE_END
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-28 14:55:35 +00:00
|
|
|
/* notify editors and python about recalc */
|
2012-05-05 00:23:55 +00:00
|
|
|
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST);
|
2014-04-01 11:34:00 +11:00
|
|
|
DAG_ids_check_recalc(bmain, scene, false);
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
|
2011-11-28 14:55:35 +00:00
|
|
|
/* clear recalc flags */
|
2014-01-17 18:51:31 +06:00
|
|
|
DAG_ids_clear_recalc(bmain);
|
2009-12-10 11:08:38 +00:00
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2007-01-31 10:59:39 +00:00
|
|
|
/* applies changes right away, does all sets too */
|
2013-12-26 17:24:42 +06:00
|
|
|
void BKE_scene_update_for_newframe(EvaluationContext *eval_ctx, Main *bmain, Scene *sce, unsigned int lay)
|
2014-02-25 15:44:39 +06:00
|
|
|
{
|
|
|
|
|
BKE_scene_update_for_newframe_ex(eval_ctx, bmain, sce, lay, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain, Scene *sce, unsigned int lay, bool do_invisible_flush)
|
2007-01-31 10:59:39 +00:00
|
|
|
{
|
2012-05-05 14:33:36 +00:00
|
|
|
float ctime = BKE_scene_frame_get(sce);
|
2010-02-19 13:13:21 +00:00
|
|
|
Scene *sce_iter;
|
2013-12-26 17:24:42 +06:00
|
|
|
#ifdef DETAILED_ANALYSIS_OUTPUT
|
|
|
|
|
double start_time = PIL_check_seconds_timer();
|
|
|
|
|
#endif
|
2013-05-22 22:17:07 +00:00
|
|
|
|
|
|
|
|
/* keep this first */
|
|
|
|
|
BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_PRE);
|
|
|
|
|
BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_PRE);
|
|
|
|
|
|
|
|
|
|
/* update animated image textures for particles, modifiers, gpu, etc,
|
|
|
|
|
* call this at the start so modifiers with textures don't lag 1 frame */
|
|
|
|
|
BKE_image_update_frame(bmain, sce->r.cfra);
|
2013-03-03 06:09:45 +00:00
|
|
|
|
|
|
|
|
/* rebuild rigid body worlds before doing the actual frame update
|
|
|
|
|
* this needs to be done on start frame but animation playback usually starts one frame later
|
|
|
|
|
* we need to do it here to avoid rebuilding the world on every simulation change, which can be very expensive
|
|
|
|
|
*/
|
|
|
|
|
scene_rebuild_rbw_recursive(sce, ctime);
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
|
|
|
|
|
sound_set_cfra(sce->r.cfra);
|
2007-01-31 10:59:39 +00:00
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
/* clear animation overrides */
|
2012-07-07 22:51:57 +00:00
|
|
|
/* XXX TODO... */
|
2010-02-19 13:13:21 +00:00
|
|
|
|
2013-02-21 19:33:04 +00:00
|
|
|
for (sce_iter = sce; sce_iter; sce_iter = sce_iter->set)
|
|
|
|
|
DAG_scene_relations_update(bmain, sce_iter);
|
2010-02-19 13:13:21 +00:00
|
|
|
|
2011-11-03 16:41:48 +00:00
|
|
|
/* flush recalc flags to dependencies, if we were only changing a frame
|
2012-03-03 20:19:11 +00:00
|
|
|
* this would not be necessary, but if a user or a script has modified
|
2012-05-05 14:33:36 +00:00
|
|
|
* some datablock before BKE_scene_update_tagged was called, we need the flush */
|
2011-11-03 16:41:48 +00:00
|
|
|
DAG_ids_flush_tagged(bmain);
|
2010-02-19 13:13:21 +00:00
|
|
|
|
|
|
|
|
/* Following 2 functions are recursive
|
2012-03-18 07:38:51 +00:00
|
|
|
* so don't call within 'scene_update_tagged_recursive' */
|
2014-02-25 15:44:39 +06:00
|
|
|
DAG_scene_update_flags(bmain, sce, lay, true, do_invisible_flush); // only stuff that moves or needs display still
|
2010-02-19 13:13:21 +00:00
|
|
|
|
2013-10-29 18:46:45 +00:00
|
|
|
BKE_mask_evaluate_all_masks(bmain, ctime, true);
|
2012-06-04 16:42:58 +00:00
|
|
|
|
2010-02-19 13:13:21 +00:00
|
|
|
/* All 'standard' (i.e. without any dependencies) animation is handled here,
|
|
|
|
|
* with an 'local' to 'macro' order of evaluation. This should ensure that
|
|
|
|
|
* settings stored nestled within a hierarchy (i.e. settings in a Texture block
|
|
|
|
|
* can be overridden by settings from Scene, which owns the Texture through a hierarchy
|
|
|
|
|
* such as Scene->World->MTex/Texture) can still get correctly overridden.
|
|
|
|
|
*/
|
== RNA Property Updates get called by Animation System now ==
This fixes bug #26764 and several others like it, where modifier
properties (and others, but most visibly modifiers) would not do
anything when animated or driven, as modifier properties require the
RNA update calls to tag the modifiers to get recalculated.
While just adding a call to RNA_property_update() could have gotten
this working (as per the Campbell's patch attached in the report, and
also my own attempt #25881). However, on production rigs, the
performance cost of this is untenatable (on my own tests, without
these updates, I was getting ~5fps on such a rig, but only 0.9fps or
possibly even worse with the updates added).
Hence, this commit adds a property-update caching system to the RNA
level, which aims to reduce to the number of times that the update
functions end up needing to get called.
While this is much faster than without the caching, I also added an
optimisation for pose bones (which are numerous in production rigs) so
that their property updates are skipped, since they are useless to the
animsys (they only tag the depsgraph for updating). This gets things
moving at a more acceptable framerate.
2011-07-24 04:34:46 +00:00
|
|
|
BKE_animsys_evaluate_all_animation(bmain, sce, ctime);
|
Bugfix [#33970] Background Scene does not show animation of rigid body objects
This was caused by multiple instantiations of the same basic problem. The
rigidbody handling code often assumed that "scene" pointers referred to the
scene where an object participating in the sim resided (and where the rigidbody
world for that sim lived). However, when dealing with background sets, "scene"
often only refers to the active scene, and not the set that the object actually
came from. Hence, the rigidbody code would often (wrongly) conclude that there
was nothing to do.
For example, we may have the following backgound set/scene chaining scenario:
"active" <-- ... <-- set i (rigidbody objects live here) <-- ... <-- set n
The fix here is a multi-part fix:
1) Moved sim-world calculation from BKE_scene_update_newframe() to
scene_update_tagged_recursive()
+ This is currently the only way that rigidbody sims in background sets will
get calculated, as part of the recursion
- These checks will get run on each update. <--- FIXME!!!
2) Tweaked depsgraph code so that when checking if there are any time-dependent
features on objects to tag for updating, the checking is done relative to the
scene that the object actually resides in (and not the active scene). Otherwise,
even if we recalculate the sim, the affected objects won't get tagged for
updating. This tagging is needed to actually flush the transforms out of the
RigidBodyObject structs (written by the sim/cache) and into the Object
transforms (obmat's)
3) Removed the requirement for rigidbody world to actually exist before we can
flush rigidbody transforms. In many cases, it should be sufficient to assume
that because the object with rigidbody data attached has been tagged for
updates, it should have updates to perform. Of course, we still check on this
data if we've got it, but that's only if the sim is in the active scene.
- TODO: if we have further problems, we should investigate passing the
"actual" scene down alongside the "active" scene for BKE_object_handle_update().
2013-02-15 11:49:22 +00:00
|
|
|
/*...done with recursive funcs */
|
2013-01-23 05:56:44 +00:00
|
|
|
|
2012-10-22 19:45:16 +00:00
|
|
|
/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later
|
|
|
|
|
* when trying to find materials with drivers that need evaluating [#32017]
|
|
|
|
|
*/
|
2013-12-30 13:25:27 +11:00
|
|
|
BKE_main_id_tag_idcode(bmain, ID_MA, false);
|
|
|
|
|
BKE_main_id_tag_idcode(bmain, ID_LA, false);
|
2012-10-22 19:45:16 +00:00
|
|
|
|
2013-03-03 06:09:48 +00:00
|
|
|
/* run rigidbody sim */
|
|
|
|
|
/* NOTE: current position is so that rigidbody sim affects other objects, might change in the future */
|
|
|
|
|
scene_do_rb_simulation_recursive(sce, ctime);
|
2013-02-15 23:48:36 +00:00
|
|
|
|
2012-05-05 14:03:12 +00:00
|
|
|
/* BKE_object_handle_update() on all objects, groups and sets */
|
2013-12-26 17:24:42 +06:00
|
|
|
scene_update_tagged_recursive(eval_ctx, bmain, sce, sce);
|
2014-03-11 14:44:13 +11:00
|
|
|
/* update sound system animation (TODO, move to depsgraph) */
|
|
|
|
|
sound_update_scene(bmain, sce);
|
2011-09-27 10:43:45 +00:00
|
|
|
|
2013-12-26 17:24:42 +06:00
|
|
|
scene_depsgraph_hack(eval_ctx, sce, sce);
|
2013-01-10 18:20:29 +00:00
|
|
|
|
2011-11-28 14:55:35 +00:00
|
|
|
/* notify editors and python about recalc */
|
2012-05-05 00:23:55 +00:00
|
|
|
BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST);
|
|
|
|
|
BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST);
|
2011-11-03 10:03:08 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
DAG_ids_check_recalc(bmain, sce, true);
|
2011-11-28 14:55:35 +00:00
|
|
|
|
|
|
|
|
/* clear recalc flags */
|
2014-01-17 18:51:31 +06:00
|
|
|
DAG_ids_clear_recalc(bmain);
|
2013-12-26 17:24:42 +06:00
|
|
|
|
|
|
|
|
#ifdef DETAILED_ANALYSIS_OUTPUT
|
|
|
|
|
fprintf(stderr, "frame update start_time %f duration %f\n", start_time, PIL_check_seconds_timer() - start_time);
|
|
|
|
|
#endif
|
2007-01-31 10:59:39 +00:00
|
|
|
}
|
|
|
|
|
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
/* return default layer, also used to patch old files */
|
2012-05-05 14:33:36 +00:00
|
|
|
SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name)
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
{
|
|
|
|
|
SceneRenderLayer *srl;
|
2011-11-18 07:11:54 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (!name)
|
2013-03-25 08:29:06 +00:00
|
|
|
name = DATA_("RenderLayer");
|
2011-11-18 07:11:54 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
srl = MEM_callocN(sizeof(SceneRenderLayer), "new render layer");
|
2011-11-18 08:42:44 +00:00
|
|
|
BLI_strncpy(srl->name, name, sizeof(srl->name));
|
2013-03-25 08:29:06 +00:00
|
|
|
BLI_uniquename(&sce->r.layers, srl, DATA_("RenderLayer"), '.', offsetof(SceneRenderLayer, name), sizeof(srl->name));
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
BLI_addtail(&sce->r.layers, srl);
|
2006-01-28 15:21:04 +00:00
|
|
|
|
|
|
|
|
/* note, this is also in render, pipeline.c, to make layer when scenedata doesnt have it */
|
2012-05-06 15:15:33 +00:00
|
|
|
srl->lay = (1 << 20) - 1;
|
|
|
|
|
srl->layflag = 0x7FFF; /* solid ztra halo edge strand */
|
|
|
|
|
srl->passflag = SCE_PASS_COMBINED | SCE_PASS_Z;
|
2014-02-06 16:10:17 +01:00
|
|
|
srl->pass_alpha_threshold = 0.5f;
|
2013-03-23 03:00:37 +00:00
|
|
|
BKE_freestyle_config_init(&srl->freestyleConfig);
|
2011-11-18 07:11:54 +00:00
|
|
|
|
|
|
|
|
return srl;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-03 18:55:59 +11:00
|
|
|
bool BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl)
|
2011-11-18 07:11:54 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
const int act = BLI_findindex(&scene->r.layers, srl);
|
2011-11-18 07:11:54 +00:00
|
|
|
Scene *sce;
|
|
|
|
|
|
2011-11-18 08:42:44 +00:00
|
|
|
if (act == -1) {
|
2011-11-18 07:11:54 +00:00
|
|
|
return 0;
|
2011-11-18 08:42:44 +00:00
|
|
|
}
|
|
|
|
|
else if ( (scene->r.layers.first == scene->r.layers.last) &&
|
|
|
|
|
(scene->r.layers.first == srl))
|
|
|
|
|
{
|
|
|
|
|
/* ensure 1 layer is kept */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2011-11-18 07:11:54 +00:00
|
|
|
|
|
|
|
|
BLI_remlink(&scene->r.layers, srl);
|
|
|
|
|
MEM_freeN(srl);
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
scene->r.actlay = 0;
|
2011-11-18 07:11:54 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
|
|
|
|
if (sce->nodetree) {
|
2011-11-18 07:11:54 +00:00
|
|
|
bNode *node;
|
2012-02-23 02:17:50 +00:00
|
|
|
for (node = sce->nodetree->nodes.first; node; node = node->next) {
|
2012-05-06 15:15:33 +00:00
|
|
|
if (node->type == CMP_NODE_R_LAYERS && (Scene *)node->id == scene) {
|
|
|
|
|
if (node->custom1 == act)
|
|
|
|
|
node->custom1 = 0;
|
|
|
|
|
else if (node->custom1 > act)
|
2011-11-18 07:11:54 +00:00
|
|
|
node->custom1--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
2007-12-26 22:40:56 +00:00
|
|
|
}
|
2008-02-13 11:18:08 +00:00
|
|
|
|
|
|
|
|
/* render simplification */
|
|
|
|
|
|
|
|
|
|
int get_render_subsurf_level(RenderData *r, int lvl)
|
|
|
|
|
{
|
2012-02-23 02:17:50 +00:00
|
|
|
if (r->mode & R_SIMPLIFY)
|
2012-10-27 11:18:54 +00:00
|
|
|
return min_ii(r->simplify_subsurf, lvl);
|
2008-02-13 11:18:08 +00:00
|
|
|
else
|
|
|
|
|
return lvl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_render_child_particle_number(RenderData *r, int num)
|
|
|
|
|
{
|
2012-02-23 02:17:50 +00:00
|
|
|
if (r->mode & R_SIMPLIFY)
|
2012-05-06 15:15:33 +00:00
|
|
|
return (int)(r->simplify_particles * num);
|
2008-02-13 11:18:08 +00:00
|
|
|
else
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_render_shadow_samples(RenderData *r, int samples)
|
|
|
|
|
{
|
2012-02-23 02:17:50 +00:00
|
|
|
if ((r->mode & R_SIMPLIFY) && samples > 0)
|
2012-10-27 11:18:54 +00:00
|
|
|
return min_ii(r->simplify_shadowsamples, samples);
|
2008-02-13 11:18:08 +00:00
|
|
|
else
|
|
|
|
|
return samples;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float get_render_aosss_error(RenderData *r, float error)
|
|
|
|
|
{
|
2012-02-23 02:17:50 +00:00
|
|
|
if (r->mode & R_SIMPLIFY)
|
2012-05-06 15:15:33 +00:00
|
|
|
return ((1.0f - r->simplify_aosss) * 10.0f + 1.0f) * error;
|
2008-02-13 11:18:08 +00:00
|
|
|
else
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-02 13:43:56 +00:00
|
|
|
/* helper function for the SETLOOPER macro */
|
2010-12-17 15:37:59 +00:00
|
|
|
Base *_setlooper_base_step(Scene **sce_iter, Base *base)
|
2010-04-02 13:43:56 +00:00
|
|
|
{
|
2012-02-23 02:17:50 +00:00
|
|
|
if (base && base->next) {
|
2011-04-21 13:11:51 +00:00
|
|
|
/* common case, step to the next */
|
|
|
|
|
return base->next;
|
|
|
|
|
}
|
2012-05-06 15:15:33 +00:00
|
|
|
else if (base == NULL && (*sce_iter)->base.first) {
|
2011-04-21 13:11:51 +00:00
|
|
|
/* first time looping, return the scenes first base */
|
2010-12-17 15:37:59 +00:00
|
|
|
return (Base *)(*sce_iter)->base.first;
|
2011-04-21 13:11:51 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* reached the end, get the next base in the set */
|
2012-05-06 15:15:33 +00:00
|
|
|
while ((*sce_iter = (*sce_iter)->set)) {
|
|
|
|
|
base = (Base *)(*sce_iter)->base.first;
|
2012-02-23 02:17:50 +00:00
|
|
|
if (base) {
|
2011-04-21 13:11:51 +00:00
|
|
|
return base;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-04-02 13:43:56 +00:00
|
|
|
|
2011-04-21 13:11:51 +00:00
|
|
|
return NULL;
|
2010-04-02 13:43:56 +00:00
|
|
|
}
|
2011-11-02 19:24:30 +00:00
|
|
|
|
2014-02-03 18:55:59 +11:00
|
|
|
bool BKE_scene_use_new_shading_nodes(Scene *scene)
|
2011-11-02 19:24:30 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
RenderEngineType *type = RE_engines_find(scene->r.engine);
|
2011-11-15 07:30:26 +00:00
|
|
|
return (type && type->flag & RE_USE_SHADING_NODES);
|
2011-11-02 19:24:30 +00:00
|
|
|
}
|
|
|
|
|
|
2014-08-27 15:52:24 +02:00
|
|
|
bool BKE_scene_uses_blender_internal(struct Scene *scene)
|
|
|
|
|
{
|
2014-08-27 18:52:17 +02:00
|
|
|
return strcmp("BLENDER_RENDER", scene->r.engine) == 0;
|
2014-08-27 15:52:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_base_flag_to_objects(struct Scene *scene)
|
2012-05-05 14:03:12 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
Base *base = scene->base.first;
|
2012-05-05 14:03:12 +00:00
|
|
|
|
|
|
|
|
while (base) {
|
2012-05-06 15:15:33 +00:00
|
|
|
base->object->flag = base->flag;
|
|
|
|
|
base = base->next;
|
2012-05-05 14:03:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_base_flag_from_objects(struct Scene *scene)
|
2012-05-05 14:03:12 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
Base *base = scene->base.first;
|
2012-05-05 14:03:12 +00:00
|
|
|
|
|
|
|
|
while (base) {
|
2012-05-06 15:15:33 +00:00
|
|
|
base->flag = base->object->flag;
|
|
|
|
|
base = base->next;
|
2012-05-05 14:03:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
|
|
|
|
void BKE_scene_disable_color_management(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
ColorManagedDisplaySettings *display_settings = &scene->display_settings;
|
|
|
|
|
ColorManagedViewSettings *view_settings = &scene->view_settings;
|
|
|
|
|
const char *view;
|
2012-09-26 13:17:47 +00:00
|
|
|
const char *none_display_name;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2012-09-26 13:17:47 +00:00
|
|
|
none_display_name = IMB_colormanagement_display_get_none_name();
|
|
|
|
|
|
|
|
|
|
BLI_strncpy(display_settings->display_device, none_display_name, sizeof(display_settings->display_device));
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
|
|
|
|
view = IMB_colormanagement_view_get_default_name(display_settings->display_device);
|
|
|
|
|
|
|
|
|
|
if (view) {
|
|
|
|
|
BLI_strncpy(view_settings->view_transform, view, sizeof(view_settings->view_transform));
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-01 11:14:02 +00:00
|
|
|
|
2014-02-03 18:55:59 +11:00
|
|
|
bool BKE_scene_check_color_management_enabled(const Scene *scene)
|
2012-10-01 11:14:02 +00:00
|
|
|
{
|
|
|
|
|
return strcmp(scene->display_settings.display_device, "None") != 0;
|
|
|
|
|
}
|
2013-01-23 05:56:22 +00:00
|
|
|
|
2014-02-03 18:55:59 +11:00
|
|
|
bool BKE_scene_check_rigidbody_active(const Scene *scene)
|
2013-01-23 05:56:22 +00:00
|
|
|
{
|
|
|
|
|
return scene && scene->rigidbody_world && scene->rigidbody_world->group && !(scene->rigidbody_world->flag & RBW_FLAG_MUTED);
|
|
|
|
|
}
|
2013-05-08 13:23:17 +00:00
|
|
|
|
|
|
|
|
int BKE_render_num_threads(const RenderData *rd)
|
|
|
|
|
{
|
|
|
|
|
int threads;
|
|
|
|
|
|
|
|
|
|
/* override set from command line? */
|
|
|
|
|
threads = BLI_system_num_threads_override_get();
|
|
|
|
|
|
|
|
|
|
if (threads > 0)
|
|
|
|
|
return threads;
|
|
|
|
|
|
|
|
|
|
/* fixed number of threads specified in scene? */
|
|
|
|
|
if (rd->mode & R_FIXED_THREADS)
|
|
|
|
|
threads = rd->threads;
|
|
|
|
|
else
|
|
|
|
|
threads = BLI_system_thread_count();
|
|
|
|
|
|
|
|
|
|
return max_ii(threads, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int BKE_scene_num_threads(const Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
return BKE_render_num_threads(&scene->r);
|
|
|
|
|
}
|
2014-08-26 20:52:07 +10:00
|
|
|
|
|
|
|
|
/* Apply the needed correction factor to value, based on unit_type (only length-related are affected currently)
|
|
|
|
|
* and unit->scale_length.
|
|
|
|
|
*/
|
|
|
|
|
double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, double value)
|
|
|
|
|
{
|
|
|
|
|
if (unit->system == USER_UNIT_NONE) {
|
|
|
|
|
/* Never apply scale_length when not using a unit setting! */
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (unit_type) {
|
|
|
|
|
case B_UNIT_LENGTH:
|
|
|
|
|
return value * (double)unit->scale_length;
|
|
|
|
|
case B_UNIT_CAMERA:
|
|
|
|
|
return value * (double)unit->scale_length;
|
|
|
|
|
case B_UNIT_AREA:
|
|
|
|
|
return value * pow(unit->scale_length, 2);
|
|
|
|
|
case B_UNIT_VOLUME:
|
|
|
|
|
return value * pow(unit->scale_length, 3);
|
|
|
|
|
case B_UNIT_MASS:
|
|
|
|
|
return value * pow(unit->scale_length, 3);
|
|
|
|
|
default:
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
}
|