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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
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"
|
2013-09-05 15:47:52 +00:00
|
|
|
#include "DNA_linestyle_types.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "DNA_mesh_types.h"
|
2011-11-18 07:11:54 +00:00
|
|
|
#include "DNA_node_types.h"
|
2010-08-04 04:01:27 +00:00
|
|
|
#include "DNA_object_types.h"
|
2013-01-23 05:56:22 +00:00
|
|
|
#include "DNA_rigidbody_types.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2010-06-24 10:04:18 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
2014-02-06 10:10:59 +01:00
|
|
|
#include "DNA_space_types.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
|
#include "DNA_windowmanager_types.h"
|
2017-10-16 17:15:03 -02:00
|
|
|
#include "DNA_workspace_types.h"
|
2016-08-03 23:31:48 +02:00
|
|
|
#include "DNA_gpencil_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_utildefines.h"
|
2011-09-27 10:43:45 +00:00
|
|
|
#include "BLI_callbacks.h"
|
2012-10-08 06:38:34 +00:00
|
|
|
#include "BLI_string.h"
|
2017-01-16 17:33:34 +01:00
|
|
|
#include "BLI_string_utils.h"
|
2013-05-08 13:23:17 +00:00
|
|
|
#include "BLI_threads.h"
|
2013-12-26 17:24:42 +06:00
|
|
|
#include "BLI_task.h"
|
2010-08-16 05:46:10 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-03-25 08:29:06 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_anim.h"
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "BKE_animsys.h"
|
2012-11-09 07:29:27 +00:00
|
|
|
#include "BKE_action.h"
|
2014-11-14 14:04:07 +01:00
|
|
|
#include "BKE_armature.h"
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
#include "BKE_cachefile.h"
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "BKE_collection.h"
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
#include "BKE_colortools.h"
|
2014-07-31 20:18:51 +06:00
|
|
|
#include "BKE_editmesh.h"
|
2012-11-09 07:29:27 +00:00
|
|
|
#include "BKE_fcurve.h"
|
2013-03-23 03:00:37 +00:00
|
|
|
#include "BKE_freestyle.h"
|
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"
|
2013-05-22 22:17:07 +00:00
|
|
|
#include "BKE_image.h"
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "BKE_layer.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_library.h"
|
2016-12-12 14:31:50 +01:00
|
|
|
#include "BKE_library_remap.h"
|
2015-05-04 15:45:32 +09:00
|
|
|
#include "BKE_linestyle.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_main.h"
|
2012-06-04 16:42:58 +00:00
|
|
|
#include "BKE_mask.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#include "BKE_node.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_object.h"
|
2009-09-18 22:25:49 +00:00
|
|
|
#include "BKE_paint.h"
|
2013-01-23 05:56:22 +00:00
|
|
|
#include "BKE_rigidbody.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_scene.h"
|
2015-05-04 15:07:24 +10:00
|
|
|
#include "BKE_screen.h"
|
2009-12-13 14:56:45 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2010-02-07 23:41:17 +00:00
|
|
|
#include "BKE_sound.h"
|
2014-08-26 20:52:07 +10:00
|
|
|
#include "BKE_unit.h"
|
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"
|
|
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
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);
|
2012-11-09 07:29:27 +00:00
|
|
|
free_fcurve(fcu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-28 14:52:17 +01:00
|
|
|
/* flag -- copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). */
|
|
|
|
|
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);
|
|
|
|
|
}
|
2018-02-28 14:52:17 +01:00
|
|
|
|
|
|
|
|
BKE_paint_copy(&ts->imapaint.paint, &ts->imapaint.paint, flag);
|
|
|
|
|
ts->imapaint.paintcursor = NULL;
|
|
|
|
|
ts->particle.paintcursor = NULL;
|
|
|
|
|
ts->particle.scene = NULL;
|
|
|
|
|
ts->particle.object = NULL;
|
|
|
|
|
|
|
|
|
|
/* duplicate Grease Pencil interpolation curve */
|
|
|
|
|
ts->gp_interpolate.custom_ipo = curvemapping_copy(ts->gp_interpolate.custom_ipo);
|
2018-07-31 10:22:19 +02:00
|
|
|
/* duplicate Grease Pencil multiframe fallof */
|
|
|
|
|
ts->gp_sculpt.cur_falloff = curvemapping_copy(ts->gp_sculpt.cur_falloff);
|
2018-12-15 17:21:47 +01:00
|
|
|
ts->gp_sculpt.cur_primitive = curvemapping_copy(ts->gp_sculpt.cur_primitive);
|
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);
|
|
|
|
|
}
|
2018-02-28 14:52:17 +01:00
|
|
|
BKE_paint_free(&toolsettings->imapaint.paint);
|
|
|
|
|
|
|
|
|
|
/* free Grease Pencil interpolation curve */
|
|
|
|
|
if (toolsettings->gp_interpolate.custom_ipo) {
|
|
|
|
|
curvemapping_free(toolsettings->gp_interpolate.custom_ipo);
|
|
|
|
|
}
|
2018-07-31 10:22:19 +02:00
|
|
|
/* free Grease Pencil multiframe falloff curve */
|
|
|
|
|
if (toolsettings->gp_sculpt.cur_falloff) {
|
|
|
|
|
curvemapping_free(toolsettings->gp_sculpt.cur_falloff);
|
|
|
|
|
}
|
2018-12-15 17:21:47 +01:00
|
|
|
if (toolsettings->gp_sculpt.cur_primitive) {
|
|
|
|
|
curvemapping_free(toolsettings->gp_sculpt.cur_primitive);
|
|
|
|
|
}
|
2018-02-28 14:52:17 +01:00
|
|
|
|
|
|
|
|
MEM_freeN(toolsettings);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
|
* Only copy internal data of Scene ID from source to already allocated/initialized destination.
|
2019-02-04 20:39:59 +01:00
|
|
|
* You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
|
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
|
|
|
*
|
|
|
|
|
* WARNING! This function will not handle ID user count!
|
|
|
|
|
*
|
2018-12-12 12:50:58 +11:00
|
|
|
* \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more).
|
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
|
|
|
*/
|
|
|
|
|
void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, const int flag)
|
2009-09-18 22:25:49 +00: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
|
|
|
/* We never handle usercount here for own data. */
|
|
|
|
|
const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
|
|
|
|
|
|
|
|
|
|
sce_dst->ed = NULL;
|
2017-10-20 12:28:25 +02:00
|
|
|
sce_dst->depsgraph_hash = NULL;
|
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_dst->fps_info = NULL;
|
|
|
|
|
|
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
|
|
|
/* Master Collection */
|
|
|
|
|
if (sce_src->master_collection) {
|
|
|
|
|
sce_dst->master_collection = BKE_collection_copy_master(bmain, sce_src->master_collection, flag);
|
|
|
|
|
}
|
2010-08-05 10:50:38 +00: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
|
|
|
/* View Layers */
|
2017-11-22 10:52:39 -02:00
|
|
|
BLI_duplicatelist(&sce_dst->view_layers, &sce_src->view_layers);
|
|
|
|
|
for (ViewLayer *view_layer_src = sce_src->view_layers.first, *view_layer_dst = sce_dst->view_layers.first;
|
|
|
|
|
view_layer_src;
|
|
|
|
|
view_layer_src = view_layer_src->next, view_layer_dst = view_layer_dst->next)
|
2017-08-15 16:05:07 +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
|
|
|
BKE_view_layer_copy_data(sce_dst, sce_src, view_layer_dst, view_layer_src, flag_subdata);
|
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
|
|
|
}
|
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
|
|
|
|
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
|
|
|
BLI_duplicatelist(&(sce_dst->markers), &(sce_src->markers));
|
2018-04-18 09:12:44 +02:00
|
|
|
BLI_duplicatelist(&(sce_dst->transform_spaces), &(sce_src->transform_spaces));
|
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
|
|
|
BLI_duplicatelist(&(sce_dst->r.views), &(sce_src->r.views));
|
|
|
|
|
BKE_keyingsets_copy(&(sce_dst->keyingsets), &(sce_src->keyingsets));
|
2013-01-29 03:12:49 +00: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_src->nodetree) {
|
2017-10-19 12:31:58 +02:00
|
|
|
/* Note: nodetree is *not* in bmain, however this specific case is handled at lower level
|
|
|
|
|
* (see BKE_libblock_copy_ex()). */
|
2019-02-04 15:34:31 +01:00
|
|
|
BKE_id_copy_ex(bmain, (ID *)sce_src->nodetree, (ID **)&sce_dst->nodetree, flag);
|
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_libblock_relink_ex(bmain, sce_dst->nodetree, (void *)(&sce_src->id), &sce_dst->id, false);
|
|
|
|
|
}
|
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
|
|
|
|
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_src->rigidbody_world) {
|
|
|
|
|
sce_dst->rigidbody_world = BKE_rigidbody_world_copy(sce_src->rigidbody_world, flag_subdata);
|
|
|
|
|
}
|
2017-06-15 13:46:52 +02:00
|
|
|
|
2016-01-16 12:44:55 +01:00
|
|
|
/* copy color management settings */
|
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_dst->display_settings, &sce_src->display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&sce_dst->view_settings, &sce_src->view_settings);
|
|
|
|
|
BKE_color_managed_colorspace_settings_copy(&sce_dst->sequencer_colorspace_settings, &sce_src->sequencer_colorspace_settings);
|
2016-01-16 12:44:55 +01: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_dst->r.im_format.display_settings, &sce_src->r.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&sce_dst->r.im_format.view_settings, &sce_src->r.im_format.view_settings);
|
2016-01-16 12:44:55 +01: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_dst->r.bake.im_format.display_settings, &sce_src->r.bake.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_copy(&sce_dst->r.bake.im_format.view_settings, &sce_src->r.bake.im_format.view_settings);
|
2016-01-16 12:44:55 +01: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
|
|
|
curvemapping_copy_data(&sce_dst->r.mblur_shutter_curve, &sce_src->r.mblur_shutter_curve);
|
2016-01-16 12:44:55 +01:00
|
|
|
|
2012-04-15 08:48:11 +00:00
|
|
|
/* tool settings */
|
2018-02-28 14:52:17 +01:00
|
|
|
sce_dst->toolsettings = BKE_toolsettings_copy(sce_dst->toolsettings, flag_subdata);
|
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
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
/* make a private copy of the avicodecdata */
|
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_src->r.avicodecdata) {
|
|
|
|
|
sce_dst->r.avicodecdata = MEM_dupallocN(sce_src->r.avicodecdata);
|
|
|
|
|
sce_dst->r.avicodecdata->lpFormat = MEM_dupallocN(sce_dst->r.avicodecdata->lpFormat);
|
|
|
|
|
sce_dst->r.avicodecdata->lpParms = MEM_dupallocN(sce_dst->r.avicodecdata->lpParms);
|
2009-09-18 22:25:49 +00: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_src->r.ffcodecdata.properties) { /* intentionally check sce_dst not sce_src. */ /* XXX ??? comment outdated... */
|
|
|
|
|
sce_dst->r.ffcodecdata.properties = IDP_CopyProperty_ex(sce_src->r.ffcodecdata.properties, flag_subdata);
|
2010-06-25 12:04:04 +00: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
|
|
|
/* before scene copy */
|
|
|
|
|
BKE_sound_create_scene(sce_dst);
|
|
|
|
|
|
|
|
|
|
/* Copy sequencer, this is local data! */
|
|
|
|
|
if (sce_src->ed) {
|
|
|
|
|
sce_dst->ed = MEM_callocN(sizeof(*sce_dst->ed), __func__);
|
|
|
|
|
sce_dst->ed->seqbasep = &sce_dst->ed->seqbase;
|
|
|
|
|
BKE_sequence_base_dupli_recursive(
|
|
|
|
|
sce_src, sce_dst, &sce_dst->ed->seqbase, &sce_src->ed->seqbase, SEQ_DUPE_ALL, flag_subdata);
|
|
|
|
|
}
|
2009-09-18 22:25:49 +00: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 ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
|
|
|
|
|
BKE_previewimg_id_copy(&sce_dst->id, &sce_src->id);
|
2009-09-18 22:25:49 +00: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
|
|
|
else {
|
|
|
|
|
sce_dst->preview = NULL;
|
|
|
|
|
}
|
2018-07-10 15:02:25 +02:00
|
|
|
|
|
|
|
|
sce_dst->eevee.light_cache = 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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
|
|
|
|
|
{
|
|
|
|
|
Scene *sce_copy;
|
|
|
|
|
|
|
|
|
|
/* 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;
|
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);
|
2017-10-12 15:54:43 +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;
|
|
|
|
|
curvemapping_free_data(&sce_copy->r.mblur_shutter_curve);
|
|
|
|
|
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;
|
2019-03-15 16:06:30 +01:00
|
|
|
sce_copy->eevee = sce->eevee;
|
|
|
|
|
sce_copy->eevee.light_cache = NULL;
|
|
|
|
|
sce_copy->eevee.light_cache_info[0] = '\0';
|
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->id.properties)
|
|
|
|
|
sce_copy->id.properties = IDP_CopyProperty(sce->id.properties);
|
|
|
|
|
|
|
|
|
|
MEM_freeN(sce_copy->toolsettings);
|
|
|
|
|
BKE_sound_destroy_scene(sce_copy);
|
|
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
|
|
|
|
|
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);
|
2009-09-18 22:25:49 +00: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);
|
|
|
|
|
|
|
|
|
|
curvemapping_copy_data(&sce_copy->r.mblur_shutter_curve, &sce->r.mblur_shutter_curve);
|
|
|
|
|
|
2018-07-11 11:43:56 +02:00
|
|
|
/* viewport display settings */
|
|
|
|
|
sce_copy->display = sce->display;
|
|
|
|
|
|
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 */
|
2018-02-28 14:52:17 +01:00
|
|
|
sce_copy->toolsettings = BKE_toolsettings_copy(sce->toolsettings, 0);
|
2010-06-25 12:04:04 +00: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
|
|
|
}
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* before scene copy */
|
|
|
|
|
BKE_sound_create_scene(sce_copy);
|
|
|
|
|
|
|
|
|
|
/* grease pencil */
|
|
|
|
|
sce_copy->gpd = NULL;
|
|
|
|
|
|
|
|
|
|
sce_copy->preview = NULL;
|
|
|
|
|
|
|
|
|
|
return sce_copy;
|
2009-09-18 22:25:49 +00: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
|
|
|
else {
|
2019-02-04 15:34:31 +01:00
|
|
|
BKE_id_copy_ex(bmain, (ID *)sce, (ID **)&sce_copy, LIB_ID_COPY_ACTIONS);
|
2017-10-12 15:54:43 +02:00
|
|
|
id_us_min(&sce_copy->id);
|
|
|
|
|
id_us_ensure_real(&sce_copy->id);
|
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
|
|
|
|
|
|
|
|
/* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks... */
|
|
|
|
|
|
2014-11-22 18:04:08 +13:00
|
|
|
if (type == SCE_COPY_FULL) {
|
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 Freestyle LineStyle datablocks. */
|
2017-11-22 10:52:39 -02:00
|
|
|
for (ViewLayer *view_layer_dst = sce_copy->view_layers.first; view_layer_dst; view_layer_dst = view_layer_dst->next) {
|
|
|
|
|
for (FreestyleLineSet *lineset = view_layer_dst->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
|
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 (lineset->linestyle) {
|
2018-10-24 08:43:20 +02:00
|
|
|
id_us_min(&lineset->linestyle->id);
|
2019-02-04 20:43:06 +01:00
|
|
|
BKE_id_copy_ex(
|
|
|
|
|
bmain,
|
|
|
|
|
(ID *)lineset->linestyle,
|
|
|
|
|
(ID **)&lineset->linestyle,
|
|
|
|
|
LIB_ID_COPY_ACTIONS);
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Full copy of world (included animations) */
|
|
|
|
|
if (sce_copy->world) {
|
2018-10-24 08:43:20 +02:00
|
|
|
id_us_min(&sce_copy->world->id);
|
2019-02-04 15:34:31 +01:00
|
|
|
BKE_id_copy_ex(bmain, (ID *)sce_copy->world, (ID **)&sce_copy->world, LIB_ID_COPY_ACTIONS);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Full copy of GreasePencil. */
|
|
|
|
|
if (sce_copy->gpd) {
|
2018-10-24 08:43:20 +02:00
|
|
|
id_us_min(&sce_copy->gpd->id);
|
2019-02-04 20:43:06 +01:00
|
|
|
BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, LIB_ID_COPY_ACTIONS);
|
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
|
|
|
}
|
2014-11-22 18:04:08 +13:00
|
|
|
}
|
|
|
|
|
else {
|
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
|
|
|
/* Remove sequencer if not full copy */
|
|
|
|
|
/* XXX Why in Hell? :/ */
|
|
|
|
|
remove_sequencer_fcurves(sce_copy);
|
2018-05-11 11:21:30 +02:00
|
|
|
BKE_sequencer_editing_free(sce_copy, true);
|
2014-11-22 18:04:08 +13:00
|
|
|
}
|
2009-09-18 22:25:49 +00: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
|
|
|
/* NOTE: part of SCE_COPY_LINK_DATA and SCE_COPY_FULL operations
|
2018-07-31 10:22:19 +02:00
|
|
|
* are done outside of blenkernel with ED_object_single_users! */
|
2015-08-10 15:41:28 +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
|
|
|
/* camera */
|
2018-10-24 08:43:20 +02:00
|
|
|
/* XXX This is most certainly useless? Object have not yet been duplicated... */
|
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 (ELEM(type, SCE_COPY_LINK_DATA, SCE_COPY_FULL)) {
|
|
|
|
|
ID_NEW_REMAP(sce_copy->camera);
|
2017-05-05 16:27:31 +02:00
|
|
|
}
|
2017-03-31 17:26:33 +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
|
|
|
}
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
|
2013-04-24 23:09:25 +00:00
|
|
|
void BKE_scene_groups_relink(Scene *sce)
|
|
|
|
|
{
|
|
|
|
|
if (sce->rigidbody_world)
|
|
|
|
|
BKE_rigidbody_world_groups_relink(sce->rigidbody_world);
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-21 16:09:08 +02:00
|
|
|
void BKE_scene_make_local(Main *bmain, Scene *sce, const bool lib_local)
|
|
|
|
|
{
|
|
|
|
|
/* For now should work, may need more work though to support all possible corner cases
|
|
|
|
|
* (also scene_copy probably needs some love). */
|
|
|
|
|
BKE_id_make_local_generic(bmain, &sce->id, true, lib_local);
|
|
|
|
|
}
|
|
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
/** Free (or release) any data used by this scene (does not free the scene itself). */
|
2017-06-14 16:56:21 +02:00
|
|
|
void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
BKE_animdata_free((ID *)sce, false);
|
|
|
|
|
|
2018-05-11 11:21:30 +02:00
|
|
|
BKE_sequencer_editing_free(sce, do_id_user);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
|
|
|
|
BKE_keyingsets_free(&sce->keyingsets);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
|
|
|
|
|
/* is no lib link block, but scene extension */
|
|
|
|
|
if (sce->nodetree) {
|
2018-12-14 15:20:33 +01:00
|
|
|
ntreeFreeNestedTree(sce->nodetree);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
MEM_freeN(sce->nodetree);
|
|
|
|
|
sce->nodetree = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sce->rigidbody_world) {
|
2018-06-27 17:08:58 +02:00
|
|
|
BKE_rigidbody_free_world(sce);
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (sce->r.avicodecdata) {
|
|
|
|
|
free_avicodecdata(sce->r.avicodecdata);
|
|
|
|
|
MEM_freeN(sce->r.avicodecdata);
|
|
|
|
|
sce->r.avicodecdata = NULL;
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
2008-05-11 20:40:55 +00:00
|
|
|
if (sce->r.ffcodecdata.properties) {
|
|
|
|
|
IDP_FreeProperty(sce->r.ffcodecdata.properties);
|
|
|
|
|
MEM_freeN(sce->r.ffcodecdata.properties);
|
|
|
|
|
sce->r.ffcodecdata.properties = NULL;
|
|
|
|
|
}
|
2017-05-04 12:18:39 +02:00
|
|
|
|
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio
window... the audio window should restrict to own options. This way
functionality is nicely separated.
Since it's the first time I added a new space (since long!) I've made an
extensive tutorial as well. You can find that here:
http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html
Notes for using timewindow;
- Add time markers with MKey
- CTRL+M gives option to name Marker
- Markers cannot be moved yet...
- Pageup-Pagedown keys moves current frame to next-prev Marker
- Xkey removes Markers
- If an object has Ipos or an Action, it draws key lines
- CTRL+Pageup-Pagedown moves current frame to next-prev Key
- Press S or E to set start/end frame for playback
Notes about the implementation in Tuhopuu:
- Add new Marker now selects new, deselects others
- Selecting Marker didn't work like elsewhere in Blender, on click it
should deselect all, except the indicated Marker. Not when holding SHIFT
of course
- Not exported functions are static now
- Removed unused defines (MARKER_NONE NEXT_AVAIL)
- Drawing order was confusing, doing too many matrix calls
- Removed not needed scrollbar, added new function to draw time values.
(Has advantage the MMB scroll works not confusing on a scrollbar)
- Added proper support for 'frame mapping'
- The string button (name Marker) had a bug (checked str[64] while str
was only 64 long)
- String button itself didn't allow "OK on enter"
- Made frame buttons in header larger, the arrows overlapped
- Removed support for negative frame values, that won't work so simple!
2005-05-05 17:19:21 +00:00
|
|
|
BLI_freelistN(&sce->markers);
|
2018-04-18 09:12:44 +02:00
|
|
|
BLI_freelistN(&sce->transform_spaces);
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_freelistN(&sce->r.views);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-02-28 14:52:17 +01:00
|
|
|
BKE_toolsettings_free(sce->toolsettings);
|
|
|
|
|
sce->toolsettings = NULL;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2017-10-20 12:28:25 +02:00
|
|
|
BKE_scene_free_depsgraph_hash(sce);
|
2017-05-16 11:23:14 +02:00
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
MEM_SAFE_FREE(sce->fps_info);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_destroy_scene(sce);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
|
|
|
|
BKE_color_managed_view_settings_free(&sce->view_settings);
|
2015-08-10 15:41:28 +02:00
|
|
|
|
|
|
|
|
BKE_previewimg_free(&sce->preview);
|
2015-10-27 19:00:51 +05:00
|
|
|
curvemapping_free_data(&sce->r.mblur_shutter_curve);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
2017-11-23 13:51:49 -02:00
|
|
|
for (ViewLayer *view_layer = sce->view_layers.first, *view_layer_next; view_layer; view_layer = view_layer_next) {
|
|
|
|
|
view_layer_next = view_layer->next;
|
2017-06-09 17:16:39 +02:00
|
|
|
|
2017-11-23 13:51:49 -02:00
|
|
|
BLI_remlink(&sce->view_layers, view_layer);
|
2017-12-26 13:31:45 -02:00
|
|
|
BKE_view_layer_free_ex(view_layer, do_id_user);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Master Collection */
|
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
|
|
|
// 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 (sce->master_collection) {
|
|
|
|
|
BKE_collection_free(sce->master_collection);
|
|
|
|
|
MEM_freeN(sce->master_collection);
|
|
|
|
|
sce->master_collection = NULL;
|
|
|
|
|
}
|
2017-02-07 11:20:15 +01:00
|
|
|
|
2018-07-10 15:02:25 +02:00
|
|
|
if (sce->eevee.light_cache) {
|
|
|
|
|
EEVEE_lightcache_free(sce->eevee.light_cache);
|
|
|
|
|
sce->eevee.light_cache = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-16 21:40:05 +02:00
|
|
|
/* These are freed on doversion. */
|
|
|
|
|
BLI_assert(sce->layer_properties == NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2017-06-14 16:56:21 +02:00
|
|
|
void BKE_scene_free(Scene *sce)
|
|
|
|
|
{
|
2017-07-14 20:59:26 +02:00
|
|
|
BKE_scene_free_ex(sce, true);
|
2017-06-14 16:56:21 +02:00
|
|
|
}
|
|
|
|
|
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
void BKE_scene_init(Scene *sce)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
ParticleEditSettings *pset;
|
|
|
|
|
int a;
|
2012-10-08 06:38:34 +00:00
|
|
|
const char *colorspace_name;
|
2015-04-06 10:40:12 -03:00
|
|
|
SceneRenderView *srv;
|
2015-11-08 07:29:12 +05:00
|
|
|
CurveMapping *mblur_shutter_curve;
|
2004-01-04 22:10:36 +00:00
|
|
|
|
2019-03-12 16:59:04 +11:00
|
|
|
BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(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
|
|
|
|
2019-02-26 00:58:35 +11:00
|
|
|
|
|
|
|
|
sce->cursor.rotation_mode = ROT_MODE_XYZ;
|
|
|
|
|
sce->cursor.rotation_quaternion[0] = 1.0f;
|
|
|
|
|
sce->cursor.rotation_axis[1] = 1.0f;
|
2018-11-28 11:50:46 +11: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
|
|
|
sce->r.mode = R_OSA;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.cfra = 1;
|
|
|
|
|
sce->r.sfra = 1;
|
|
|
|
|
sce->r.efra = 250;
|
|
|
|
|
sce->r.frame_step = 1;
|
|
|
|
|
sce->r.xsch = 1920;
|
|
|
|
|
sce->r.ysch = 1080;
|
|
|
|
|
sce->r.xasp = 1;
|
|
|
|
|
sce->r.yasp = 1;
|
2012-11-05 08:05:14 +00:00
|
|
|
sce->r.tilex = 256;
|
|
|
|
|
sce->r.tiley = 256;
|
2018-05-15 14:40:01 +02:00
|
|
|
sce->r.size = 100;
|
2012-05-06 15:15:33 +00:00
|
|
|
|
2013-09-10 13:25:37 +00:00
|
|
|
sce->r.im_format.planes = R_IMF_PLANES_RGBA;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.im_format.imtype = R_IMF_IMTYPE_PNG;
|
2012-12-31 14:02:33 +00:00
|
|
|
sce->r.im_format.depth = R_IMF_CHAN_DEPTH_8;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.im_format.quality = 90;
|
2013-11-25 16:22:55 +06:00
|
|
|
sce->r.im_format.compress = 15;
|
2012-05-06 15:15:33 +00:00
|
|
|
|
2018-05-15 14:40:01 +02:00
|
|
|
sce->r.displaymode = R_OUTPUT_WINDOW;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.framapto = 100;
|
|
|
|
|
sce->r.images = 100;
|
|
|
|
|
sce->r.framelen = 1.0;
|
|
|
|
|
sce->r.blurfac = 0.5;
|
|
|
|
|
sce->r.frs_sec = 24;
|
|
|
|
|
sce->r.frs_sec_base = 1;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2012-09-26 20:05:38 +00:00
|
|
|
/* OCIO_TODO: for forwards compatibility only, so if no tonecurve are used,
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
* images would look in the same way as in current blender
|
|
|
|
|
*
|
|
|
|
|
* perhaps at some point should be completely deprecated?
|
|
|
|
|
*/
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->r.color_mgt_flag |= R_COLOR_MANAGEMENT;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2019-01-03 15:59:01 +01:00
|
|
|
sce->r.gauss = 1.5;
|
2018-05-24 21:19:38 +02:00
|
|
|
sce->r.dither_intensity = 1.0f;
|
|
|
|
|
|
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
|
|
|
sce->r.bake_mode = 0;
|
2013-03-04 15:58:40 +00:00
|
|
|
sce->r.bake_filter = 16;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.bake_flag = R_BAKE_CLEAR;
|
2012-12-19 12:30:39 +00:00
|
|
|
sce->r.bake_samples = 256;
|
2012-12-22 18:31:05 +00:00
|
|
|
sce->r.bake_biasdist = 0.001;
|
Bake API - bpy.ops.object.bake()
New operator that can calls a bake function to the current render engine when available. This commit provides no feature for the users, but allows external engines to be accessed by the operator and be integrated with the baking api.
The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an array of floats with the result.
The Blender Internal (and multires) system is still running independent, but we eventually will pipe it through the API as well. Cycles baking will come next as a separated commit
Python Operator:
----------------
The operator can be called with some arguments, or a user interface can be created for it. In that case the arguments can be ommited and the interface can expose the settings from bpy.context.scene.render.bake
bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_split_materials=False, use_automatic_name=False)
Note: external save mode is currently disabled.
Supported Features:
------------------
* Margin - Baked result is extended this many pixels beyond the border of each UV "island," to soften seams in the texture.
* Selected to Active - bake shading on the surface of selected object to the active object. The rays are cast from the lowpoly object inwards towards the highpoly object. If the highpoly object is not entirely involved by the lowpoly object, you can tweak the rays start point with Cage Extrusion. For even more control of the cage you can use a Cage object.
* Cage Extrusion - distance to use for the inward ray cast when using selected to active
* Custom Cage - object to use as cage (instead of the lowpoly object).
* Normal swizzle - change the axis that gets mapped to RGB
* Normal space - save as tangent or object normal spaces
Supported Passes:
-----------------
Any pass that is supported by Blender renderlayer system. Though it's up to the external engine to provide a valid enum with its supported passes. Normal passes get a special treatment since we post-process them to converted and "swizzled"
Development Notes for External Engines:
---------------------------------------
(read them in bake_api.c)
* For a complete implementation example look at the Cycles Bake commit (next).
Review: D421
Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge
Normal map pipeline "consulting" by Andy Davies (metalliandy)
Original design by Brecht van Lommel.
The entire commit history can be found on the branch: bake-cycles
2014-01-02 19:05:07 -02:00
|
|
|
|
|
|
|
|
sce->r.bake.flag = R_BAKE_CLEAR;
|
2016-01-15 13:00:56 -02:00
|
|
|
sce->r.bake.pass_filter = R_BAKE_PASS_FILTER_ALL;
|
Bake API - bpy.ops.object.bake()
New operator that can calls a bake function to the current render engine when available. This commit provides no feature for the users, but allows external engines to be accessed by the operator and be integrated with the baking api.
The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an array of floats with the result.
The Blender Internal (and multires) system is still running independent, but we eventually will pipe it through the API as well. Cycles baking will come next as a separated commit
Python Operator:
----------------
The operator can be called with some arguments, or a user interface can be created for it. In that case the arguments can be ommited and the interface can expose the settings from bpy.context.scene.render.bake
bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_split_materials=False, use_automatic_name=False)
Note: external save mode is currently disabled.
Supported Features:
------------------
* Margin - Baked result is extended this many pixels beyond the border of each UV "island," to soften seams in the texture.
* Selected to Active - bake shading on the surface of selected object to the active object. The rays are cast from the lowpoly object inwards towards the highpoly object. If the highpoly object is not entirely involved by the lowpoly object, you can tweak the rays start point with Cage Extrusion. For even more control of the cage you can use a Cage object.
* Cage Extrusion - distance to use for the inward ray cast when using selected to active
* Custom Cage - object to use as cage (instead of the lowpoly object).
* Normal swizzle - change the axis that gets mapped to RGB
* Normal space - save as tangent or object normal spaces
Supported Passes:
-----------------
Any pass that is supported by Blender renderlayer system. Though it's up to the external engine to provide a valid enum with its supported passes. Normal passes get a special treatment since we post-process them to converted and "swizzled"
Development Notes for External Engines:
---------------------------------------
(read them in bake_api.c)
* For a complete implementation example look at the Cycles Bake commit (next).
Review: D421
Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge
Normal map pipeline "consulting" by Andy Davies (metalliandy)
Original design by Brecht van Lommel.
The entire commit history can be found on the branch: bake-cycles
2014-01-02 19:05:07 -02:00
|
|
|
sce->r.bake.width = 512;
|
|
|
|
|
sce->r.bake.height = 512;
|
|
|
|
|
sce->r.bake.margin = 16;
|
|
|
|
|
sce->r.bake.normal_space = R_BAKE_SPACE_TANGENT;
|
|
|
|
|
sce->r.bake.normal_swizzle[0] = R_BAKE_POSX;
|
|
|
|
|
sce->r.bake.normal_swizzle[1] = R_BAKE_POSY;
|
|
|
|
|
sce->r.bake.normal_swizzle[2] = R_BAKE_POSZ;
|
|
|
|
|
BLI_strncpy(sce->r.bake.filepath, U.renderdir, sizeof(sce->r.bake.filepath));
|
|
|
|
|
|
|
|
|
|
sce->r.bake.im_format.planes = R_IMF_PLANES_RGBA;
|
|
|
|
|
sce->r.bake.im_format.imtype = R_IMF_IMTYPE_PNG;
|
|
|
|
|
sce->r.bake.im_format.depth = R_IMF_CHAN_DEPTH_8;
|
|
|
|
|
sce->r.bake.im_format.quality = 90;
|
|
|
|
|
sce->r.bake.im_format.compress = 15;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.scemode = R_DOCOMP | R_DOSEQ | R_EXTENSION;
|
2016-05-19 21:39:22 +02:00
|
|
|
sce->r.stamp = R_STAMP_TIME | R_STAMP_FRAME | R_STAMP_DATE | R_STAMP_CAMERA | R_STAMP_SCENE | R_STAMP_FILENAME | R_STAMP_RENDERTIME | R_STAMP_MEMORY;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.stamp_font_id = 12;
|
|
|
|
|
sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
|
|
|
|
|
sce->r.fg_stamp[3] = 1.0f;
|
|
|
|
|
sce->r.bg_stamp[0] = sce->r.bg_stamp[1] = sce->r.bg_stamp[2] = 0.0f;
|
|
|
|
|
sce->r.bg_stamp[3] = 0.25f;
|
2010-03-16 17:37:34 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.seq_prev_type = OB_SOLID;
|
|
|
|
|
sce->r.seq_rend_type = OB_SOLID;
|
2017-08-11 18:02:54 +02:00
|
|
|
sce->r.seq_flag = 0;
|
2010-03-16 17:37:34 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.threads = 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.simplify_subsurf = 6;
|
|
|
|
|
sce->r.simplify_particles = 1.0f;
|
2008-02-13 11:18:08 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
sce->r.border.xmin = 0.0f;
|
|
|
|
|
sce->r.border.ymin = 0.0f;
|
|
|
|
|
sce->r.border.xmax = 1.0f;
|
|
|
|
|
sce->r.border.ymax = 1.0f;
|
2014-07-28 16:32:36 +06:00
|
|
|
|
|
|
|
|
sce->r.preview_start_resolution = 64;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2014-09-26 12:05:18 +09:00
|
|
|
sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE;
|
|
|
|
|
sce->r.unit_line_thickness = 1.0f;
|
|
|
|
|
|
2015-11-08 07:29:12 +05:00
|
|
|
mblur_shutter_curve = &sce->r.mblur_shutter_curve;
|
|
|
|
|
curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
|
curvemapping_initialize(mblur_shutter_curve);
|
|
|
|
|
curvemap_reset(mblur_shutter_curve->cm,
|
|
|
|
|
&mblur_shutter_curve->clipr,
|
|
|
|
|
CURVE_PRESET_MAX,
|
|
|
|
|
CURVEMAP_SLOPE_POS_NEG);
|
|
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
|
2018-06-20 10:18:53 +02:00
|
|
|
|
|
|
|
|
sce->toolsettings->object_flag |= SCE_OBJECT_MODE_LOCK;
|
2005-08-24 20:37:25 +00:00
|
|
|
sce->toolsettings->doublimit = 0.001;
|
2015-07-17 18:49:58 +02:00
|
|
|
sce->toolsettings->vgroup_weight = 1.0f;
|
2012-10-15 17:56:51 +00:00
|
|
|
sce->toolsettings->uvcalc_margin = 0.001f;
|
2018-05-24 21:19:38 +02:00
|
|
|
sce->toolsettings->uvcalc_flag = UVCALC_TRANSFORM_CORRECT;
|
2006-06-10 20:06:41 +00:00
|
|
|
sce->toolsettings->unwrapper = 1;
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->toolsettings->select_thresh = 0.01f;
|
2018-09-17 12:51:32 +10:00
|
|
|
sce->toolsettings->gizmo_flag = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->toolsettings->selectmode = SCE_SELECT_VERTEX;
|
|
|
|
|
sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX;
|
|
|
|
|
sce->toolsettings->autokey_mode = U.autokey_mode;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
|
2018-12-14 11:09:42 +11:00
|
|
|
sce->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
|
2018-05-22 08:58:56 -03:00
|
|
|
sce->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT;
|
2013-11-06 17:46:32 +00:00
|
|
|
sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
|
2018-05-22 08:58:56 -03:00
|
|
|
sce->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT;
|
2018-12-18 11:54:02 +01:00
|
|
|
sce->toolsettings->snap_transform_mode_flag = SCE_SNAP_TRANSFORM_MODE_TRANSLATE;
|
2013-11-06 17:46:32 +00:00
|
|
|
|
2016-04-15 18:10:05 +10:00
|
|
|
sce->toolsettings->curve_paint_settings.curve_type = CU_BEZIER;
|
|
|
|
|
sce->toolsettings->curve_paint_settings.flag |= CURVE_PAINT_FLAG_CORNERS_DETECT;
|
|
|
|
|
sce->toolsettings->curve_paint_settings.error_threshold = 8;
|
|
|
|
|
sce->toolsettings->curve_paint_settings.radius_max = 1.0f;
|
|
|
|
|
sce->toolsettings->curve_paint_settings.corner_angle = DEG2RADF(70.0f);
|
|
|
|
|
|
2013-04-17 09:27:23 +00:00
|
|
|
sce->toolsettings->statvis.overhang_axis = OB_NEGZ;
|
|
|
|
|
sce->toolsettings->statvis.overhang_min = 0;
|
|
|
|
|
sce->toolsettings->statvis.overhang_max = DEG2RADF(45.0f);
|
|
|
|
|
sce->toolsettings->statvis.thickness_max = 0.1f;
|
|
|
|
|
sce->toolsettings->statvis.thickness_samples = 1;
|
2013-04-18 04:24:18 +00:00
|
|
|
sce->toolsettings->statvis.distort_min = DEG2RADF(5.0f);
|
|
|
|
|
sce->toolsettings->statvis.distort_max = DEG2RADF(45.0f);
|
2013-04-17 09:27:23 +00:00
|
|
|
|
2013-04-18 17:09:56 +00:00
|
|
|
sce->toolsettings->statvis.sharp_min = DEG2RADF(90.0f);
|
|
|
|
|
sce->toolsettings->statvis.sharp_max = DEG2RADF(180.0f);
|
|
|
|
|
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->toolsettings->proportional_size = 1.0f;
|
|
|
|
|
|
2014-08-15 19:59:31 +10:00
|
|
|
sce->toolsettings->imapaint.paint.flags |= PAINT_SHOW_BRUSH;
|
2014-08-15 11:44:31 +02:00
|
|
|
sce->toolsettings->imapaint.normal_angle = 80;
|
|
|
|
|
sce->toolsettings->imapaint.seam_bleed = 2;
|
2014-03-10 18:42:35 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* grease pencil multiframe falloff curve */
|
|
|
|
|
sce->toolsettings->gp_sculpt.cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
|
CurveMapping *gp_falloff_curve = sce->toolsettings->gp_sculpt.cur_falloff;
|
|
|
|
|
curvemapping_initialize(gp_falloff_curve);
|
2018-12-20 08:01:39 +11:00
|
|
|
curvemap_reset(
|
|
|
|
|
gp_falloff_curve->cm,
|
|
|
|
|
&gp_falloff_curve->clipr,
|
|
|
|
|
CURVE_PRESET_GAUSS,
|
|
|
|
|
CURVEMAP_SLOPE_POSITIVE);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2018-12-15 17:21:47 +01:00
|
|
|
sce->toolsettings->gp_sculpt.cur_primitive = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
|
CurveMapping *gp_primitive_curve = sce->toolsettings->gp_sculpt.cur_primitive;
|
|
|
|
|
curvemapping_initialize(gp_primitive_curve);
|
2018-12-20 08:01:39 +11:00
|
|
|
curvemap_reset(
|
|
|
|
|
gp_primitive_curve->cm,
|
|
|
|
|
&gp_primitive_curve->clipr,
|
|
|
|
|
CURVE_PRESET_BELL,
|
|
|
|
|
CURVEMAP_SLOPE_POSITIVE);
|
2018-12-15 17:21:47 +01:00
|
|
|
|
2019-01-11 19:15:23 +01:00
|
|
|
sce->toolsettings->gp_sculpt.guide.spacing = 20.0f;
|
|
|
|
|
|
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
|
|
|
sce->physics_settings.gravity[0] = 0.0f;
|
|
|
|
|
sce->physics_settings.gravity[1] = 0.0f;
|
|
|
|
|
sce->physics_settings.gravity[2] = -9.81f;
|
|
|
|
|
sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2018-05-15 14:40:01 +02:00
|
|
|
sce->unit.system = USER_UNIT_METRIC;
|
2009-09-18 22:25:49 +00:00
|
|
|
sce->unit.scale_length = 1.0f;
|
2018-10-03 10:20:16 +02:00
|
|
|
sce->unit.length_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_LENGTH);
|
|
|
|
|
sce->unit.mass_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_MASS);
|
|
|
|
|
sce->unit.time_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_TIME);
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
pset = &sce->toolsettings->particle;
|
|
|
|
|
pset->flag = PE_KEEP_LENGTHS | PE_LOCK_FIRST | PE_DEFLECT_EMITTER | PE_AUTO_VELOCITY;
|
|
|
|
|
pset->emitterdist = 0.25f;
|
|
|
|
|
pset->totrekey = 5;
|
|
|
|
|
pset->totaddkey = 5;
|
2019-03-07 00:07:23 +11:00
|
|
|
pset->brushtype = PE_BRUSH_COMB;
|
2012-05-06 15:15:33 +00:00
|
|
|
pset->draw_step = 2;
|
|
|
|
|
pset->fade_frames = 2;
|
|
|
|
|
pset->selectmode = SCE_SELECT_PATH;
|
2018-01-18 14:02:26 +11:00
|
|
|
|
|
|
|
|
for (a = 0; a < ARRAY_SIZE(pset->brush); a++) {
|
2016-03-03 15:48:50 +01:00
|
|
|
pset->brush[a].strength = 0.5f;
|
2012-05-06 15:15:33 +00:00
|
|
|
pset->brush[a].size = 50;
|
|
|
|
|
pset->brush[a].step = 10;
|
|
|
|
|
pset->brush[a].count = 10;
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
}
|
2016-03-03 15:48:50 +01:00
|
|
|
pset->brush[PE_BRUSH_CUT].strength = 1.0f;
|
2010-11-09 10:40:03 +00:00
|
|
|
|
2015-12-27 16:33:54 +01:00
|
|
|
sce->r.ffcodecdata.audio_mixrate = 48000;
|
2010-11-18 03:03:17 +00:00
|
|
|
sce->r.ffcodecdata.audio_volume = 1.0f;
|
2011-05-30 18:57:28 +00:00
|
|
|
sce->r.ffcodecdata.audio_bitrate = 192;
|
2011-06-21 20:39:41 +00:00
|
|
|
sce->r.ffcodecdata.audio_channels = 2;
|
2010-11-18 03:03:17 +00:00
|
|
|
|
2018-04-17 13:35:05 +02:00
|
|
|
BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine));
|
2005-08-24 20:37:25 +00:00
|
|
|
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
sce->audio.distance_model = 2.0f;
|
|
|
|
|
sce->audio.doppler_factor = 1.0f;
|
|
|
|
|
sce->audio.speed_of_sound = 343.3f;
|
|
|
|
|
sce->audio.volume = 1.0f;
|
2018-05-03 18:50:53 +02:00
|
|
|
sce->audio.flag = AUDIO_SYNC;
|
2005-08-24 20:37:25 +00:00
|
|
|
|
2011-06-10 10:13:50 +00:00
|
|
|
BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
|
2006-11-06 01:08:26 +00:00
|
|
|
|
2012-07-12 08:31:23 +00:00
|
|
|
BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
|
2012-05-06 15:15:33 +00:00
|
|
|
sce->r.osa = 8;
|
2006-11-06 01:08:26 +00:00
|
|
|
|
2006-02-14 11:28:13 +00:00
|
|
|
/* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
/* multiview - stereo */
|
|
|
|
|
BKE_scene_add_render_view(sce, STEREO_LEFT_NAME);
|
|
|
|
|
srv = sce->r.views.first;
|
|
|
|
|
BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
|
|
|
|
|
|
|
|
|
|
BKE_scene_add_render_view(sce, STEREO_RIGHT_NAME);
|
|
|
|
|
srv = sce->r.views.last;
|
|
|
|
|
BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
|
|
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_create_scene(sce);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2012-10-08 06:38:34 +00:00
|
|
|
/* color management */
|
|
|
|
|
colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER);
|
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
BKE_color_managed_display_settings_init(&sce->display_settings);
|
2018-12-06 11:56:23 +01:00
|
|
|
BKE_color_managed_view_settings_init_render(&sce->view_settings,
|
2019-02-01 20:30:10 +01:00
|
|
|
&sce->display_settings,
|
|
|
|
|
"Filmic");
|
2012-10-08 06:38:34 +00:00
|
|
|
BLI_strncpy(sce->sequencer_colorspace_settings.name, colorspace_name,
|
|
|
|
|
sizeof(sce->sequencer_colorspace_settings.name));
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2019-03-11 16:49:29 +01:00
|
|
|
/* 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(&sce->r.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_init_render(&sce->r.im_format.view_settings,
|
|
|
|
|
&sce->r.im_format.display_settings,
|
|
|
|
|
"Filmic");
|
|
|
|
|
|
|
|
|
|
BKE_color_managed_display_settings_init(&sce->r.bake.im_format.display_settings);
|
|
|
|
|
BKE_color_managed_view_settings_init_render(&sce->r.bake.im_format.view_settings,
|
|
|
|
|
&sce->r.bake.im_format.display_settings,
|
|
|
|
|
"Filmic");
|
|
|
|
|
|
2015-01-19 16:30:35 +11:00
|
|
|
/* Safe Areas */
|
2018-12-18 15:19:45 +01:00
|
|
|
copy_v2_fl2(sce->safe_areas.title, 10.0f / 100.0f, 5.0f / 100.0f);
|
|
|
|
|
copy_v2_fl2(sce->safe_areas.action, 3.5f / 100.0f, 3.5f / 100.0f);
|
2015-01-19 16:30:35 +11:00
|
|
|
copy_v2_fl2(sce->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
|
|
|
|
|
copy_v2_fl2(sce->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
|
|
|
|
|
|
2015-08-10 15:41:28 +02:00
|
|
|
sce->preview = NULL;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
/* GP Sculpt brushes */
|
|
|
|
|
{
|
2018-11-18 19:28:54 +01:00
|
|
|
GP_Sculpt_Settings *gset = &sce->toolsettings->gp_sculpt;
|
|
|
|
|
GP_Sculpt_Data *gp_brush;
|
2018-07-31 10:22:19 +02:00
|
|
|
float curcolor_add[3], curcolor_sub[3];
|
|
|
|
|
ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
|
|
|
|
|
ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_SMOOTH];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 25;
|
|
|
|
|
gp_brush->strength = 0.3f;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_SMOOTH_PRESSURE | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_THICKNESS];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 25;
|
|
|
|
|
gp_brush->strength = 0.5f;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_STRENGTH];
|
2016-08-03 23:31:48 +02:00
|
|
|
gp_brush->size = 25;
|
|
|
|
|
gp_brush->strength = 0.5f;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2016-08-03 23:31:48 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_GRAB];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 50;
|
|
|
|
|
gp_brush->strength = 0.3f;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_PUSH];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 25;
|
|
|
|
|
gp_brush->strength = 0.3f;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_TWIST];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 50;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->strength = 0.3f;
|
|
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_PINCH];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 50;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->strength = 0.5f;
|
|
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush = &gset->brush[GP_SCULPT_TYPE_RANDOMIZE];
|
2015-12-13 21:03:13 +13:00
|
|
|
gp_brush->size = 25;
|
|
|
|
|
gp_brush->strength = 0.5f;
|
2018-11-18 19:28:54 +01:00
|
|
|
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
|
2018-07-31 10:22:19 +02:00
|
|
|
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
|
|
|
|
|
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
|
2015-12-13 21:03:13 +13:00
|
|
|
}
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
/* GP Stroke Placement */
|
|
|
|
|
sce->toolsettings->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
|
|
|
|
|
sce->toolsettings->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
|
|
|
|
|
sce->toolsettings->gpencil_seq_align = GP_PROJECT_VIEWSPACE;
|
|
|
|
|
sce->toolsettings->gpencil_ima_align = GP_PROJECT_VIEWSPACE;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* Annotations */
|
|
|
|
|
sce->toolsettings->annotate_v3d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
|
|
|
|
|
sce->toolsettings->annotate_thickness = 3;
|
|
|
|
|
|
2018-12-19 20:51:04 +11:00
|
|
|
for (int i = 0; i < ARRAY_SIZE(sce->orientation_slots); i++) {
|
|
|
|
|
sce->orientation_slots[i].index_custom = -1;
|
|
|
|
|
}
|
2018-04-18 09:12:44 +02: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
|
|
|
/* Master Collection */
|
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
|
|
|
sce->master_collection = BKE_collection_master_add();
|
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
|
|
|
|
2017-11-23 08:31:15 -02:00
|
|
|
BKE_view_layer_add(sce, "View Layer");
|
2018-05-09 13:30:27 +02:00
|
|
|
|
|
|
|
|
/* SceneDisplay */
|
2018-11-30 13:26:30 +01:00
|
|
|
copy_v3_v3(sce->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3});
|
|
|
|
|
sce->display.shadow_shift = 0.1f;
|
|
|
|
|
sce->display.shadow_focus = 0.0f;
|
2018-05-16 19:34:24 +02:00
|
|
|
|
2018-05-16 21:28:05 +02:00
|
|
|
sce->display.matcap_ssao_distance = 0.2f;
|
|
|
|
|
sce->display.matcap_ssao_attenuation = 1.0f;
|
|
|
|
|
sce->display.matcap_ssao_samples = 16;
|
|
|
|
|
|
2018-07-11 11:43:56 +02:00
|
|
|
/* OpenGL Render. */
|
|
|
|
|
BKE_screen_view3d_shading_init(&sce->display.shading);
|
|
|
|
|
|
2018-05-16 19:34:24 +02:00
|
|
|
/* SceneEEVEE */
|
|
|
|
|
sce->eevee.gi_diffuse_bounces = 3;
|
|
|
|
|
sce->eevee.gi_cubemap_resolution = 512;
|
|
|
|
|
sce->eevee.gi_visibility_resolution = 32;
|
2018-07-10 15:02:25 +02:00
|
|
|
sce->eevee.gi_cubemap_draw_size = 0.3f;
|
|
|
|
|
sce->eevee.gi_irradiance_draw_size = 0.1f;
|
2018-11-15 18:13:07 +01:00
|
|
|
sce->eevee.gi_irradiance_smoothing = 0.1f;
|
2018-11-15 20:04:35 +01:00
|
|
|
sce->eevee.gi_filter_quality = 1.0f;
|
2018-05-16 19:34:24 +02:00
|
|
|
|
|
|
|
|
sce->eevee.taa_samples = 16;
|
|
|
|
|
sce->eevee.taa_render_samples = 64;
|
|
|
|
|
|
|
|
|
|
sce->eevee.sss_samples = 7;
|
|
|
|
|
sce->eevee.sss_jitter_threshold = 0.3f;
|
|
|
|
|
|
|
|
|
|
sce->eevee.ssr_quality = 0.25f;
|
|
|
|
|
sce->eevee.ssr_max_roughness = 0.5f;
|
|
|
|
|
sce->eevee.ssr_thickness = 0.2f;
|
|
|
|
|
sce->eevee.ssr_border_fade = 0.075f;
|
|
|
|
|
sce->eevee.ssr_firefly_fac = 10.0f;
|
|
|
|
|
|
|
|
|
|
sce->eevee.volumetric_start = 0.1f;
|
|
|
|
|
sce->eevee.volumetric_end = 100.0f;
|
|
|
|
|
sce->eevee.volumetric_tile_size = 8;
|
|
|
|
|
sce->eevee.volumetric_samples = 64;
|
|
|
|
|
sce->eevee.volumetric_sample_distribution = 0.8f;
|
|
|
|
|
sce->eevee.volumetric_light_clamp = 0.0f;
|
|
|
|
|
sce->eevee.volumetric_shadow_samples = 16;
|
|
|
|
|
|
|
|
|
|
sce->eevee.gtao_distance = 0.2f;
|
|
|
|
|
sce->eevee.gtao_factor = 1.0f;
|
|
|
|
|
sce->eevee.gtao_quality = 0.25f;
|
|
|
|
|
|
|
|
|
|
sce->eevee.bokeh_max_size = 100.0f;
|
|
|
|
|
sce->eevee.bokeh_threshold = 1.0f;
|
|
|
|
|
|
|
|
|
|
copy_v3_fl(sce->eevee.bloom_color, 1.0f);
|
|
|
|
|
sce->eevee.bloom_threshold = 0.8f;
|
|
|
|
|
sce->eevee.bloom_knee = 0.5f;
|
Physically based defaults for Eevee Bloom and Shutter
Some of Eevee's Bloom defaults are not very good for physically based rendering. This patches addresses this issue.
This picture shows one of the problems with current default. Bloom looks very foggy:
{F6280495}
Even worse, light emitters much dimmer than the Sun can make everything equally hazy if Clamp is set to 1.0 and intensity to 0.8 (current default). Artists often forget to adjust Clamp value and do not know what value to use for realistic intensity. Also, currently both Clamp and Intensity do not have good UI ranges. This is why often Eevee renders end up very hazy and bloom often does not look right.
Bloom effect plays important role to help to distinguish between bright and relatively dim light sources. With current defaults this is broken because Clamp set to 1.0. Also, it cannot be disabled if set to 0 like expected. This patch fixes this and sets it to 0 by default. If users need to clamp, they can do so easily with UI range up to 1000. This range is good enough for most cases and provides enough precision to control lower values, and the highest value helps to limit bloom from the Sun if necessary and will leave untouched most other light emitters. If needed, much higher values for Clamp can be entered manually up to 100000. 10000 is still affects the Sun, but up to 100000 highest limit allows to clamp anything that is much brighter than the Sun if user needs to limit bloom in such cases (for example, bright explosion in the sky or anything else very bright).
I propose new default for bloom Intensity - 0.05 and UI range to suggests realistic values. Bloom Intensity > 0.1 is not realistic for clean lens but the user can enter manually much larger values if needed.
For comparison, here is a my own photo with and without bloom caused by the Sun (on second photo the Sun was occluded with an object).
{F6280500}
{F6280492}
In real life bloom is much more subtle and does not look hazy. If Clamp is disabled, then out of 0.1, 0.05 and 0.025 values I have tried, 0.05 looks most similar to the photo. Here is test render with and without bloom with the Sun in similar position like on the photo:
{F6280496}
{F6280494}
Using color probe 27x27 I compared lightness below the horizon under the Sun. In rendered by Eevee images lightness difference was 17. In case of the photos lightness difference in similar place was 11. I then compared leftmost spot (also below the horizon) and lightness difference was approximately 2 between two photos and 1 between rendered images. In other words, with these settings bloom effect is not too strong and is not too weak. Visually it may seem like decreasing bloom intensity may increase photorealism, but then bloom effect would be too localized even for the Sun.
Besides this single test, I tested in many other scenes as well, with and without the Sun, with different HDRIs, and as far as I can tell 0.05 intensity turned out to be good default - it produces bloom strong enough to be noticeable and not too hazy.
In Cycles shutter default value is 0.50, so for consistency set to 0.5 by default in Eevee too. Besides, 0.5 is typical standard for real cameras, and values higher than 0.5 usually are needed only if very strong motion blur is desired.
Here is summary of all changes:
Bloom Intensity: 0.8 > 0.05
Bloom Intensity UI range: 0-10 > 0-0.1
Bloom Clamp: 1.0 > 0.0 (disabled by default)
Bloom Clamp manual range: 0-1000 > 0-100000
Bloom Clamp UI range: 0-10 > 0-1000
Shutter: 1.0 > 0.5
This patch is related to the discussion in this thread, there are more examples of what bloom will look like with 0.05 intensity by me and others:
https://devtalk.blender.org/t/eevee-needs-to-have-physically-based-defaults/4700
Reviewers: fclem
Reviewed By: fclem
Subscribers: pablovazquez, billreynish, rboxman
Tags: #eevee
Differential Revision: https://developer.blender.org/D4212
2019-01-17 19:54:49 +01:00
|
|
|
sce->eevee.bloom_intensity = 0.05f;
|
2018-05-16 19:34:24 +02:00
|
|
|
sce->eevee.bloom_radius = 6.5f;
|
Physically based defaults for Eevee Bloom and Shutter
Some of Eevee's Bloom defaults are not very good for physically based rendering. This patches addresses this issue.
This picture shows one of the problems with current default. Bloom looks very foggy:
{F6280495}
Even worse, light emitters much dimmer than the Sun can make everything equally hazy if Clamp is set to 1.0 and intensity to 0.8 (current default). Artists often forget to adjust Clamp value and do not know what value to use for realistic intensity. Also, currently both Clamp and Intensity do not have good UI ranges. This is why often Eevee renders end up very hazy and bloom often does not look right.
Bloom effect plays important role to help to distinguish between bright and relatively dim light sources. With current defaults this is broken because Clamp set to 1.0. Also, it cannot be disabled if set to 0 like expected. This patch fixes this and sets it to 0 by default. If users need to clamp, they can do so easily with UI range up to 1000. This range is good enough for most cases and provides enough precision to control lower values, and the highest value helps to limit bloom from the Sun if necessary and will leave untouched most other light emitters. If needed, much higher values for Clamp can be entered manually up to 100000. 10000 is still affects the Sun, but up to 100000 highest limit allows to clamp anything that is much brighter than the Sun if user needs to limit bloom in such cases (for example, bright explosion in the sky or anything else very bright).
I propose new default for bloom Intensity - 0.05 and UI range to suggests realistic values. Bloom Intensity > 0.1 is not realistic for clean lens but the user can enter manually much larger values if needed.
For comparison, here is a my own photo with and without bloom caused by the Sun (on second photo the Sun was occluded with an object).
{F6280500}
{F6280492}
In real life bloom is much more subtle and does not look hazy. If Clamp is disabled, then out of 0.1, 0.05 and 0.025 values I have tried, 0.05 looks most similar to the photo. Here is test render with and without bloom with the Sun in similar position like on the photo:
{F6280496}
{F6280494}
Using color probe 27x27 I compared lightness below the horizon under the Sun. In rendered by Eevee images lightness difference was 17. In case of the photos lightness difference in similar place was 11. I then compared leftmost spot (also below the horizon) and lightness difference was approximately 2 between two photos and 1 between rendered images. In other words, with these settings bloom effect is not too strong and is not too weak. Visually it may seem like decreasing bloom intensity may increase photorealism, but then bloom effect would be too localized even for the Sun.
Besides this single test, I tested in many other scenes as well, with and without the Sun, with different HDRIs, and as far as I can tell 0.05 intensity turned out to be good default - it produces bloom strong enough to be noticeable and not too hazy.
In Cycles shutter default value is 0.50, so for consistency set to 0.5 by default in Eevee too. Besides, 0.5 is typical standard for real cameras, and values higher than 0.5 usually are needed only if very strong motion blur is desired.
Here is summary of all changes:
Bloom Intensity: 0.8 > 0.05
Bloom Intensity UI range: 0-10 > 0-0.1
Bloom Clamp: 1.0 > 0.0 (disabled by default)
Bloom Clamp manual range: 0-1000 > 0-100000
Bloom Clamp UI range: 0-10 > 0-1000
Shutter: 1.0 > 0.5
This patch is related to the discussion in this thread, there are more examples of what bloom will look like with 0.05 intensity by me and others:
https://devtalk.blender.org/t/eevee-needs-to-have-physically-based-defaults/4700
Reviewers: fclem
Reviewed By: fclem
Subscribers: pablovazquez, billreynish, rboxman
Tags: #eevee
Differential Revision: https://developer.blender.org/D4212
2019-01-17 19:54:49 +01:00
|
|
|
sce->eevee.bloom_clamp = 0.0f;
|
2018-05-16 19:34:24 +02:00
|
|
|
|
|
|
|
|
sce->eevee.motion_blur_samples = 8;
|
Physically based defaults for Eevee Bloom and Shutter
Some of Eevee's Bloom defaults are not very good for physically based rendering. This patches addresses this issue.
This picture shows one of the problems with current default. Bloom looks very foggy:
{F6280495}
Even worse, light emitters much dimmer than the Sun can make everything equally hazy if Clamp is set to 1.0 and intensity to 0.8 (current default). Artists often forget to adjust Clamp value and do not know what value to use for realistic intensity. Also, currently both Clamp and Intensity do not have good UI ranges. This is why often Eevee renders end up very hazy and bloom often does not look right.
Bloom effect plays important role to help to distinguish between bright and relatively dim light sources. With current defaults this is broken because Clamp set to 1.0. Also, it cannot be disabled if set to 0 like expected. This patch fixes this and sets it to 0 by default. If users need to clamp, they can do so easily with UI range up to 1000. This range is good enough for most cases and provides enough precision to control lower values, and the highest value helps to limit bloom from the Sun if necessary and will leave untouched most other light emitters. If needed, much higher values for Clamp can be entered manually up to 100000. 10000 is still affects the Sun, but up to 100000 highest limit allows to clamp anything that is much brighter than the Sun if user needs to limit bloom in such cases (for example, bright explosion in the sky or anything else very bright).
I propose new default for bloom Intensity - 0.05 and UI range to suggests realistic values. Bloom Intensity > 0.1 is not realistic for clean lens but the user can enter manually much larger values if needed.
For comparison, here is a my own photo with and without bloom caused by the Sun (on second photo the Sun was occluded with an object).
{F6280500}
{F6280492}
In real life bloom is much more subtle and does not look hazy. If Clamp is disabled, then out of 0.1, 0.05 and 0.025 values I have tried, 0.05 looks most similar to the photo. Here is test render with and without bloom with the Sun in similar position like on the photo:
{F6280496}
{F6280494}
Using color probe 27x27 I compared lightness below the horizon under the Sun. In rendered by Eevee images lightness difference was 17. In case of the photos lightness difference in similar place was 11. I then compared leftmost spot (also below the horizon) and lightness difference was approximately 2 between two photos and 1 between rendered images. In other words, with these settings bloom effect is not too strong and is not too weak. Visually it may seem like decreasing bloom intensity may increase photorealism, but then bloom effect would be too localized even for the Sun.
Besides this single test, I tested in many other scenes as well, with and without the Sun, with different HDRIs, and as far as I can tell 0.05 intensity turned out to be good default - it produces bloom strong enough to be noticeable and not too hazy.
In Cycles shutter default value is 0.50, so for consistency set to 0.5 by default in Eevee too. Besides, 0.5 is typical standard for real cameras, and values higher than 0.5 usually are needed only if very strong motion blur is desired.
Here is summary of all changes:
Bloom Intensity: 0.8 > 0.05
Bloom Intensity UI range: 0-10 > 0-0.1
Bloom Clamp: 1.0 > 0.0 (disabled by default)
Bloom Clamp manual range: 0-1000 > 0-100000
Bloom Clamp UI range: 0-10 > 0-1000
Shutter: 1.0 > 0.5
This patch is related to the discussion in this thread, there are more examples of what bloom will look like with 0.05 intensity by me and others:
https://devtalk.blender.org/t/eevee-needs-to-have-physically-based-defaults/4700
Reviewers: fclem
Reviewed By: fclem
Subscribers: pablovazquez, billreynish, rboxman
Tags: #eevee
Differential Revision: https://developer.blender.org/D4212
2019-01-17 19:54:49 +01:00
|
|
|
sce->eevee.motion_blur_shutter = 0.5f;
|
2018-05-16 19:34:24 +02:00
|
|
|
|
|
|
|
|
sce->eevee.shadow_method = SHADOW_ESM;
|
|
|
|
|
sce->eevee.shadow_cube_size = 512;
|
|
|
|
|
sce->eevee.shadow_cascade_size = 1024;
|
|
|
|
|
|
2018-07-10 15:02:25 +02:00
|
|
|
sce->eevee.light_cache = NULL;
|
2018-11-15 14:44:45 +01:00
|
|
|
sce->eevee.light_threshold = 0.01f;
|
2018-07-10 15:02:25 +02:00
|
|
|
|
2018-10-31 19:40:00 +01:00
|
|
|
sce->eevee.overscan = 3.0f;
|
2018-10-31 18:31:14 +01:00
|
|
|
|
2018-05-16 19:34:24 +02:00
|
|
|
sce->eevee.flag =
|
|
|
|
|
SCE_EEVEE_VOLUMETRIC_LIGHTS |
|
|
|
|
|
SCE_EEVEE_GTAO_BENT_NORMALS |
|
|
|
|
|
SCE_EEVEE_GTAO_BOUNCE |
|
|
|
|
|
SCE_EEVEE_TAA_REPROJECTION |
|
|
|
|
|
SCE_EEVEE_SSR_HALF_RESOLUTION;
|
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;
|
|
|
|
|
|
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 = BKE_libblock_alloc(bmain, ID_SCE, name, 0);
|
2016-09-26 16:35:52 +02:00
|
|
|
id_us_min(&sce->id);
|
|
|
|
|
id_us_ensure_real(&sce->id);
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
|
|
|
|
|
BKE_scene_init(sce);
|
2015-08-10 15:41:28 +02:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return sce;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2017-11-08 12:16:49 -02:00
|
|
|
Object *BKE_scene_object_find_by_name(Scene *scene, const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2017-11-22 10:52:39 -02:00
|
|
|
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
|
|
|
|
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
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
|
|
|
/**
|
|
|
|
|
* Sets the active scene, mainly used when running in background mode (``--scene`` command line argument).
|
|
|
|
|
* This is also called to set the scene directly, bypassing windowing code.
|
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-03-08 09:29:17 +11: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;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* copy layers and flags from bases to objects */
|
2017-11-22 10:52:39 -02:00
|
|
|
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
|
|
|
|
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
|
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
|
|
|
}
|
More work on render stuff!
- Scene support in RenderLayers
You now can indicate in Compositor to use RenderLayer(s) from other scenes.
Use the new dropdown menu in the "Render Result" node. It will change the
title of the node to indicate that.
The other Scenes are rendered fully separate, creating own databases (and
octrees) after the current scene was finished. They use their own render
settings, with as exception the render output size (and optional border).
This makes the option an interesting memory saver and speedup.
Also note that the render-results of other scenes are kept in memory while
you work. So, after a render, you can tweak all composit effects.
- Render Stats
Added an 'info string' to stats, printed in renderwindow header. It gives
info now on steps "creating database", "shadow buffers", and "octree".
- Bug fixes
Added redraw event for Image window, when using compositor render.
Text objects were not rendered using background render (probably a bug
since depsgraph was added)
Dropdown buttons in Node editor were not refreshed after usage
Sometimes render window did not open, this due to wrong check for 'esc'.
Removed option that renders view-layers on F12, with mouse in 3d window.
Not only was it confusing, it's now more efficient with the Preview Panel,
which does this nicely.
2006-02-04 13:28:50 +00:00
|
|
|
/* no full animation update, this to enable render code to work (render code calls own animation updates) */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2016-03-04 06:35:17 +11:00
|
|
|
/* called from creator_args.c */
|
2012-05-05 14:33:36 +00:00
|
|
|
Scene *BKE_scene_set_name(Main *bmain, const char *name)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
|
2014-07-18 22:31:33 +02:00
|
|
|
/* Used by metaballs, return *all* objects (including duplis) 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,
|
2017-11-09 15:44:56 -02:00
|
|
|
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;
|
2018-06-17 17:05:51 +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;
|
2004-01-04 22:10:36 +00:00
|
|
|
|
2003-04-26 13:07:59 +00:00
|
|
|
/* the first base */
|
2014-01-23 10:20:42 +01:00
|
|
|
if (iter->phase == F_START) {
|
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;
|
|
|
|
|
}
|
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;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-17 17:05:51 +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) {
|
2019-03-08 09:29:17 +11:00
|
|
|
/* collections cannot be duplicated for metaballs 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);
|
2018-06-17 17:05:51 +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;
|
2008-04-12 14:30:17 +00:00
|
|
|
|
2014-07-18 22:31:33 +02:00
|
|
|
if (!iter->dupob) {
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
free_object_duplilist(iter->duplilist);
|
2014-07-18 22:31:33 +02:00
|
|
|
iter->duplilist = NULL;
|
|
|
|
|
}
|
|
|
|
|
iter->dupli_refob = NULL;
|
2006-11-03 12:38:21 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-04-26 13:07:59 +00:00
|
|
|
/* handle dupli's */
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
if (iter->dupob) {
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
(*base)->flag_legacy |= OB_FROMDUPLI;
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
*ob = iter->dupob->ob;
|
2014-01-23 10:20:42 +01:00
|
|
|
iter->phase = F_DUPLI;
|
2014-07-18 22:31:33 +02:00
|
|
|
|
|
|
|
|
if (iter->dupli_refob != *ob) {
|
|
|
|
|
if (iter->dupli_refob) {
|
|
|
|
|
/* Restore previous object's real matrix. */
|
|
|
|
|
copy_m4_m4(iter->dupli_refob->obmat, iter->omat);
|
|
|
|
|
}
|
|
|
|
|
/* Backup new object's real matrix. */
|
|
|
|
|
iter->dupli_refob = *ob;
|
|
|
|
|
copy_m4_m4(iter->omat, iter->dupli_refob->obmat);
|
|
|
|
|
}
|
|
|
|
|
copy_m4_m4((*ob)->obmat, iter->dupob->mat);
|
|
|
|
|
|
Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.
Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:
- Wrap almost all the static variables into own context-
like structure, which is owned by the callee function
and getting passed to the iteration function.
- Recursion detection wasn't possible with such approach,
so recursion detection still uses static in_next_object
variable, but which is now stored in thread local
storage (TLS, or thread variable if this names are more
clear for you).
This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.
Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".
But this ideal things are to be solved in Joshua's and
mind GSoC projects.
Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.
Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
|
|
|
iter->dupob = iter->dupob->next;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2014-01-23 10:20:42 +01:00
|
|
|
else if (iter->phase == F_DUPLI) {
|
|
|
|
|
iter->phase = F_SCENE;
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
(*base)->flag_legacy &= ~OB_FROMDUPLI;
|
2018-06-17 17:05:51 +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
|
|
|
}
|
2018-06-17 17:05:51 +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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-03-03 20:19:11 +00:00
|
|
|
|
2014-01-23 10:20:42 +01:00
|
|
|
return iter->phase;
|
2002-10-12 11:37:38 +00: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) {
|
2017-11-22 10:52:39 -02:00
|
|
|
for (ViewLayer *layer = scene->view_layers.first; layer; layer = layer->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
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-16 19:49:33 +00:00
|
|
|
TimeMarker *m;
|
|
|
|
|
int cfra = scene->r.cfra;
|
|
|
|
|
int frame = -(MAXFRAME + 1);
|
2013-10-17 14:10:03 +00:00
|
|
|
int min_frame = MAXFRAME + 1;
|
2012-05-06 15:15:33 +00:00
|
|
|
Object *camera = NULL;
|
2013-10-17 15:51:12 +00:00
|
|
|
Object *first_camera = NULL;
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
for (m = scene->markers.first; m; m = m->next) {
|
2013-10-17 14:10:03 +00:00
|
|
|
if (m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER) == 0) {
|
|
|
|
|
if ((m->frame <= cfra) && (m->frame > frame)) {
|
|
|
|
|
camera = m->camera;
|
|
|
|
|
frame = m->frame;
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2013-10-17 14:10:03 +00:00
|
|
|
if (frame == cfra)
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
|
2013-10-17 14:10:03 +00:00
|
|
|
if (m->frame < min_frame) {
|
|
|
|
|
first_camera = m->camera;
|
|
|
|
|
min_frame = m->frame;
|
|
|
|
|
}
|
2009-12-16 19:49:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-10-17 14:10:03 +00:00
|
|
|
|
|
|
|
|
if (camera == NULL) {
|
|
|
|
|
/* If there's no marker to the left of current frame,
|
|
|
|
|
* use camera from left-most marker to solve all sort
|
|
|
|
|
* of Schrodinger uncertainties.
|
|
|
|
|
*/
|
|
|
|
|
return first_camera;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-16 19:49:33 +00:00
|
|
|
return camera;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
int BKE_scene_camera_switch_update(Scene *scene)
|
2010-03-09 07:41:04 +00:00
|
|
|
{
|
|
|
|
|
#ifdef DURIAN_CAMERA_SWITCH
|
2012-05-06 15:15:33 +00:00
|
|
|
Object *camera = BKE_scene_camera_switch_find(scene);
|
2012-02-23 02:17:50 +00:00
|
|
|
if (camera) {
|
2012-05-06 15:15:33 +00:00
|
|
|
scene->camera = camera;
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
|
2010-03-09 07:41:04 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
2011-11-05 14:26:18 +00:00
|
|
|
#else
|
|
|
|
|
(void)scene;
|
2010-03-09 07:41:04 +00:00
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
char *BKE_scene_find_marker_name(Scene *scene, int frame)
|
2009-12-16 19:49:33 +00:00
|
|
|
{
|
2012-05-06 15:15:33 +00:00
|
|
|
ListBase *markers = &scene->markers;
|
2009-12-16 19:49:33 +00:00
|
|
|
TimeMarker *m1, *m2;
|
|
|
|
|
|
|
|
|
|
/* search through markers for match */
|
2012-05-06 15:15:33 +00:00
|
|
|
for (m1 = markers->first, m2 = markers->last; m1 && m2; m1 = m1->next, m2 = m2->prev) {
|
|
|
|
|
if (m1->frame == frame)
|
2009-12-16 19:49:33 +00:00
|
|
|
return m1->name;
|
|
|
|
|
|
|
|
|
|
if (m1 == m2)
|
|
|
|
|
break;
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
if (m2->frame == frame)
|
2009-12-16 19:49:33 +00:00
|
|
|
return m2->name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-02-06 14:56:25 +00:00
|
|
|
/* return the current marker for this frame,
|
2013-04-07 15:09:06 +00:00
|
|
|
* we can have more than 1 marker per frame, this just returns the first :/ */
|
2012-05-05 14:33:36 +00:00
|
|
|
char *BKE_scene_find_last_marker_name(Scene *scene, int frame)
|
2010-02-06 14:56:25 +00:00
|
|
|
{
|
|
|
|
|
TimeMarker *marker, *best_marker = NULL;
|
2012-05-06 15:15:33 +00:00
|
|
|
int best_frame = -MAXFRAME * 2;
|
|
|
|
|
for (marker = scene->markers.first; marker; marker = marker->next) {
|
|
|
|
|
if (marker->frame == frame) {
|
2010-02-07 09:52:43 +00:00
|
|
|
return marker->name;
|
2010-02-06 14:56:25 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-06 15:15:33 +00:00
|
|
|
if (marker->frame > best_frame && marker->frame < frame) {
|
2010-02-06 14:56:25 +00:00
|
|
|
best_marker = marker;
|
|
|
|
|
best_frame = marker->frame;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return best_marker ? best_marker->name : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-19 14:57:07 +02:00
|
|
|
void BKE_scene_remove_rigidbody_object(struct Main *bmain, Scene *scene, Object *ob)
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
{
|
|
|
|
|
/* remove rigid body constraint from world before removing object */
|
|
|
|
|
if (ob->rigidbody_constraint)
|
|
|
|
|
BKE_rigidbody_remove_constraint(scene, ob);
|
|
|
|
|
/* remove rigid body object from world before removing object */
|
|
|
|
|
if (ob->rigidbody_object)
|
2018-06-19 14:57:07 +02:00
|
|
|
BKE_rigidbody_remove_object(bmain, scene, ob);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
}
|
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
|
|
|
|
2014-12-01 17:11:18 +01:00
|
|
|
if (sce->set == NULL) return true;
|
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
|
|
|
}
|
|
|
|
|
|
2010-06-27 05:39:55 +00:00
|
|
|
/* This function is needed to cope with fractional frames - including two Blender rendering features
|
2018-06-01 18:19:39 +02:00
|
|
|
* mblur (motion blur that renders 'subframes' and blurs them together), and fields rendering.
|
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
|
|
|
{
|
2012-05-05 14:33:36 +00:00
|
|
|
return BKE_scene_frame_get_from_ctime(scene, scene->r.cfra);
|
2011-11-06 06:08:18 +00:00
|
|
|
}
|
2010-06-27 05:39:55 +00:00
|
|
|
|
2011-11-06 12:12:14 +00:00
|
|
|
/* This function is used to obtain arbitrary fractional frames */
|
2015-03-21 22:10:43 +11:00
|
|
|
float BKE_scene_frame_get_from_ctime(const Scene *scene, const float frame)
|
2011-11-06 06:08:18 +00:00
|
|
|
{
|
2011-11-06 12:12:14 +00:00
|
|
|
float ctime = frame;
|
2011-11-06 06:08:18 +00:00
|
|
|
ctime += scene->r.subframe;
|
2012-10-21 05:46:41 +00:00
|
|
|
ctime *= scene->r.framelen;
|
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
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int flag)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(flag && !(flag & ~(SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE)));
|
|
|
|
|
int index = SCE_ORIENT_DEFAULT;
|
|
|
|
|
if (flag & SCE_GIZMO_SHOW_TRANSLATE) {
|
|
|
|
|
index = SCE_ORIENT_TRANSLATE;
|
|
|
|
|
}
|
|
|
|
|
else if (flag & SCE_GIZMO_SHOW_ROTATE) {
|
|
|
|
|
index = SCE_ORIENT_ROTATE;
|
|
|
|
|
}
|
|
|
|
|
else if (flag & SCE_GIZMO_SHOW_SCALE) {
|
|
|
|
|
index = SCE_ORIENT_SCALE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((scene->orientation_slots[index].flag & SELECT) == 0) {
|
|
|
|
|
index = SCE_ORIENT_DEFAULT;
|
|
|
|
|
}
|
|
|
|
|
return &scene->orientation_slots[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
2014-11-14 14:04:07 +01:00
|
|
|
/* That's like really a bummer, because currently animation data for armatures
|
|
|
|
|
* might want to use pose, and pose might be missing on the object.
|
|
|
|
|
* This happens when changing visible layers, which leads to situations when
|
|
|
|
|
* pose is missing or marked for recalc, animation will change it and then
|
|
|
|
|
* object update will restore the pose.
|
|
|
|
|
*
|
|
|
|
|
* This could be solved by the new dependency graph, but for until then we'll
|
|
|
|
|
* do an extra pass on the objects to ensure it's all fine.
|
|
|
|
|
*/
|
|
|
|
|
#define POSE_ANIMATION_WORKAROUND
|
2013-01-10 18:20:29 +00:00
|
|
|
|
2014-11-14 14:04:07 +01:00
|
|
|
#ifdef POSE_ANIMATION_WORKAROUND
|
2018-05-29 15:57:14 +02:00
|
|
|
static void scene_armature_depsgraph_workaround(Main *bmain, Depsgraph *depsgraph)
|
2014-11-14 14:04:07 +01:00
|
|
|
{
|
|
|
|
|
Object *ob;
|
2019-03-08 09:29:17 +11:00
|
|
|
if (BLI_listbase_is_empty(&bmain->armatures) || !DEG_id_type_updated(depsgraph, ID_OB)) {
|
2014-11-14 14:04:07 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2019-03-08 09:29:17 +11:00
|
|
|
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
|
2019-01-29 11:59:17 +01:00
|
|
|
if (ob->type == OB_ARMATURE && ob->adt) {
|
2014-11-14 14:04:07 +01:00
|
|
|
if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) {
|
2018-07-31 11:38:10 +02:00
|
|
|
BKE_pose_rebuild(bmain, ob, ob->data, true);
|
2014-11-14 14:04:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-01-10 18:20:29 +00:00
|
|
|
}
|
2014-11-14 14:04:07 +01:00
|
|
|
#endif
|
2013-01-10 18:20:29 +00:00
|
|
|
|
2014-07-31 20:18:51 +06:00
|
|
|
static bool check_rendered_viewport_visible(Main *bmain)
|
|
|
|
|
{
|
|
|
|
|
wmWindowManager *wm = bmain->wm.first;
|
|
|
|
|
wmWindow *window;
|
|
|
|
|
for (window = wm->windows.first; window != NULL; window = window->next) {
|
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);
|
|
|
|
|
|
2018-05-30 14:32:47 +02:00
|
|
|
if (type->draw_engine || !type->render) {
|
2017-05-01 14:55:59 +02:00
|
|
|
continue;
|
|
|
|
|
}
|
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(
|
2018-04-05 18:20:27 +02:00
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
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(
|
2018-06-13 16:29:12 +02:00
|
|
|
bmain, bm, mesh,
|
2018-02-19 17:27:01 +11:00
|
|
|
(&(struct BMeshToMeshParams){
|
|
|
|
|
.calc_object_remap = true,
|
|
|
|
|
}));
|
2017-04-06 16:11:50 +02:00
|
|
|
DEG_id_tag_update(&mesh->id, 0);
|
2014-07-31 20:18:51 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|
2018-04-06 11:21:20 +02:00
|
|
|
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph,
|
|
|
|
|
Main *bmain)
|
2009-12-10 11:08:38 +00:00
|
|
|
{
|
2018-04-06 11:21:20 +02:00
|
|
|
Scene *scene = DEG_get_input_scene(depsgraph);
|
|
|
|
|
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
|
|
|
|
|
|
2018-11-23 11:51:42 +01:00
|
|
|
bool run_callbacks = DEG_id_type_any_updated(depsgraph);
|
|
|
|
|
if (run_callbacks) {
|
|
|
|
|
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_PRE);
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-25 15:23:06 +02:00
|
|
|
/* TODO(sergey): Some functions here are changing global state,
|
|
|
|
|
* for example, clearing update tags from bmain.
|
|
|
|
|
*/
|
|
|
|
|
/* (Re-)build dependency graph if needed. */
|
2017-11-22 10:52:39 -02:00
|
|
|
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer);
|
2017-10-25 14:37:03 +02:00
|
|
|
/* Uncomment this to check if graph was properly tagged for update. */
|
2017-10-25 15:23:06 +02:00
|
|
|
// DEG_debug_graph_relations_validate(depsgraph, bmain, scene);
|
|
|
|
|
/* Flush editing data if needed. */
|
2018-04-05 18:20:27 +02:00
|
|
|
prepare_mesh_for_viewport_render(bmain, view_layer);
|
2017-10-25 15:23:06 +02:00
|
|
|
/* Flush recalc flags to dependencies. */
|
|
|
|
|
DEG_graph_flush_update(bmain, depsgraph);
|
|
|
|
|
/* Update all objects: drivers, matrices, displists, etc. flags set
|
2017-10-25 14:02:51 +02:00
|
|
|
* by depgraph or manual, no layer check here, gets correct flushed.
|
|
|
|
|
*/
|
2018-04-06 11:21:20 +02:00
|
|
|
DEG_evaluate_on_refresh(depsgraph);
|
2017-10-25 15:23:06 +02:00
|
|
|
/* Update sound system animation (TODO, move to depsgraph). */
|
2015-03-26 11:35:41 +01:00
|
|
|
BKE_sound_update_scene(bmain, scene);
|
2018-11-23 11:51:42 +01:00
|
|
|
|
|
|
|
|
/* Notify python about depsgraph update */
|
|
|
|
|
if (run_callbacks) {
|
|
|
|
|
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_POST);
|
|
|
|
|
}
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
/* Inform editors about possible changes. */
|
2018-01-16 15:37:52 +01:00
|
|
|
DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, false);
|
2017-10-25 15:23:06 +02:00
|
|
|
/* Clear recalc flags. */
|
2018-05-29 15:57:14 +02:00
|
|
|
DEG_ids_clear_recalc(bmain, depsgraph);
|
2009-12-10 11:08:38 +00:00
|
|
|
}
|
2009-09-18 22:25:49 +00:00
|
|
|
|
2007-01-31 10:59:39 +00:00
|
|
|
/* applies changes right away, does all sets too */
|
2018-04-06 11:21:20 +02:00
|
|
|
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph,
|
|
|
|
|
Main *bmain)
|
2007-01-31 10:59:39 +00:00
|
|
|
{
|
2018-04-06 11:21:20 +02:00
|
|
|
Scene *scene = DEG_get_input_scene(depsgraph);
|
|
|
|
|
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
|
|
|
|
|
|
2017-10-25 15:23:06 +02:00
|
|
|
/* TODO(sergey): Some functions here are changing global state,
|
|
|
|
|
* for example, clearing update tags from bmain.
|
|
|
|
|
*/
|
|
|
|
|
const float ctime = BKE_scene_frame_get(scene);
|
2017-11-28 12:56:01 +01:00
|
|
|
/* Keep this first. */
|
2017-10-25 15:23:06 +02:00
|
|
|
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_FRAME_CHANGE_PRE);
|
|
|
|
|
/* Update animated image textures for particles, modifiers, gpu, etc,
|
|
|
|
|
* call this at the start so modifiers with textures don't lag 1 frame.
|
|
|
|
|
*/
|
2019-02-18 13:23:49 +01:00
|
|
|
BKE_image_editors_update_frame(bmain, scene->r.cfra);
|
2017-10-25 15:23:06 +02:00
|
|
|
BKE_sound_set_cfra(scene->r.cfra);
|
2017-11-22 10:52:39 -02:00
|
|
|
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer);
|
2017-10-25 15:23:06 +02:00
|
|
|
/* Update animated cache files for modifiers.
|
|
|
|
|
*
|
|
|
|
|
* TODO(sergey): Make this a depsgraph node?
|
|
|
|
|
*/
|
2018-05-31 12:52:13 +02:00
|
|
|
BKE_cachefile_update_frame(bmain, depsgraph, scene, ctime,
|
2017-10-25 15:23:06 +02:00
|
|
|
(((double)scene->r.frs_sec) / (double)scene->r.frs_sec_base));
|
2014-11-14 14:04:07 +01:00
|
|
|
#ifdef POSE_ANIMATION_WORKAROUND
|
2018-05-29 15:57:14 +02:00
|
|
|
scene_armature_depsgraph_workaround(bmain, depsgraph);
|
2014-11-14 14:04:07 +01:00
|
|
|
#endif
|
2017-10-25 15:23:06 +02:00
|
|
|
/* Update all objects: drivers, matrices, displists, etc. flags set
|
|
|
|
|
* by depgraph or manual, no layer check here, gets correct flushed.
|
|
|
|
|
*/
|
2018-04-06 11:21:20 +02:00
|
|
|
DEG_evaluate_on_framechange(bmain, depsgraph, ctime);
|
2017-10-25 15:23:06 +02:00
|
|
|
/* Update sound system animation (TODO, move to depsgraph). */
|
|
|
|
|
BKE_sound_update_scene(bmain, scene);
|
|
|
|
|
/* Notify editors and python about recalc. */
|
|
|
|
|
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_FRAME_CHANGE_POST);
|
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
|
|
|
/* Inform editors about possible changes. */
|
2018-01-16 15:37:52 +01:00
|
|
|
DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, true);
|
2011-11-28 14:55:35 +00:00
|
|
|
/* clear recalc flags */
|
2018-05-29 15:57:14 +02:00
|
|
|
DEG_ids_clear_recalc(bmain, depsgraph);
|
2007-01-31 10:59:39 +00:00
|
|
|
}
|
|
|
|
|
|
2018-08-03 10:13:33 +02:00
|
|
|
/** Ensures given scene/view_layer pair has a valid, up-to-date depsgraph.
|
|
|
|
|
*
|
|
|
|
|
* \warning Sets matching depsgraph as active, so should only be called from the active editing context
|
|
|
|
|
* (usually, from operators).
|
|
|
|
|
*/
|
|
|
|
|
void BKE_scene_view_layer_graph_evaluated_ensure(Main *bmain, Scene *scene, ViewLayer *view_layer)
|
|
|
|
|
{
|
|
|
|
|
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
|
name = DATA_("RenderView");
|
|
|
|
|
|
|
|
|
|
srv = MEM_callocN(sizeof(SceneRenderView), "new render view");
|
|
|
|
|
BLI_strncpy(srv->name, name, sizeof(srv->name));
|
|
|
|
|
BLI_uniquename(&sce->r.views, srv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(srv->name));
|
|
|
|
|
BLI_addtail(&sce->r.views, srv);
|
|
|
|
|
|
|
|
|
|
return srv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BKE_scene_remove_render_view(Scene *scene, SceneRenderView *srv)
|
|
|
|
|
{
|
|
|
|
|
const int act = BLI_findindex(&scene->r.views, srv);
|
|
|
|
|
|
|
|
|
|
if (act == -1) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (scene->r.views.first == scene->r.views.last) {
|
|
|
|
|
/* ensure 1 view is kept */
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_remlink(&scene->r.views, srv);
|
|
|
|
|
MEM_freeN(srv);
|
|
|
|
|
|
|
|
|
|
scene->r.actview = 0;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-13 11:18:08 +00:00
|
|
|
/* render simplification */
|
|
|
|
|
|
2015-05-04 16:26:28 +05:00
|
|
|
int get_render_subsurf_level(const RenderData *r, int lvl, bool for_render)
|
2008-02-13 11:18:08 +00:00
|
|
|
{
|
2017-06-02 15:38:04 +10:00
|
|
|
if (r->mode & R_SIMPLIFY) {
|
2015-05-04 16:26:28 +05:00
|
|
|
if (for_render)
|
|
|
|
|
return min_ii(r->simplify_subsurf_render, lvl);
|
|
|
|
|
else
|
|
|
|
|
return min_ii(r->simplify_subsurf, lvl);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2008-02-13 11:18:08 +00:00
|
|
|
return lvl;
|
2015-05-04 16:26:28 +05:00
|
|
|
}
|
2008-02-13 11:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-04 16:26:28 +05:00
|
|
|
int get_render_child_particle_number(const RenderData *r, int num, bool for_render)
|
2008-02-13 11:18:08 +00:00
|
|
|
{
|
2015-05-04 16:26:28 +05:00
|
|
|
if (r->mode & R_SIMPLIFY) {
|
|
|
|
|
if (for_render)
|
|
|
|
|
return (int)(r->simplify_particles_render * num);
|
|
|
|
|
else
|
|
|
|
|
return (int)(r->simplify_particles * num);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2008-02-13 11:18:08 +00:00
|
|
|
return num;
|
2015-05-04 16:26:28 +05:00
|
|
|
}
|
2008-02-13 11:18:08 +00:00
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2017-11-22 10:52:39 -02:00
|
|
|
else 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;
|
2017-02-15 14:04:11 +01:00
|
|
|
|
2012-02-23 02:17:50 +00:00
|
|
|
if (base) {
|
2011-04-21 13:11:51 +00:00
|
|
|
return base;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-04-02 13:43:56 +00:00
|
|
|
|
2011-04-21 13:11:51 +00:00
|
|
|
return NULL;
|
2010-04-02 13:43:56 +00:00
|
|
|
}
|
2011-11-02 19:24:30 +00:00
|
|
|
|
2015-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
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
ob->flag = base->flag;
|
2017-02-08 12:26:41 +01:00
|
|
|
|
|
|
|
|
if ((base->flag & BASE_SELECTED) != 0) {
|
|
|
|
|
ob->flag |= SELECT;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ob->flag &= ~SELECT;
|
|
|
|
|
}
|
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_object(Base *base)
|
|
|
|
|
{
|
2017-02-08 12:26:41 +01:00
|
|
|
Object *ob = base->object;
|
|
|
|
|
base->flag = ob->flag;
|
|
|
|
|
|
2019-03-25 21:08:27 +01:00
|
|
|
if ((ob->flag & SELECT) != 0 && (base->flag & BASE_SELECTABLE) != 0) {
|
2017-02-08 12:26:41 +01:00
|
|
|
base->flag |= BASE_SELECTED;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
base->flag &= ~BASE_SELECTED;
|
|
|
|
|
}
|
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();
|
|
|
|
|
|
|
|
|
|
if (threads > 0)
|
|
|
|
|
return threads;
|
|
|
|
|
|
|
|
|
|
/* fixed number of threads specified in scene? */
|
|
|
|
|
if (rd->mode & R_FIXED_THREADS)
|
|
|
|
|
threads = rd->threads;
|
|
|
|
|
else
|
|
|
|
|
threads = BLI_system_thread_count();
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-26 20:52:07 +10:00
|
|
|
/* Apply the needed correction factor to value, based on unit_type (only length-related are affected currently)
|
|
|
|
|
* and unit->scale_length.
|
|
|
|
|
*/
|
|
|
|
|
double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, double value)
|
|
|
|
|
{
|
|
|
|
|
if (unit->system == USER_UNIT_NONE) {
|
|
|
|
|
/* Never apply scale_length when not using a unit setting! */
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (unit_type) {
|
|
|
|
|
case B_UNIT_LENGTH:
|
|
|
|
|
return value * (double)unit->scale_length;
|
|
|
|
|
case B_UNIT_AREA:
|
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;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (rd->views_format == SCE_VIEWS_FORMAT_STEREO_3D) {
|
2015-05-12 18:43:07 -03:00
|
|
|
srv = BLI_findstring(&rd->views, STEREO_LEFT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
|
if ((srv && srv->viewflag & SCE_VIEW_DISABLE) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
totviews++;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-12 18:43:07 -03:00
|
|
|
srv = BLI_findstring(&rd->views, STEREO_RIGHT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
|
if ((srv && srv->viewflag & SCE_VIEW_DISABLE) == 0) {
|
2015-04-06 10:40:12 -03:00
|
|
|
totviews++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (srv = rd->views.first; srv; srv = srv->next) {
|
|
|
|
|
if ((srv->viewflag & SCE_VIEW_DISABLE) == 0) {
|
|
|
|
|
totviews++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return totviews;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BKE_scene_multiview_is_stereo3d(const RenderData *rd)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv[2];
|
|
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
srv[0] = (SceneRenderView *)BLI_findstring(&rd->views, STEREO_LEFT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
|
srv[1] = (SceneRenderView *)BLI_findstring(&rd->views, STEREO_RIGHT_NAME, offsetof(SceneRenderView, name));
|
|
|
|
|
|
|
|
|
|
return (srv[0] && ((srv[0]->viewflag & SCE_VIEW_DISABLE) == 0) &&
|
|
|
|
|
srv[1] && ((srv[1]->viewflag & SCE_VIEW_DISABLE) == 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* return whether to render this SceneRenderView */
|
|
|
|
|
bool BKE_scene_multiview_is_render_view_active(const RenderData *rd, const SceneRenderView *srv)
|
|
|
|
|
{
|
|
|
|
|
if (srv == NULL)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if ((srv->viewflag & SCE_VIEW_DISABLE))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
/* SCE_VIEWS_SETUP_BASIC */
|
|
|
|
|
if (STREQ(srv->name, STEREO_LEFT_NAME) ||
|
|
|
|
|
STREQ(srv->name, STEREO_RIGHT_NAME))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* return true if viewname is the first or if the name is NULL or not found */
|
|
|
|
|
bool BKE_scene_multiview_is_render_view_first(const RenderData *rd, const char *viewname)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if ((!viewname) || (!viewname[0]))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
for (srv = rd->views.first; srv; srv = srv->next) {
|
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
|
return STREQ(viewname, srv->name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* return true if viewname is the last or if the name is NULL or not found */
|
|
|
|
|
bool BKE_scene_multiview_is_render_view_last(const RenderData *rd, const char *viewname)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if ((!viewname) || (!viewname[0]))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
for (srv = rd->views.last; srv; srv = srv->prev) {
|
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
|
return STREQ(viewname, srv->name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SceneRenderView *BKE_scene_multiview_render_view_findindex(const RenderData *rd, const int view_id)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
size_t nr;
|
|
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
for (srv = rd->views.first, nr = 0; srv; srv = srv->next) {
|
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
|
if (nr++ == view_id)
|
|
|
|
|
return srv;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return srv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *BKE_scene_multiview_render_view_name_get(const RenderData *rd, const int view_id)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv = BKE_scene_multiview_render_view_findindex(rd, view_id);
|
|
|
|
|
|
|
|
|
|
if (srv)
|
|
|
|
|
return srv->name;
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-24 01:01:10 +11:00
|
|
|
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
size_t nr;
|
|
|
|
|
|
|
|
|
|
if ((!rd) || ((rd->scemode & R_MULTIVIEW) == 0))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if ((!viewname) || (!viewname[0]))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (srv = rd->views.first, nr = 0; srv; srv = srv->next) {
|
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(rd, srv)) {
|
|
|
|
|
if (STREQ(viewname, srv->name)) {
|
|
|
|
|
return nr;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
nr += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_multiview_filepath_get(
|
|
|
|
|
SceneRenderView *srv, const char *filepath,
|
|
|
|
|
char *r_filepath)
|
|
|
|
|
{
|
|
|
|
|
BLI_strncpy(r_filepath, filepath, FILE_MAX);
|
|
|
|
|
BLI_path_suffix(r_filepath, FILE_MAX, srv->suffix, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* When multiview is not used the filepath is as usual (e.g., ``Image.jpg``).
|
|
|
|
|
* When multiview is on, even if only one view is enabled the view is incorporated
|
|
|
|
|
* into the file name (e.g., ``Image_L.jpg``). That allows for the user to re-render
|
|
|
|
|
* individual views.
|
|
|
|
|
*/
|
|
|
|
|
void BKE_scene_multiview_view_filepath_get(
|
|
|
|
|
const RenderData *rd, const char *filepath, const char *viewname,
|
|
|
|
|
char *r_filepath)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
char suffix[FILE_MAX];
|
|
|
|
|
|
|
|
|
|
srv = BLI_findstring(&rd->views, viewname, offsetof(SceneRenderView, name));
|
|
|
|
|
if (srv)
|
|
|
|
|
BLI_strncpy(suffix, srv->suffix, sizeof(suffix));
|
|
|
|
|
else
|
|
|
|
|
BLI_strncpy(suffix, viewname, sizeof(suffix));
|
|
|
|
|
|
|
|
|
|
BLI_strncpy(r_filepath, filepath, FILE_MAX);
|
|
|
|
|
BLI_path_suffix(r_filepath, FILE_MAX, suffix, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *BKE_scene_multiview_view_suffix_get(const RenderData *rd, const char *viewname)
|
|
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
|
|
|
|
|
if ((viewname == NULL) || (viewname[0] == '\0'))
|
|
|
|
|
return viewname;
|
|
|
|
|
|
|
|
|
|
srv = BLI_findstring(&rd->views, viewname, offsetof(SceneRenderView, name));
|
|
|
|
|
if (srv)
|
|
|
|
|
return srv->suffix;
|
|
|
|
|
else
|
|
|
|
|
return viewname;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-24 01:01:10 +11:00
|
|
|
const char *BKE_scene_multiview_view_id_suffix_get(const RenderData *rd, const int view_id)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
const char *viewname = BKE_scene_multiview_render_view_name_get(rd, view_id);
|
|
|
|
|
return BKE_scene_multiview_view_suffix_get(rd, viewname);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-27 11:00:47 +02:00
|
|
|
void BKE_scene_multiview_view_prefix_get(Scene *scene, const char *name, char *rprefix, const char **rext)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
|
SceneRenderView *srv;
|
|
|
|
|
size_t index_act;
|
2015-06-27 11:00:47 +02:00
|
|
|
const char *suf_act;
|
2015-04-06 10:40:12 -03:00
|
|
|
const char delims[] = {'.', '\0'};
|
|
|
|
|
|
|
|
|
|
rprefix[0] = '\0';
|
|
|
|
|
|
|
|
|
|
/* begin of extension */
|
|
|
|
|
index_act = BLI_str_rpartition(name, delims, rext, &suf_act);
|
2016-02-20 17:43:31 +01:00
|
|
|
if (*rext == NULL)
|
|
|
|
|
return;
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_assert(index_act > 0);
|
2015-06-21 12:30:11 +10:00
|
|
|
UNUSED_VARS_NDEBUG(index_act);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
for (srv = scene->r.views.first; srv; srv = srv->next) {
|
|
|
|
|
if (BKE_scene_multiview_is_render_view_active(&scene->r, srv)) {
|
|
|
|
|
size_t len = strlen(srv->suffix);
|
2016-02-20 17:43:31 +01:00
|
|
|
if (strlen(*rext) >= len && STREQLEN(*rext - len, srv->suffix, len)) {
|
2015-04-06 10:40:12 -03:00
|
|
|
BLI_strncpy(rprefix, name, strlen(name) - strlen(*rext) - len + 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BKE_scene_multiview_videos_dimensions_get(
|
|
|
|
|
const RenderData *rd, const size_t width, const size_t height,
|
|
|
|
|
size_t *r_width, size_t *r_height)
|
|
|
|
|
{
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) &&
|
|
|
|
|
rd->im_format.views_format == R_IMF_VIEWS_STEREO_3D)
|
|
|
|
|
{
|
|
|
|
|
IMB_stereo3d_write_dimensions(
|
|
|
|
|
rd->im_format.stereo3d_format.display_mode,
|
|
|
|
|
(rd->im_format.stereo3d_format.flag & S3D_SQUEEZED_FRAME) != 0,
|
|
|
|
|
width, height,
|
|
|
|
|
r_width, r_height);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*r_width = width;
|
|
|
|
|
*r_height = height;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-24 01:01:10 +11:00
|
|
|
int BKE_scene_multiview_num_videos_get(const RenderData *rd)
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
|
if (BKE_imtype_is_movie(rd->im_format.imtype) == false)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if ((rd->scemode & R_MULTIVIEW) == 0)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (rd->im_format.views_format == R_IMF_VIEWS_STEREO_3D) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* R_IMF_VIEWS_INDIVIDUAL */
|
|
|
|
|
return BKE_scene_multiview_num_views_get(rd);
|
|
|
|
|
}
|
|
|
|
|
}
|
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 {
|
2017-11-22 10:52:39 -02:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Query depsgraph for a specific contexts. */
|
|
|
|
|
|
2017-11-07 16:29:31 +01:00
|
|
|
Depsgraph *BKE_scene_get_depsgraph(Scene *scene,
|
2017-11-22 10:52:39 -02:00
|
|
|
ViewLayer *view_layer,
|
2017-11-07 16:29:31 +01:00
|
|
|
bool allocate)
|
2017-07-13 15:43:36 +02:00
|
|
|
{
|
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);
|
2017-11-07 17:01:14 +01:00
|
|
|
/* Make sure hash itself exists. */
|
|
|
|
|
if (allocate) {
|
|
|
|
|
BKE_scene_ensure_depsgraph_hash(scene);
|
|
|
|
|
}
|
|
|
|
|
if (scene->depsgraph_hash == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
/* Either ensure item is in the hash or simply return NULL if it's not,
|
|
|
|
|
* depending on whether caller wants us to create depsgraph or not.
|
|
|
|
|
*/
|
|
|
|
|
DepsgraphKey key;
|
2017-11-22 10:52:39 -02:00
|
|
|
key.view_layer = view_layer;
|
2017-11-07 17:01:14 +01:00
|
|
|
Depsgraph *depsgraph;
|
|
|
|
|
if (allocate) {
|
|
|
|
|
DepsgraphKey **key_ptr;
|
|
|
|
|
Depsgraph **depsgraph_ptr;
|
|
|
|
|
if (!BLI_ghash_ensure_p_ex(scene->depsgraph_hash,
|
|
|
|
|
&key,
|
2017-12-04 17:19:34 +11:00
|
|
|
(void ***)&key_ptr,
|
|
|
|
|
(void ***)&depsgraph_ptr))
|
2017-11-07 17:01:14 +01:00
|
|
|
{
|
|
|
|
|
*key_ptr = MEM_mallocN(sizeof(DepsgraphKey), __func__);
|
|
|
|
|
**key_ptr = key;
|
2018-04-06 09:17:53 +02:00
|
|
|
*depsgraph_ptr = DEG_graph_new(scene, view_layer, DAG_EVAL_VIEWPORT);
|
2018-05-02 14:55:33 +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);
|
2017-11-07 17:01:14 +01:00
|
|
|
}
|
|
|
|
|
depsgraph = *depsgraph_ptr;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
depsgraph = BLI_ghash_lookup(scene->depsgraph_hash, &key);
|
2017-11-07 16:29:31 +01:00
|
|
|
}
|
|
|
|
|
return depsgraph;
|
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;
|
|
|
|
|
}
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \return the index that \a orientation has within \a scene's transform-orientation list or -1 if not found.
|
|
|
|
|
*/
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
switch (cursor->rotation_mode) {
|
|
|
|
|
case ROT_MODE_QUAT:
|
|
|
|
|
{
|
|
|
|
|
mat3_normalized_to_quat(cursor->rotation_quaternion, mat);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
switch (cursor->rotation_mode) {
|
|
|
|
|
case ROT_MODE_QUAT:
|
|
|
|
|
{
|
|
|
|
|
copy_qt_qt(cursor->rotation_quaternion, quat);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|