2011-10-10 09:38:02 +00:00
|
|
|
/*
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
2011-02-27 20:40:57 +00:00
|
|
|
*/
|
|
|
|
|
|
2020-11-06 14:49:15 +01:00
|
|
|
/* Allow using deprecated functionality for .blend file I/O. */
|
|
|
|
|
#define DNA_DEPRECATED_ALLOW
|
|
|
|
|
|
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"
|
2018-08-29 15:32:50 +02:00
|
|
|
#include "DNA_collection_types.h"
|
2019-11-20 16:12:32 -05:00
|
|
|
#include "DNA_curveprofile_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_defaults.h"
|
|
|
|
|
#include "DNA_gpencil_types.h"
|
2013-09-05 15:47:52 +00:00
|
|
|
#include "DNA_linestyle_types.h"
|
2020-05-21 19:29:55 +02:00
|
|
|
#include "DNA_mask_types.h"
|
2020-12-15 10:47:58 +11:00
|
|
|
#include "DNA_material_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"
|
2019-06-04 16:52:48 +02:00
|
|
|
#include "DNA_sound_types.h"
|
2014-02-06 10:10:59 +01:00
|
|
|
#include "DNA_space_types.h"
|
2020-05-21 19:29:55 +02:00
|
|
|
#include "DNA_text_types.h"
|
2020-12-15 10:47:58 +11:00
|
|
|
#include "DNA_vfont_types.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
|
#include "DNA_windowmanager_types.h"
|
2017-10-16 17:15:03 -02:00
|
|
|
#include "DNA_workspace_types.h"
|
2019-09-07 23:17:40 +10:00
|
|
|
#include "DNA_world_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-09-05 15:52:38 +02:00
|
|
|
#include "BKE_callbacks.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_math.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-12-26 17:24:42 +06:00
|
|
|
#include "BLI_task.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_threads.h"
|
|
|
|
|
#include "BLI_utildefines.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
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_action.h"
|
2020-04-03 13:07:36 +02:00
|
|
|
#include "BKE_anim_data.h"
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "BKE_animsys.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"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_curveprofile.h"
|
2020-04-03 11:35:04 +02:00
|
|
|
#include "BKE_duplilist.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "BKE_editmesh.h"
|
2020-11-06 14:57:36 +01:00
|
|
|
#include "BKE_effect.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"
|
2014-11-22 18:04:08 +13:00
|
|
|
#include "BKE_gpencil.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"
|
2020-03-06 11:10:10 +01:00
|
|
|
#include "BKE_idtype.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"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_id.h"
|
2020-05-21 19:29:55 +02:00
|
|
|
#include "BKE_lib_query.h"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_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"
|
2020-11-06 14:49:15 +01:00
|
|
|
#include "BKE_pointcache.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"
|
2010-02-07 23:41:17 +00:00
|
|
|
#include "BKE_sound.h"
|
2014-08-26 20:52:07 +10:00
|
|
|
#include "BKE_unit.h"
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
#include "BKE_workspace.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"
|
2017-04-06 16:11:50 +02:00
|
|
|
#include "DEG_depsgraph_build.h"
|
2017-10-25 14:51:02 +02:00
|
|
|
#include "DEG_depsgraph_debug.h"
|
2017-04-06 16:11:50 +02:00
|
|
|
#include "DEG_depsgraph_query.h"
|
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
|
|
|
|
2018-07-10 15:02:25 +02:00
|
|
|
#include "RE_engine.h"
|
|
|
|
|
|
2020-12-19 06:44:57 +01:00
|
|
|
#include "SEQ_edit.h"
|
|
|
|
|
#include "SEQ_iterator.h"
|
|
|
|
|
#include "SEQ_modifier.h"
|
|
|
|
|
#include "SEQ_proxy.h"
|
|
|
|
|
#include "SEQ_relations.h"
|
2020-11-01 21:03:31 +01:00
|
|
|
#include "SEQ_sequencer.h"
|
2020-12-19 06:44:57 +01:00
|
|
|
#include "SEQ_sound.h"
|
2020-11-01 21:03:31 +01:00
|
|
|
|
2020-11-03 11:39:36 +01:00
|
|
|
#include "BLO_read_write.h"
|
|
|
|
|
|
2018-07-10 15:02:25 +02:00
|
|
|
#include "engines/eevee/eevee_lightcache.h"
|
2011-11-02 19:24:30 +00:00
|
|
|
|
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"
|
|
|
|
|
|
2020-03-06 11:10:10 +01:00
|
|
|
static void scene_init_data(ID *id)
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)id;
|
|
|
|
|
const char *colorspace_name;
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
CurveMapping *mblur_shutter_curve;
|
|
|
|
|
|
|
|
|
|
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(scene, id));
|
|
|
|
|
|
|
|
|
|
MEMCPY_STRUCT_AFTER(scene, DNA_struct_default_get(Scene), id);
|
|
|
|
|
|
|
|
|
|
BLI_strncpy(scene->r.bake.filepath, U.renderdir, sizeof(scene->r.bake.filepath));
|
|
|
|
|
|
|
|
|
|
mblur_shutter_curve = &scene->r.mblur_shutter_curve;
|
|
|
|
|
BKE_curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f);
|
2020-08-01 13:02:21 +10:00
|
|
|
BKE_curvemapping_init(mblur_shutter_curve);
|
2020-03-06 11:10:10 +01:00
|
|
|
BKE_curvemap_reset(mblur_shutter_curve->cm,
|
|
|
|
|
&mblur_shutter_curve->clipr,
|
|
|
|
|
CURVE_PRESET_MAX,
|
|
|
|
|
CURVEMAP_SLOPE_POS_NEG);
|
|
|
|
|
|
|
|
|
|
scene->toolsettings = DNA_struct_default_alloc(ToolSettings);
|
|
|
|
|
|
|
|
|
|
scene->toolsettings->autokey_mode = (uchar)U.autokey_mode;
|
|
|
|
|
|
|
|
|
|
/* grease pencil multiframe falloff curve */
|
|
|
|
|
scene->toolsettings->gp_sculpt.cur_falloff = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
|
CurveMapping *gp_falloff_curve = scene->toolsettings->gp_sculpt.cur_falloff;
|
2020-08-01 13:02:21 +10:00
|
|
|
BKE_curvemapping_init(gp_falloff_curve);
|
2020-03-06 11:10:10 +01:00
|
|
|
BKE_curvemap_reset(
|
|
|
|
|
gp_falloff_curve->cm, &gp_falloff_curve->clipr, CURVE_PRESET_GAUSS, CURVEMAP_SLOPE_POSITIVE);
|
|
|
|
|
|
|
|
|
|
scene->toolsettings->gp_sculpt.cur_primitive = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
|
CurveMapping *gp_primitive_curve = scene->toolsettings->gp_sculpt.cur_primitive;
|
2020-08-01 13:02:21 +10:00
|
|
|
BKE_curvemapping_init(gp_primitive_curve);
|
2020-03-06 11:10:10 +01:00
|
|
|
BKE_curvemap_reset(gp_primitive_curve->cm,
|
|
|
|
|
&gp_primitive_curve->clipr,
|
|
|
|
|
CURVE_PRESET_BELL,
|
|
|
|
|
CURVEMAP_SLOPE_POSITIVE);
|
|
|
|
|
|
|
|
|
|
scene->unit.system = USER_UNIT_METRIC;
|
|
|
|
|
scene->unit.scale_length = 1.0f;
|
2020-09-09 08:41:15 -05:00
|
|
|
scene->unit.length_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_LENGTH);
|
|
|
|
|
scene->unit.mass_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_MASS);
|
|
|
|
|
scene->unit.time_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_TIME);
|
|
|
|
|
scene->unit.temperature_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC,
|
|
|
|
|
B_UNIT_TEMPERATURE);
|
2020-03-06 11:10:10 +01:00
|
|
|
|
2020-05-29 13:57:40 -04:00
|
|
|
/* Anti-Aliasing threshold. */
|
2020-05-12 17:47:48 +02:00
|
|
|
scene->grease_pencil_settings.smaa_threshold = 1.0f;
|
|
|
|
|
|
2020-03-06 11:10:10 +01:00
|
|
|
{
|
|
|
|
|
ParticleEditSettings *pset;
|
|
|
|
|
pset = &scene->toolsettings->particle;
|
|
|
|
|
for (size_t i = 1; i < ARRAY_SIZE(pset->brush); i++) {
|
|
|
|
|
pset->brush[i] = pset->brush[0];
|
|
|
|
|
}
|
|
|
|
|
pset->brush[PE_BRUSH_CUT].strength = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
|
|
|
|
|
|
|
|
|
|
BLI_strncpy(scene->r.pic, U.renderdir, sizeof(scene->r.pic));
|
|
|
|
|
|
|
|
|
|
/* Note; in header_info.c the scene copy happens...,
|
|
|
|
|
* if you add more to renderdata it has to be checked there. */
|
|
|
|
|
|
|
|
|
|
/* multiview - stereo */
|
|
|
|
|
BKE_scene_add_render_view(scene, STEREO_LEFT_NAME);
|
|
|
|
|
srv = scene->r.views.first;
|
|
|
|
|
BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
|
|
|
|
|
|
|
|
|
|
BKE_scene_add_render_view(scene, STEREO_RIGHT_NAME);
|
|
|
|
|
srv = scene->r.views.last;
|
|
|
|
|
BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
|
|
|
|
|
|
|
|
|
|
BKE_sound_reset_scene_runtime(scene);
|
|
|
|
|
|
|
|
|
|
/* color management */
|
|
|
|
|
colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER);
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_display_settings_init(&scene->display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_init_render(
|
|
|
|
|
&scene->view_settings, &scene->display_settings, "Filmic");
|
|
|
|
|
BLI_strncpy(scene->sequencer_colorspace_settings.name,
|
|
|
|
|
colorspace_name,
|
|
|
|
|
sizeof(scene->sequencer_colorspace_settings.name));
|
|
|
|
|
|
|
|
|
|
/* Those next two sets (render and baking settings) are not currently in use,
|
|
|
|
|
* but are exposed to RNA API and hence must have valid data. */
|
|
|
|
|
BKE_color_managed_display_settings_init(&scene->r.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_init_render(
|
|
|
|
|
&scene->r.im_format.view_settings, &scene->r.im_format.display_settings, "Filmic");
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_display_settings_init(&scene->r.bake.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_init_render(
|
|
|
|
|
&scene->r.bake.im_format.view_settings, &scene->r.bake.im_format.display_settings, "Filmic");
|
|
|
|
|
|
|
|
|
|
/* Curve Profile */
|
|
|
|
|
scene->toolsettings->custom_bevel_profile_preset = BKE_curveprofile_add(PROF_PRESET_LINE);
|
2020-12-16 20:34:26 +01:00
|
|
|
scene->toolsettings->sequencer_tool_settings = SEQ_tool_settings_init();
|
2020-03-06 11:10:10 +01:00
|
|
|
|
|
|
|
|
for (size_t i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
|
|
|
|
|
scene->orientation_slots[i].index_custom = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Master Collection */
|
|
|
|
|
scene->master_collection = BKE_collection_master_add();
|
|
|
|
|
|
2020-03-26 19:33:27 +01:00
|
|
|
BKE_view_layer_add(scene, "View Layer", NULL, VIEWLAYER_ADD_NEW);
|
2020-03-06 11:10:10 +01:00
|
|
|
}
|
|
|
|
|
|
2020-09-18 16:57:33 +02:00
|
|
|
static void scene_copy_markers(Scene *scene_dst, const Scene *scene_src, const int flag)
|
|
|
|
|
{
|
|
|
|
|
BLI_duplicatelist(&scene_dst->markers, &scene_src->markers);
|
|
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &scene_dst->markers) {
|
|
|
|
|
if (marker->prop != NULL) {
|
|
|
|
|
marker->prop = IDP_CopyProperty_ex(marker->prop, flag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 11:10:10 +01:00
|
|
|
static void scene_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
|
|
|
|
|
{
|
|
|
|
|
Scene *scene_dst = (Scene *)id_dst;
|
|
|
|
|
const Scene *scene_src = (const Scene *)id_src;
|
|
|
|
|
/* We never handle usercount here for own data. */
|
|
|
|
|
const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
|
|
|
|
|
/* We always need allocation of our private ID data. */
|
|
|
|
|
const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE;
|
|
|
|
|
|
|
|
|
|
scene_dst->ed = NULL;
|
|
|
|
|
scene_dst->depsgraph_hash = NULL;
|
|
|
|
|
scene_dst->fps_info = NULL;
|
|
|
|
|
|
|
|
|
|
/* Master Collection */
|
|
|
|
|
if (scene_src->master_collection) {
|
|
|
|
|
BKE_id_copy_ex(bmain,
|
|
|
|
|
(ID *)scene_src->master_collection,
|
|
|
|
|
(ID **)&scene_dst->master_collection,
|
|
|
|
|
flag_private_id_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* View Layers */
|
|
|
|
|
BLI_duplicatelist(&scene_dst->view_layers, &scene_src->view_layers);
|
|
|
|
|
for (ViewLayer *view_layer_src = scene_src->view_layers.first,
|
|
|
|
|
*view_layer_dst = scene_dst->view_layers.first;
|
|
|
|
|
view_layer_src;
|
|
|
|
|
view_layer_src = view_layer_src->next, view_layer_dst = view_layer_dst->next) {
|
|
|
|
|
BKE_view_layer_copy_data(scene_dst, scene_src, view_layer_dst, view_layer_src, flag_subdata);
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-18 16:57:33 +02:00
|
|
|
scene_copy_markers(scene_dst, scene_src, flag);
|
|
|
|
|
|
2020-03-06 11:10:10 +01:00
|
|
|
BLI_duplicatelist(&(scene_dst->transform_spaces), &(scene_src->transform_spaces));
|
|
|
|
|
BLI_duplicatelist(&(scene_dst->r.views), &(scene_src->r.views));
|
|
|
|
|
BKE_keyingsets_copy(&(scene_dst->keyingsets), &(scene_src->keyingsets));
|
|
|
|
|
|
|
|
|
|
if (scene_src->nodetree) {
|
|
|
|
|
BKE_id_copy_ex(
|
|
|
|
|
bmain, (ID *)scene_src->nodetree, (ID **)&scene_dst->nodetree, flag_private_id_data);
|
|
|
|
|
BKE_libblock_relink_ex(bmain,
|
|
|
|
|
scene_dst->nodetree,
|
|
|
|
|
(void *)(&scene_src->id),
|
|
|
|
|
&scene_dst->id,
|
|
|
|
|
ID_REMAP_SKIP_NEVER_NULL_USAGE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene_src->rigidbody_world) {
|
|
|
|
|
scene_dst->rigidbody_world = BKE_rigidbody_world_copy(scene_src->rigidbody_world,
|
|
|
|
|
flag_subdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* copy color management settings */
|
|
|
|
|
BKE_color_managed_display_settings_copy(&scene_dst->display_settings,
|
|
|
|
|
&scene_src->display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&scene_dst->view_settings, &scene_src->view_settings);
|
|
|
|
|
BKE_color_managed_colorspace_settings_copy(&scene_dst->sequencer_colorspace_settings,
|
|
|
|
|
&scene_src->sequencer_colorspace_settings);
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_display_settings_copy(&scene_dst->r.im_format.display_settings,
|
|
|
|
|
&scene_src->r.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&scene_dst->r.im_format.view_settings,
|
|
|
|
|
&scene_src->r.im_format.view_settings);
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_display_settings_copy(&scene_dst->r.bake.im_format.display_settings,
|
|
|
|
|
&scene_src->r.bake.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&scene_dst->r.bake.im_format.view_settings,
|
|
|
|
|
&scene_src->r.bake.im_format.view_settings);
|
|
|
|
|
|
|
|
|
|
BKE_curvemapping_copy_data(&scene_dst->r.mblur_shutter_curve, &scene_src->r.mblur_shutter_curve);
|
|
|
|
|
|
|
|
|
|
/* tool settings */
|
|
|
|
|
scene_dst->toolsettings = BKE_toolsettings_copy(scene_dst->toolsettings, flag_subdata);
|
|
|
|
|
|
|
|
|
|
/* make a private copy of the avicodecdata */
|
|
|
|
|
if (scene_src->r.avicodecdata) {
|
|
|
|
|
scene_dst->r.avicodecdata = MEM_dupallocN(scene_src->r.avicodecdata);
|
|
|
|
|
scene_dst->r.avicodecdata->lpFormat = MEM_dupallocN(scene_dst->r.avicodecdata->lpFormat);
|
|
|
|
|
scene_dst->r.avicodecdata->lpParms = MEM_dupallocN(scene_dst->r.avicodecdata->lpParms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene_src->r.ffcodecdata.properties) {
|
|
|
|
|
/* intentionally check sce_dst not sce_src. */ /* XXX ??? comment outdated... */
|
|
|
|
|
scene_dst->r.ffcodecdata.properties = IDP_CopyProperty_ex(scene_src->r.ffcodecdata.properties,
|
|
|
|
|
flag_subdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene_src->display.shading.prop) {
|
|
|
|
|
scene_dst->display.shading.prop = IDP_CopyProperty(scene_src->display.shading.prop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_sound_reset_scene_runtime(scene_dst);
|
|
|
|
|
|
|
|
|
|
/* Copy sequencer, this is local data! */
|
|
|
|
|
if (scene_src->ed) {
|
|
|
|
|
scene_dst->ed = MEM_callocN(sizeof(*scene_dst->ed), __func__);
|
|
|
|
|
scene_dst->ed->seqbasep = &scene_dst->ed->seqbase;
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_sequence_base_dupli_recursive(scene_src,
|
2020-03-06 11:10:10 +01:00
|
|
|
scene_dst,
|
|
|
|
|
&scene_dst->ed->seqbase,
|
|
|
|
|
&scene_src->ed->seqbase,
|
|
|
|
|
SEQ_DUPE_ALL,
|
|
|
|
|
flag_subdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
|
|
|
|
|
BKE_previewimg_id_copy(&scene_dst->id, &scene_src->id);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
scene_dst->preview = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_scene_copy_data_eevee(scene_dst, scene_src);
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-18 16:57:33 +02:00
|
|
|
static void scene_free_markers(Scene *scene, bool do_id_user)
|
|
|
|
|
{
|
|
|
|
|
LISTBASE_FOREACH_MUTABLE (TimeMarker *, marker, &scene->markers) {
|
|
|
|
|
if (marker->prop != NULL) {
|
|
|
|
|
IDP_FreePropertyContent_ex(marker->prop, do_id_user);
|
|
|
|
|
MEM_freeN(marker->prop);
|
|
|
|
|
}
|
|
|
|
|
MEM_freeN(marker);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 11:10:10 +01:00
|
|
|
static void scene_free_data(ID *id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Scene *scene = (Scene *)id;
|
|
|
|
|
const bool do_id_user = false;
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_editing_free(scene, do_id_user);
|
2020-03-06 11:10:10 +01:00
|
|
|
|
|
|
|
|
BKE_keyingsets_free(&scene->keyingsets);
|
|
|
|
|
|
|
|
|
|
/* is no lib link block, but scene extension */
|
|
|
|
|
if (scene->nodetree) {
|
2020-04-20 16:14:45 +02:00
|
|
|
ntreeFreeEmbeddedTree(scene->nodetree);
|
2020-03-06 11:10:10 +01:00
|
|
|
MEM_freeN(scene->nodetree);
|
|
|
|
|
scene->nodetree = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene->rigidbody_world) {
|
2020-05-12 16:10:21 +02:00
|
|
|
/* Prevent rigidbody freeing code to follow other IDs pointers, this should never be allowed
|
|
|
|
|
* nor necessary from here, and with new undo code, those pointers may be fully invalid or
|
|
|
|
|
* worse, pointing to data actually belonging to new BMain! */
|
|
|
|
|
scene->rigidbody_world->constraints = NULL;
|
|
|
|
|
scene->rigidbody_world->group = NULL;
|
2020-03-06 11:10:10 +01:00
|
|
|
BKE_rigidbody_free_world(scene);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene->r.avicodecdata) {
|
|
|
|
|
free_avicodecdata(scene->r.avicodecdata);
|
|
|
|
|
MEM_freeN(scene->r.avicodecdata);
|
|
|
|
|
scene->r.avicodecdata = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (scene->r.ffcodecdata.properties) {
|
|
|
|
|
IDP_FreeProperty(scene->r.ffcodecdata.properties);
|
|
|
|
|
scene->r.ffcodecdata.properties = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-18 16:57:33 +02:00
|
|
|
scene_free_markers(scene, do_id_user);
|
2020-03-06 11:10:10 +01:00
|
|
|
BLI_freelistN(&scene->transform_spaces);
|
|
|
|
|
BLI_freelistN(&scene->r.views);
|
|
|
|
|
|
|
|
|
|
BKE_toolsettings_free(scene->toolsettings);
|
|
|
|
|
scene->toolsettings = NULL;
|
|
|
|
|
|
|
|
|
|
BKE_scene_free_depsgraph_hash(scene);
|
|
|
|
|
|
|
|
|
|
MEM_SAFE_FREE(scene->fps_info);
|
|
|
|
|
|
|
|
|
|
BKE_sound_destroy_scene(scene);
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_view_settings_free(&scene->view_settings);
|
|
|
|
|
|
|
|
|
|
BKE_previewimg_free(&scene->preview);
|
|
|
|
|
BKE_curvemapping_free_data(&scene->r.mblur_shutter_curve);
|
|
|
|
|
|
|
|
|
|
for (ViewLayer *view_layer = scene->view_layers.first, *view_layer_next; view_layer;
|
|
|
|
|
view_layer = view_layer_next) {
|
|
|
|
|
view_layer_next = view_layer->next;
|
|
|
|
|
|
|
|
|
|
BLI_remlink(&scene->view_layers, view_layer);
|
|
|
|
|
BKE_view_layer_free_ex(view_layer, do_id_user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Master Collection */
|
|
|
|
|
/* TODO: what to do with do_id_user? it's also true when just
|
|
|
|
|
* closing the file which seems wrong? should decrement users
|
|
|
|
|
* for objects directly in the master collection? then other
|
|
|
|
|
* collections in the scene need to do it too? */
|
|
|
|
|
if (scene->master_collection) {
|
|
|
|
|
BKE_collection_free(scene->master_collection);
|
|
|
|
|
MEM_freeN(scene->master_collection);
|
|
|
|
|
scene->master_collection = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-11 17:12:01 +01:00
|
|
|
if (scene->eevee.light_cache_data) {
|
|
|
|
|
EEVEE_lightcache_free(scene->eevee.light_cache_data);
|
|
|
|
|
scene->eevee.light_cache_data = NULL;
|
2020-03-06 11:10:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene->display.shading.prop) {
|
|
|
|
|
IDP_FreeProperty(scene->display.shading.prop);
|
|
|
|
|
scene->display.shading.prop = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* These are freed on doversion. */
|
|
|
|
|
BLI_assert(scene->layer_properties == NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-21 10:23:48 +02:00
|
|
|
static void scene_foreach_rigidbodyworldSceneLooper(struct RigidBodyWorld *UNUSED(rbw),
|
|
|
|
|
ID **id_pointer,
|
|
|
|
|
void *user_data,
|
|
|
|
|
int cb_flag)
|
2020-05-21 19:29:55 +02:00
|
|
|
{
|
|
|
|
|
LibraryForeachIDData *data = (LibraryForeachIDData *)user_data;
|
|
|
|
|
BKE_lib_query_foreachid_process(data, id_pointer, cb_flag);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 23:59:24 +11:00
|
|
|
/**
|
|
|
|
|
* This code is shared by both the regular `foreach_id` looper, and the code trying to restore or
|
2021-02-09 20:30:54 +11:00
|
|
|
* preserve ID pointers like brushes across undo-steps.
|
2020-11-03 23:59:24 +11:00
|
|
|
*/
|
2020-11-03 12:09:00 +01:00
|
|
|
typedef enum eSceneForeachUndoPreserveProcess {
|
2020-11-03 23:59:24 +11:00
|
|
|
/* Undo when preserving tool-settings from old scene, we also want to try to preserve that ID
|
2020-11-03 12:09:00 +01:00
|
|
|
* pointer from its old scene's value. */
|
|
|
|
|
SCENE_FOREACH_UNDO_RESTORE,
|
2020-11-03 23:59:24 +11:00
|
|
|
/* Undo when preserving tool-settings from old scene, we want to keep the new value of that ID
|
2020-11-03 12:09:00 +01:00
|
|
|
* pointer. */
|
|
|
|
|
SCENE_FOREACH_UNDO_NO_RESTORE,
|
|
|
|
|
} eSceneForeachUndoPreserveProcess;
|
|
|
|
|
|
|
|
|
|
static void scene_foreach_toolsettings_id_pointer_process(
|
|
|
|
|
ID **id_p,
|
|
|
|
|
const eSceneForeachUndoPreserveProcess action,
|
|
|
|
|
BlendLibReader *reader,
|
|
|
|
|
ID **id_old_p,
|
|
|
|
|
const uint cb_flag)
|
2020-05-21 19:29:55 +02:00
|
|
|
{
|
2020-11-03 12:09:00 +01:00
|
|
|
switch (action) {
|
|
|
|
|
case SCENE_FOREACH_UNDO_RESTORE: {
|
|
|
|
|
ID *id_old = *id_old_p;
|
|
|
|
|
/* Old data has not been remapped to new values of the pointers, if we want to keep the old
|
|
|
|
|
* pointer here we need its new address. */
|
|
|
|
|
ID *id_old_new = id_old != NULL ? BLO_read_get_new_id_address(reader, id_old->lib, id_old) :
|
|
|
|
|
NULL;
|
|
|
|
|
if (id_old_new != NULL) {
|
|
|
|
|
BLI_assert(ELEM(id_old, id_old_new, id_old_new->orig_id));
|
|
|
|
|
*id_old_p = id_old_new;
|
|
|
|
|
if (cb_flag & IDWALK_CB_USER) {
|
|
|
|
|
id_us_plus_no_lib(id_old_new);
|
|
|
|
|
id_us_min(id_old);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* We failed to find a new valid pointer for the previous ID, just keep the current one as
|
|
|
|
|
* if we had been under SCENE_FOREACH_UNDO_NO_RESTORE case. */
|
|
|
|
|
SWAP(ID *, *id_p, *id_old_p);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case SCENE_FOREACH_UNDO_NO_RESTORE:
|
|
|
|
|
/* Counteract the swap of the whole ToolSettings container struct. */
|
|
|
|
|
SWAP(ID *, *id_p, *id_old_p);
|
|
|
|
|
break;
|
2020-05-21 19:29:55 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 12:09:00 +01:00
|
|
|
#define BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS( \
|
|
|
|
|
__data, __id, __do_undo_restore, __action, __reader, __id_old, __cb_flag) \
|
|
|
|
|
{ \
|
|
|
|
|
if (__do_undo_restore) { \
|
|
|
|
|
scene_foreach_toolsettings_id_pointer_process( \
|
|
|
|
|
(ID **)&(__id), __action, __reader, (ID **)&(__id_old), __cb_flag); \
|
|
|
|
|
} \
|
|
|
|
|
else { \
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(__data, __id, __cb_flag); \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
(void)0
|
|
|
|
|
|
|
|
|
|
static void scene_foreach_paint(LibraryForeachIDData *data,
|
|
|
|
|
Paint *paint,
|
|
|
|
|
const bool do_undo_restore,
|
|
|
|
|
BlendLibReader *reader,
|
|
|
|
|
Paint *paint_old)
|
2020-10-21 11:38:32 +02:00
|
|
|
{
|
2020-11-03 12:09:00 +01:00
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
paint->brush,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
paint_old->brush,
|
|
|
|
|
IDWALK_CB_USER);
|
|
|
|
|
for (int i = 0; i < paint_old->tool_slots_len; i++) {
|
|
|
|
|
/* This is a bit tricky.
|
|
|
|
|
* - In case we do not do `undo_restore`, `paint` and `paint_old` pointers are the same, so
|
|
|
|
|
* this is equivalent to simply looping over slots from `paint`.
|
|
|
|
|
* - In case we do `undo_restore`, we only want to consider the slots from the old one, since
|
|
|
|
|
* those are the one we keep in the end.
|
|
|
|
|
* + In case the new data has less valid slots, we feed in a dummy NULL pointer.
|
|
|
|
|
* + In case the new data has more valid slots, the extra ones are ignored.
|
|
|
|
|
*/
|
|
|
|
|
Brush *brush_tmp = NULL;
|
|
|
|
|
Brush **brush_p = i < paint->tool_slots_len ? &paint->tool_slots[i].brush : &brush_tmp;
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
*brush_p,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
paint_old->brush,
|
|
|
|
|
IDWALK_CB_USER);
|
|
|
|
|
}
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
paint->palette,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
paint_old->palette,
|
|
|
|
|
IDWALK_CB_USER);
|
|
|
|
|
}
|
2020-10-21 11:38:32 +02:00
|
|
|
|
2020-11-03 12:09:00 +01:00
|
|
|
static void scene_foreach_toolsettings(LibraryForeachIDData *data,
|
|
|
|
|
ToolSettings *toolsett,
|
|
|
|
|
const bool do_undo_restore,
|
|
|
|
|
BlendLibReader *reader,
|
|
|
|
|
ToolSettings *toolsett_old)
|
|
|
|
|
{
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->particle.scene,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_NO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->particle.scene,
|
|
|
|
|
IDWALK_CB_NOP);
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->particle.object,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_NO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->particle.object,
|
|
|
|
|
IDWALK_CB_NOP);
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->particle.shape_object,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_NO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->particle.shape_object,
|
|
|
|
|
IDWALK_CB_NOP);
|
|
|
|
|
|
|
|
|
|
scene_foreach_paint(
|
|
|
|
|
data, &toolsett->imapaint.paint, do_undo_restore, reader, &toolsett_old->imapaint.paint);
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->imapaint.stencil,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->imapaint.stencil,
|
|
|
|
|
IDWALK_CB_USER);
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->imapaint.clone,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->imapaint.clone,
|
|
|
|
|
IDWALK_CB_USER);
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->imapaint.canvas,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->imapaint.canvas,
|
|
|
|
|
IDWALK_CB_USER);
|
2020-10-21 11:38:32 +02:00
|
|
|
|
|
|
|
|
if (toolsett->vpaint) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(
|
|
|
|
|
data, &toolsett->vpaint->paint, do_undo_restore, reader, &toolsett_old->vpaint->paint);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
if (toolsett->wpaint) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(
|
|
|
|
|
data, &toolsett->wpaint->paint, do_undo_restore, reader, &toolsett_old->wpaint->paint);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
if (toolsett->sculpt) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(
|
|
|
|
|
data, &toolsett->sculpt->paint, do_undo_restore, reader, &toolsett_old->sculpt->paint);
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->sculpt->gravity_object,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_NO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->sculpt->gravity_object,
|
|
|
|
|
IDWALK_CB_NOP);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
if (toolsett->uvsculpt) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(
|
|
|
|
|
data, &toolsett->uvsculpt->paint, do_undo_restore, reader, &toolsett_old->uvsculpt->paint);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
if (toolsett->gp_paint) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(
|
|
|
|
|
data, &toolsett->gp_paint->paint, do_undo_restore, reader, &toolsett_old->gp_paint->paint);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
if (toolsett->gp_vertexpaint) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(data,
|
|
|
|
|
&toolsett->gp_vertexpaint->paint,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
reader,
|
|
|
|
|
&toolsett_old->gp_vertexpaint->paint);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
if (toolsett->gp_sculptpaint) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(data,
|
|
|
|
|
&toolsett->gp_sculptpaint->paint,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
reader,
|
|
|
|
|
&toolsett_old->gp_sculptpaint->paint);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
if (toolsett->gp_weightpaint) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_paint(data,
|
|
|
|
|
&toolsett->gp_weightpaint->paint,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
reader,
|
|
|
|
|
&toolsett_old->gp_weightpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
|
|
|
|
|
toolsett->gp_sculpt.guide.reference_object,
|
|
|
|
|
do_undo_restore,
|
|
|
|
|
SCENE_FOREACH_UNDO_NO_RESTORE,
|
|
|
|
|
reader,
|
|
|
|
|
toolsett_old->gp_sculpt.guide.reference_object,
|
|
|
|
|
IDWALK_CB_NOP);
|
2020-10-21 11:38:32 +02:00
|
|
|
}
|
|
|
|
|
|
2020-10-21 10:23:48 +02:00
|
|
|
static void scene_foreach_layer_collection(LibraryForeachIDData *data, ListBase *lb)
|
2020-05-21 19:29:55 +02:00
|
|
|
{
|
|
|
|
|
LISTBASE_FOREACH (LayerCollection *, lc, lb) {
|
|
|
|
|
/* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
|
|
|
|
|
* anyway... */
|
|
|
|
|
const int cb_flag = (lc->collection != NULL &&
|
|
|
|
|
(lc->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
|
|
|
|
|
IDWALK_CB_EMBEDDED :
|
|
|
|
|
IDWALK_CB_NOP;
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, lc->collection, cb_flag);
|
2020-10-21 10:23:48 +02:00
|
|
|
scene_foreach_layer_collection(data, &lc->layer_collections);
|
2020-05-21 19:29:55 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_foreach_id(ID *id, LibraryForeachIDData *data)
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)id;
|
|
|
|
|
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, scene->camera, IDWALK_CB_NOP);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, scene->world, IDWALK_CB_USER);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, scene->set, IDWALK_CB_NEVER_SELF);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, scene->clip, IDWALK_CB_USER);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, scene->gpd, IDWALK_CB_USER);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, scene->r.bake.cage_object, IDWALK_CB_NOP);
|
|
|
|
|
if (scene->nodetree) {
|
|
|
|
|
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
|
|
|
|
BKE_library_foreach_ID_embedded(data, (ID **)&scene->nodetree);
|
|
|
|
|
}
|
|
|
|
|
if (scene->ed) {
|
|
|
|
|
Sequence *seq;
|
2020-08-21 18:55:27 +02:00
|
|
|
SEQ_ALL_BEGIN (scene->ed, seq) {
|
2020-05-21 19:29:55 +02:00
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, seq->scene, IDWALK_CB_NEVER_SELF);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, seq->scene_camera, IDWALK_CB_NOP);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, seq->clip, IDWALK_CB_USER);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, seq->mask, IDWALK_CB_USER);
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, seq->sound, IDWALK_CB_USER);
|
|
|
|
|
IDP_foreach_property(
|
|
|
|
|
seq->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data);
|
|
|
|
|
LISTBASE_FOREACH (SequenceModifierData *, smd, &seq->modifiers) {
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, smd->mask_id, IDWALK_CB_USER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
|
|
|
|
|
TextVars *text_data = seq->effectdata;
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, text_data->text_font, IDWALK_CB_USER);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-21 18:55:27 +02:00
|
|
|
SEQ_ALL_END;
|
2020-05-21 19:29:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This pointer can be NULL during old files reading, better be safe than sorry. */
|
|
|
|
|
if (scene->master_collection != NULL) {
|
|
|
|
|
BKE_library_foreach_ID_embedded(data, (ID **)&scene->master_collection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, view_layer->mat_override, IDWALK_CB_USER);
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
|
2021-05-05 16:39:53 +02:00
|
|
|
BKE_LIB_FOREACHID_PROCESS(
|
|
|
|
|
data, base->object, IDWALK_CB_NOP | IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE);
|
2020-05-21 19:29:55 +02:00
|
|
|
}
|
|
|
|
|
|
2020-10-21 10:23:48 +02:00
|
|
|
scene_foreach_layer_collection(data, &view_layer->layer_collections);
|
2020-05-21 19:29:55 +02:00
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &view_layer->freestyle_config.modules) {
|
|
|
|
|
if (fmc->script) {
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, fmc->script, IDWALK_CB_NOP);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) {
|
|
|
|
|
if (fls->group) {
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, fls->group, IDWALK_CB_USER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fls->linestyle) {
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, fls->linestyle, IDWALK_CB_USER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) {
|
|
|
|
|
BKE_LIB_FOREACHID_PROCESS(data, marker->camera, IDWALK_CB_NOP);
|
2020-09-18 16:57:33 +02:00
|
|
|
IDP_foreach_property(
|
|
|
|
|
marker->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data);
|
2020-05-21 19:29:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ToolSettings *toolsett = scene->toolsettings;
|
|
|
|
|
if (toolsett) {
|
2020-11-03 12:09:00 +01:00
|
|
|
scene_foreach_toolsettings(data, toolsett, false, NULL, toolsett);
|
2020-05-21 19:29:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scene->rigidbody_world) {
|
|
|
|
|
BKE_rigidbody_world_id_loop(
|
2020-10-21 10:23:48 +02:00
|
|
|
scene->rigidbody_world, scene_foreach_rigidbodyworldSceneLooper, data);
|
2020-05-21 19:29:55 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-03 16:09:58 +02:00
|
|
|
static void scene_foreach_cache(ID *id,
|
|
|
|
|
IDTypeForeachCacheFunctionCallback function_callback,
|
|
|
|
|
void *user_data)
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)id;
|
|
|
|
|
IDCacheKey key = {
|
|
|
|
|
.id_session_uuid = id->session_uuid,
|
|
|
|
|
.offset_in_ID = offsetof(Scene, eevee.light_cache_data),
|
|
|
|
|
.cache_v = scene->eevee.light_cache_data,
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-06 15:07:12 +02:00
|
|
|
function_callback(id,
|
|
|
|
|
&key,
|
|
|
|
|
(void **)&scene->eevee.light_cache_data,
|
|
|
|
|
IDTYPE_CACHE_CB_FLAGS_PERSISTENT,
|
|
|
|
|
user_data);
|
2020-07-03 16:09:58 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-06 14:49:15 +01:00
|
|
|
static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_address)
|
|
|
|
|
{
|
|
|
|
|
Scene *sce = (Scene *)id;
|
|
|
|
|
|
|
|
|
|
if (BLO_write_is_undo(writer)) {
|
|
|
|
|
/* Clean up, important in undo case to reduce false detection of changed data-blocks. */
|
|
|
|
|
/* XXX This UI data should not be stored in Scene at all... */
|
|
|
|
|
memset(&sce->cursor, 0, sizeof(sce->cursor));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* write LibData */
|
|
|
|
|
BLO_write_id_struct(writer, Scene, id_address, &sce->id);
|
|
|
|
|
BKE_id_blend_write(writer, &sce->id);
|
|
|
|
|
|
|
|
|
|
if (sce->adt) {
|
|
|
|
|
BKE_animdata_blend_write(writer, sce->adt);
|
|
|
|
|
}
|
|
|
|
|
BKE_keyingsets_blend_write(writer, &sce->keyingsets);
|
|
|
|
|
|
|
|
|
|
/* direct data */
|
|
|
|
|
ToolSettings *tos = sce->toolsettings;
|
|
|
|
|
BLO_write_struct(writer, ToolSettings, tos);
|
|
|
|
|
if (tos->vpaint) {
|
|
|
|
|
BLO_write_struct(writer, VPaint, tos->vpaint);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->vpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (tos->wpaint) {
|
|
|
|
|
BLO_write_struct(writer, VPaint, tos->wpaint);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->wpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (tos->sculpt) {
|
|
|
|
|
BLO_write_struct(writer, Sculpt, tos->sculpt);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->sculpt->paint);
|
|
|
|
|
}
|
|
|
|
|
if (tos->uvsculpt) {
|
|
|
|
|
BLO_write_struct(writer, UvSculpt, tos->uvsculpt);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->uvsculpt->paint);
|
|
|
|
|
}
|
|
|
|
|
if (tos->gp_paint) {
|
|
|
|
|
BLO_write_struct(writer, GpPaint, tos->gp_paint);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->gp_paint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (tos->gp_vertexpaint) {
|
|
|
|
|
BLO_write_struct(writer, GpVertexPaint, tos->gp_vertexpaint);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->gp_vertexpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (tos->gp_sculptpaint) {
|
|
|
|
|
BLO_write_struct(writer, GpSculptPaint, tos->gp_sculptpaint);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->gp_sculptpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (tos->gp_weightpaint) {
|
|
|
|
|
BLO_write_struct(writer, GpWeightPaint, tos->gp_weightpaint);
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->gp_weightpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
/* write grease-pencil custom ipo curve to file */
|
|
|
|
|
if (tos->gp_interpolate.custom_ipo) {
|
|
|
|
|
BKE_curvemapping_blend_write(writer, tos->gp_interpolate.custom_ipo);
|
|
|
|
|
}
|
|
|
|
|
/* write grease-pencil multiframe falloff curve to file */
|
|
|
|
|
if (tos->gp_sculpt.cur_falloff) {
|
|
|
|
|
BKE_curvemapping_blend_write(writer, tos->gp_sculpt.cur_falloff);
|
|
|
|
|
}
|
|
|
|
|
/* write grease-pencil primitive curve to file */
|
|
|
|
|
if (tos->gp_sculpt.cur_primitive) {
|
|
|
|
|
BKE_curvemapping_blend_write(writer, tos->gp_sculpt.cur_primitive);
|
|
|
|
|
}
|
|
|
|
|
/* Write the curve profile to the file. */
|
|
|
|
|
if (tos->custom_bevel_profile_preset) {
|
|
|
|
|
BKE_curveprofile_blend_write(writer, tos->custom_bevel_profile_preset);
|
|
|
|
|
}
|
2020-12-16 20:34:26 +01:00
|
|
|
if (tos->sequencer_tool_settings) {
|
|
|
|
|
BLO_write_struct(writer, SequencerToolSettings, tos->sequencer_tool_settings);
|
|
|
|
|
}
|
2020-11-06 14:49:15 +01:00
|
|
|
|
|
|
|
|
BKE_paint_blend_write(writer, &tos->imapaint.paint);
|
|
|
|
|
|
|
|
|
|
Editing *ed = sce->ed;
|
|
|
|
|
if (ed) {
|
|
|
|
|
Sequence *seq;
|
|
|
|
|
|
|
|
|
|
BLO_write_struct(writer, Editing, ed);
|
|
|
|
|
|
|
|
|
|
/* reset write flags too */
|
|
|
|
|
|
|
|
|
|
SEQ_ALL_BEGIN (ed, seq) {
|
|
|
|
|
if (seq->strip) {
|
|
|
|
|
seq->strip->done = false;
|
|
|
|
|
}
|
|
|
|
|
BLO_write_struct(writer, Sequence, seq);
|
|
|
|
|
}
|
|
|
|
|
SEQ_ALL_END;
|
|
|
|
|
|
|
|
|
|
SEQ_ALL_BEGIN (ed, seq) {
|
|
|
|
|
if (seq->strip && seq->strip->done == 0) {
|
|
|
|
|
/* write strip with 'done' at 0 because readfile */
|
|
|
|
|
|
|
|
|
|
if (seq->effectdata) {
|
|
|
|
|
switch (seq->type) {
|
|
|
|
|
case SEQ_TYPE_COLOR:
|
|
|
|
|
BLO_write_struct(writer, SolidColorVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_SPEED:
|
|
|
|
|
BLO_write_struct(writer, SpeedControlVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_WIPE:
|
|
|
|
|
BLO_write_struct(writer, WipeVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_GLOW:
|
|
|
|
|
BLO_write_struct(writer, GlowVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_TRANSFORM:
|
|
|
|
|
BLO_write_struct(writer, TransformVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_GAUSSIAN_BLUR:
|
|
|
|
|
BLO_write_struct(writer, GaussianBlurVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_TEXT:
|
|
|
|
|
BLO_write_struct(writer, TextVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
case SEQ_TYPE_COLORMIX:
|
|
|
|
|
BLO_write_struct(writer, ColorMixVars, seq->effectdata);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_write_struct(writer, Stereo3dFormat, seq->stereo3d_format);
|
|
|
|
|
|
|
|
|
|
Strip *strip = seq->strip;
|
|
|
|
|
BLO_write_struct(writer, Strip, strip);
|
|
|
|
|
if (strip->crop) {
|
|
|
|
|
BLO_write_struct(writer, StripCrop, strip->crop);
|
|
|
|
|
}
|
|
|
|
|
if (strip->transform) {
|
|
|
|
|
BLO_write_struct(writer, StripTransform, strip->transform);
|
|
|
|
|
}
|
|
|
|
|
if (strip->proxy) {
|
|
|
|
|
BLO_write_struct(writer, StripProxy, strip->proxy);
|
|
|
|
|
}
|
|
|
|
|
if (seq->type == SEQ_TYPE_IMAGE) {
|
|
|
|
|
BLO_write_struct_array(writer,
|
|
|
|
|
StripElem,
|
|
|
|
|
MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem),
|
|
|
|
|
strip->stripdata);
|
|
|
|
|
}
|
|
|
|
|
else if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
|
|
|
|
|
BLO_write_struct(writer, StripElem, strip->stripdata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strip->done = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->prop) {
|
|
|
|
|
IDP_BlendWrite(writer, seq->prop);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_modifier_blend_write(writer, &seq->modifiers);
|
2020-11-06 14:49:15 +01:00
|
|
|
}
|
|
|
|
|
SEQ_ALL_END;
|
|
|
|
|
|
|
|
|
|
/* new; meta stack too, even when its nasty restore code */
|
|
|
|
|
LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) {
|
|
|
|
|
BLO_write_struct(writer, MetaStack, ms);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->r.avicodecdata) {
|
|
|
|
|
BLO_write_struct(writer, AviCodecData, sce->r.avicodecdata);
|
|
|
|
|
if (sce->r.avicodecdata->lpFormat) {
|
|
|
|
|
BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat);
|
|
|
|
|
}
|
|
|
|
|
if (sce->r.avicodecdata->lpParms) {
|
|
|
|
|
BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbParms, sce->r.avicodecdata->lpParms);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sce->r.ffcodecdata.properties) {
|
|
|
|
|
IDP_BlendWrite(writer, sce->r.ffcodecdata.properties);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* writing dynamic list of TimeMarkers to the blend file */
|
|
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
|
|
|
|
|
BLO_write_struct(writer, TimeMarker, marker);
|
|
|
|
|
|
|
|
|
|
if (marker->prop != NULL) {
|
|
|
|
|
IDP_BlendWrite(writer, marker->prop);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* writing dynamic list of TransformOrientations to the blend file */
|
|
|
|
|
LISTBASE_FOREACH (TransformOrientation *, ts, &sce->transform_spaces) {
|
|
|
|
|
BLO_write_struct(writer, TransformOrientation, ts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* writing MultiView to the blend file */
|
|
|
|
|
LISTBASE_FOREACH (SceneRenderView *, srv, &sce->r.views) {
|
|
|
|
|
BLO_write_struct(writer, SceneRenderView, srv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->nodetree) {
|
|
|
|
|
BLO_write_struct(writer, bNodeTree, sce->nodetree);
|
|
|
|
|
ntreeBlendWrite(writer, sce->nodetree);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_view_settings_blend_write(writer, &sce->view_settings);
|
|
|
|
|
|
|
|
|
|
/* writing RigidBodyWorld data to the blend file */
|
|
|
|
|
if (sce->rigidbody_world) {
|
|
|
|
|
/* Set deprecated pointers to prevent crashes of older Blenders */
|
|
|
|
|
sce->rigidbody_world->pointcache = sce->rigidbody_world->shared->pointcache;
|
|
|
|
|
sce->rigidbody_world->ptcaches = sce->rigidbody_world->shared->ptcaches;
|
|
|
|
|
BLO_write_struct(writer, RigidBodyWorld, sce->rigidbody_world);
|
|
|
|
|
|
|
|
|
|
BLO_write_struct(writer, RigidBodyWorld_Shared, sce->rigidbody_world->shared);
|
|
|
|
|
BLO_write_struct(writer, EffectorWeights, sce->rigidbody_world->effector_weights);
|
|
|
|
|
BKE_ptcache_blend_write(writer, &(sce->rigidbody_world->shared->ptcaches));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_previewimg_blend_write(writer, sce->preview);
|
|
|
|
|
BKE_curvemapping_curves_blend_write(writer, &sce->r.mblur_shutter_curve);
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
|
|
|
|
|
BKE_view_layer_blend_write(writer, view_layer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->master_collection) {
|
|
|
|
|
BLO_write_struct(writer, Collection, sce->master_collection);
|
|
|
|
|
BKE_collection_blend_write_nolib(writer, sce->master_collection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Eevee Lightcache */
|
|
|
|
|
if (sce->eevee.light_cache_data && !BLO_write_is_undo(writer)) {
|
|
|
|
|
BLO_write_struct(writer, LightCache, sce->eevee.light_cache_data);
|
|
|
|
|
EEVEE_lightcache_blend_write(writer, sce->eevee.light_cache_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_screen_view3d_shading_blend_write(writer, &sce->display.shading);
|
|
|
|
|
|
|
|
|
|
/* Freed on doversion. */
|
|
|
|
|
BLI_assert(sce->layer_properties == NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-06 14:57:36 +01:00
|
|
|
static void direct_link_paint_helper(BlendDataReader *reader, const Scene *scene, Paint **paint)
|
|
|
|
|
{
|
|
|
|
|
/* TODO. is this needed */
|
|
|
|
|
BLO_read_data_address(reader, paint);
|
|
|
|
|
|
|
|
|
|
if (*paint) {
|
|
|
|
|
BKE_paint_blend_read_data(reader, scene, *paint);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void link_recurs_seq(BlendDataReader *reader, ListBase *lb)
|
|
|
|
|
{
|
|
|
|
|
BLO_read_list(reader, lb);
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (Sequence *, seq, lb) {
|
|
|
|
|
if (seq->seqbase.first) {
|
|
|
|
|
link_recurs_seq(reader, &seq->seqbase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_blend_read_data(BlendDataReader *reader, ID *id)
|
|
|
|
|
{
|
|
|
|
|
Scene *sce = (Scene *)id;
|
|
|
|
|
|
|
|
|
|
sce->depsgraph_hash = NULL;
|
|
|
|
|
sce->fps_info = NULL;
|
|
|
|
|
|
|
|
|
|
memset(&sce->customdata_mask, 0, sizeof(sce->customdata_mask));
|
|
|
|
|
memset(&sce->customdata_mask_modal, 0, sizeof(sce->customdata_mask_modal));
|
|
|
|
|
|
|
|
|
|
BKE_sound_reset_scene_runtime(sce);
|
|
|
|
|
|
|
|
|
|
/* set users to one by default, not in lib-link, this will increase it for compo nodes */
|
|
|
|
|
id_us_ensure_real(&sce->id);
|
|
|
|
|
|
|
|
|
|
BLO_read_list(reader, &(sce->base));
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->adt);
|
|
|
|
|
BKE_animdata_blend_read_data(reader, sce->adt);
|
|
|
|
|
|
|
|
|
|
BLO_read_list(reader, &sce->keyingsets);
|
|
|
|
|
BKE_keyingsets_blend_read_data(reader, &sce->keyingsets);
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->basact);
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->toolsettings);
|
|
|
|
|
if (sce->toolsettings) {
|
|
|
|
|
|
|
|
|
|
/* Reset last_location and last_hit, so they are not remembered across sessions. In some files
|
|
|
|
|
* these are also NaN, which could lead to crashes in painting. */
|
|
|
|
|
struct UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings;
|
|
|
|
|
zero_v3(ups->last_location);
|
|
|
|
|
ups->last_hit = 0;
|
|
|
|
|
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->sculpt);
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->vpaint);
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->wpaint);
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->uvsculpt);
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_paint);
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_vertexpaint);
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_sculptpaint);
|
|
|
|
|
direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_weightpaint);
|
|
|
|
|
|
|
|
|
|
BKE_paint_blend_read_data(reader, sce, &sce->toolsettings->imapaint.paint);
|
|
|
|
|
|
|
|
|
|
sce->toolsettings->particle.paintcursor = NULL;
|
|
|
|
|
sce->toolsettings->particle.scene = NULL;
|
|
|
|
|
sce->toolsettings->particle.object = NULL;
|
|
|
|
|
sce->toolsettings->gp_sculpt.paintcursor = NULL;
|
|
|
|
|
|
|
|
|
|
/* relink grease pencil interpolation curves */
|
|
|
|
|
BLO_read_data_address(reader, &sce->toolsettings->gp_interpolate.custom_ipo);
|
|
|
|
|
if (sce->toolsettings->gp_interpolate.custom_ipo) {
|
|
|
|
|
BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_interpolate.custom_ipo);
|
|
|
|
|
}
|
|
|
|
|
/* relink grease pencil multiframe falloff curve */
|
|
|
|
|
BLO_read_data_address(reader, &sce->toolsettings->gp_sculpt.cur_falloff);
|
|
|
|
|
if (sce->toolsettings->gp_sculpt.cur_falloff) {
|
|
|
|
|
BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_sculpt.cur_falloff);
|
|
|
|
|
}
|
|
|
|
|
/* relink grease pencil primitive curve */
|
|
|
|
|
BLO_read_data_address(reader, &sce->toolsettings->gp_sculpt.cur_primitive);
|
|
|
|
|
if (sce->toolsettings->gp_sculpt.cur_primitive) {
|
|
|
|
|
BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_sculpt.cur_primitive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Relink toolsettings curve profile */
|
|
|
|
|
BLO_read_data_address(reader, &sce->toolsettings->custom_bevel_profile_preset);
|
|
|
|
|
if (sce->toolsettings->custom_bevel_profile_preset) {
|
|
|
|
|
BKE_curveprofile_blend_read(reader, sce->toolsettings->custom_bevel_profile_preset);
|
|
|
|
|
}
|
2020-12-16 20:34:26 +01:00
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->toolsettings->sequencer_tool_settings);
|
2020-11-06 14:57:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->ed) {
|
|
|
|
|
ListBase *old_seqbasep = &sce->ed->seqbase;
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->ed);
|
|
|
|
|
Editing *ed = sce->ed;
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &ed->act_seq);
|
|
|
|
|
ed->cache = NULL;
|
|
|
|
|
ed->prefetch_job = NULL;
|
|
|
|
|
|
|
|
|
|
/* recursive link sequences, lb will be correctly initialized */
|
|
|
|
|
link_recurs_seq(reader, &ed->seqbase);
|
|
|
|
|
|
|
|
|
|
Sequence *seq;
|
|
|
|
|
SEQ_ALL_BEGIN (ed, seq) {
|
|
|
|
|
/* Do as early as possible, so that other parts of reading can rely on valid session UUID. */
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_relations_session_uuid_generate(seq);
|
2020-11-06 14:57:36 +01:00
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &seq->seq1);
|
|
|
|
|
BLO_read_data_address(reader, &seq->seq2);
|
|
|
|
|
BLO_read_data_address(reader, &seq->seq3);
|
|
|
|
|
|
|
|
|
|
/* a patch: after introduction of effects with 3 input strips */
|
|
|
|
|
if (seq->seq3 == NULL) {
|
|
|
|
|
seq->seq3 = seq->seq2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &seq->effectdata);
|
|
|
|
|
BLO_read_data_address(reader, &seq->stereo3d_format);
|
|
|
|
|
|
|
|
|
|
if (seq->type & SEQ_TYPE_EFFECT) {
|
|
|
|
|
seq->flag |= SEQ_EFFECT_NOT_LOADED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_SPEED) {
|
|
|
|
|
SpeedControlVars *s = seq->effectdata;
|
|
|
|
|
s->frameMap = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_TEXT) {
|
|
|
|
|
TextVars *t = seq->effectdata;
|
|
|
|
|
t->text_blf_id = SEQ_FONT_NOT_LOADED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &seq->prop);
|
|
|
|
|
IDP_BlendDataRead(reader, &seq->prop);
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &seq->strip);
|
|
|
|
|
if (seq->strip && seq->strip->done == 0) {
|
|
|
|
|
seq->strip->done = true;
|
|
|
|
|
|
|
|
|
|
if (ELEM(seq->type,
|
|
|
|
|
SEQ_TYPE_IMAGE,
|
|
|
|
|
SEQ_TYPE_MOVIE,
|
|
|
|
|
SEQ_TYPE_SOUND_RAM,
|
|
|
|
|
SEQ_TYPE_SOUND_HD)) {
|
|
|
|
|
BLO_read_data_address(reader, &seq->strip->stripdata);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
seq->strip->stripdata = NULL;
|
|
|
|
|
}
|
|
|
|
|
BLO_read_data_address(reader, &seq->strip->crop);
|
|
|
|
|
BLO_read_data_address(reader, &seq->strip->transform);
|
|
|
|
|
BLO_read_data_address(reader, &seq->strip->proxy);
|
|
|
|
|
if (seq->strip->proxy) {
|
|
|
|
|
seq->strip->proxy->anim = NULL;
|
|
|
|
|
}
|
|
|
|
|
else if (seq->flag & SEQ_USE_PROXY) {
|
|
|
|
|
SEQ_proxy_set(seq, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* need to load color balance to it could be converted to modifier */
|
|
|
|
|
BLO_read_data_address(reader, &seq->strip->color_balance);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_modifier_blend_read_data(reader, &seq->modifiers);
|
2020-11-06 14:57:36 +01:00
|
|
|
}
|
|
|
|
|
SEQ_ALL_END;
|
|
|
|
|
|
|
|
|
|
/* link metastack, slight abuse of structs here,
|
|
|
|
|
* have to restore pointer to internal part in struct */
|
|
|
|
|
{
|
|
|
|
|
Sequence temp;
|
|
|
|
|
void *poin;
|
|
|
|
|
intptr_t offset;
|
|
|
|
|
|
|
|
|
|
offset = ((intptr_t) & (temp.seqbase)) - ((intptr_t)&temp);
|
|
|
|
|
|
|
|
|
|
/* root pointer */
|
|
|
|
|
if (ed->seqbasep == old_seqbasep) {
|
|
|
|
|
ed->seqbasep = &ed->seqbase;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
poin = POINTER_OFFSET(ed->seqbasep, -offset);
|
|
|
|
|
|
|
|
|
|
poin = BLO_read_get_new_data_address(reader, poin);
|
|
|
|
|
|
|
|
|
|
if (poin) {
|
|
|
|
|
ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ed->seqbasep = &ed->seqbase;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* stack */
|
|
|
|
|
BLO_read_list(reader, &(ed->metastack));
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) {
|
|
|
|
|
BLO_read_data_address(reader, &ms->parseq);
|
|
|
|
|
|
|
|
|
|
if (ms->oldbasep == old_seqbasep) {
|
|
|
|
|
ms->oldbasep = &ed->seqbase;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
poin = POINTER_OFFSET(ms->oldbasep, -offset);
|
|
|
|
|
poin = BLO_read_get_new_data_address(reader, poin);
|
|
|
|
|
if (poin) {
|
|
|
|
|
ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ms->oldbasep = &ed->seqbase;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
|
|
|
|
/* Runtime */
|
|
|
|
|
sce->r.mode &= ~R_NO_CAMERA_SWITCH;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->r.avicodecdata);
|
|
|
|
|
if (sce->r.avicodecdata) {
|
|
|
|
|
BLO_read_data_address(reader, &sce->r.avicodecdata->lpFormat);
|
|
|
|
|
BLO_read_data_address(reader, &sce->r.avicodecdata->lpParms);
|
|
|
|
|
}
|
|
|
|
|
if (sce->r.ffcodecdata.properties) {
|
|
|
|
|
BLO_read_data_address(reader, &sce->r.ffcodecdata.properties);
|
|
|
|
|
IDP_BlendDataRead(reader, &sce->r.ffcodecdata.properties);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_read_list(reader, &(sce->markers));
|
|
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
|
|
|
|
|
BLO_read_data_address(reader, &marker->prop);
|
|
|
|
|
IDP_BlendDataRead(reader, &marker->prop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_read_list(reader, &(sce->transform_spaces));
|
|
|
|
|
BLO_read_list(reader, &(sce->r.layers));
|
|
|
|
|
BLO_read_list(reader, &(sce->r.views));
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
|
|
|
|
|
BLO_read_data_address(reader, &srl->prop);
|
|
|
|
|
IDP_BlendDataRead(reader, &srl->prop);
|
|
|
|
|
BLO_read_list(reader, &(srl->freestyleConfig.modules));
|
|
|
|
|
BLO_read_list(reader, &(srl->freestyleConfig.linesets));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_view_settings_blend_read_data(reader, &sce->view_settings);
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->rigidbody_world);
|
|
|
|
|
RigidBodyWorld *rbw = sce->rigidbody_world;
|
|
|
|
|
if (rbw) {
|
|
|
|
|
BLO_read_data_address(reader, &rbw->shared);
|
|
|
|
|
|
|
|
|
|
if (rbw->shared == NULL) {
|
|
|
|
|
/* Link deprecated caches if they exist, so we can use them for versioning.
|
|
|
|
|
* We should only do this when rbw->shared == NULL, because those pointers
|
|
|
|
|
* are always set (for compatibility with older Blenders). We mustn't link
|
|
|
|
|
* the same pointcache twice. */
|
|
|
|
|
BKE_ptcache_blend_read_data(reader, &rbw->ptcaches, &rbw->pointcache, false);
|
|
|
|
|
|
|
|
|
|
/* make sure simulation starts from the beginning after loading file */
|
|
|
|
|
if (rbw->pointcache) {
|
|
|
|
|
rbw->ltime = (float)rbw->pointcache->startframe;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* must nullify the reference to physics sim object, since it no-longer exist
|
|
|
|
|
* (and will need to be recalculated)
|
|
|
|
|
*/
|
|
|
|
|
rbw->shared->physics_world = NULL;
|
|
|
|
|
|
|
|
|
|
/* link caches */
|
|
|
|
|
BKE_ptcache_blend_read_data(reader, &rbw->shared->ptcaches, &rbw->shared->pointcache, false);
|
|
|
|
|
|
|
|
|
|
/* make sure simulation starts from the beginning after loading file */
|
|
|
|
|
if (rbw->shared->pointcache) {
|
|
|
|
|
rbw->ltime = (float)rbw->shared->pointcache->startframe;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rbw->objects = NULL;
|
|
|
|
|
rbw->numbodies = 0;
|
|
|
|
|
|
|
|
|
|
/* set effector weights */
|
|
|
|
|
BLO_read_data_address(reader, &rbw->effector_weights);
|
|
|
|
|
if (!rbw->effector_weights) {
|
|
|
|
|
rbw->effector_weights = BKE_effector_add_weights(NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->preview);
|
|
|
|
|
BKE_previewimg_blend_read(reader, sce->preview);
|
|
|
|
|
|
|
|
|
|
BKE_curvemapping_blend_read(reader, &sce->r.mblur_shutter_curve);
|
|
|
|
|
|
|
|
|
|
#ifdef USE_COLLECTION_COMPAT_28
|
|
|
|
|
/* this runs before the very first doversion */
|
|
|
|
|
if (sce->collection) {
|
|
|
|
|
BLO_read_data_address(reader, &sce->collection);
|
|
|
|
|
BKE_collection_compat_blend_read_data(reader, sce->collection);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* insert into global old-new map for reading without UI (link_global accesses it again) */
|
|
|
|
|
BLO_read_glob_list(reader, &sce->view_layers);
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
|
|
|
|
|
BKE_view_layer_blend_read_data(reader, view_layer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (BLO_read_data_is_undo(reader)) {
|
|
|
|
|
/* If it's undo do nothing here, caches are handled by higher-level generic calling code. */
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* else try to read the cache from file. */
|
|
|
|
|
BLO_read_data_address(reader, &sce->eevee.light_cache_data);
|
|
|
|
|
if (sce->eevee.light_cache_data) {
|
|
|
|
|
EEVEE_lightcache_blend_read_data(reader, sce->eevee.light_cache_data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
EEVEE_lightcache_info_update(&sce->eevee);
|
|
|
|
|
|
|
|
|
|
BKE_screen_view3d_shading_blend_read_data(reader, &sce->display.shading);
|
|
|
|
|
|
|
|
|
|
BLO_read_data_address(reader, &sce->layer_properties);
|
|
|
|
|
IDP_BlendDataRead(reader, &sce->layer_properties);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-06 15:21:45 +01:00
|
|
|
/* patch for missing scene IDs, can't be in do-versions */
|
|
|
|
|
static void composite_patch(bNodeTree *ntree, Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
if (node->id == NULL &&
|
|
|
|
|
((node->type == CMP_NODE_R_LAYERS) ||
|
|
|
|
|
(node->type == CMP_NODE_CRYPTOMATTE && node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER))) {
|
2020-11-06 15:21:45 +01:00
|
|
|
node->id = &scene->id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
|
|
|
|
|
{
|
|
|
|
|
Scene *sce = (Scene *)id;
|
|
|
|
|
|
|
|
|
|
BKE_keyingsets_blend_read_lib(reader, &sce->id, &sce->keyingsets);
|
|
|
|
|
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->camera);
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->world);
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->set);
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->gpd);
|
|
|
|
|
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->imapaint.paint);
|
|
|
|
|
if (sce->toolsettings->sculpt) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->sculpt->paint);
|
|
|
|
|
}
|
|
|
|
|
if (sce->toolsettings->vpaint) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->vpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (sce->toolsettings->wpaint) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->wpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (sce->toolsettings->uvsculpt) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->uvsculpt->paint);
|
|
|
|
|
}
|
|
|
|
|
if (sce->toolsettings->gp_paint) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_paint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (sce->toolsettings->gp_vertexpaint) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_vertexpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (sce->toolsettings->gp_sculptpaint) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_sculptpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
if (sce->toolsettings->gp_weightpaint) {
|
|
|
|
|
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_weightpaint->paint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->toolsettings->sculpt) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->sculpt->gravity_object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->toolsettings->imapaint.stencil) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.stencil);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->toolsettings->imapaint.clone) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.clone);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->toolsettings->imapaint.canvas) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.canvas);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->particle.shape_object);
|
|
|
|
|
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->gp_sculpt.guide.reference_object);
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH_MUTABLE (Base *, base_legacy, &sce->base) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &base_legacy->object);
|
|
|
|
|
|
|
|
|
|
if (base_legacy->object == NULL) {
|
|
|
|
|
BLO_reportf_wrap(BLO_read_lib_reports(reader),
|
|
|
|
|
RPT_WARNING,
|
|
|
|
|
TIP_("LIB: object lost from scene: '%s'"),
|
|
|
|
|
sce->id.name + 2);
|
|
|
|
|
BLI_remlink(&sce->base, base_legacy);
|
|
|
|
|
if (base_legacy == sce->basact) {
|
|
|
|
|
sce->basact = NULL;
|
|
|
|
|
}
|
|
|
|
|
MEM_freeN(base_legacy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sequence *seq;
|
|
|
|
|
SEQ_ALL_BEGIN (sce->ed, seq) {
|
|
|
|
|
IDP_BlendReadLib(reader, seq->prop);
|
|
|
|
|
|
|
|
|
|
if (seq->ipo) {
|
|
|
|
|
BLO_read_id_address(
|
|
|
|
|
reader, sce->id.lib, &seq->ipo); /* XXX deprecated - old animation system */
|
|
|
|
|
}
|
|
|
|
|
seq->scene_sound = NULL;
|
|
|
|
|
if (seq->scene) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &seq->scene);
|
|
|
|
|
seq->scene_sound = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (seq->clip) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &seq->clip);
|
|
|
|
|
}
|
|
|
|
|
if (seq->mask) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &seq->mask);
|
|
|
|
|
}
|
|
|
|
|
if (seq->scene_camera) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &seq->scene_camera);
|
|
|
|
|
}
|
|
|
|
|
if (seq->sound) {
|
|
|
|
|
seq->scene_sound = NULL;
|
|
|
|
|
if (seq->type == SEQ_TYPE_SOUND_HD) {
|
|
|
|
|
seq->type = SEQ_TYPE_SOUND_RAM;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &seq->sound);
|
|
|
|
|
}
|
|
|
|
|
if (seq->sound) {
|
|
|
|
|
id_us_plus_no_lib((ID *)seq->sound);
|
|
|
|
|
seq->scene_sound = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (seq->type == SEQ_TYPE_TEXT) {
|
|
|
|
|
TextVars *t = seq->effectdata;
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &t->text_font);
|
|
|
|
|
}
|
|
|
|
|
BLI_listbase_clear(&seq->anims);
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_modifier_blend_read_lib(reader, sce, &seq->modifiers);
|
2020-11-06 15:21:45 +01:00
|
|
|
}
|
|
|
|
|
SEQ_ALL_END;
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
|
|
|
|
|
IDP_BlendReadLib(reader, marker->prop);
|
|
|
|
|
|
|
|
|
|
if (marker->camera) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &marker->camera);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* rigidbody world relies on its linked collections */
|
|
|
|
|
if (sce->rigidbody_world) {
|
|
|
|
|
RigidBodyWorld *rbw = sce->rigidbody_world;
|
|
|
|
|
if (rbw->group) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &rbw->group);
|
|
|
|
|
}
|
|
|
|
|
if (rbw->constraints) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &rbw->constraints);
|
|
|
|
|
}
|
|
|
|
|
if (rbw->effector_weights) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &rbw->effector_weights->group);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->nodetree) {
|
|
|
|
|
composite_patch(sce->nodetree, sce);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &srl->mat_override);
|
|
|
|
|
LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &srl->freestyleConfig.modules) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &fmc->script);
|
|
|
|
|
}
|
|
|
|
|
LISTBASE_FOREACH (FreestyleLineSet *, fls, &srl->freestyleConfig.linesets) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &fls->linestyle);
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &fls->group);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Motion Tracking */
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->clip);
|
|
|
|
|
|
|
|
|
|
#ifdef USE_COLLECTION_COMPAT_28
|
|
|
|
|
if (sce->collection) {
|
|
|
|
|
BKE_collection_compat_blend_read_lib(reader, sce->id.lib, sce->collection);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
|
|
|
|
|
BKE_view_layer_blend_read_lib(reader, sce->id.lib, view_layer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->r.bake.cage_object) {
|
|
|
|
|
BLO_read_id_address(reader, sce->id.lib, &sce->r.bake.cage_object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef USE_SETSCENE_CHECK
|
|
|
|
|
if (sce->set != NULL) {
|
|
|
|
|
sce->flag |= SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-06 15:37:56 +01:00
|
|
|
static void scene_blend_read_expand(BlendExpander *expander, ID *id)
|
|
|
|
|
{
|
|
|
|
|
Scene *sce = (Scene *)id;
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (Base *, base_legacy, &sce->base) {
|
|
|
|
|
BLO_expand(expander, base_legacy->object);
|
|
|
|
|
}
|
|
|
|
|
BLO_expand(expander, sce->camera);
|
|
|
|
|
BLO_expand(expander, sce->world);
|
|
|
|
|
|
|
|
|
|
BKE_keyingsets_blend_read_expand(expander, &sce->keyingsets);
|
|
|
|
|
|
|
|
|
|
if (sce->set) {
|
|
|
|
|
BLO_expand(expander, sce->set);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
|
|
|
|
|
BLO_expand(expander, srl->mat_override);
|
|
|
|
|
LISTBASE_FOREACH (FreestyleModuleConfig *, module, &srl->freestyleConfig.modules) {
|
|
|
|
|
if (module->script) {
|
|
|
|
|
BLO_expand(expander, module->script);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
LISTBASE_FOREACH (FreestyleLineSet *, lineset, &srl->freestyleConfig.linesets) {
|
|
|
|
|
if (lineset->group) {
|
|
|
|
|
BLO_expand(expander, lineset->group);
|
|
|
|
|
}
|
|
|
|
|
BLO_expand(expander, lineset->linestyle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
|
|
|
|
|
IDP_BlendReadExpand(expander, view_layer->id_properties);
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (FreestyleModuleConfig *, module, &view_layer->freestyle_config.modules) {
|
|
|
|
|
if (module->script) {
|
|
|
|
|
BLO_expand(expander, module->script);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer->freestyle_config.linesets) {
|
|
|
|
|
if (lineset->group) {
|
|
|
|
|
BLO_expand(expander, lineset->group);
|
|
|
|
|
}
|
|
|
|
|
BLO_expand(expander, lineset->linestyle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->gpd) {
|
|
|
|
|
BLO_expand(expander, sce->gpd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->ed) {
|
|
|
|
|
Sequence *seq;
|
|
|
|
|
|
|
|
|
|
SEQ_ALL_BEGIN (sce->ed, seq) {
|
|
|
|
|
IDP_BlendReadExpand(expander, seq->prop);
|
|
|
|
|
|
|
|
|
|
if (seq->scene) {
|
|
|
|
|
BLO_expand(expander, seq->scene);
|
|
|
|
|
}
|
|
|
|
|
if (seq->scene_camera) {
|
|
|
|
|
BLO_expand(expander, seq->scene_camera);
|
|
|
|
|
}
|
|
|
|
|
if (seq->clip) {
|
|
|
|
|
BLO_expand(expander, seq->clip);
|
|
|
|
|
}
|
|
|
|
|
if (seq->mask) {
|
|
|
|
|
BLO_expand(expander, seq->mask);
|
|
|
|
|
}
|
|
|
|
|
if (seq->sound) {
|
|
|
|
|
BLO_expand(expander, seq->sound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
|
|
|
|
|
TextVars *data = seq->effectdata;
|
|
|
|
|
BLO_expand(expander, data->text_font);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
SEQ_ALL_END;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->rigidbody_world) {
|
|
|
|
|
BLO_expand(expander, sce->rigidbody_world->group);
|
|
|
|
|
BLO_expand(expander, sce->rigidbody_world->constraints);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
|
|
|
|
|
IDP_BlendReadExpand(expander, marker->prop);
|
|
|
|
|
|
|
|
|
|
if (marker->camera) {
|
|
|
|
|
BLO_expand(expander, marker->camera);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLO_expand(expander, sce->clip);
|
|
|
|
|
|
|
|
|
|
#ifdef USE_COLLECTION_COMPAT_28
|
|
|
|
|
if (sce->collection) {
|
|
|
|
|
BKE_collection_compat_blend_read_expand(expander, sce->collection);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (sce->r.bake.cage_object) {
|
|
|
|
|
BLO_expand(expander, sce->r.bake.cage_object);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 12:09:00 +01:00
|
|
|
static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
|
2020-11-03 11:39:36 +01:00
|
|
|
{
|
|
|
|
|
Scene *scene_new = (Scene *)id_new;
|
|
|
|
|
Scene *scene_old = (Scene *)id_old;
|
|
|
|
|
|
|
|
|
|
SWAP(View3DCursor, scene_old->cursor, scene_new->cursor);
|
2020-11-03 12:09:00 +01:00
|
|
|
if (scene_new->toolsettings != NULL && scene_old->toolsettings != NULL) {
|
|
|
|
|
/* First try to restore ID pointers that can be and should be preserved (like brushes or
|
|
|
|
|
* palettes), and counteract the swap of the whole ToolSettings structs below for the others
|
|
|
|
|
* (like object ones). */
|
|
|
|
|
scene_foreach_toolsettings(
|
|
|
|
|
NULL, scene_new->toolsettings, true, reader, scene_old->toolsettings);
|
|
|
|
|
SWAP(ToolSettings, *scene_old->toolsettings, *scene_new->toolsettings);
|
|
|
|
|
}
|
2020-11-03 11:39:36 +01:00
|
|
|
}
|
|
|
|
|
|
2021-01-22 14:52:50 +01:00
|
|
|
static void scene_lib_override_apply_post(ID *id_dst, ID *UNUSED(id_src))
|
|
|
|
|
{
|
|
|
|
|
Scene *scene = (Scene *)id_dst;
|
|
|
|
|
|
|
|
|
|
if (scene->rigidbody_world != NULL) {
|
|
|
|
|
PTCacheID pid;
|
|
|
|
|
BKE_ptcache_id_from_rigidbody(&pid, NULL, scene->rigidbody_world);
|
|
|
|
|
LISTBASE_FOREACH (PointCache *, point_cache, pid.ptcaches) {
|
|
|
|
|
point_cache->flag |= PTCACHE_FLAG_INFO_DIRTY;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 11:10:10 +01:00
|
|
|
IDTypeInfo IDType_ID_SCE = {
|
|
|
|
|
.id_code = ID_SCE,
|
|
|
|
|
.id_filter = FILTER_ID_SCE,
|
|
|
|
|
.main_listbase_index = INDEX_ID_SCE,
|
|
|
|
|
.struct_size = sizeof(Scene),
|
|
|
|
|
.name = "Scene",
|
|
|
|
|
.name_plural = "scenes",
|
|
|
|
|
.translation_context = BLT_I18NCONTEXT_ID_SCENE,
|
|
|
|
|
.flags = 0,
|
|
|
|
|
|
|
|
|
|
.init_data = scene_init_data,
|
|
|
|
|
.copy_data = scene_copy_data,
|
|
|
|
|
.free_data = scene_free_data,
|
|
|
|
|
/* For now default `BKE_lib_id_make_local_generic()` should work, may need more work though to
|
|
|
|
|
* support all possible corner cases. */
|
|
|
|
|
.make_local = NULL,
|
2020-05-21 19:29:55 +02:00
|
|
|
.foreach_id = scene_foreach_id,
|
2020-07-03 16:09:58 +02:00
|
|
|
.foreach_cache = scene_foreach_cache,
|
2021-02-25 10:17:31 +01:00
|
|
|
.owner_get = NULL,
|
2020-08-28 13:05:48 +02:00
|
|
|
|
2020-11-06 14:49:15 +01:00
|
|
|
.blend_write = scene_blend_write,
|
2020-11-06 14:57:36 +01:00
|
|
|
.blend_read_data = scene_blend_read_data,
|
2020-11-06 15:21:45 +01:00
|
|
|
.blend_read_lib = scene_blend_read_lib,
|
2020-11-06 15:37:56 +01:00
|
|
|
.blend_read_expand = scene_blend_read_expand,
|
2020-11-03 11:39:36 +01:00
|
|
|
|
|
|
|
|
.blend_read_undo_preserve = scene_undo_preserve,
|
2021-01-22 14:52:50 +01:00
|
|
|
|
|
|
|
|
.lib_override_apply_post = scene_lib_override_apply_post,
|
2020-03-06 11:10:10 +01:00
|
|
|
};
|
|
|
|
|
|
2017-05-02 19:55:02 +02:00
|
|
|
const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";
|
2018-11-26 19:00:01 +01:00
|
|
|
const char *RE_engine_id_BLENDER_WORKBENCH = "BLENDER_WORKBENCH";
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
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;
|
2018-06-17 17:05:51 +02: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);
|
2020-06-05 09:30:15 +02:00
|
|
|
BKE_fcurve_free(fcu);
|
2012-11-09 07:29:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-10 12:58:59 +01:00
|
|
|
/* flag -- copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more). */
|
2018-02-28 14:52:17 +01:00
|
|
|
ToolSettings *BKE_toolsettings_copy(ToolSettings *toolsettings, const int flag)
|
|
|
|
|
{
|
|
|
|
|
if (toolsettings == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
ToolSettings *ts = MEM_dupallocN(toolsettings);
|
|
|
|
|
if (ts->vpaint) {
|
|
|
|
|
ts->vpaint = MEM_dupallocN(ts->vpaint);
|
|
|
|
|
BKE_paint_copy(&ts->vpaint->paint, &ts->vpaint->paint, flag);
|
|
|
|
|
}
|
|
|
|
|
if (ts->wpaint) {
|
|
|
|
|
ts->wpaint = MEM_dupallocN(ts->wpaint);
|
|
|
|
|
BKE_paint_copy(&ts->wpaint->paint, &ts->wpaint->paint, flag);
|
|
|
|
|
}
|
|
|
|
|
if (ts->sculpt) {
|
|
|
|
|
ts->sculpt = MEM_dupallocN(ts->sculpt);
|
|
|
|
|
BKE_paint_copy(&ts->sculpt->paint, &ts->sculpt->paint, flag);
|
|
|
|
|
}
|
|
|
|
|
if (ts->uvsculpt) {
|
|
|
|
|
ts->uvsculpt = MEM_dupallocN(ts->uvsculpt);
|
|
|
|
|
BKE_paint_copy(&ts->uvsculpt->paint, &ts->uvsculpt->paint, flag);
|
|
|
|
|
}
|
2018-07-31 10:22:19 +02:00
|
|
|
if (ts->gp_paint) {
|
|
|
|
|
ts->gp_paint = MEM_dupallocN(ts->gp_paint);
|
|
|
|
|
BKE_paint_copy(&ts->gp_paint->paint, &ts->gp_paint->paint, flag);
|
|
|
|
|
}
|
2020-03-09 16:27:24 +01:00
|
|
|
if (ts->gp_vertexpaint) {
|
|
|
|
|
ts->gp_vertexpaint = MEM_dupallocN(ts->gp_vertexpaint);
|
|
|
|
|
BKE_paint_copy(&ts->gp_vertexpaint->paint, &ts->gp_vertexpaint->paint, flag);
|
|
|
|
|
}
|
|
|
|
|
if (ts->gp_sculptpaint) {
|
|
|
|
|
ts->gp_sculptpaint = MEM_dupallocN(ts->gp_sculptpaint);
|
|
|
|
|
BKE_paint_copy(&ts->gp_sculptpaint->paint, &ts->gp_sculptpaint->paint, flag);
|
|
|
|
|
}
|
|
|
|
|
if (ts->gp_weightpaint) {
|
|
|
|
|
ts->gp_weightpaint = MEM_dupallocN(ts->gp_weightpaint);
|
|
|
|
|
BKE_paint_copy(&ts->gp_weightpaint->paint, &ts->gp_weightpaint->paint, flag);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-02-28 14:52:17 +01:00
|
|
|
BKE_paint_copy(&ts->imapaint.paint, &ts->imapaint.paint, flag);
|
|
|
|
|
ts->particle.paintcursor = NULL;
|
|
|
|
|
ts->particle.scene = NULL;
|
|
|
|
|
ts->particle.object = NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-02-28 14:52:17 +01:00
|
|
|
/* duplicate Grease Pencil interpolation curve */
|
2019-08-07 03:21:55 +10:00
|
|
|
ts->gp_interpolate.custom_ipo = BKE_curvemapping_copy(ts->gp_interpolate.custom_ipo);
|
2020-09-21 15:17:41 +02:00
|
|
|
/* Duplicate Grease Pencil multiframe falloff. */
|
2019-08-07 03:21:55 +10:00
|
|
|
ts->gp_sculpt.cur_falloff = BKE_curvemapping_copy(ts->gp_sculpt.cur_falloff);
|
|
|
|
|
ts->gp_sculpt.cur_primitive = BKE_curvemapping_copy(ts->gp_sculpt.cur_primitive);
|
2019-11-20 16:12:32 -05:00
|
|
|
|
|
|
|
|
ts->custom_bevel_profile_preset = BKE_curveprofile_copy(ts->custom_bevel_profile_preset);
|
2020-12-16 20:34:26 +01:00
|
|
|
|
|
|
|
|
ts->sequencer_tool_settings = SEQ_tool_settings_copy(ts->sequencer_tool_settings);
|
2018-02-28 14:52:17 +01:00
|
|
|
return ts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_toolsettings_free(ToolSettings *toolsettings)
|
|
|
|
|
{
|
|
|
|
|
if (toolsettings == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (toolsettings->vpaint) {
|
|
|
|
|
BKE_paint_free(&toolsettings->vpaint->paint);
|
|
|
|
|
MEM_freeN(toolsettings->vpaint);
|
|
|
|
|
}
|
|
|
|
|
if (toolsettings->wpaint) {
|
|
|
|
|
BKE_paint_free(&toolsettings->wpaint->paint);
|
|
|
|
|
MEM_freeN(toolsettings->wpaint);
|
|
|
|
|
}
|
|
|
|
|
if (toolsettings->sculpt) {
|
|
|
|
|
BKE_paint_free(&toolsettings->sculpt->paint);
|
|
|
|
|
MEM_freeN(toolsettings->sculpt);
|
|
|
|
|
}
|
|
|
|
|
if (toolsettings->uvsculpt) {
|
|
|
|
|
BKE_paint_free(&toolsettings->uvsculpt->paint);
|
|
|
|
|
MEM_freeN(toolsettings->uvsculpt);
|
|
|
|
|
}
|
2018-07-31 10:22:19 +02:00
|
|
|
if (toolsettings->gp_paint) {
|
|
|
|
|
BKE_paint_free(&toolsettings->gp_paint->paint);
|
|
|
|
|
MEM_freeN(toolsettings->gp_paint);
|
|
|
|
|
}
|
2020-03-09 16:27:24 +01:00
|
|
|
if (toolsettings->gp_vertexpaint) {
|
|
|
|
|
BKE_paint_free(&toolsettings->gp_vertexpaint->paint);
|
|
|
|
|
MEM_freeN(toolsettings->gp_vertexpaint);
|
|
|
|
|
}
|
|
|
|
|
if (toolsettings->gp_sculptpaint) {
|
|
|
|
|
BKE_paint_free(&toolsettings->gp_sculptpaint->paint);
|
|
|
|
|
MEM_freeN(toolsettings->gp_sculptpaint);
|
|
|
|
|
}
|
|
|
|
|
if (toolsettings->gp_weightpaint) {
|
|
|
|
|
BKE_paint_free(&toolsettings->gp_weightpaint->paint);
|
|
|
|
|
MEM_freeN(toolsettings->gp_weightpaint);
|
|
|
|
|
}
|
2018-02-28 14:52:17 +01:00
|
|
|
BKE_paint_free(&toolsettings->imapaint.paint);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-02-28 14:52:17 +01:00
|
|
|
/* free Grease Pencil interpolation curve */
|
|
|
|
|
if (toolsettings->gp_interpolate.custom_ipo) {
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemapping_free(toolsettings->gp_interpolate.custom_ipo);
|
2018-02-28 14:52:17 +01:00
|
|
|
}
|
2018-07-31 10:22:19 +02:00
|
|
|
/* free Grease Pencil multiframe falloff curve */
|
|
|
|
|
if (toolsettings->gp_sculpt.cur_falloff) {
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemapping_free(toolsettings->gp_sculpt.cur_falloff);
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
2018-12-15 17:21:47 +01:00
|
|
|
if (toolsettings->gp_sculpt.cur_primitive) {
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemapping_free(toolsettings->gp_sculpt.cur_primitive);
|
2018-12-15 17:21:47 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-11-20 16:12:32 -05:00
|
|
|
if (toolsettings->custom_bevel_profile_preset) {
|
|
|
|
|
BKE_curveprofile_free(toolsettings->custom_bevel_profile_preset);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-16 20:34:26 +01:00
|
|
|
if (toolsettings->sequencer_tool_settings) {
|
|
|
|
|
SEQ_tool_settings_free(toolsettings->sequencer_tool_settings);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-28 14:52:17 +01:00
|
|
|
MEM_freeN(toolsettings);
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-28 18:19:44 +01:00
|
|
|
void BKE_scene_copy_data_eevee(Scene *sce_dst, const Scene *sce_src)
|
|
|
|
|
{
|
|
|
|
|
/* Copy eevee data between scenes. */
|
|
|
|
|
sce_dst->eevee = sce_src->eevee;
|
2020-03-11 17:12:01 +01:00
|
|
|
sce_dst->eevee.light_cache_data = NULL;
|
2019-03-15 16:06:30 +01:00
|
|
|
sce_dst->eevee.light_cache_info[0] = '\0';
|
2018-07-10 15:02:25 +02:00
|
|
|
/* TODO Copy the cache. */
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-10 18:30:59 +02:00
|
|
|
Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type)
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
{
|
|
|
|
|
Scene *sce_copy;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
/* TODO this should/could most likely be replaced by call to more generic code at some point...
|
|
|
|
|
* But for now, let's keep it well isolated here. */
|
|
|
|
|
if (type == SCE_COPY_EMPTY) {
|
2017-11-16 13:39:25 -02:00
|
|
|
ListBase rv;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
sce_copy = BKE_scene_add(bmain, sce->id.name + 2);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
rv = sce_copy->r.views;
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemapping_free_data(&sce_copy->r.mblur_shutter_curve);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
sce_copy->r = sce->r;
|
|
|
|
|
sce_copy->r.views = rv;
|
|
|
|
|
sce_copy->unit = sce->unit;
|
|
|
|
|
sce_copy->physics_settings = sce->physics_settings;
|
|
|
|
|
sce_copy->audio = sce->audio;
|
2020-01-28 18:19:44 +01:00
|
|
|
BKE_scene_copy_data_eevee(sce_copy, sce);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (sce->id.properties) {
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
sce_copy->id.properties = IDP_CopyProperty(sce->id.properties);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
BKE_sound_destroy_scene(sce_copy);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
/* copy color management settings */
|
|
|
|
|
BKE_color_managed_display_settings_copy(&sce_copy->display_settings, &sce->display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&sce_copy->view_settings, &sce->view_settings);
|
|
|
|
|
BKE_color_managed_colorspace_settings_copy(&sce_copy->sequencer_colorspace_settings,
|
|
|
|
|
&sce->sequencer_colorspace_settings);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
BKE_color_managed_display_settings_copy(&sce_copy->r.im_format.display_settings,
|
|
|
|
|
&sce->r.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&sce_copy->r.im_format.view_settings,
|
|
|
|
|
&sce->r.im_format.view_settings);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
BKE_color_managed_display_settings_copy(&sce_copy->r.bake.im_format.display_settings,
|
|
|
|
|
&sce->r.bake.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&sce_copy->r.bake.im_format.view_settings,
|
|
|
|
|
&sce->r.bake.im_format.view_settings);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-08-07 03:21:55 +10:00
|
|
|
BKE_curvemapping_copy_data(&sce_copy->r.mblur_shutter_curve, &sce->r.mblur_shutter_curve);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-11 11:43:56 +02:00
|
|
|
/* viewport display settings */
|
|
|
|
|
sce_copy->display = sce->display;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
/* tool settings */
|
2021-01-07 15:04:26 +11:00
|
|
|
BKE_toolsettings_free(sce_copy->toolsettings);
|
2018-02-28 14:52:17 +01:00
|
|
|
sce_copy->toolsettings = BKE_toolsettings_copy(sce->toolsettings, 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
/* make a private copy of the avicodecdata */
|
|
|
|
|
if (sce->r.avicodecdata) {
|
|
|
|
|
sce_copy->r.avicodecdata = MEM_dupallocN(sce->r.avicodecdata);
|
|
|
|
|
sce_copy->r.avicodecdata->lpFormat = MEM_dupallocN(sce_copy->r.avicodecdata->lpFormat);
|
|
|
|
|
sce_copy->r.avicodecdata->lpParms = MEM_dupallocN(sce_copy->r.avicodecdata->lpParms);
|
2010-06-25 12:04:04 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
if (sce->r.ffcodecdata.properties) { /* intentionally check scen not sce. */
|
|
|
|
|
sce_copy->r.ffcodecdata.properties = IDP_CopyProperty(sce->r.ffcodecdata.properties);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-04 16:52:48 +02:00
|
|
|
BKE_sound_reset_scene_runtime(sce_copy);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
/* grease pencil */
|
|
|
|
|
sce_copy->gpd = NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
sce_copy->preview = NULL;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
return sce_copy;
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
2020-06-17 15:27:22 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
eDupli_ID_Flags duplicate_flags = U.dupflag | USER_DUP_OBJECT;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-07 16:13:01 +02:00
|
|
|
sce_copy = (Scene *)BKE_id_copy(bmain, (ID *)sce);
|
2020-08-07 12:30:43 +02:00
|
|
|
id_us_min(&sce_copy->id);
|
|
|
|
|
id_us_ensure_real(&sce_copy->id);
|
2020-06-17 15:27:22 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
BKE_animdata_duplicate_id_action(bmain, &sce_copy->id, duplicate_flags);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
/* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks. */
|
2020-06-17 15:02:04 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
if (type == SCE_COPY_FULL) {
|
|
|
|
|
/* Scene duplication is always root of duplication currently. */
|
|
|
|
|
const bool is_subprocess = false;
|
|
|
|
|
|
|
|
|
|
if (!is_subprocess) {
|
2021-05-27 22:44:02 +10:00
|
|
|
BKE_main_id_newptr_and_tag_clear(bmain);
|
2020-08-07 12:30:43 +02:00
|
|
|
/* In case root duplicated ID is linked, assume we want to get a local copy of it and
|
|
|
|
|
* duplicate all expected linked data. */
|
|
|
|
|
if (ID_IS_LINKED(sce)) {
|
|
|
|
|
duplicate_flags |= USER_DUP_LINKED_ID;
|
2020-06-17 15:02:04 +02:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
}
|
2020-06-17 15:02:04 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
/* Copy Freestyle LineStyle datablocks. */
|
|
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer_dst, &sce_copy->view_layers) {
|
|
|
|
|
LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer_dst->freestyle_config.linesets) {
|
|
|
|
|
BKE_id_copy_for_duplicate(bmain, (ID *)lineset->linestyle, duplicate_flags);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
/* Full copy of world (included animations) */
|
|
|
|
|
BKE_id_copy_for_duplicate(bmain, (ID *)sce->world, duplicate_flags);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
/* Full copy of GreasePencil. */
|
|
|
|
|
BKE_id_copy_for_duplicate(bmain, (ID *)sce->gpd, duplicate_flags);
|
2020-06-10 18:27:32 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
/* Deep-duplicate collections and objects (using preferences' settings for which sub-data to
|
|
|
|
|
* duplicate along the object itself). */
|
|
|
|
|
BKE_collection_duplicate(
|
|
|
|
|
bmain, NULL, sce_copy->master_collection, duplicate_flags, LIB_ID_DUPLICATE_IS_SUBPROCESS);
|
2020-06-17 15:02:04 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
if (!is_subprocess) {
|
|
|
|
|
/* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW.*/
|
|
|
|
|
BKE_libblock_relink_to_newid(&sce_copy->id);
|
2020-06-17 15:02:04 +02:00
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
2020-08-07 12:30:43 +02:00
|
|
|
/* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those
|
|
|
|
|
* flags. */
|
|
|
|
|
ID *id_iter;
|
|
|
|
|
FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
|
|
|
|
|
BLI_assert((id_iter->tag & LIB_TAG_NEW) == 0);
|
|
|
|
|
}
|
|
|
|
|
FOREACH_MAIN_ID_END;
|
2020-06-17 15:02:04 +02:00
|
|
|
#endif
|
|
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
/* Cleanup. */
|
2021-05-27 22:44:02 +10:00
|
|
|
BKE_main_id_newptr_and_tag_clear(bmain);
|
2020-06-17 15:02:04 +02:00
|
|
|
|
2020-08-07 12:30:43 +02:00
|
|
|
BKE_main_collection_sync(bmain);
|
2014-11-22 18:04:08 +13:00
|
|
|
}
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
else {
|
|
|
|
|
/* Remove sequencer if not full copy */
|
|
|
|
|
/* XXX Why in Hell? :/ */
|
|
|
|
|
remove_sequencer_fcurves(sce_copy);
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_editing_free(sce_copy, true);
|
2020-08-07 12:30:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sce_copy;
|
2009-09-18 22:25:49 +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
|
|
|
|
2013-04-24 23:09:25 +00:00
|
|
|
void BKE_scene_groups_relink(Scene *sce)
|
|
|
|
|
{
|
2019-04-22 09:39:35 +10:00
|
|
|
if (sce->rigidbody_world) {
|
2013-04-24 23:09:25 +00:00
|
|
|
BKE_rigidbody_world_groups_relink(sce->rigidbody_world);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2013-04-24 23:09:25 +00:00
|
|
|
}
|
|
|
|
|
|
2021-01-08 16:30:44 +01:00
|
|
|
bool BKE_scene_can_be_removed(const Main *bmain, const Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
/* Linked scenes can always be removed. */
|
|
|
|
|
if (ID_IS_LINKED(scene)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
/* Local scenes can only be removed, when there is at least one local scene left. */
|
|
|
|
|
LISTBASE_FOREACH (Scene *, other_scene, &bmain->scenes) {
|
|
|
|
|
if (other_scene != scene && !ID_IS_LINKED(other_scene)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
|
2020-10-08 12:50:04 +02:00
|
|
|
sce = BKE_id_new(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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return sce;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-08 12:16:49 -02:00
|
|
|
/**
|
2018-09-24 18:46:51 +02:00
|
|
|
* Check if there is any instance of the object in the scene
|
2017-11-08 12:16:49 -02:00
|
|
|
*/
|
|
|
|
|
bool BKE_scene_object_find(Scene *scene, Object *ob)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
2017-11-22 10:52:39 -02:00
|
|
|
if (BLI_findptr(&view_layer->object_bases, ob, offsetof(Base, object))) {
|
2017-11-08 12:16:49 -02:00
|
|
|
return true;
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
}
|
2017-11-08 12:16:49 -02:00
|
|
|
return false;
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
|
2020-03-13 17:27:11 +11:00
|
|
|
Object *BKE_scene_object_find_by_name(const Scene *scene, const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
|
|
|
|
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
|
2017-11-08 12:16:49 -02:00
|
|
|
if (STREQ(base->object->id.name + 2, name)) {
|
|
|
|
|
return base->object;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2015-08-06 21:02:08 +10:00
|
|
|
/**
|
2019-04-27 12:07:07 +10:00
|
|
|
* Sets the active scene, mainly used when running in background mode
|
|
|
|
|
* (``--scene`` command line argument).
|
2015-08-06 21:02:08 +10:00
|
|
|
* This is also called to set the scene directly, bypassing windowing code.
|
2018-07-03 15:34:26 +02:00
|
|
|
* Otherwise #WM_window_set_active_scene is used when changing scenes by the user.
|
2015-08-06 21:02:08 +10:00
|
|
|
*/
|
2012-05-05 14:33:36 +00:00
|
|
|
void BKE_scene_set_background(Main *bmain, Scene *scene)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
Object *ob;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
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);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* deselect objects (for dataselect) */
|
2019-04-22 09:39:35 +10:00
|
|
|
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
ob->flag &= ~SELECT;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* copy layers and flags from bases to objects */
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
|
|
|
|
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
|
2017-11-08 12:16:49 -02:00
|
|
|
ob = base->object;
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
/* collection patch... */
|
2017-11-08 12:16:49 -02:00
|
|
|
BKE_scene_object_base_flag_sync_from_base(base);
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2019-04-27 12:07:07 +10: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
|
|
|
{
|
2018-05-31 16:04:04 +02:00
|
|
|
Scene *sce = (Scene *)BKE_libblock_find_name(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);
|
2018-06-05 15:10:33 +02:00
|
|
|
printf("Scene switch for render: '%s' in file: '%s'\n", name, BKE_main_blendfile_path(bmain));
|
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
|
|
|
|
2018-06-05 15:10:33 +02:00
|
|
|
printf("Can't find scene: '%s' in file: '%s'\n", name, BKE_main_blendfile_path(bmain));
|
2010-07-05 00:00:40 +00:00
|
|
|
return NULL;
|
2009-09-18 22:25:49 +00:00
|
|
|
}
|
|
|
|
|
|
2020-08-13 16:21:10 +10:00
|
|
|
/* Used by meta-balls, return *all* objects (including duplis)
|
2019-04-27 12:07:07 +10:00
|
|
|
* existing in the scene (including scene's sets). */
|
2018-06-11 14:39:38 +02:00
|
|
|
int BKE_scene_base_iter_next(
|
|
|
|
|
Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2014-02-03 18:55:59 +11:00
|
|
|
bool run_again = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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;
|
2019-04-17 06:17:24 +02: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) {
|
2018-04-06 12:07:27 +02:00
|
|
|
ViewLayer *view_layer = (depsgraph) ? DEG_get_evaluated_view_layer(depsgraph) :
|
2018-04-24 15:20:17 +02:00
|
|
|
BKE_view_layer_context_active_PLACEHOLDER(*scene);
|
2017-11-22 10:52:39 -02:00
|
|
|
*base = view_layer->object_bases.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 {
|
2017-11-08 12:16:49 -02:00
|
|
|
/* exception: empty scene layer */
|
2012-02-23 02:17:50 +00:00
|
|
|
while ((*scene)->set) {
|
2012-05-06 15:15:33 +00:00
|
|
|
(*scene) = (*scene)->set;
|
2018-04-24 15:20:17 +02:00
|
|
|
ViewLayer *view_layer_set = BKE_view_layer_default_render((*scene));
|
2017-11-22 10:52:39 -02:00
|
|
|
if (view_layer_set->object_bases.first) {
|
|
|
|
|
*base = view_layer_set->object_bases.first;
|
2012-05-06 15:15:33 +00:00
|
|
|
*ob = (*base)->object;
|
2014-01-23 10:20:42 +01:00
|
|
|
iter->phase = F_SCENE;
|
2010-07-13 16:06:51 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2010-07-13 16:06:51 +00:00
|
|
|
}
|
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;
|
2018-04-24 15:20:17 +02:00
|
|
|
ViewLayer *view_layer_set = BKE_view_layer_default_render((*scene));
|
2017-11-22 10:52:39 -02:00
|
|
|
if (view_layer_set->object_bases.first) {
|
|
|
|
|
*base = view_layer_set->object_bases.first;
|
2012-05-06 15:15:33 +00:00
|
|
|
*ob = (*base)->object;
|
2010-07-13 16:06:51 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2010-07-13 16:06:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02: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) {
|
2018-04-06 12:07:27 +02:00
|
|
|
if (depsgraph && (*base)->object->transflag & OB_DUPLI) {
|
2020-08-13 16:21:10 +10:00
|
|
|
/* Collections cannot be duplicated for meta-balls yet,
|
2018-06-17 17:05:51 +02:00
|
|
|
* this enters eternal loop because of
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
* makeDispListMBall getting called inside of collection_duplilist */
|
2019-02-17 19:00:54 +11:00
|
|
|
if ((*base)->object->instance_collection == NULL) {
|
2018-06-06 14:39:05 +02:00
|
|
|
iter->duplilist = object_duplilist(depsgraph, (*scene), (*base)->object);
|
2019-04-17 06:17:24 +02: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;
|
2019-04-17 06:17:24 +02: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;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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);
|
2019-04-17 06:17:24 +02: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->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;
|
2019-04-17 06:17:24 +02: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
|
|
|
}
|
2019-04-17 06:17:24 +02: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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-01-23 10:20:42 +01:00
|
|
|
return iter->phase;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2020-08-21 11:19:07 +02:00
|
|
|
bool BKE_scene_has_view_layer(const Scene *scene, const ViewLayer *layer)
|
2020-08-19 12:32:11 +02:00
|
|
|
{
|
2020-08-21 11:19:07 +02:00
|
|
|
return BLI_findindex(&scene->view_layers, layer) != -1;
|
2020-08-19 12:32:11 +02:00
|
|
|
}
|
|
|
|
|
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
Scene *BKE_scene_find_from_collection(const Main *bmain, const Collection *collection)
|
2017-03-01 13:10:29 +01:00
|
|
|
{
|
2019-03-08 09:29:17 +11:00
|
|
|
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (ViewLayer *, layer, &scene->view_layers) {
|
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
2018-04-30 15:57:22 +02:00
|
|
|
if (BKE_view_layer_has_collection(layer, collection)) {
|
2017-03-01 13:10:29 +01:00
|
|
|
return scene;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2018-01-18 14:49:09 +11:00
|
|
|
if (scene->r.mode & R_NO_CAMERA_SWITCH) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-12-23 17:28:15 +11:00
|
|
|
const int cfra = ((scene->r.images == scene->r.framapto) ?
|
|
|
|
|
scene->r.cfra :
|
|
|
|
|
(int)(scene->r.cfra *
|
|
|
|
|
((float)scene->r.framapto / (float)scene->r.images)));
|
2009-12-16 19:49:33 +00:00
|
|
|
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;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 19:15:01 +02:00
|
|
|
LISTBASE_FOREACH (TimeMarker *, m, &scene->markers) {
|
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;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (frame == cfra) {
|
2013-10-17 14:10:03 +00:00
|
|
|
break;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2013-10-17 14:10:03 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02: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
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02: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;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-12-16 19:49:33 +00:00
|
|
|
return camera;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-10-16 19:10:28 +11:00
|
|
|
bool 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);
|
2019-10-16 19:10:28 +11:00
|
|
|
if (camera && (camera != scene->camera)) {
|
2012-05-06 15:15:33 +00:00
|
|
|
scene->camera = camera;
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
|
2019-10-16 19:10:28 +11:00
|
|
|
return true;
|
2010-03-09 07:41:04 +00:00
|
|
|
}
|
2011-11-05 14:26:18 +00:00
|
|
|
#else
|
|
|
|
|
(void)scene;
|
2010-03-09 07:41:04 +00:00
|
|
|
#endif
|
2019-10-16 19:10:28 +11:00
|
|
|
return false;
|
2010-03-09 07:41:04 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-13 17:27:11 +11:00
|
|
|
const char *BKE_scene_find_marker_name(const Scene *scene, int frame)
|
2009-12-16 19:49:33 +00:00
|
|
|
{
|
2020-03-13 17:27:11 +11:00
|
|
|
const ListBase *markers = &scene->markers;
|
|
|
|
|
const TimeMarker *m1, *m2;
|
2009-12-16 19:49:33 +00:00
|
|
|
|
|
|
|
|
/* 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) {
|
2019-04-22 09:39:35 +10:00
|
|
|
if (m1->frame == frame) {
|
2009-12-16 19:49:33 +00:00
|
|
|
return m1->name;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (m1 == m2) {
|
2009-12-16 19:49:33 +00:00
|
|
|
break;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (m2->frame == frame) {
|
2009-12-16 19:49:33 +00:00
|
|
|
return m2->name;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 :/ */
|
2020-03-13 17:27:11 +11:00
|
|
|
const char *BKE_scene_find_last_marker_name(const Scene *scene, int frame)
|
2010-02-06 14:56:25 +00:00
|
|
|
{
|
2020-03-13 17:27:11 +11:00
|
|
|
const 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;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-30 16:16:44 +10:00
|
|
|
int BKE_scene_frame_snap_by_seconds(Scene *scene, double interval_in_seconds, int cfra)
|
|
|
|
|
{
|
|
|
|
|
const int fps = round_db_to_int(FPS * interval_in_seconds);
|
|
|
|
|
const int second_prev = cfra - mod_i(cfra, fps);
|
|
|
|
|
const int second_next = second_prev + fps;
|
|
|
|
|
const int delta_prev = cfra - second_prev;
|
|
|
|
|
const int delta_next = second_next - cfra;
|
|
|
|
|
return (delta_prev < delta_next) ? second_prev : second_next;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-04 18:51:00 +02:00
|
|
|
void BKE_scene_remove_rigidbody_object(struct Main *bmain,
|
|
|
|
|
Scene *scene,
|
|
|
|
|
Object *ob,
|
|
|
|
|
const bool free_us)
|
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
|
|
|
{
|
|
|
|
|
/* remove rigid body constraint from world before removing object */
|
2019-04-22 09:39:35 +10:00
|
|
|
if (ob->rigidbody_constraint) {
|
2019-10-04 18:51:00 +02:00
|
|
|
BKE_rigidbody_remove_constraint(bmain, scene, ob, free_us);
|
2019-04-22 09:39:35 +10: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
|
|
|
/* remove rigid body object from world before removing object */
|
2019-04-22 09:39:35 +10:00
|
|
|
if (ob->rigidbody_object) {
|
2019-10-04 18:51:00 +02:00
|
|
|
BKE_rigidbody_remove_object(bmain, scene, ob, free_us);
|
2019-04-22 09:39:35 +10: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
|
|
|
}
|
2010-11-18 05:05:06 +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
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (sce->set == NULL) {
|
2014-12-01 17:11:18 +01:00
|
|
|
return true;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2019-03-08 09:29:17 +11:00
|
|
|
totscene = BLI_listbase_count(&bmain->scenes);
|
2018-06-17 17:05:51 +02: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
|
|
|
}
|
|
|
|
|
|
2019-04-27 12:07:07 +10:00
|
|
|
/**
|
2020-05-28 16:54:27 +10:00
|
|
|
* This function is needed to cope with fractional frames, needed for motion blur & physics.
|
2011-11-06 06:08:18 +00:00
|
|
|
*/
|
2015-03-21 22:10:43 +11:00
|
|
|
float BKE_scene_frame_get(const Scene *scene)
|
2009-09-18 22:25:49 +00:00
|
|
|
{
|
2019-08-02 19:25:43 +10:00
|
|
|
return BKE_scene_frame_to_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 */
|
2019-08-02 19:25:43 +10:00
|
|
|
float BKE_scene_frame_to_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;
|
2018-06-17 17:05:51 +02: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;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-19 20:51:04 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Scene Orientation Slots
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2019-04-13 20:36:53 +02:00
|
|
|
TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int slot_index)
|
2018-12-19 20:51:04 +11:00
|
|
|
{
|
2019-04-13 20:36:53 +02:00
|
|
|
if ((scene->orientation_slots[slot_index].flag & SELECT) == 0) {
|
|
|
|
|
slot_index = SCE_ORIENT_DEFAULT;
|
2018-12-19 20:51:04 +11:00
|
|
|
}
|
2019-04-13 20:36:53 +02:00
|
|
|
return &scene->orientation_slots[slot_index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TransformOrientationSlot *BKE_scene_orientation_slot_get_from_flag(Scene *scene, int flag)
|
|
|
|
|
{
|
2019-04-14 13:11:17 +02:00
|
|
|
BLI_assert(flag && !(flag & ~(V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE |
|
|
|
|
|
V3D_GIZMO_SHOW_OBJECT_SCALE)));
|
2019-04-13 20:36:53 +02:00
|
|
|
int slot_index = SCE_ORIENT_DEFAULT;
|
2019-04-14 13:11:17 +02:00
|
|
|
if (flag & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) {
|
2019-04-13 20:36:53 +02:00
|
|
|
slot_index = SCE_ORIENT_TRANSLATE;
|
2018-12-19 20:51:04 +11:00
|
|
|
}
|
2019-04-14 13:11:17 +02:00
|
|
|
else if (flag & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
|
2019-04-13 20:36:53 +02:00
|
|
|
slot_index = SCE_ORIENT_ROTATE;
|
2018-12-19 20:51:04 +11:00
|
|
|
}
|
2019-04-14 13:11:17 +02:00
|
|
|
else if (flag & V3D_GIZMO_SHOW_OBJECT_SCALE) {
|
2019-04-13 20:36:53 +02:00
|
|
|
slot_index = SCE_ORIENT_SCALE;
|
2018-12-19 20:51:04 +11:00
|
|
|
}
|
2019-04-13 20:36:53 +02:00
|
|
|
return BKE_scene_orientation_slot_get(scene, slot_index);
|
2018-12-19 20:51:04 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Activate a transform orientation in a 3D view based on an enum value.
|
|
|
|
|
*
|
2019-02-08 15:14:54 +11:00
|
|
|
* \param orientation: If this is #V3D_ORIENT_CUSTOM or greater, the custom transform orientation
|
|
|
|
|
* with index \a orientation - #V3D_ORIENT_CUSTOM gets activated.
|
2018-12-19 20:51:04 +11:00
|
|
|
*/
|
|
|
|
|
void BKE_scene_orientation_slot_set_index(TransformOrientationSlot *orient_slot, int orientation)
|
|
|
|
|
{
|
2019-02-08 15:14:54 +11:00
|
|
|
const bool is_custom = orientation >= V3D_ORIENT_CUSTOM;
|
|
|
|
|
orient_slot->type = is_custom ? V3D_ORIENT_CUSTOM : orientation;
|
|
|
|
|
orient_slot->index_custom = is_custom ? (orientation - V3D_ORIENT_CUSTOM) : -1;
|
2018-12-19 20:51:04 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int BKE_scene_orientation_slot_get_index(const TransformOrientationSlot *orient_slot)
|
|
|
|
|
{
|
2019-02-08 15:14:54 +11:00
|
|
|
return (orient_slot->type == V3D_ORIENT_CUSTOM) ?
|
|
|
|
|
(orient_slot->type + orient_slot->index_custom) :
|
|
|
|
|
orient_slot->type;
|
2018-12-19 20:51:04 +11:00
|
|
|
}
|
|
|
|
|
|
2021-04-01 11:19:31 -03:00
|
|
|
int BKE_scene_orientation_get_index(Scene *scene, int slot_index)
|
|
|
|
|
{
|
|
|
|
|
TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, slot_index);
|
|
|
|
|
return BKE_scene_orientation_slot_get_index(orient_slot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int BKE_scene_orientation_get_index_from_flag(Scene *scene, int flag)
|
|
|
|
|
{
|
|
|
|
|
TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get_from_flag(scene, flag);
|
|
|
|
|
return BKE_scene_orientation_slot_get_index(orient_slot);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-19 20:51:04 +11: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) {
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
const bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook);
|
|
|
|
|
Scene *scene = window->scene;
|
2018-04-17 13:35:05 +02:00
|
|
|
RenderEngineType *type = RE_engines_find(scene->r.engine);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-30 14:32:47 +02:00
|
|
|
if (type->draw_engine || !type->render) {
|
2017-05-01 14:55:59 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-17 13:35:05 +02:00
|
|
|
for (ScrArea *area = screen->areabase.first; area != NULL; area = area->next) {
|
2014-07-31 20:18:51 +06:00
|
|
|
View3D *v3d = area->spacedata.first;
|
|
|
|
|
if (area->spacetype != SPACE_VIEW3D) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2018-07-11 14:20:39 +02:00
|
|
|
if (v3d->shading.type == OB_RENDER) {
|
2014-07-31 20:18:51 +06:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
/* TODO(campbell): shouldn't we be able to use 'DEG_get_view_layer' here?
|
2018-02-22 15:52:30 +11:00
|
|
|
* Currently this is NULL on load, so don't. */
|
|
|
|
|
static void prepare_mesh_for_viewport_render(Main *bmain, const ViewLayer *view_layer)
|
2014-07-31 20:18:51 +06:00
|
|
|
{
|
|
|
|
|
/* 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.
|
|
|
|
|
*/
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
|
2014-07-31 20:18:51 +06:00
|
|
|
if (obedit) {
|
|
|
|
|
Mesh *mesh = obedit->data;
|
|
|
|
|
if ((obedit->type == OB_MESH) &&
|
2017-12-15 09:43:18 +01:00
|
|
|
((obedit->id.recalc & ID_RECALC_ALL) || (mesh->id.recalc & ID_RECALC_ALL))) {
|
2014-07-31 20:18:51 +06:00
|
|
|
if (check_rendered_viewport_visible(bmain)) {
|
2019-02-17 18:05:18 +11:00
|
|
|
BMesh *bm = mesh->edit_mesh->bm;
|
2018-02-19 17:27:01 +11:00
|
|
|
BM_mesh_bm_to_me(bmain,
|
2018-06-13 16:29:12 +02:00
|
|
|
bm,
|
|
|
|
|
mesh,
|
2018-02-19 17:27:01 +11:00
|
|
|
(&(struct BMeshToMeshParams){
|
|
|
|
|
.calc_object_remap = true,
|
2019-11-28 06:12:17 +11:00
|
|
|
.update_shapekey_indices = true,
|
2018-02-19 17:27:01 +11:00
|
|
|
}));
|
2017-04-06 16:11:50 +02:00
|
|
|
DEG_id_tag_update(&mesh->id, 0);
|
2014-07-31 20:18:51 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-17 11:04:17 +02:00
|
|
|
void BKE_scene_update_sound(Depsgraph *depsgraph, Main *bmain)
|
2019-06-04 16:52:48 +02:00
|
|
|
{
|
|
|
|
|
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
|
|
|
|
const int recalc = scene->id.recalc;
|
|
|
|
|
BKE_sound_ensure_scene(scene);
|
|
|
|
|
if (recalc & ID_RECALC_AUDIO_SEEK) {
|
|
|
|
|
BKE_sound_seek_scene(bmain, scene);
|
|
|
|
|
}
|
|
|
|
|
if (recalc & ID_RECALC_AUDIO_FPS) {
|
2019-06-11 10:55:13 +02:00
|
|
|
BKE_sound_update_fps(bmain, scene);
|
2019-06-04 16:52:48 +02:00
|
|
|
}
|
|
|
|
|
if (recalc & ID_RECALC_AUDIO_VOLUME) {
|
|
|
|
|
BKE_sound_set_scene_volume(scene, scene->audio.volume);
|
|
|
|
|
}
|
|
|
|
|
if (recalc & ID_RECALC_AUDIO_MUTE) {
|
|
|
|
|
const bool is_mute = (scene->audio.flag & AUDIO_MUTE);
|
|
|
|
|
BKE_sound_mute_scene(scene, is_mute);
|
|
|
|
|
}
|
|
|
|
|
if (recalc & ID_RECALC_AUDIO_LISTENER) {
|
|
|
|
|
BKE_sound_update_scene_listener(scene);
|
|
|
|
|
}
|
2019-06-07 10:58:51 +02:00
|
|
|
BKE_sound_update_scene(depsgraph, scene);
|
2019-06-04 16:52:48 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-14 19:22:18 +02:00
|
|
|
void BKE_scene_update_tag_audio_volume(Depsgraph *UNUSED(depsgraph), Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(DEG_is_evaluated_id(&scene->id));
|
|
|
|
|
/* The volume is actually updated in BKE_scene_update_sound(), from either
|
|
|
|
|
* scene_graph_update_tagged() or from BKE_scene_graph_update_for_newframe(). */
|
|
|
|
|
scene->id.recalc |= ID_RECALC_AUDIO_VOLUME;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
/* TODO(sergey): This actually should become view_layer_graph or so.
|
2017-11-07 17:01:14 +01:00
|
|
|
* Same applies to update_for_newframe.
|
2019-05-28 15:52:26 +02:00
|
|
|
*
|
|
|
|
|
* If only_if_tagged is truth then the function will do nothing if the dependency graph is up
|
|
|
|
|
* to date already.
|
2017-11-07 17:01:14 +01:00
|
|
|
*/
|
2019-05-28 15:52:26 +02:00
|
|
|
static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool only_if_tagged)
|
2009-12-10 11:08:38 +00:00
|
|
|
{
|
2019-05-28 15:52:26 +02:00
|
|
|
if (only_if_tagged && DEG_is_fully_evaluated(depsgraph)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-06 11:21:20 +02:00
|
|
|
Scene *scene = DEG_get_input_scene(depsgraph);
|
|
|
|
|
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
|
2021-04-19 19:38:05 +02:00
|
|
|
bool used_multiple_passes = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-11-23 11:51:42 +01:00
|
|
|
bool run_callbacks = DEG_id_type_any_updated(depsgraph);
|
|
|
|
|
if (run_callbacks) {
|
2019-09-09 10:25:04 +02:00
|
|
|
BKE_callback_exec_id(bmain, &scene->id, BKE_CB_EVT_DEPSGRAPH_UPDATE_PRE);
|
2018-11-23 11:51:42 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-08 00:12:26 +10:00
|
|
|
for (int pass = 0; pass < 2; pass++) {
|
2019-09-05 12:57:41 +02:00
|
|
|
/* (Re-)build dependency graph if needed. */
|
2020-08-18 15:51:32 +02:00
|
|
|
DEG_graph_relations_update(depsgraph);
|
2019-09-05 12:57:41 +02:00
|
|
|
/* Uncomment this to check if graph was properly tagged for update. */
|
|
|
|
|
// DEG_debug_graph_relations_validate(depsgraph, bmain, scene);
|
|
|
|
|
/* Flush editing data if needed. */
|
|
|
|
|
prepare_mesh_for_viewport_render(bmain, view_layer);
|
|
|
|
|
/* Update all objects: drivers, matrices, displists, etc. flags set
|
2020-09-02 09:58:26 +10:00
|
|
|
* by depsgraph or manual, no layer check here, gets correct flushed. */
|
2020-08-18 17:40:45 +02:00
|
|
|
DEG_evaluate_on_refresh(depsgraph);
|
2019-09-05 12:57:41 +02:00
|
|
|
/* Update sound system. */
|
|
|
|
|
BKE_scene_update_sound(depsgraph, bmain);
|
|
|
|
|
/* Notify python about depsgraph update. */
|
|
|
|
|
if (run_callbacks) {
|
2019-09-09 10:25:04 +02:00
|
|
|
BKE_callback_exec_id_depsgraph(
|
|
|
|
|
bmain, &scene->id, depsgraph, BKE_CB_EVT_DEPSGRAPH_UPDATE_POST);
|
2020-01-02 17:09:57 +01:00
|
|
|
|
|
|
|
|
/* It is possible that the custom callback modified scene and removed some IDs from the main
|
Render: faster animation and re-rendering with Persistent Data
For Cycles, when enabling the Persistent Data option, the full render data
will be preserved from frame-to-frame in animation renders and between
re-renders of the scene. This means that any modifier evaluation, BVH
building, OpenGL vertex buffer uploads, etc, can be done only once for
unchanged objects. This comes at an increased memory cost.
Previously there option was named Persistent Images and had a more limited
impact on render time and memory.
When using multiple view layers, only data from a single view layer is
preserved to keep memory usage somewhat under control. However objects
shared between view layers are preserved, and so this can speedup such
renders as well, even single frame renders.
For Eevee and Workbench this option is not available, however these engines
will now always reuse the depsgraph for animation and multiple view layers.
This can significantly speed up rendering.
These engines do not support sharing the depsgraph between re-renders, due
to technical issues regarding OpenGL contexts. Support for this could be added
if those are solved, see the code comments for details.
2021-04-04 23:51:24 +02:00
|
|
|
* database. In this case DEG_editors_update() will crash because it iterates over all IDs
|
2020-01-02 17:09:57 +01:00
|
|
|
* which depsgraph was built for.
|
|
|
|
|
*
|
|
|
|
|
* The solution is to update relations prior to this call, avoiding access to freed IDs.
|
|
|
|
|
* Should be safe because relations update is supposed to preserve flags of all IDs which are
|
|
|
|
|
* still a part of the dependency graph. If an ID is kicked out of the dependency graph it
|
|
|
|
|
* should also be fine because when/if it's added to another dependency graph it will need to
|
|
|
|
|
* be tagged for an update anyway.
|
|
|
|
|
*
|
|
|
|
|
* If there are no relations changed by the callback this call will do nothing. */
|
2020-08-18 15:51:32 +02:00
|
|
|
DEG_graph_relations_update(depsgraph);
|
2019-09-05 12:57:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If user callback did not tag anything for update we can skip second iteration.
|
|
|
|
|
* Otherwise we update scene once again, but without running callbacks to bring
|
|
|
|
|
* scene to a fully evaluated state with user modifications taken into account. */
|
|
|
|
|
if (DEG_is_fully_evaluated(depsgraph)) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 19:38:05 +02:00
|
|
|
/* Clear recalc flags for second pass, but back them up for editors update. */
|
2021-04-19 22:37:39 +02:00
|
|
|
const bool backup = true;
|
|
|
|
|
DEG_ids_clear_recalc(depsgraph, backup);
|
2021-04-19 19:38:05 +02:00
|
|
|
used_multiple_passes = true;
|
2019-09-05 12:57:41 +02:00
|
|
|
run_callbacks = false;
|
2018-11-23 11:51:42 +01:00
|
|
|
}
|
2021-04-19 19:38:05 +02:00
|
|
|
|
|
|
|
|
/* Inform editors about changes, using recalc flags from both passes. */
|
|
|
|
|
if (used_multiple_passes) {
|
|
|
|
|
DEG_ids_restore_recalc(depsgraph);
|
|
|
|
|
}
|
2021-04-19 22:37:39 +02:00
|
|
|
const bool is_time_update = false;
|
|
|
|
|
DEG_editors_update(depsgraph, is_time_update);
|
|
|
|
|
|
|
|
|
|
const bool backup = false;
|
|
|
|
|
DEG_ids_clear_recalc(depsgraph, backup);
|
2009-12-10 11:08:38 +00:00
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2019-05-28 15:52:26 +02:00
|
|
|
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain)
|
|
|
|
|
{
|
|
|
|
|
scene_graph_update_tagged(depsgraph, bmain, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
|
|
|
|
|
{
|
|
|
|
|
scene_graph_update_tagged(depsgraph, bmain, true);
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-31 10:59:39 +00:00
|
|
|
/* applies changes right away, does all sets too */
|
2021-04-19 22:37:39 +02:00
|
|
|
void BKE_scene_graph_update_for_newframe_ex(Depsgraph *depsgraph, const bool clear_recalc)
|
2007-01-31 10:59:39 +00:00
|
|
|
{
|
2018-04-06 11:21:20 +02:00
|
|
|
Scene *scene = DEG_get_input_scene(depsgraph);
|
2020-08-18 15:45:58 +02:00
|
|
|
Main *bmain = DEG_get_bmain(depsgraph);
|
2021-04-19 19:38:05 +02:00
|
|
|
bool used_multiple_passes = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-11-28 12:56:01 +01:00
|
|
|
/* Keep this first. */
|
2019-09-09 10:25:04 +02:00
|
|
|
BKE_callback_exec_id(bmain, &scene->id, BKE_CB_EVT_FRAME_CHANGE_PRE);
|
2019-09-05 12:57:41 +02:00
|
|
|
|
2019-09-08 00:12:26 +10:00
|
|
|
for (int pass = 0; pass < 2; pass++) {
|
2019-09-05 12:57:41 +02:00
|
|
|
/* 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_editors_update_frame(bmain, scene->r.cfra);
|
|
|
|
|
BKE_sound_set_cfra(scene->r.cfra);
|
2020-08-18 15:51:32 +02:00
|
|
|
DEG_graph_relations_update(depsgraph);
|
2019-09-05 12:57:41 +02:00
|
|
|
/* Update all objects: drivers, matrices, displists, etc. flags set
|
|
|
|
|
* by depgraph or manual, no layer check here, gets correct flushed.
|
2019-09-10 11:13:19 +02:00
|
|
|
*
|
|
|
|
|
* NOTE: Only update for new frame on first iteration. Second iteration is for ensuring user
|
|
|
|
|
* edits from callback are properly taken into account. Doing a time update on those would
|
|
|
|
|
* lose any possible unkeyed changes made by the handler. */
|
|
|
|
|
if (pass == 0) {
|
|
|
|
|
const float ctime = BKE_scene_frame_get(scene);
|
2020-08-18 17:40:45 +02:00
|
|
|
DEG_evaluate_on_framechange(depsgraph, ctime);
|
2019-09-10 11:13:19 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2020-08-18 17:40:45 +02:00
|
|
|
DEG_evaluate_on_refresh(depsgraph);
|
2019-09-10 11:13:19 +02:00
|
|
|
}
|
2019-09-05 12:57:41 +02:00
|
|
|
/* Update sound system animation. */
|
|
|
|
|
BKE_scene_update_sound(depsgraph, bmain);
|
|
|
|
|
|
|
|
|
|
/* Notify editors and python about recalc. */
|
|
|
|
|
if (pass == 0) {
|
2019-09-09 10:25:04 +02:00
|
|
|
BKE_callback_exec_id_depsgraph(bmain, &scene->id, depsgraph, BKE_CB_EVT_FRAME_CHANGE_POST);
|
2020-01-02 17:09:57 +01:00
|
|
|
|
|
|
|
|
/* NOTE: Similar to this case in scene_graph_update_tagged(). Need to ensure that
|
Render: faster animation and re-rendering with Persistent Data
For Cycles, when enabling the Persistent Data option, the full render data
will be preserved from frame-to-frame in animation renders and between
re-renders of the scene. This means that any modifier evaluation, BVH
building, OpenGL vertex buffer uploads, etc, can be done only once for
unchanged objects. This comes at an increased memory cost.
Previously there option was named Persistent Images and had a more limited
impact on render time and memory.
When using multiple view layers, only data from a single view layer is
preserved to keep memory usage somewhat under control. However objects
shared between view layers are preserved, and so this can speedup such
renders as well, even single frame renders.
For Eevee and Workbench this option is not available, however these engines
will now always reuse the depsgraph for animation and multiple view layers.
This can significantly speed up rendering.
These engines do not support sharing the depsgraph between re-renders, due
to technical issues regarding OpenGL contexts. Support for this could be added
if those are solved, see the code comments for details.
2021-04-04 23:51:24 +02:00
|
|
|
* DEG_editors_update() doesn't access freed memory of possibly removed ID. */
|
2020-08-18 15:51:32 +02:00
|
|
|
DEG_graph_relations_update(depsgraph);
|
2019-09-05 12:57:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If user callback did not tag anything for update we can skip second iteration.
|
|
|
|
|
* Otherwise we update scene once again, but without running callbacks to bring
|
|
|
|
|
* scene to a fully evaluated state with user modifications taken into account. */
|
|
|
|
|
if (DEG_is_fully_evaluated(depsgraph)) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-04-19 19:38:05 +02:00
|
|
|
|
|
|
|
|
/* Clear recalc flags for second pass, but back them up for editors update. */
|
2021-04-19 22:37:39 +02:00
|
|
|
const bool backup = true;
|
|
|
|
|
DEG_ids_clear_recalc(depsgraph, backup);
|
2021-04-19 19:38:05 +02:00
|
|
|
used_multiple_passes = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Inform editors about changes, using recalc flags from both passes. */
|
|
|
|
|
if (used_multiple_passes) {
|
|
|
|
|
DEG_ids_restore_recalc(depsgraph);
|
2019-09-05 12:57:41 +02:00
|
|
|
}
|
2021-04-19 22:37:39 +02:00
|
|
|
|
|
|
|
|
const bool is_time_update = true;
|
|
|
|
|
DEG_editors_update(depsgraph, is_time_update);
|
|
|
|
|
|
|
|
|
|
/* Clear recalc flags, can be skipped for e.g. renderers that will read these
|
|
|
|
|
* and clear the flags later. */
|
|
|
|
|
if (clear_recalc) {
|
|
|
|
|
const bool backup = false;
|
|
|
|
|
DEG_ids_clear_recalc(depsgraph, backup);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
|
|
|
|
|
{
|
|
|
|
|
BKE_scene_graph_update_for_newframe_ex(depsgraph, true);
|
2007-01-31 10:59:39 +00:00
|
|
|
}
|
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
|
* Ensures given scene/view_layer pair has a valid, up-to-date depsgraph.
|
2018-08-03 10:13:33 +02:00
|
|
|
*
|
2019-04-27 12:07:07 +10:00
|
|
|
* \warning Sets matching depsgraph as active,
|
|
|
|
|
* so should only be called from the active editing context (usually, from operators).
|
2018-08-03 10:13:33 +02:00
|
|
|
*/
|
|
|
|
|
void BKE_scene_view_layer_graph_evaluated_ensure(Main *bmain, Scene *scene, ViewLayer *view_layer)
|
|
|
|
|
{
|
2020-08-21 11:56:03 +02:00
|
|
|
Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer);
|
2018-08-03 10:13:33 +02:00
|
|
|
DEG_make_active(depsgraph);
|
|
|
|
|
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* return default view */
|
|
|
|
|
SceneRenderView *BKE_scene_add_render_view(Scene *sce, const char *name)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (!name) {
|
2015-04-06 10:40:12 -03:00
|
|
|
name = DATA_("RenderView");
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
if (scene->r.views.first == scene->r.views.last) {
|
2015-04-06 10:40:12 -03:00
|
|
|
/* 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
|
|
|
{
|
2017-06-02 15:38:04 +10:00
|
|
|
if (r->mode & R_SIMPLIFY) {
|
2019-04-22 09:39:35 +10:00
|
|
|
if (for_render) {
|
2015-05-04 16:26:28 +05:00
|
|
|
return min_ii(r->simplify_subsurf_render, lvl);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
return min_ii(r->simplify_subsurf, lvl);
|
2015-05-04 16:26:28 +05:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
return lvl;
|
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) {
|
2019-04-22 09:39:35 +10:00
|
|
|
if (for_render) {
|
2015-05-04 16:26:28 +05:00
|
|
|
return (int)(r->simplify_particles_render * num);
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
return (int)(r->simplify_particles * num);
|
2015-05-04 16:26:28 +05:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
return num;
|
2008-02-13 11:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
2017-02-15 14:04:11 +01:00
|
|
|
/**
|
2019-03-19 15:17:46 +11:00
|
|
|
* Helper function for the SETLOOPER and SETLOOPER_VIEW_LAYER macros
|
|
|
|
|
*
|
|
|
|
|
* It iterates over the bases of the active layer and then the bases
|
|
|
|
|
* of the active layer of the background (set) scenes recursively.
|
|
|
|
|
*/
|
2017-11-22 10:52:39 -02:00
|
|
|
Base *_setlooper_base_step(Scene **sce_iter, ViewLayer *view_layer, Base *base)
|
2010-04-02 13:43:56 +00:00
|
|
|
{
|
2012-02-23 02:17:50 +00:00
|
|
|
if (base && base->next) {
|
2017-10-16 17:15:03 -02:00
|
|
|
/* Common case, step to the next. */
|
2011-04-21 13:11:51 +00:00
|
|
|
return base->next;
|
|
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
if ((base == NULL) && (view_layer != NULL)) {
|
2017-10-16 17:15:03 -02:00
|
|
|
/* First time looping, return the scenes first base. */
|
|
|
|
|
/* For the first loop we should get the layer from workspace when available. */
|
2017-11-22 10:52:39 -02:00
|
|
|
if (view_layer->object_bases.first) {
|
|
|
|
|
return (Base *)view_layer->object_bases.first;
|
2017-02-15 14:04:11 +01:00
|
|
|
}
|
2017-10-16 17:15:03 -02:00
|
|
|
/* No base on this scene layer. */
|
2017-02-15 14:04:11 +01:00
|
|
|
goto next_set;
|
2011-04-21 13:11:51 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2017-02-15 14:04:11 +01:00
|
|
|
next_set:
|
2017-10-16 17:15:03 -02:00
|
|
|
/* Reached the end, get the next base in the set. */
|
2012-05-06 15:15:33 +00:00
|
|
|
while ((*sce_iter = (*sce_iter)->set)) {
|
2018-04-24 15:20:17 +02:00
|
|
|
ViewLayer *view_layer_set = BKE_view_layer_default_render((*sce_iter));
|
2017-11-22 10:52:39 -02:00
|
|
|
base = (Base *)view_layer_set->object_bases.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (base) {
|
2011-04-21 13:11:51 +00:00
|
|
|
return base;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02: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-05-06 23:50:54 +10:00
|
|
|
bool BKE_scene_use_shading_nodes_custom(Scene *scene)
|
|
|
|
|
{
|
2018-04-17 13:35:05 +02: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
|
|
|
}
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2018-04-17 13:35:05 +02:00
|
|
|
RenderEngineType *type = RE_engines_find(scene->r.engine);
|
|
|
|
|
return (type && type->flag & RE_USE_SPHERICAL_STEREO);
|
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
|
|
|
}
|
|
|
|
|
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
bool BKE_scene_uses_blender_eevee(const Scene *scene)
|
2014-08-27 15:52:24 +02:00
|
|
|
{
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
return STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE);
|
2014-08-27 15:52:24 +02:00
|
|
|
}
|
|
|
|
|
|
2018-11-26 19:00:01 +01:00
|
|
|
bool BKE_scene_uses_blender_workbench(const Scene *scene)
|
2018-07-11 11:43:56 +02:00
|
|
|
{
|
2018-11-26 19:00:01 +01:00
|
|
|
return STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH);
|
2018-07-11 11:43:56 +02:00
|
|
|
}
|
|
|
|
|
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
bool BKE_scene_uses_cycles(const Scene *scene)
|
2017-05-02 19:55:02 +02:00
|
|
|
{
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
return STREQ(scene->r.engine, RE_engine_id_CYCLES);
|
2017-05-02 19:55:02 +02:00
|
|
|
}
|
|
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
void BKE_scene_base_flag_to_objects(ViewLayer *view_layer)
|
2012-05-05 14:03:12 +00:00
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
Base *base = view_layer->object_bases.first;
|
2012-05-05 14:03:12 +00:00
|
|
|
|
|
|
|
|
while (base) {
|
2017-02-08 12:26:41 +01:00
|
|
|
BKE_scene_object_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
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
2019-04-30 16:12:50 -03:00
|
|
|
/**
|
|
|
|
|
* Synchronize object base flags
|
|
|
|
|
*
|
|
|
|
|
* This is usually handled by the depsgraph.
|
|
|
|
|
* However, in rare occasions we need to use the latest object flags
|
|
|
|
|
* before depsgraph is fully updated.
|
|
|
|
|
*
|
|
|
|
|
* It should (ideally) only run for copy-on-written objects since this is
|
|
|
|
|
* runtime data generated per-viewlayer.
|
|
|
|
|
*/
|
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_object_base_flag_sync_from_base(Base *base)
|
|
|
|
|
{
|
|
|
|
|
Object *ob = base->object;
|
2019-04-30 16:12:50 -03:00
|
|
|
ob->base_flag = base->flag;
|
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
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (threads > 0) {
|
2013-05-08 13:23:17 +00:00
|
|
|
return threads;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2013-05-08 13:23:17 +00:00
|
|
|
|
|
|
|
|
/* fixed number of threads specified in scene? */
|
2019-04-22 09:39:35 +10:00
|
|
|
if (rd->mode & R_FIXED_THREADS) {
|
2013-05-08 13:23:17 +00:00
|
|
|
threads = rd->threads;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2013-05-08 13:23:17 +00:00
|
|
|
threads = BLI_system_thread_count();
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2013-05-08 13:23:17 +00:00
|
|
|
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
|
|
|
|
2017-08-15 00:11:52 +02:00
|
|
|
int BKE_render_preview_pixel_size(const RenderData *r)
|
|
|
|
|
{
|
|
|
|
|
if (r->preview_pixel_size == 0) {
|
2017-10-06 16:56:41 +11:00
|
|
|
return (U.pixelsize > 1.5f) ? 2 : 1;
|
2017-08-15 00:11:52 +02:00
|
|
|
}
|
|
|
|
|
return r->preview_pixel_size;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-27 12:07:07 +10:00
|
|
|
/**
|
|
|
|
|
* Apply the needed correction factor to value, based on unit_type
|
|
|
|
|
* (only length-related are affected currently) and unit->scale_length.
|
2014-08-26 20:52:07 +10:00
|
|
|
*/
|
|
|
|
|
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;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-08-26 20:52:07 +10:00
|
|
|
switch (unit_type) {
|
|
|
|
|
case B_UNIT_LENGTH:
|
2019-09-17 13:37:43 +02:00
|
|
|
case B_UNIT_VELOCITY:
|
|
|
|
|
case B_UNIT_ACCELERATION:
|
2014-08-26 20:52:07 +10:00
|
|
|
return value * (double)unit->scale_length;
|
|
|
|
|
case B_UNIT_AREA:
|
2019-02-08 12:31:28 +01:00
|
|
|
case B_UNIT_POWER:
|
2014-08-26 20:52:07 +10:00
|
|
|
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;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return 1;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
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++;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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];
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return false;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2019-04-22 09:39:35 +10:00
|
|
|
if (srv == NULL) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return false;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return false;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((srv->viewflag & SCE_VIEW_DISABLE)) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return false;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return true;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
/* SCE_VIEWS_SETUP_BASIC */
|
2020-11-06 15:29:25 +11:00
|
|
|
if (STR_ELEM(srv->name, STEREO_LEFT_NAME, STEREO_RIGHT_NAME)) {
|
2015-04-06 10:40:12 -03:00
|
|
|
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;
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return true;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((!viewname) || (!viewname[0])) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return true;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return true;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((!viewname) || (!viewname[0])) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return true;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return NULL;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
for (srv = rd->views.first, nr = 0; srv; srv = srv->next) {
|
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
2019-04-22 09:39:35 +10:00
|
|
|
if (nr++ == view_id) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return srv;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if (srv) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return srv->name;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
return "";
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((!rd) || ((rd->scemode & R_MULTIVIEW) == 0)) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return 0;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((!viewname) || (!viewname[0])) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return 0;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
nr += 1;
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
2019-04-22 09:39:35 +10:00
|
|
|
if (srv) {
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_strncpy(suffix, srv->suffix, sizeof(suffix));
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_strncpy(suffix, viewname, sizeof(suffix));
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((viewname == NULL) || (viewname[0] == '\0')) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return viewname;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
srv = BLI_findstring(&rd->views, viewname, offsetof(SceneRenderView, name));
|
2019-04-22 09:39:35 +10:00
|
|
|
if (srv) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return srv->suffix;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
return viewname;
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
|
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 "";
|
|
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
const char *viewname = BKE_scene_multiview_render_view_name_get(rd, view_id);
|
|
|
|
|
return BKE_scene_multiview_view_suffix_get(rd, viewname);
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-27 11:00:47 +02:00
|
|
|
void BKE_scene_multiview_view_prefix_get(Scene *scene,
|
|
|
|
|
const char *name,
|
2020-03-06 12:49:00 +11:00
|
|
|
char *r_prefix,
|
|
|
|
|
const char **r_ext)
|
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'};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 12:49:00 +11:00
|
|
|
r_prefix[0] = '\0';
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* begin of extension */
|
2020-03-06 12:49:00 +11:00
|
|
|
index_act = BLI_str_rpartition(name, delims, r_ext, &suf_act);
|
|
|
|
|
if (*r_ext == NULL) {
|
2016-02-20 17:43:31 +01:00
|
|
|
return;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
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);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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)) {
|
2020-03-06 12:49:00 +11:00
|
|
|
const size_t len = strlen(srv->suffix);
|
|
|
|
|
const size_t ext_len = strlen(*r_ext);
|
|
|
|
|
if (ext_len >= len && STREQLEN(*r_ext - len, srv->suffix, len)) {
|
|
|
|
|
BLI_strncpy(r_prefix, name, strlen(name) - ext_len - len + 1);
|
2015-04-06 10:40:12 -03:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
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
|
|
|
{
|
2019-04-22 09:39:35 +10:00
|
|
|
if (BKE_imtype_is_movie(rd->im_format.imtype) == false) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return 0;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2019-04-22 09:39:35 +10:00
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return 1;
|
2019-04-22 09:39:35 +10:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
if (rd->im_format.views_format == R_IMF_VIEWS_STEREO_3D) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2020-08-07 12:30:43 +02:00
|
|
|
|
|
|
|
|
/* R_IMF_VIEWS_INDIVIDUAL */
|
|
|
|
|
return BKE_scene_multiview_num_views_get(rd);
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
2017-07-13 15:43:36 +02:00
|
|
|
|
2017-10-20 12:28:25 +02:00
|
|
|
/* Manipulation of depsgraph storage. */
|
|
|
|
|
|
|
|
|
|
/* This is a key which identifies depsgraph. */
|
|
|
|
|
typedef struct DepsgraphKey {
|
2021-01-28 13:36:23 +01:00
|
|
|
const ViewLayer *view_layer;
|
2017-10-20 12:28:25 +02:00
|
|
|
/* TODO(sergey): Need to include window somehow (same layer might be in a
|
|
|
|
|
* different states in different windows).
|
|
|
|
|
*/
|
|
|
|
|
} DepsgraphKey;
|
|
|
|
|
|
|
|
|
|
static unsigned int depsgraph_key_hash(const void *key_v)
|
|
|
|
|
{
|
|
|
|
|
const DepsgraphKey *key = key_v;
|
2017-11-22 10:52:39 -02:00
|
|
|
unsigned int hash = BLI_ghashutil_ptrhash(key->view_layer);
|
2017-10-20 12:28:25 +02:00
|
|
|
/* TODO(sergey): Include hash from other fields in the key. */
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool depsgraph_key_compare(const void *key_a_v, const void *key_b_v)
|
|
|
|
|
{
|
|
|
|
|
const DepsgraphKey *key_a = key_a_v;
|
|
|
|
|
const DepsgraphKey *key_b = key_b_v;
|
|
|
|
|
/* TODO(sergey): Compare rest of */
|
2017-11-22 10:52:39 -02:00
|
|
|
return !(key_a->view_layer == key_b->view_layer);
|
2017-10-20 12:28:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void depsgraph_key_free(void *key_v)
|
|
|
|
|
{
|
|
|
|
|
DepsgraphKey *key = key_v;
|
|
|
|
|
MEM_freeN(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void depsgraph_key_value_free(void *value)
|
|
|
|
|
{
|
|
|
|
|
Depsgraph *depsgraph = value;
|
|
|
|
|
DEG_graph_free(depsgraph);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_allocate_depsgraph_hash(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
scene->depsgraph_hash = BLI_ghash_new(
|
|
|
|
|
depsgraph_key_hash, depsgraph_key_compare, "Scene Depsgraph Hash");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_ensure_depsgraph_hash(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
if (scene->depsgraph_hash == NULL) {
|
|
|
|
|
BKE_scene_allocate_depsgraph_hash(scene);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_free_depsgraph_hash(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
if (scene->depsgraph_hash == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
BLI_ghash_free(scene->depsgraph_hash, depsgraph_key_free, depsgraph_key_value_free);
|
2019-06-04 13:37:45 +02:00
|
|
|
scene->depsgraph_hash = NULL;
|
2017-10-20 12:28:25 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-11 14:18:22 +01:00
|
|
|
void BKE_scene_free_view_layer_depsgraph(Scene *scene, ViewLayer *view_layer)
|
|
|
|
|
{
|
|
|
|
|
if (scene->depsgraph_hash != NULL) {
|
|
|
|
|
DepsgraphKey key = {view_layer};
|
|
|
|
|
BLI_ghash_remove(scene->depsgraph_hash, &key, depsgraph_key_free, depsgraph_key_value_free);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-20 12:28:25 +02:00
|
|
|
/* Query depsgraph for a specific contexts. */
|
|
|
|
|
|
2020-08-21 11:56:03 +02:00
|
|
|
static Depsgraph **scene_get_depsgraph_p(Scene *scene,
|
2020-03-17 11:24:37 +01:00
|
|
|
ViewLayer *view_layer,
|
2020-08-21 11:56:03 +02:00
|
|
|
const bool allocate_ghash_entry)
|
2017-07-13 15:43:36 +02:00
|
|
|
{
|
2020-08-21 11:19:07 +02:00
|
|
|
/* bmain may be NULL here! */
|
2017-11-07 17:01:14 +01:00
|
|
|
BLI_assert(scene != NULL);
|
2017-11-22 10:52:39 -02:00
|
|
|
BLI_assert(view_layer != NULL);
|
2020-08-21 11:19:07 +02:00
|
|
|
BLI_assert(BKE_scene_has_view_layer(scene, view_layer));
|
|
|
|
|
|
2017-11-07 17:01:14 +01:00
|
|
|
/* Make sure hash itself exists. */
|
2020-03-17 11:24:37 +01:00
|
|
|
if (allocate_ghash_entry) {
|
2017-11-07 17:01:14 +01:00
|
|
|
BKE_scene_ensure_depsgraph_hash(scene);
|
|
|
|
|
}
|
|
|
|
|
if (scene->depsgraph_hash == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2020-08-21 11:56:03 +02:00
|
|
|
|
2017-11-07 17:01:14 +01:00
|
|
|
DepsgraphKey key;
|
2017-11-22 10:52:39 -02:00
|
|
|
key.view_layer = view_layer;
|
2020-08-21 11:21:16 +02:00
|
|
|
|
2020-03-17 11:24:37 +01:00
|
|
|
Depsgraph **depsgraph_ptr;
|
2020-08-21 11:21:16 +02:00
|
|
|
if (!allocate_ghash_entry) {
|
2020-03-17 11:24:37 +01:00
|
|
|
depsgraph_ptr = (Depsgraph **)BLI_ghash_lookup_p(scene->depsgraph_hash, &key);
|
2020-08-21 11:21:16 +02:00
|
|
|
return depsgraph_ptr;
|
2020-03-17 11:24:37 +01:00
|
|
|
}
|
2020-08-21 11:21:16 +02:00
|
|
|
|
|
|
|
|
DepsgraphKey **key_ptr;
|
|
|
|
|
if (BLI_ghash_ensure_p_ex(
|
|
|
|
|
scene->depsgraph_hash, &key, (void ***)&key_ptr, (void ***)&depsgraph_ptr)) {
|
|
|
|
|
return depsgraph_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-21 11:56:03 +02:00
|
|
|
/* Depsgraph was not found in the ghash, but the key still needs allocating. */
|
2020-08-21 11:21:16 +02:00
|
|
|
*key_ptr = MEM_mallocN(sizeof(DepsgraphKey), __func__);
|
|
|
|
|
**key_ptr = key;
|
|
|
|
|
|
2020-08-21 11:56:03 +02:00
|
|
|
*depsgraph_ptr = NULL;
|
|
|
|
|
return depsgraph_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Depsgraph **scene_ensure_depsgraph_p(Main *bmain, Scene *scene, ViewLayer *view_layer)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(bmain != NULL);
|
|
|
|
|
|
|
|
|
|
Depsgraph **depsgraph_ptr = scene_get_depsgraph_p(scene, view_layer, true);
|
|
|
|
|
if (depsgraph_ptr == NULL) {
|
|
|
|
|
/* The scene has no depsgraph hash. */
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (*depsgraph_ptr != NULL) {
|
|
|
|
|
/* The depsgraph was found, no need to allocate. */
|
|
|
|
|
return depsgraph_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Allocate a new depsgraph. scene_get_depsgraph_p() already ensured that the pointer is stored
|
|
|
|
|
* in the scene's depsgraph hash. */
|
2020-08-21 11:21:16 +02:00
|
|
|
*depsgraph_ptr = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_VIEWPORT);
|
2020-08-21 11:56:03 +02:00
|
|
|
|
2020-08-21 11:21:16 +02:00
|
|
|
/* TODO(sergey): Would be cool to avoid string format print,
|
|
|
|
|
* but is a bit tricky because we can't know in advance whether
|
|
|
|
|
* we will ever enable debug messages for this depsgraph.
|
|
|
|
|
*/
|
|
|
|
|
char name[1024];
|
|
|
|
|
BLI_snprintf(name, sizeof(name), "%s :: %s", scene->id.name, view_layer->name);
|
|
|
|
|
DEG_debug_name_set(*depsgraph_ptr, name);
|
|
|
|
|
|
Render: faster animation and re-rendering with Persistent Data
For Cycles, when enabling the Persistent Data option, the full render data
will be preserved from frame-to-frame in animation renders and between
re-renders of the scene. This means that any modifier evaluation, BVH
building, OpenGL vertex buffer uploads, etc, can be done only once for
unchanged objects. This comes at an increased memory cost.
Previously there option was named Persistent Images and had a more limited
impact on render time and memory.
When using multiple view layers, only data from a single view layer is
preserved to keep memory usage somewhat under control. However objects
shared between view layers are preserved, and so this can speedup such
renders as well, even single frame renders.
For Eevee and Workbench this option is not available, however these engines
will now always reuse the depsgraph for animation and multiple view layers.
This can significantly speed up rendering.
These engines do not support sharing the depsgraph between re-renders, due
to technical issues regarding OpenGL contexts. Support for this could be added
if those are solved, see the code comments for details.
2021-04-04 23:51:24 +02:00
|
|
|
/* These viewport depsgraphs communicate changes to the editors. */
|
|
|
|
|
DEG_enable_editors_update(*depsgraph_ptr);
|
|
|
|
|
|
2020-03-17 11:24:37 +01:00
|
|
|
return depsgraph_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-29 15:48:14 +01:00
|
|
|
Depsgraph *BKE_scene_get_depsgraph(const Scene *scene, const ViewLayer *view_layer)
|
2020-08-21 11:56:03 +02:00
|
|
|
{
|
2021-01-29 15:48:14 +01:00
|
|
|
BLI_assert(BKE_scene_has_view_layer(scene, view_layer));
|
|
|
|
|
|
2021-02-01 09:55:06 +01:00
|
|
|
if (scene->depsgraph_hash == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-29 15:48:14 +01:00
|
|
|
DepsgraphKey key;
|
|
|
|
|
key.view_layer = view_layer;
|
|
|
|
|
return BLI_ghash_lookup(scene->depsgraph_hash, &key);
|
2020-08-21 11:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Depsgraph *BKE_scene_ensure_depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer)
|
2020-03-17 11:24:37 +01:00
|
|
|
{
|
2020-08-21 11:56:03 +02:00
|
|
|
Depsgraph **depsgraph_ptr = scene_ensure_depsgraph_p(bmain, scene, view_layer);
|
2020-03-17 11:24:37 +01:00
|
|
|
return (depsgraph_ptr != NULL) ? *depsgraph_ptr : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *scene_undo_depsgraph_gen_key(Scene *scene, ViewLayer *view_layer, char *key_full)
|
|
|
|
|
{
|
|
|
|
|
if (key_full == NULL) {
|
|
|
|
|
key_full = MEM_callocN(MAX_ID_NAME + FILE_MAX + MAX_NAME, __func__);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t key_full_offset = BLI_strncpy_rlen(key_full, scene->id.name, MAX_ID_NAME);
|
|
|
|
|
if (scene->id.lib != NULL) {
|
2020-06-23 09:54:14 +10:00
|
|
|
key_full_offset += BLI_strncpy_rlen(
|
|
|
|
|
key_full + key_full_offset, scene->id.lib->filepath, FILE_MAX);
|
2020-03-17 11:24:37 +01:00
|
|
|
}
|
|
|
|
|
key_full_offset += BLI_strncpy_rlen(key_full + key_full_offset, view_layer->name, MAX_NAME);
|
|
|
|
|
BLI_assert(key_full_offset < MAX_ID_NAME + FILE_MAX + MAX_NAME);
|
|
|
|
|
|
|
|
|
|
return key_full;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GHash *BKE_scene_undo_depsgraphs_extract(Main *bmain)
|
|
|
|
|
{
|
|
|
|
|
GHash *depsgraph_extract = BLI_ghash_new(
|
|
|
|
|
BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, __func__);
|
|
|
|
|
|
|
|
|
|
for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
|
|
|
|
|
if (scene->depsgraph_hash == NULL) {
|
2021-04-19 22:37:39 +02:00
|
|
|
/* In some cases, e.g. when undo has to perform multiple steps at once, no depsgraph will
|
|
|
|
|
* be built so this pointer may be NULL. */
|
2020-03-17 11:24:37 +01:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL;
|
|
|
|
|
view_layer = view_layer->next) {
|
|
|
|
|
DepsgraphKey key;
|
|
|
|
|
key.view_layer = view_layer;
|
|
|
|
|
Depsgraph **depsgraph = (Depsgraph **)BLI_ghash_lookup_p(scene->depsgraph_hash, &key);
|
|
|
|
|
|
|
|
|
|
if (depsgraph != NULL && *depsgraph != NULL) {
|
|
|
|
|
char *key_full = scene_undo_depsgraph_gen_key(scene, view_layer, NULL);
|
|
|
|
|
|
|
|
|
|
/* We steal the depsgraph from the scene. */
|
|
|
|
|
BLI_ghash_insert(depsgraph_extract, key_full, *depsgraph);
|
|
|
|
|
*depsgraph = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return depsgraph_extract;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_undo_depsgraphs_restore(Main *bmain, GHash *depsgraph_extract)
|
|
|
|
|
{
|
|
|
|
|
for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
|
|
|
|
|
for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL;
|
|
|
|
|
view_layer = view_layer->next) {
|
|
|
|
|
char key_full[MAX_ID_NAME + FILE_MAX + MAX_NAME] = {0};
|
|
|
|
|
scene_undo_depsgraph_gen_key(scene, view_layer, key_full);
|
|
|
|
|
|
|
|
|
|
Depsgraph **depsgraph_extract_ptr = (Depsgraph **)BLI_ghash_lookup_p(depsgraph_extract,
|
|
|
|
|
key_full);
|
|
|
|
|
if (depsgraph_extract_ptr == NULL) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
BLI_assert(*depsgraph_extract_ptr != NULL);
|
|
|
|
|
|
2020-08-21 11:56:03 +02:00
|
|
|
Depsgraph **depsgraph_scene_ptr = scene_get_depsgraph_p(scene, view_layer, true);
|
2020-03-17 11:24:37 +01:00
|
|
|
BLI_assert(depsgraph_scene_ptr != NULL);
|
|
|
|
|
BLI_assert(*depsgraph_scene_ptr == NULL);
|
|
|
|
|
|
|
|
|
|
/* We steal the depsgraph back from our 'extract' storage to the scene. */
|
|
|
|
|
Depsgraph *depsgraph = *depsgraph_extract_ptr;
|
|
|
|
|
|
|
|
|
|
DEG_graph_replace_owners(depsgraph, bmain, scene, view_layer);
|
|
|
|
|
|
|
|
|
|
DEG_graph_tag_relations_update(depsgraph);
|
|
|
|
|
|
|
|
|
|
*depsgraph_scene_ptr = depsgraph;
|
|
|
|
|
*depsgraph_extract_ptr = NULL;
|
|
|
|
|
}
|
2017-11-07 16:29:31 +01:00
|
|
|
}
|
2020-03-17 11:24:37 +01:00
|
|
|
|
|
|
|
|
BLI_ghash_free(depsgraph_extract, MEM_freeN, depsgraph_key_value_free);
|
2017-07-13 15:43:36 +02:00
|
|
|
}
|
2018-04-18 09:12:44 +02:00
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Scene Orientation
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
void BKE_scene_transform_orientation_remove(Scene *scene, TransformOrientation *orientation)
|
|
|
|
|
{
|
|
|
|
|
const int orientation_index = BKE_scene_transform_orientation_get_index(scene, orientation);
|
2018-12-19 20:51:04 +11:00
|
|
|
|
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
|
|
|
|
|
TransformOrientationSlot *orient_slot = &scene->orientation_slots[i];
|
|
|
|
|
if (orient_slot->index_custom == orientation_index) {
|
|
|
|
|
/* could also use orientation_index-- */
|
2019-02-08 15:14:54 +11:00
|
|
|
orient_slot->type = V3D_ORIENT_GLOBAL;
|
2018-12-19 20:51:04 +11:00
|
|
|
orient_slot->index_custom = -1;
|
|
|
|
|
}
|
2020-09-04 15:01:04 -03:00
|
|
|
else if (orient_slot->index_custom > orientation_index) {
|
|
|
|
|
BLI_assert(orient_slot->type == V3D_ORIENT_CUSTOM);
|
|
|
|
|
orient_slot->index_custom--;
|
|
|
|
|
}
|
2018-04-18 09:12:44 +02:00
|
|
|
}
|
2018-12-19 20:51:04 +11:00
|
|
|
|
2018-04-18 09:12:44 +02:00
|
|
|
BLI_freelinkN(&scene->transform_spaces, orientation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TransformOrientation *BKE_scene_transform_orientation_find(const Scene *scene, const int index)
|
|
|
|
|
{
|
|
|
|
|
return BLI_findlink(&scene->transform_spaces, index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-04-27 12:07:07 +10:00
|
|
|
* \return the index that \a orientation has within \a scene's transform-orientation list
|
|
|
|
|
* or -1 if not found.
|
2018-04-18 09:12:44 +02:00
|
|
|
*/
|
|
|
|
|
int BKE_scene_transform_orientation_get_index(const Scene *scene,
|
|
|
|
|
const TransformOrientation *orientation)
|
|
|
|
|
{
|
|
|
|
|
return BLI_findindex(&scene->transform_spaces, orientation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
2019-02-26 00:58:35 +11:00
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Scene Cursor Rotation
|
|
|
|
|
*
|
|
|
|
|
* Matches #BKE_object_rot_to_mat3 and #BKE_object_mat3_to_rot.
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
void BKE_scene_cursor_rot_to_mat3(const View3DCursor *cursor, float mat[3][3])
|
|
|
|
|
{
|
|
|
|
|
if (cursor->rotation_mode > 0) {
|
|
|
|
|
eulO_to_mat3(mat, cursor->rotation_euler, cursor->rotation_mode);
|
|
|
|
|
}
|
|
|
|
|
else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
|
|
|
|
|
axis_angle_to_mat3(mat, cursor->rotation_axis, cursor->rotation_angle);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
float tquat[4];
|
|
|
|
|
normalize_qt_qt(tquat, cursor->rotation_quaternion);
|
|
|
|
|
quat_to_mat3(mat, tquat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_cursor_rot_to_quat(const View3DCursor *cursor, float quat[4])
|
|
|
|
|
{
|
|
|
|
|
if (cursor->rotation_mode > 0) {
|
|
|
|
|
eulO_to_quat(quat, cursor->rotation_euler, cursor->rotation_mode);
|
|
|
|
|
}
|
|
|
|
|
else if (cursor->rotation_mode == ROT_MODE_AXISANGLE) {
|
|
|
|
|
axis_angle_to_quat(quat, cursor->rotation_axis, cursor->rotation_angle);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
normalize_qt_qt(quat, cursor->rotation_quaternion);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_cursor_mat3_to_rot(View3DCursor *cursor, const float mat[3][3], bool use_compat)
|
|
|
|
|
{
|
|
|
|
|
BLI_ASSERT_UNIT_M3(mat);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-26 00:58:35 +11:00
|
|
|
switch (cursor->rotation_mode) {
|
|
|
|
|
case ROT_MODE_QUAT: {
|
2020-01-15 19:03:05 +11:00
|
|
|
float quat[4];
|
|
|
|
|
mat3_normalized_to_quat(quat, mat);
|
|
|
|
|
if (use_compat) {
|
|
|
|
|
float quat_orig[4];
|
|
|
|
|
copy_v4_v4(quat_orig, cursor->rotation_quaternion);
|
|
|
|
|
quat_to_compatible_quat(cursor->rotation_quaternion, quat, quat_orig);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_v4_v4(cursor->rotation_quaternion, quat);
|
|
|
|
|
}
|
2019-02-26 00:58:35 +11:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ROT_MODE_AXISANGLE: {
|
|
|
|
|
mat3_to_axis_angle(cursor->rotation_axis, &cursor->rotation_angle, mat);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
if (use_compat) {
|
|
|
|
|
mat3_to_compatible_eulO(
|
|
|
|
|
cursor->rotation_euler, cursor->rotation_euler, cursor->rotation_mode, mat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mat3_to_eulO(cursor->rotation_euler, cursor->rotation_mode, mat);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], bool use_compat)
|
|
|
|
|
{
|
|
|
|
|
BLI_ASSERT_UNIT_QUAT(quat);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-26 00:58:35 +11:00
|
|
|
switch (cursor->rotation_mode) {
|
|
|
|
|
case ROT_MODE_QUAT: {
|
2020-01-15 19:03:05 +11:00
|
|
|
if (use_compat) {
|
|
|
|
|
float quat_orig[4];
|
|
|
|
|
copy_v4_v4(quat_orig, cursor->rotation_quaternion);
|
|
|
|
|
quat_to_compatible_quat(cursor->rotation_quaternion, quat, quat_orig);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_qt_qt(cursor->rotation_quaternion, quat);
|
|
|
|
|
}
|
2019-02-26 00:58:35 +11:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ROT_MODE_AXISANGLE: {
|
|
|
|
|
quat_to_axis_angle(cursor->rotation_axis, &cursor->rotation_angle, quat);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
if (use_compat) {
|
|
|
|
|
quat_to_compatible_eulO(
|
|
|
|
|
cursor->rotation_euler, cursor->rotation_euler, cursor->rotation_mode, quat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
quat_to_eulO(cursor->rotation_euler, cursor->rotation_mode, quat);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-16 13:38:33 +10:00
|
|
|
void BKE_scene_cursor_to_mat4(const View3DCursor *cursor, float mat[4][4])
|
|
|
|
|
{
|
|
|
|
|
float mat3[3][3];
|
|
|
|
|
BKE_scene_cursor_rot_to_mat3(cursor, mat3);
|
|
|
|
|
copy_m4_m3(mat, mat3);
|
|
|
|
|
copy_v3_v3(mat[3], cursor->location);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_cursor_from_mat4(View3DCursor *cursor, const float mat[4][4], bool use_compat)
|
|
|
|
|
{
|
|
|
|
|
float mat3[3][3];
|
|
|
|
|
copy_m3_m4(mat3, mat);
|
|
|
|
|
BKE_scene_cursor_mat3_to_rot(cursor, mat3, use_compat);
|
|
|
|
|
copy_v3_v3(cursor->location, mat[3]);
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-26 00:58:35 +11:00
|
|
|
/** \} */
|
2019-06-04 16:52:48 +02:00
|
|
|
|
|
|
|
|
/* Dependency graph evaluation. */
|
|
|
|
|
|
2019-07-01 11:12:18 +02:00
|
|
|
static void scene_sequencer_disable_sound_strips(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
if (scene->sound_scene == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Sequence *seq;
|
2020-08-21 18:55:27 +02:00
|
|
|
SEQ_ALL_BEGIN (scene->ed, seq) {
|
2019-07-01 11:12:18 +02:00
|
|
|
if (seq->scene_sound != NULL) {
|
|
|
|
|
BKE_sound_remove_scene_sound(scene, seq->scene_sound);
|
|
|
|
|
seq->scene_sound = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-21 18:55:27 +02:00
|
|
|
SEQ_ALL_END;
|
2019-07-01 11:12:18 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-04 16:52:48 +02:00
|
|
|
void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
DEG_debug_print_eval(depsgraph, __func__, scene->id.name, scene);
|
|
|
|
|
if (scene->ed == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
BKE_sound_ensure_scene(scene);
|
|
|
|
|
Sequence *seq;
|
2020-08-21 18:55:27 +02:00
|
|
|
SEQ_ALL_BEGIN (scene->ed, seq) {
|
2019-06-07 11:27:34 +02:00
|
|
|
if (seq->scene_sound == NULL) {
|
|
|
|
|
if (seq->sound != NULL) {
|
2019-06-17 12:54:56 +02:00
|
|
|
if (seq->scene_sound == NULL) {
|
|
|
|
|
seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
|
|
|
|
|
}
|
2019-06-07 11:27:34 +02:00
|
|
|
}
|
|
|
|
|
else if (seq->type == SEQ_TYPE_SCENE) {
|
|
|
|
|
if (seq->scene != NULL) {
|
|
|
|
|
BKE_sound_ensure_scene(seq->scene);
|
|
|
|
|
seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(scene, seq);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-06-04 16:52:48 +02:00
|
|
|
}
|
2019-06-26 12:58:54 +02:00
|
|
|
if (seq->scene_sound != NULL) {
|
|
|
|
|
/* Make sure changing volume via sequence's properties panel works correct.
|
|
|
|
|
*
|
|
|
|
|
* Ideally, the entire BKE_scene_update_sound() will happen from a dependency graph, so
|
|
|
|
|
* then it is no longer needed to do such manual forced updates. */
|
|
|
|
|
if (seq->type == SEQ_TYPE_SCENE && seq->scene != NULL) {
|
|
|
|
|
BKE_sound_set_scene_volume(seq->scene, seq->scene->audio.volume);
|
2019-07-01 11:12:18 +02:00
|
|
|
if ((seq->flag & SEQ_SCENE_STRIPS) == 0) {
|
|
|
|
|
scene_sequencer_disable_sound_strips(seq->scene);
|
|
|
|
|
}
|
2019-06-26 12:58:54 +02:00
|
|
|
}
|
2019-06-17 15:23:24 +02:00
|
|
|
if (seq->sound != NULL) {
|
|
|
|
|
if (scene->id.recalc & ID_RECALC_AUDIO || seq->sound->id.recalc & ID_RECALC_AUDIO) {
|
|
|
|
|
BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
|
|
|
|
|
}
|
2019-06-17 12:54:56 +02:00
|
|
|
}
|
2019-06-04 16:52:48 +02:00
|
|
|
BKE_sound_set_scene_sound_volume(
|
|
|
|
|
seq->scene_sound, seq->volume, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
|
|
|
|
|
BKE_sound_set_scene_sound_pitch(
|
|
|
|
|
seq->scene_sound, seq->pitch, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
|
|
|
|
|
BKE_sound_set_scene_sound_pan(
|
|
|
|
|
seq->scene_sound, seq->pan, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-21 18:55:27 +02:00
|
|
|
SEQ_ALL_END;
|
2020-12-19 06:44:57 +01:00
|
|
|
SEQ_edit_update_muting(scene->ed);
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_sound_update_bounds_all(scene);
|
2019-06-04 16:52:48 +02:00
|
|
|
}
|