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"
|
2016-08-03 23:31:48 +02:00
|
|
|
#include "DNA_gpencil_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"
|
2017-01-16 17:33:34 +01:00
|
|
|
#include "BLI_string_utils.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
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-03-25 08:29:06 +00:00
|
|
|
|
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"
|
2014-11-14 14:04:07 +01:00
|
|
|
#include "BKE_armature.h"
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
#include "BKE_cachefile.h"
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "BKE_collection.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"
|
2014-11-22 18:04:08 +13:00
|
|
|
#include "BKE_gpencil.h"
|
2010-03-26 10:52:55 +00:00
|
|
|
#include "BKE_group.h"
|
2015-08-10 15:41:28 +02:00
|
|
|
#include "BKE_icons.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"
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "BKE_layer.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_library.h"
|
2016-12-12 14:31:50 +01:00
|
|
|
#include "BKE_library_remap.h"
|
2015-05-04 15:45:32 +09:00
|
|
|
#include "BKE_linestyle.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"
|
2015-05-04 15:07:24 +10:00
|
|
|
#include "BKE_screen.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
|
|
|
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
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"
|
2015-04-06 10:40:12 -03:00
|
|
|
#include "IMB_imbuf.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
|
|
|
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "bmesh.h"
|
|
|
|
|
2014-10-28 12:49:04 +01:00
|
|
|
const char *RE_engine_id_BLENDER_RENDER = "BLENDER_RENDER";
|
|
|
|
const char *RE_engine_id_BLENDER_GAME = "BLENDER_GAME";
|
2017-02-07 11:20:15 +01:00
|
|
|
const char *RE_engine_id_BLENDER_CLAY = "BLENDER_CLAY";
|
2014-10-28 12:49:04 +01:00
|
|
|
const char *RE_engine_id_CYCLES = "CYCLES";
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
/* copy SceneCollection tree but keep pointing to the same objects */
|
|
|
|
static void scene_collection_copy(SceneCollection *scn, SceneCollection *sc)
|
|
|
|
{
|
|
|
|
BLI_duplicatelist(&scn->objects, &sc->objects);
|
|
|
|
for (LinkData *link = scn->objects.first; link; link = link->next) {
|
|
|
|
id_us_plus(link->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_duplicatelist(&scn->filter_objects, &sc->filter_objects);
|
|
|
|
for (LinkData *link = scn->filter_objects.first; link; link = link->next) {
|
|
|
|
id_us_plus(link->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_duplicatelist(&scn->scene_collections, &sc->scene_collections);
|
|
|
|
SceneCollection *nscn = scn->scene_collections.first; /* nested SceneCollection new */
|
|
|
|
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
|
|
|
scene_collection_copy(nscn, nsc);
|
|
|
|
nscn = nscn->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the equivalent SceneCollection in the new tree */
|
|
|
|
static SceneCollection *scene_collection_from_new_tree(SceneCollection *sc_reference, SceneCollection *scn, SceneCollection *sc)
|
|
|
|
{
|
|
|
|
if (sc == sc_reference) {
|
|
|
|
return scn;
|
|
|
|
}
|
|
|
|
|
|
|
|
SceneCollection *nscn = scn->scene_collections.first; /* nested master collection new */
|
|
|
|
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
|
|
|
|
|
|
|
SceneCollection *found = scene_collection_from_new_tree(sc_reference, nscn, nsc);
|
|
|
|
if (found) {
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
nscn = nscn->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* recreate the LayerCollection tree */
|
|
|
|
static void layer_collections_recreate(SceneLayer *sl, ListBase *lb, SceneCollection *mcn, SceneCollection *mc)
|
|
|
|
{
|
|
|
|
for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
|
|
|
|
|
|
|
|
SceneCollection *sc = scene_collection_from_new_tree(lc->scene_collection, mcn, mc);
|
|
|
|
BLI_assert(sc);
|
|
|
|
|
|
|
|
/* instead of syncronizing both trees we simply re-create it */
|
|
|
|
BKE_collection_link(sl, sc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-10 14:52:00 +02:00
|
|
|
Scene *BKE_scene_copy(Main *bmain, 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;
|
2015-05-04 15:45:32 +09:00
|
|
|
FreestyleLineSet *lineset;
|
2009-09-18 22:25:49 +00:00
|
|
|
ToolSettings *ts;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *legacy_base, *olegacy_base;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (type == SCE_COPY_EMPTY) {
|
2015-04-06 10:40:12 -03:00
|
|
|
ListBase rl, rv;
|
2016-07-10 14:52:00 +02:00
|
|
|
scen = BKE_scene_add(bmain, sce->id.name + 2);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
rl = scen->r.layers;
|
|
|
|
rv = scen->r.views;
|
2016-01-16 12:44:55 +01:00
|
|
|
curvemapping_free_data(&scen->r.mblur_shutter_curve);
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->r = sce->r;
|
2015-04-06 10:40:12 -03:00
|
|
|
scen->r.layers = rl;
|
2013-10-18 09:45:21 +00:00
|
|
|
scen->r.actlay = 0;
|
2015-04-06 10:40:12 -03:00
|
|
|
scen->r.views = rv;
|
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);
|
2016-01-16 12:44:55 +01:00
|
|
|
BKE_sound_destroy_scene(scen);
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
|
|
|
else {
|
2016-07-10 14:52:00 +02:00
|
|
|
scen = BKE_libblock_copy(bmain, &sce->id);
|
2009-09-18 22:25:49 +00:00
|
|
|
BLI_duplicatelist(&(scen->base), &(sce->base));
|
|
|
|
|
|
|
|
id_us_plus((ID *)scen->world);
|
|
|
|
id_us_plus((ID *)scen->set);
|
2016-01-16 12:44:55 +01:00
|
|
|
/* id_us_plus((ID *)scen->gm.dome.warptext); */ /* XXX Not refcounted? see readfile.c */
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
scen->ed = NULL;
|
|
|
|
scen->theDag = NULL;
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
scen->depsgraph = NULL;
|
2012-05-06 15:15:33 +00:00
|
|
|
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));
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_duplicatelist(&(scen->r.views), &(sce->r.views));
|
2009-09-18 22:25:49 +00:00
|
|
|
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 */
|
2016-07-10 14:52:00 +02:00
|
|
|
scen->nodetree = ntreeCopyTree(bmain, sce->nodetree);
|
2016-12-12 14:31:50 +01:00
|
|
|
BKE_libblock_relink_ex(bmain, scen->nodetree, &sce->id, &scen->id, false);
|
2010-08-05 10:50:38 +00:00
|
|
|
}
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
olegacy_base = sce->base.first;
|
|
|
|
legacy_base = scen->base.first;
|
|
|
|
while (legacy_base) {
|
|
|
|
id_us_plus(&legacy_base->object->id);
|
|
|
|
if (olegacy_base == sce->basact) scen->basact = legacy_base;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
olegacy_base = olegacy_base->next;
|
|
|
|
legacy_base = legacy_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
|
|
|
|
2014-01-21 15:15:47 +01:00
|
|
|
/* copy action and remove animation used by sequencer */
|
2016-11-30 15:25:54 +01:00
|
|
|
BKE_animdata_copy_id_action(&scen->id, false);
|
2014-01-21 15:15:47 +01:00
|
|
|
|
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);
|
2015-05-04 15:45:32 +09:00
|
|
|
if (type == SCE_COPY_FULL) {
|
|
|
|
for (lineset = new_srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
|
|
|
|
if (lineset->linestyle) {
|
|
|
|
id_us_plus((ID *)lineset->linestyle);
|
2016-07-10 14:52:00 +02:00
|
|
|
lineset->linestyle = BKE_linestyle_copy(bmain, lineset->linestyle);
|
2015-05-04 15:45:32 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-23 03:00:37 +00:00
|
|
|
new_srl = new_srl->next;
|
2013-01-29 03:12:49 +00:00
|
|
|
}
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
|
|
|
/* layers and collections */
|
|
|
|
scen->collection = MEM_dupallocN(sce->collection);
|
|
|
|
SceneCollection *mcn = BKE_collection_master(scen);
|
|
|
|
SceneCollection *mc = BKE_collection_master(sce);
|
|
|
|
|
|
|
|
/* recursively creates a new SceneCollection tree */
|
|
|
|
scene_collection_copy(mcn, mc);
|
|
|
|
|
|
|
|
BLI_duplicatelist(&scen->render_layers, &sce->render_layers);
|
|
|
|
SceneLayer *new_sl = scen->render_layers.first;
|
|
|
|
for (SceneLayer *sl = sce->render_layers.first; sl; sl = sl->next) {
|
|
|
|
|
|
|
|
/* we start fresh with no overrides and no visibility flags set
|
|
|
|
* instead of syncing both trees we simply unlink and relink the scene collection */
|
|
|
|
BLI_listbase_clear(&new_sl->layer_collections);
|
|
|
|
BLI_listbase_clear(&new_sl->object_bases);
|
|
|
|
layer_collections_recreate(new_sl, &sl->layer_collections, mcn, mc);
|
|
|
|
|
|
|
|
if (sl->basact) {
|
|
|
|
Object *active_ob = sl->basact->object;
|
|
|
|
for (Base *base = new_sl->object_bases.first; base; base = base->next) {
|
|
|
|
if (base->object == active_ob) {
|
|
|
|
new_sl->basact = base;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
new_sl = new_sl->next;
|
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
2012-04-15 08:48:11 +00:00
|
|
|
|
2016-01-16 12:44:55 +01: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);
|
|
|
|
BKE_color_managed_colorspace_settings_copy(&scen->sequencer_colorspace_settings, &sce->sequencer_colorspace_settings);
|
|
|
|
|
|
|
|
BKE_color_managed_display_settings_copy(&scen->r.im_format.display_settings, &sce->r.im_format.display_settings);
|
|
|
|
BKE_color_managed_view_settings_copy(&scen->r.im_format.view_settings, &sce->r.im_format.view_settings);
|
|
|
|
|
|
|
|
BKE_color_managed_display_settings_copy(&scen->r.bake.im_format.display_settings, &sce->r.bake.im_format.display_settings);
|
|
|
|
BKE_color_managed_view_settings_copy(&scen->r.bake.im_format.view_settings, &sce->r.bake.im_format.view_settings);
|
|
|
|
|
|
|
|
curvemapping_copy_data(&scen->r.mblur_shutter_curve, &sce->r.mblur_shutter_curve);
|
|
|
|
|
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;
|
2017-01-18 19:00:17 +13:00
|
|
|
|
2016-08-03 23:31:48 +02:00
|
|
|
/* duplicate Grease Pencil Drawing Brushes */
|
|
|
|
BLI_listbase_clear(&ts->gp_brushes);
|
|
|
|
for (bGPDbrush *brush = sce->toolsettings->gp_brushes.first; brush; brush = brush->next) {
|
2016-08-04 15:03:18 +02:00
|
|
|
bGPDbrush *newbrush = BKE_gpencil_brush_duplicate(brush);
|
2016-08-03 23:31:48 +02:00
|
|
|
BLI_addtail(&ts->gp_brushes, newbrush);
|
|
|
|
}
|
2017-01-18 19:00:17 +13:00
|
|
|
|
|
|
|
/* duplicate Grease Pencil interpolation curve */
|
|
|
|
ts->gp_interpolate.custom_ipo = curvemapping_copy(ts->gp_interpolate.custom_ipo);
|
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) {
|
2016-11-30 15:25:54 +01:00
|
|
|
ID_NEW_REMAP(scen->camera);
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
2010-10-04 15:31:04 +00:00
|
|
|
|
|
|
|
/* before scene copy */
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_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);
|
2016-07-10 14:52:00 +02:00
|
|
|
scen->world = BKE_world_copy(bmain, scen->world);
|
2016-11-30 15:25:54 +01:00
|
|
|
BKE_animdata_copy_id_action((ID *)scen->world, false);
|
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
|
|
|
}
|
2014-11-22 18:04:08 +13:00
|
|
|
|
|
|
|
/* grease pencil */
|
|
|
|
if (scen->gpd) {
|
|
|
|
if (type == SCE_COPY_FULL) {
|
2016-08-04 15:03:18 +02:00
|
|
|
scen->gpd = BKE_gpencil_data_duplicate(bmain, scen->gpd, false);
|
2014-11-22 18:04:08 +13:00
|
|
|
}
|
|
|
|
else if (type == SCE_COPY_EMPTY) {
|
|
|
|
scen->gpd = NULL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
id_us_plus((ID *)scen->gpd);
|
|
|
|
}
|
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2016-07-19 16:27:40 +02:00
|
|
|
BKE_previewimg_id_copy(&scen->id, &sce->id);
|
2015-08-10 15:41:28 +02: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);
|
|
|
|
}
|
|
|
|
|
2016-07-21 16:09:08 +02:00
|
|
|
void BKE_scene_make_local(Main *bmain, Scene *sce, const bool lib_local)
|
|
|
|
{
|
|
|
|
/* For now should work, may need more work though to support all possible corner cases
|
|
|
|
* (also scene_copy probably needs some love). */
|
|
|
|
BKE_id_make_local_generic(bmain, &sce->id, true, lib_local);
|
|
|
|
}
|
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
/** Free (or release) any data used by this scene (does not free the scene itself). */
|
2012-05-05 14:03:12 +00:00
|
|
|
void BKE_scene_free(Scene *sce)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2013-03-23 03:00:37 +00:00
|
|
|
SceneRenderLayer *srl;
|
2012-12-11 22:00:22 +00:00
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
BKE_animdata_free((ID *)sce, false);
|
|
|
|
|
2013-02-28 14:25:09 +00:00
|
|
|
/* check all sequences */
|
|
|
|
BKE_sequencer_clear_scene_in_allseqs(G.main, sce);
|
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
sce->basact = NULL;
|
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_keyingsets_free(&sce->keyingsets);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
|
|
|
|
/* is no lib link block, but scene extension */
|
|
|
|
if (sce->nodetree) {
|
|
|
|
ntreeFreeTree(sce->nodetree);
|
|
|
|
MEM_freeN(sce->nodetree);
|
|
|
|
sce->nodetree = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sce->rigidbody_world) {
|
2013-01-23 05:56:22 +00:00
|
|
|
BKE_rigidbody_free_world(sce->rigidbody_world);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
sce->rigidbody_world = NULL;
|
|
|
|
}
|
|
|
|
|
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);
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_freelistN(&sce->r.views);
|
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);
|
|
|
|
}
|
2017-01-18 19:00:17 +13:00
|
|
|
BKE_paint_free(&sce->toolsettings->imapaint.paint);
|
|
|
|
|
2016-08-03 23:31:48 +02:00
|
|
|
/* free Grease Pencil Drawing Brushes */
|
2016-08-04 15:03:18 +02:00
|
|
|
BKE_gpencil_free_brushes(&sce->toolsettings->gp_brushes);
|
2016-08-03 23:31:48 +02:00
|
|
|
BLI_freelistN(&sce->toolsettings->gp_brushes);
|
2017-01-18 19:00:17 +13:00
|
|
|
|
|
|
|
/* free Grease Pencil interpolation curve */
|
|
|
|
if (sce->toolsettings->gp_interpolate.custom_ipo) {
|
|
|
|
curvemapping_free(sce->toolsettings->gp_interpolate.custom_ipo);
|
|
|
|
}
|
|
|
|
|
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);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
if (sce->depsgraph)
|
|
|
|
DEG_graph_free(sce->depsgraph);
|
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
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
MEM_SAFE_FREE(sce->stats);
|
|
|
|
MEM_SAFE_FREE(sce->fps_info);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_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);
|
2015-08-10 15:41:28 +02:00
|
|
|
|
|
|
|
BKE_previewimg_free(&sce->preview);
|
2015-10-27 19:00:51 +05:00
|
|
|
curvemapping_free_data(&sce->r.mblur_shutter_curve);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
|
|
|
for (SceneLayer *sl = sce->render_layers.first; sl; sl = sl->next) {
|
|
|
|
BKE_scene_layer_free(sl);
|
|
|
|
}
|
|
|
|
BLI_freelistN(&sce->render_layers);
|
|
|
|
|
|
|
|
/* Master Collection */
|
|
|
|
BKE_collection_master_free(sce);
|
|
|
|
MEM_freeN(sce->collection);
|
|
|
|
sce->collection = NULL;
|
2017-02-07 11:20:15 +01:00
|
|
|
|
|
|
|
/* Runtime Engine Data */
|
|
|
|
for (RenderEngineSettings *res = sce->engines_settings.first; res; res = res->next) {
|
|
|
|
if (res->data)
|
|
|
|
MEM_freeN(res->data);
|
|
|
|
}
|
|
|
|
BLI_freelistN(&sce->engines_settings);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
void BKE_scene_init(Scene *sce)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
ParticleEditSettings *pset;
|
|
|
|
int a;
|
2012-10-08 06:38:34 +00:00
|
|
|
const char *colorspace_name;
|
2015-04-06 10:40:12 -03:00
|
|
|
SceneRenderView *srv;
|
2015-11-08 07:29:12 +05:00
|
|
|
CurveMapping *mblur_shutter_curve;
|
2004-01-04 22:10:36 +00:00
|
|
|
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(sce, id));
|
|
|
|
|
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;
|
2016-01-15 13:00:56 -02:00
|
|
|
sce->r.bake.pass_filter = R_BAKE_PASS_FILTER_ALL;
|
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.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;
|
2016-05-19 21:39:22 +02:00
|
|
|
sce->r.stamp = R_STAMP_TIME | R_STAMP_FRAME | R_STAMP_DATE | R_STAMP_CAMERA | R_STAMP_SCENE | R_STAMP_FILENAME | R_STAMP_RENDERTIME | R_STAMP_MEMORY;
|
2012-05-06 15:15:33 +00:00
|
|
|
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
|
|
|
|
2014-09-26 12:05:18 +09:00
|
|
|
sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE;
|
|
|
|
sce->r.unit_line_thickness = 1.0f;
|
|
|
|
|
2015-11-08 07:29:12 +05:00
|
|
|
mblur_shutter_curve = &sce->r.mblur_shutter_curve;
|
|
|
|
curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
curvemapping_initialize(mblur_shutter_curve);
|
|
|
|
curvemap_reset(mblur_shutter_curve->cm,
|
|
|
|
&mblur_shutter_curve->clipr,
|
|
|
|
CURVE_PRESET_MAX,
|
|
|
|
CURVEMAP_SLOPE_POS_NEG);
|
|
|
|
|
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;
|
2015-07-17 18:49:58 +02:00
|
|
|
sce->toolsettings->vgroup_weight = 1.0f;
|
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;
|
|
|
|
|
2016-04-15 18:10:05 +10:00
|
|
|
sce->toolsettings->curve_paint_settings.curve_type = CU_BEZIER;
|
|
|
|
sce->toolsettings->curve_paint_settings.flag |= CURVE_PAINT_FLAG_CORNERS_DETECT;
|
|
|
|
sce->toolsettings->curve_paint_settings.error_threshold = 8;
|
|
|
|
sce->toolsettings->curve_paint_settings.radius_max = 1.0f;
|
|
|
|
sce->toolsettings->curve_paint_settings.corner_angle = DEG2RADF(70.0f);
|
|
|
|
|
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++) {
|
2016-03-03 15:48:50 +01:00
|
|
|
pset->brush[a].strength = 0.5f;
|
2012-05-06 15:15:33 +00:00
|
|
|
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
|
|
|
}
|
2016-03-03 15:48:50 +01:00
|
|
|
pset->brush[PE_BRUSH_CUT].strength = 1.0f;
|
2010-11-09 10:40:03 +00:00
|
|
|
|
2015-12-27 16:33:54 +01:00
|
|
|
sce->r.ffcodecdata.audio_mixrate = 48000;
|
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
|
|
|
|
2014-10-28 12:49:04 +01:00
|
|
|
BLI_strncpy(sce->r.engine, RE_engine_id_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);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
/* multiview - stereo */
|
|
|
|
BKE_scene_add_render_view(sce, STEREO_LEFT_NAME);
|
|
|
|
srv = sce->r.views.first;
|
|
|
|
BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
|
|
|
|
|
|
|
|
BKE_scene_add_render_view(sce, STEREO_RIGHT_NAME);
|
|
|
|
srv = sce->r.views.last;
|
|
|
|
BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
|
|
|
|
|
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;
|
2015-05-02 19:46:27 +02:00
|
|
|
sce->gm.recastData.agentmaxslope = M_PI_4;
|
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;
|
|
|
|
|
2015-03-22 18:13:53 +01:00
|
|
|
sce->gm.lodflag = SCE_LOD_USE_HYST;
|
|
|
|
sce->gm.scehysteresis = 10;
|
|
|
|
|
2012-01-25 01:39:38 +00:00
|
|
|
sce->gm.exitkey = 218; // Blender key code for ESC
|
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_create_scene(sce);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
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
|
|
|
|
2015-01-19 16:30:35 +11:00
|
|
|
/* Safe Areas */
|
|
|
|
copy_v2_fl2(sce->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
|
|
|
|
copy_v2_fl2(sce->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
|
|
|
|
copy_v2_fl2(sce->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
|
|
|
|
copy_v2_fl2(sce->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
|
|
|
|
|
2015-08-10 15:41:28 +02:00
|
|
|
sce->preview = NULL;
|
2015-12-13 21:03:13 +13:00
|
|
|
|
|
|
|
/* GP Sculpt brushes */
|
|
|
|
{
|
|
|
|
GP_BrushEdit_Settings *gset = &sce->toolsettings->gp_sculpt;
|
|
|
|
GP_EditBrush_Data *gp_brush;
|
|
|
|
|
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH];
|
|
|
|
gp_brush->size = 25;
|
|
|
|
gp_brush->strength = 0.3f;
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE;
|
|
|
|
|
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS];
|
|
|
|
gp_brush->size = 25;
|
|
|
|
gp_brush->strength = 0.5f;
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
|
|
|
|
2016-08-03 23:31:48 +02:00
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_STRENGTH];
|
|
|
|
gp_brush->size = 25;
|
|
|
|
gp_brush->strength = 0.5f;
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_GRAB];
|
|
|
|
gp_brush->size = 50;
|
|
|
|
gp_brush->strength = 0.3f;
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
|
|
|
|
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH];
|
|
|
|
gp_brush->size = 25;
|
|
|
|
gp_brush->strength = 0.3f;
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
|
|
|
|
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST];
|
|
|
|
gp_brush->size = 50;
|
|
|
|
gp_brush->strength = 0.3f; // XXX?
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
|
|
|
|
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH];
|
|
|
|
gp_brush->size = 50;
|
|
|
|
gp_brush->strength = 0.5f; // XXX?
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
|
|
|
|
2015-12-14 19:20:31 +01:00
|
|
|
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 25;
|
|
|
|
gp_brush->strength = 0.5f;
|
|
|
|
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* GP Stroke Placement */
|
|
|
|
sce->toolsettings->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
|
|
|
|
sce->toolsettings->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
|
|
|
|
sce->toolsettings->gpencil_seq_align = GP_PROJECT_VIEWSPACE;
|
|
|
|
sce->toolsettings->gpencil_ima_align = GP_PROJECT_VIEWSPACE;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
|
|
|
/* Master Collection */
|
|
|
|
sce->collection = MEM_callocN(sizeof(SceneCollection), "Master Collection");
|
|
|
|
BLI_strncpy(sce->collection->name, "Master Collection", sizeof(sce->collection->name));
|
|
|
|
|
|
|
|
BKE_scene_layer_add(sce, "Render Layer");
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Scene *BKE_scene_add(Main *bmain, const char *name)
|
|
|
|
{
|
|
|
|
Scene *sce;
|
|
|
|
|
|
|
|
sce = BKE_libblock_alloc(bmain, ID_SCE, name);
|
2016-09-26 16:35:52 +02:00
|
|
|
id_us_min(&sce->id);
|
|
|
|
id_us_ensure_real(&sce->id);
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
|
|
|
|
BKE_scene_init(sce);
|
2015-08-10 15:41:28 +02:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return sce;
|
|
|
|
}
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *BKE_scene_base_find_by_name(struct Scene *scene, const char *name)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *base;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
|
|
|
if (STREQ(base->object->id.name + 2, name)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return base;
|
|
|
|
}
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *BKE_scene_base_find(Scene *scene, Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
return BLI_findptr(&scene->base, ob, offsetof(BaseLegacy, object));
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2015-08-06 21:02:08 +10:00
|
|
|
/**
|
|
|
|
* Sets the active scene, mainly used when running in background mode (``--scene`` command line argument).
|
|
|
|
* This is also called to set the scene directly, bypassing windowing code.
|
|
|
|
* Otherwise #ED_screen_set_scene is used when changing scenes by the user.
|
|
|
|
*/
|
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;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *base;
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *ob;
|
|
|
|
Group *group;
|
|
|
|
GroupObject *go;
|
|
|
|
|
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... */
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BKE_scene_base_flag_sync_from_base(base);
|
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
|
|
|
}
|
|
|
|
|
2016-03-04 06:35:17 +11:00
|
|
|
/* called from creator_args.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);
|
2016-10-11 14:48:15 +02:00
|
|
|
printf("Scene switch for render: '%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-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,
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
Scene **scene, int val, BaseLegacy **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) {
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
(*base)->flag_legacy |= 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;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
(*base)->flag_legacy &= ~OB_FROMDUPLI;
|
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
|
|
|
|
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
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *base;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
void BKE_scene_remove_rigidbody_object(Scene *scene, Object *ob)
|
|
|
|
{
|
|
|
|
/* remove rigid body constraint from world before removing object */
|
|
|
|
if (ob->rigidbody_constraint)
|
|
|
|
BKE_rigidbody_remove_constraint(scene, ob);
|
|
|
|
/* remove rigid body object from world before removing object */
|
|
|
|
if (ob->rigidbody_object)
|
|
|
|
BKE_rigidbody_remove_object(scene, ob);
|
|
|
|
}
|
2010-11-18 05:05:06 +00:00
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *BKE_scene_base_add(Scene *sce, Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *b = MEM_callocN(sizeof(*b), __func__);
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_addhead(&sce->base, b);
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
b->object = ob;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
b->flag_legacy = ob->flag;
|
2012-05-06 15:15:33 +00:00
|
|
|
b->lay = ob->lay;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
void BKE_scene_base_unlink(Scene *sce, BaseLegacy *base)
|
2013-01-23 05:56:22 +00:00
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BKE_scene_remove_rigidbody_object(sce, base->object);
|
|
|
|
|
2013-01-23 05:56:22 +00:00
|
|
|
BLI_remlink(&sce->base, base);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
if (sce->basact == base)
|
|
|
|
sce->basact = NULL;
|
2013-01-23 05:56:22 +00:00
|
|
|
}
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_base_deselect_all(Scene *sce)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *b;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
for (b = sce->base.first; b; b = b->next) {
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
b->flag_legacy &= ~SELECT;
|
|
|
|
int flag = b->object->flag & (OB_FROMGROUP);
|
|
|
|
b->object->flag = b->flag_legacy;
|
|
|
|
b->object->flag |= flag;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
void BKE_scene_base_select(Scene *sce, BaseLegacy *selbase)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
selbase->flag_legacy |= SELECT;
|
|
|
|
selbase->object->flag = selbase->flag_legacy;
|
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 */
|
2014-11-11 19:32:46 +01:00
|
|
|
bool BKE_scene_validate_setscene(Main *bmain, Scene *sce)
|
2006-05-15 10:46:04 +00:00
|
|
|
{
|
2014-11-11 19:32:46 +01:00
|
|
|
Scene *sce_iter;
|
2008-02-29 13:29:15 +00:00
|
|
|
int a, totscene;
|
2014-11-11 19:32:46 +01:00
|
|
|
|
2014-12-01 17:11:18 +01:00
|
|
|
if (sce->set == NULL) return true;
|
2014-11-16 13:57:58 +01:00
|
|
|
totscene = BLI_listbase_count(&bmain->scene);
|
2006-05-15 10:46:04 +00:00
|
|
|
|
2014-11-11 19:32:46 +01:00
|
|
|
for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->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;
|
2014-12-01 17:11:18 +01:00
|
|
|
return false;
|
2008-02-29 13:29:15 +00:00
|
|
|
}
|
2006-05-15 10:46:04 +00:00
|
|
|
}
|
2008-02-29 13:29:15 +00:00
|
|
|
|
2014-12-01 17:11:18 +01:00
|
|
|
return true;
|
2006-05-15 10:46:04 +00:00
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
*/
|
2015-03-21 22:10:43 +11:00
|
|
|
float BKE_scene_frame_get(const 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 */
|
2015-03-21 22:10:43 +11:00
|
|
|
float BKE_scene_frame_get_from_ctime(const 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;
|
|
|
|
}
|
|
|
|
|
2014-11-14 14:04:07 +01:00
|
|
|
/* That's like really a bummer, because currently animation data for armatures
|
|
|
|
* might want to use pose, and pose might be missing on the object.
|
|
|
|
* This happens when changing visible layers, which leads to situations when
|
|
|
|
* pose is missing or marked for recalc, animation will change it and then
|
|
|
|
* object update will restore the pose.
|
|
|
|
*
|
|
|
|
* This could be solved by the new dependency graph, but for until then we'll
|
|
|
|
* do an extra pass on the objects to ensure it's all fine.
|
|
|
|
*/
|
|
|
|
#define POSE_ANIMATION_WORKAROUND
|
2013-01-10 18:20:29 +00:00
|
|
|
|
2014-11-14 14:04:07 +01:00
|
|
|
#ifdef POSE_ANIMATION_WORKAROUND
|
|
|
|
static void scene_armature_depsgraph_workaround(Main *bmain)
|
|
|
|
{
|
|
|
|
Object *ob;
|
2014-11-14 14:55:45 +01:00
|
|
|
if (BLI_listbase_is_empty(&bmain->armature) || !DAG_id_type_tagged(bmain, ID_OB)) {
|
2014-11-14 14:04:07 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
|
|
|
if (ob->type == OB_ARMATURE && ob->adt && ob->adt->recalc & ADT_RECALC_ANIM) {
|
|
|
|
if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) {
|
|
|
|
BKE_pose_rebuild(ob, ob->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-01-10 18:20:29 +00:00
|
|
|
}
|
2014-11-14 14:04:07 +01:00
|
|
|
#endif
|
2013-01-10 18:20:29 +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;
|
|
|
|
if ((obedit->type == OB_MESH) &&
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
((obedit->id.tag & LIB_TAG_ID_RECALC_ALL) ||
|
|
|
|
(mesh->id.tag & LIB_TAG_ID_RECALC_ALL)))
|
2014-07-31 20:18:51 +06:00
|
|
|
{
|
|
|
|
if (check_rendered_viewport_visible(bmain)) {
|
|
|
|
BMesh *bm = mesh->edit_btmesh->bm;
|
2016-04-29 22:33:06 +10:00
|
|
|
BM_mesh_bm_to_me(bm, mesh, (&(struct BMeshToMeshParams){0}));
|
2014-07-31 20:18:51 +06:00
|
|
|
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;
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
|
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 */
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
for (sce_iter = scene; sce_iter; sce_iter = sce_iter->set) {
|
2013-02-21 19:33:04 +00:00
|
|
|
DAG_scene_relations_update(bmain, sce_iter);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
/* Uncomment this to check if graph was properly tagged for update. */
|
|
|
|
#if 0
|
2017-01-24 12:42:56 +01:00
|
|
|
DAG_scene_relations_validate(bmain, sce_iter);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
#endif
|
|
|
|
}
|
2013-02-21 19:33:04 +00:00
|
|
|
|
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
|
|
|
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
/* clear "LIB_TAG_DOIT" flag from all materials, to prevent infinite recursion problems later
|
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
|
|
|
* when trying to find materials with drivers that need evaluating [#32017]
|
|
|
|
*/
|
2016-02-15 19:35:35 +01:00
|
|
|
BKE_main_id_tag_idcode(bmain, ID_MA, LIB_TAG_DOIT, false);
|
|
|
|
BKE_main_id_tag_idcode(bmain, ID_LA, LIB_TAG_DOIT, 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 */
|
2017-01-24 12:42:56 +01:00
|
|
|
DEG_evaluate_on_refresh(eval_ctx, scene->depsgraph, scene);
|
|
|
|
/* TODO(sergey): This is to beocme a node in new depsgraph. */
|
|
|
|
BKE_mask_update_scene(bmain, scene);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
|
2014-03-11 14:44:13 +11:00
|
|
|
/* update sound system animation (TODO, move to depsgraph) */
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_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
|
|
|
|
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);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
|
|
|
|
/* Inform editors about possible changes. */
|
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);
|
|
|
|
}
|
|
|
|
|
2017-01-24 12:42:56 +01:00
|
|
|
void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain, Scene *sce, unsigned int lay, bool UNUSED(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-05-22 22:17:07 +00:00
|
|
|
|
2015-08-27 12:10:01 +02:00
|
|
|
DAG_editors_update_pre(bmain, sce, true);
|
|
|
|
|
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);
|
2017-01-24 12:42:56 +01:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_set_cfra(sce->r.cfra);
|
2017-01-24 12:42:56 +01: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
|
|
|
|
2013-10-29 18:46:45 +00:00
|
|
|
BKE_mask_evaluate_all_masks(bmain, ctime, true);
|
2012-06-04 16:42:58 +00:00
|
|
|
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
/* Update animated cache files for modifiers. */
|
|
|
|
BKE_cachefile_update_frame(bmain, sce, ctime, (((double)sce->r.frs_sec) / (double)sce->r.frs_sec_base));
|
|
|
|
|
2014-11-14 14:04:07 +01:00
|
|
|
#ifdef POSE_ANIMATION_WORKAROUND
|
|
|
|
scene_armature_depsgraph_workaround(bmain);
|
|
|
|
#endif
|
|
|
|
|
Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
2015-12-27 11:53:50 +01:00
|
|
|
/* clear "LIB_TAG_DOIT" flag from all materials, to prevent infinite recursion problems later
|
2012-10-22 19:45:16 +00:00
|
|
|
* when trying to find materials with drivers that need evaluating [#32017]
|
|
|
|
*/
|
2016-02-15 19:35:35 +01:00
|
|
|
BKE_main_id_tag_idcode(bmain, ID_MA, LIB_TAG_DOIT, false);
|
|
|
|
BKE_main_id_tag_idcode(bmain, ID_LA, LIB_TAG_DOIT, false);
|
2012-10-22 19:45:16 +00:00
|
|
|
|
2012-05-05 14:03:12 +00:00
|
|
|
/* BKE_object_handle_update() on all objects, groups and sets */
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
DEG_evaluate_on_framechange(eval_ctx, bmain, sce->depsgraph, ctime, lay);
|
|
|
|
|
2014-03-11 14:44:13 +11:00
|
|
|
/* update sound system animation (TODO, move to depsgraph) */
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_update_scene(bmain, sce);
|
2011-09-27 10:43:45 +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
|
|
|
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
/* Inform editors about possible changes. */
|
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);
|
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) {
|
2014-12-01 17:11:18 +01:00
|
|
|
return false;
|
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 */
|
2014-12-01 17:11:18 +01:00
|
|
|
return false;
|
2011-11-18 08:42:44 +00:00
|
|
|
}
|
2011-11-18 07:11:54 +00:00
|
|
|
|
2017-01-26 11:58:47 +01:00
|
|
|
BKE_freestyle_config_free(&srl->freestyleConfig);
|
|
|
|
|
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) {
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BKE_nodetree_remove_layer_n(sce->nodetree, scene, act);
|
2011-11-18 07:11:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-01 17:11:18 +01:00
|
|
|
return true;
|
2007-12-26 22:40:56 +00:00
|
|
|
}
|
2008-02-13 11:18:08 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* return default view */
|
|
|
|
SceneRenderView *BKE_scene_add_render_view(Scene *sce, const char *name)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
name = DATA_("RenderView");
|
|
|
|
|
|
|
|
srv = MEM_callocN(sizeof(SceneRenderView), "new render view");
|
|
|
|
BLI_strncpy(srv->name, name, sizeof(srv->name));
|
|
|
|
BLI_uniquename(&sce->r.views, srv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(srv->name));
|
|
|
|
BLI_addtail(&sce->r.views, srv);
|
|
|
|
|
|
|
|
return srv;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BKE_scene_remove_render_view(Scene *scene, SceneRenderView *srv)
|
|
|
|
{
|
|
|
|
const int act = BLI_findindex(&scene->r.views, srv);
|
|
|
|
|
|
|
|
if (act == -1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if (scene->r.views.first == scene->r.views.last) {
|
|
|
|
/* ensure 1 view is kept */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_remlink(&scene->r.views, srv);
|
|
|
|
MEM_freeN(srv);
|
|
|
|
|
|
|
|
scene->r.actview = 0;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-02-13 11:18:08 +00:00
|
|
|
/* render simplification */
|
|
|
|
|
2015-05-04 16:26:28 +05:00
|
|
|
int get_render_subsurf_level(const RenderData *r, int lvl, bool for_render)
|
2008-02-13 11:18:08 +00:00
|
|
|
{
|
2015-05-04 16:26:28 +05:00
|
|
|
if (r->mode & R_SIMPLIFY) {
|
|
|
|
if (for_render)
|
|
|
|
return min_ii(r->simplify_subsurf_render, lvl);
|
|
|
|
else
|
|
|
|
return min_ii(r->simplify_subsurf, lvl);
|
|
|
|
}
|
|
|
|
else {
|
2008-02-13 11:18:08 +00:00
|
|
|
return lvl;
|
2015-05-04 16:26:28 +05:00
|
|
|
}
|
2008-02-13 11:18:08 +00:00
|
|
|
}
|
|
|
|
|
2015-05-04 16:26:28 +05:00
|
|
|
int get_render_child_particle_number(const RenderData *r, int num, bool for_render)
|
2008-02-13 11:18:08 +00:00
|
|
|
{
|
2015-05-04 16:26:28 +05:00
|
|
|
if (r->mode & R_SIMPLIFY) {
|
|
|
|
if (for_render)
|
|
|
|
return (int)(r->simplify_particles_render * num);
|
|
|
|
else
|
|
|
|
return (int)(r->simplify_particles * num);
|
|
|
|
}
|
|
|
|
else {
|
2008-02-13 11:18:08 +00:00
|
|
|
return num;
|
2015-05-04 16:26:28 +05:00
|
|
|
}
|
2008-02-13 11:18:08 +00:00
|
|
|
}
|
|
|
|
|
2015-03-21 22:10:43 +11:00
|
|
|
int get_render_shadow_samples(const RenderData *r, int samples)
|
2008-02-13 11:18:08 +00:00
|
|
|
{
|
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;
|
|
|
|
}
|
|
|
|
|
2015-03-21 22:10:43 +11:00
|
|
|
float get_render_aosss_error(const RenderData *r, float error)
|
2008-02-13 11:18:08 +00:00
|
|
|
{
|
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 */
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *_setlooper_base_step(Scene **sce_iter, BaseLegacy *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 */
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
return (BaseLegacy *)(*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)) {
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
base = (BaseLegacy *)(*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
|
|
|
|
2015-03-21 22:10:43 +11:00
|
|
|
bool BKE_scene_use_new_shading_nodes(const Scene *scene)
|
2011-11-02 19:24:30 +00:00
|
|
|
{
|
2015-03-21 22:10:43 +11:00
|
|
|
const 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
|
|
|
}
|
|
|
|
|
2015-05-06 23:50:54 +10:00
|
|
|
bool BKE_scene_use_shading_nodes_custom(Scene *scene)
|
|
|
|
{
|
2015-09-22 15:02:11 +10:00
|
|
|
RenderEngineType *type = RE_engines_find(scene->r.engine);
|
|
|
|
return (type && type->flag & RE_USE_SHADING_NODES_CUSTOM);
|
2015-05-06 23:50:54 +10:00
|
|
|
}
|
|
|
|
|
2016-06-07 10:33:32 +03:00
|
|
|
bool BKE_scene_use_world_space_shading(Scene *scene)
|
|
|
|
{
|
|
|
|
const RenderEngineType *type = RE_engines_find(scene->r.engine);
|
2016-06-07 19:23:43 +10:00
|
|
|
return ((scene->r.mode & R_USE_WS_SHADING) ||
|
|
|
|
(type && (type->flag & RE_USE_SHADING_NODES)));
|
2016-06-07 10:33:32 +03:00
|
|
|
}
|
|
|
|
|
Multi-View: Cycles - Spherical Stereo support (VR Panoramas)
This is a new option for panorama cameras to render
stereo that can be used in virtual reality devices
The option is available under the camera panel when Multi-View is enabled (Views option in the Render Layers panel)
Known limitations:
------------------
* Parallel convergence is not supported (you need to set a convergence distance really high to simulate this effect).
* Pivot was not supposed to affect the render but it does, this has to be looked at, but for now set it to CENTER
* Derivatives in perspective camera need to be pre-computed or we shuld get rid of kcam->dx/dy (Sergey words, I don't fully grasp the implication shere)
* This works in perspective mode and in panorama mode. However, for fully benefit from this effect in perspective mode you need to render a cube map. (there is an addon for this, developed separately, perhaps we could include it in master).
* We have no support for "neck distance" at the moment. This is supposed to help with objects at short distances.
* We have no support to rotate the "Up Axis" of the stereo plane. Meaning, we hardcode 0,0,1 as UP, and create the stereo pair related to that. (although we could take the camera local UP when rendering panoramas, this wouldn't work for perspective cameras.
* We have no support for interocular distance attenuation based on the proximity of the poles (which helps to reduce the pole rotation effect/artifact).
THIS NEEDS DOCS - both in 2.78 release log and the Blender manual.
Meanwhile you can read about it here: http://code.blender.org/2015/03/1451
This patch specifically dates from March 2015, as you can see in the code.blender.org post. Many thanks to all the reviewers, testers and minor sponsors who helped me maintain spherical-stereo for 1 year.
All that said, have fun with this. This feature was what got me started with Multi-View development (at the time what I was looking for was Fulldome stereo support, but the implementation is the same). In order to make this into Blender I had to make it aiming at a less-specic user-case Thus Multi-View started. (this was December 2012, during Siggraph Asia and a chat I had with Paul Bourke during the conference). I don't have the original patch anymore, but you can find a re-based version of it from March 2013, right before I start with the Multi-View project https://developer.blender.org/P332
Reviewers: sergey, dingto
Subscribers: #cycles
Differential Revision: https://developer.blender.org/D1223
2016-03-10 09:28:29 -03:00
|
|
|
bool BKE_scene_use_spherical_stereo(Scene *scene)
|
|
|
|
{
|
|
|
|
RenderEngineType *type = RE_engines_find(scene->r.engine);
|
|
|
|
return (type && type->flag & RE_USE_SPHERICAL_STEREO);
|
|
|
|
}
|
|
|
|
|
2015-03-21 22:10:43 +11:00
|
|
|
bool BKE_scene_uses_blender_internal(const Scene *scene)
|
2014-08-27 15:52:24 +02:00
|
|
|
{
|
2014-10-28 12:49:04 +01:00
|
|
|
return STREQ(scene->r.engine, RE_engine_id_BLENDER_RENDER);
|
2014-08-27 15:52:24 +02:00
|
|
|
}
|
|
|
|
|
2015-03-21 22:10:43 +11:00
|
|
|
bool BKE_scene_uses_blender_game(const Scene *scene)
|
2014-10-23 13:39:45 +02:00
|
|
|
{
|
2014-10-28 12:49:04 +01:00
|
|
|
return STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME);
|
2014-10-23 13:39:45 +02:00
|
|
|
}
|
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
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *base = scene->base.first;
|
2012-05-05 14:03:12 +00:00
|
|
|
|
|
|
|
while (base) {
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BKE_scene_base_flag_sync_from_base(base);
|
2012-05-06 15:15:33 +00:00
|
|
|
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
|
|
|
{
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BaseLegacy *base = scene->base.first;
|
2012-05-05 14:03:12 +00:00
|
|
|
|
|
|
|
while (base) {
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
BKE_scene_base_flag_sync_from_object(base);
|
2012-05-06 15:15:33 +00:00
|
|
|
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
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
void BKE_scene_base_flag_sync_from_base(BaseLegacy *base)
|
|
|
|
{
|
|
|
|
Object *ob = base->object;
|
|
|
|
|
|
|
|
/* keep the object only flags untouched */
|
|
|
|
int flag = ob->flag & OB_FROMGROUP;
|
|
|
|
|
|
|
|
ob->flag = base->flag_legacy;
|
|
|
|
ob->flag |= flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_scene_base_flag_sync_from_object(BaseLegacy *base)
|
|
|
|
{
|
|
|
|
base->flag_legacy = base->object->flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_scene_object_base_flag_sync_from_base(Base *base)
|
|
|
|
{
|
|
|
|
Object *ob = base->object;
|
|
|
|
|
|
|
|
/* keep the object only flags untouched */
|
|
|
|
int flag = ob->flag & OB_FROMGROUP;
|
|
|
|
|
|
|
|
ob->flag = base->flag;
|
|
|
|
ob->flag |= flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_scene_object_base_flag_sync_from_object(Base *base)
|
|
|
|
{
|
|
|
|
base->flag = base->object->flag;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2015-01-26 16:03:11 +01:00
|
|
|
return !STREQ(scene->display_settings.display_device, "None");
|
2012-10-01 11:14:02 +00:00
|
|
|
}
|
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_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);
|
2014-09-30 15:07:44 +02:00
|
|
|
case B_UNIT_CAMERA: /* *Do not* use scene's unit scale for camera focal lens! See T42026. */
|
2014-08-26 20:52:07 +10:00
|
|
|
default:
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
/******************** multiview *************************/
|
|
|
|
|
2015-10-24 01:01:10 +11:00
|
|
|
int BKE_scene_multiview_num_views_get(const RenderData *rd)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
2015-10-24 01:01:10 +11:00
|
|
|
int totviews = 0;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (rd->views_format == SCE_VIEWS_FORMAT_STEREO_3D) {
|
2015-05-12 18:43:07 -03:00
|
|
|
srv = BLI_findstring(&rd->views, STEREO_LEFT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
if ((srv && srv->viewflag & SCE_VIEW_DISABLE) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
totviews++;
|
|
|
|
}
|
|
|
|
|
2015-05-12 18:43:07 -03:00
|
|
|
srv = BLI_findstring(&rd->views, STEREO_RIGHT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
if ((srv && srv->viewflag & SCE_VIEW_DISABLE) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
totviews++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (srv = rd->views.first; srv; srv = srv->next) {
|
|
|
|
if ((srv->viewflag & SCE_VIEW_DISABLE) == 0) {
|
|
|
|
totviews++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return totviews;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BKE_scene_multiview_is_stereo3d(const RenderData *rd)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv[2];
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
srv[0] = (SceneRenderView *)BLI_findstring(&rd->views, STEREO_LEFT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
srv[1] = (SceneRenderView *)BLI_findstring(&rd->views, STEREO_RIGHT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
|
|
|
|
return (srv[0] && ((srv[0]->viewflag & SCE_VIEW_DISABLE) == 0) &&
|
|
|
|
srv[1] && ((srv[1]->viewflag & SCE_VIEW_DISABLE) == 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return whether to render this SceneRenderView */
|
|
|
|
bool BKE_scene_multiview_is_render_view_active(const RenderData *rd, const SceneRenderView *srv)
|
|
|
|
{
|
|
|
|
if (srv == NULL)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if ((srv->viewflag & SCE_VIEW_DISABLE))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* SCE_VIEWS_SETUP_BASIC */
|
|
|
|
if (STREQ(srv->name, STEREO_LEFT_NAME) ||
|
|
|
|
STREQ(srv->name, STEREO_RIGHT_NAME))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return true if viewname is the first or if the name is NULL or not found */
|
|
|
|
bool BKE_scene_multiview_is_render_view_first(const RenderData *rd, const char *viewname)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ((!viewname) || (!viewname[0]))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
for (srv = rd->views.first; srv; srv = srv->next) {
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
return STREQ(viewname, srv->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return true if viewname is the last or if the name is NULL or not found */
|
|
|
|
bool BKE_scene_multiview_is_render_view_last(const RenderData *rd, const char *viewname)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ((!viewname) || (!viewname[0]))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
for (srv = rd->views.last; srv; srv = srv->prev) {
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
return STREQ(viewname, srv->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
SceneRenderView *BKE_scene_multiview_render_view_findindex(const RenderData *rd, const int view_id)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
size_t nr;
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (srv = rd->views.first, nr = 0; srv; srv = srv->next) {
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
if (nr++ == view_id)
|
|
|
|
return srv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return srv;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *BKE_scene_multiview_render_view_name_get(const RenderData *rd, const int view_id)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv = BKE_scene_multiview_render_view_findindex(rd, view_id);
|
|
|
|
|
|
|
|
if (srv)
|
|
|
|
return srv->name;
|
|
|
|
else
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2015-10-24 01:01:10 +11:00
|
|
|
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
size_t nr;
|
|
|
|
|
|
|
|
if ((!rd) || ((rd->scemode & R_MULTIVIEW) == 0))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ((!viewname) || (!viewname[0]))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (srv = rd->views.first, nr = 0; srv; srv = srv->next) {
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
if (STREQ(viewname, srv->name)) {
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nr += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_scene_multiview_filepath_get(
|
|
|
|
SceneRenderView *srv, const char *filepath,
|
|
|
|
char *r_filepath)
|
|
|
|
{
|
|
|
|
BLI_strncpy(r_filepath, filepath, FILE_MAX);
|
|
|
|
BLI_path_suffix(r_filepath, FILE_MAX, srv->suffix, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When multiview is not used the filepath is as usual (e.g., ``Image.jpg``).
|
|
|
|
* When multiview is on, even if only one view is enabled the view is incorporated
|
|
|
|
* into the file name (e.g., ``Image_L.jpg``). That allows for the user to re-render
|
|
|
|
* individual views.
|
|
|
|
*/
|
|
|
|
void BKE_scene_multiview_view_filepath_get(
|
|
|
|
const RenderData *rd, const char *filepath, const char *viewname,
|
|
|
|
char *r_filepath)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
char suffix[FILE_MAX];
|
|
|
|
|
|
|
|
srv = BLI_findstring(&rd->views, viewname, offsetof(SceneRenderView, name));
|
|
|
|
if (srv)
|
|
|
|
BLI_strncpy(suffix, srv->suffix, sizeof(suffix));
|
|
|
|
else
|
|
|
|
BLI_strncpy(suffix, viewname, sizeof(suffix));
|
|
|
|
|
|
|
|
BLI_strncpy(r_filepath, filepath, FILE_MAX);
|
|
|
|
BLI_path_suffix(r_filepath, FILE_MAX, suffix, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *BKE_scene_multiview_view_suffix_get(const RenderData *rd, const char *viewname)
|
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
|
|
if ((viewname == NULL) || (viewname[0] == '\0'))
|
|
|
|
return viewname;
|
|
|
|
|
|
|
|
srv = BLI_findstring(&rd->views, viewname, offsetof(SceneRenderView, name));
|
|
|
|
if (srv)
|
|
|
|
return srv->suffix;
|
|
|
|
else
|
|
|
|
return viewname;
|
|
|
|
}
|
|
|
|
|
2015-10-24 01:01:10 +11:00
|
|
|
const char *BKE_scene_multiview_view_id_suffix_get(const RenderData *rd, const int view_id)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
const char *viewname = BKE_scene_multiview_render_view_name_get(rd, view_id);
|
|
|
|
return BKE_scene_multiview_view_suffix_get(rd, viewname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-27 11:00:47 +02:00
|
|
|
void BKE_scene_multiview_view_prefix_get(Scene *scene, const char *name, char *rprefix, const char **rext)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
SceneRenderView *srv;
|
|
|
|
size_t index_act;
|
2015-06-27 11:00:47 +02:00
|
|
|
const char *suf_act;
|
2015-04-06 10:40:12 -03:00
|
|
|
const char delims[] = {'.', '\0'};
|
|
|
|
|
|
|
|
rprefix[0] = '\0';
|
|
|
|
|
|
|
|
/* begin of extension */
|
|
|
|
index_act = BLI_str_rpartition(name, delims, rext, &suf_act);
|
2016-02-20 17:43:31 +01:00
|
|
|
if (*rext == NULL)
|
|
|
|
return;
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_assert(index_act > 0);
|
2015-06-21 12:30:11 +10:00
|
|
|
UNUSED_VARS_NDEBUG(index_act);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
for (srv = scene->r.views.first; srv; srv = srv->next) {
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(&scene->r, srv)) {
|
|
|
|
size_t len = strlen(srv->suffix);
|
2016-02-20 17:43:31 +01:00
|
|
|
if (strlen(*rext) >= len && STREQLEN(*rext - len, srv->suffix, len)) {
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_strncpy(rprefix, name, strlen(name) - strlen(*rext) - len + 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_scene_multiview_videos_dimensions_get(
|
|
|
|
const RenderData *rd, const size_t width, const size_t height,
|
|
|
|
size_t *r_width, size_t *r_height)
|
|
|
|
{
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) &&
|
|
|
|
rd->im_format.views_format == R_IMF_VIEWS_STEREO_3D)
|
|
|
|
{
|
|
|
|
IMB_stereo3d_write_dimensions(
|
|
|
|
rd->im_format.stereo3d_format.display_mode,
|
|
|
|
(rd->im_format.stereo3d_format.flag & S3D_SQUEEZED_FRAME) != 0,
|
|
|
|
width, height,
|
|
|
|
r_width, r_height);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*r_width = width;
|
|
|
|
*r_height = height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-24 01:01:10 +11:00
|
|
|
int BKE_scene_multiview_num_videos_get(const RenderData *rd)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
if (BKE_imtype_is_movie(rd->im_format.imtype) == false)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (rd->im_format.views_format == R_IMF_VIEWS_STEREO_3D) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* R_IMF_VIEWS_INDIVIDUAL */
|
|
|
|
return BKE_scene_multiview_num_views_get(rd);
|
|
|
|
}
|
|
|
|
}
|