2011-10-23 17:52:20 +00:00
|
|
|
/*
|
2011-09-05 21:01:50 +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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2011-09-05 21:01:50 +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,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup nodes
|
2011-09-05 21:01:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.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 "DNA_color_types.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "DNA_node_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_scene_types.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2011-11-09 15:00:11 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "BKE_context.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_node.h"
|
2011-11-07 12:56:05 +00:00
|
|
|
#include "BKE_tracking.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2012-08-06 18:49:28 +00:00
|
|
|
#include "node_common.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "node_util.h"
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
|
|
#include "NOD_composite.h"
|
|
|
|
#include "node_composite_util.h"
|
2012-06-30 14:14:22 +00:00
|
|
|
|
|
|
|
#ifdef WITH_COMPOSITOR
|
2013-12-22 14:11:10 +11:00
|
|
|
# include "COM_compositor.h"
|
2012-06-30 14:14:22 +00:00
|
|
|
#endif
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
static void composite_get_from_context(const bContext *C,
|
|
|
|
bNodeTreeType *UNUSED(treetype),
|
|
|
|
bNodeTree **r_ntree,
|
|
|
|
ID **r_id,
|
|
|
|
ID **r_from)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-18 16:34:57 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
*r_from = NULL;
|
|
|
|
*r_id = &scene->id;
|
|
|
|
*r_ntree = scene->nodetree;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
2018-04-17 13:35:05 +02:00
|
|
|
static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func)
|
2011-11-07 22:14:48 +00:00
|
|
|
{
|
2012-05-16 15:01:46 +00:00
|
|
|
func(calldata, NODE_CLASS_INPUT, N_("Input"));
|
|
|
|
func(calldata, NODE_CLASS_OUTPUT, N_("Output"));
|
|
|
|
func(calldata, NODE_CLASS_OP_COLOR, N_("Color"));
|
|
|
|
func(calldata, NODE_CLASS_OP_VECTOR, N_("Vector"));
|
|
|
|
func(calldata, NODE_CLASS_OP_FILTER, N_("Filter"));
|
|
|
|
func(calldata, NODE_CLASS_CONVERTOR, N_("Convertor"));
|
|
|
|
func(calldata, NODE_CLASS_MATTE, N_("Matte"));
|
|
|
|
func(calldata, NODE_CLASS_DISTORT, N_("Distort"));
|
|
|
|
func(calldata, NODE_CLASS_GROUP, N_("Group"));
|
2013-03-18 16:34:57 +00:00
|
|
|
func(calldata, NODE_CLASS_INTERFACE, N_("Interface"));
|
2012-05-16 15:01:46 +00:00
|
|
|
func(calldata, NODE_CLASS_LAYOUT, N_("Layout"));
|
2011-11-07 22:14:48 +00:00
|
|
|
}
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
|
|
|
|
{
|
|
|
|
bNodeSocket *sock;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-05-27 08:04:07 +00:00
|
|
|
for (sock = node->outputs.first; sock; sock = sock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sock->cache) {
|
2013-05-27 08:04:07 +00:00
|
|
|
sock->cache = NULL;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_cache(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
bNode *node;
|
2019-04-22 13:31:31 +10:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
2011-09-05 21:01:50 +00:00
|
|
|
free_node_cache(ntree, node);
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* local tree then owns all compbufs */
|
2019-06-03 17:08:25 +02:00
|
|
|
static void localize(bNodeTree *localtree, bNodeTree *ntree)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-03 17:08:25 +02:00
|
|
|
bNode *node = ntree->nodes.first;
|
|
|
|
bNode *local_node = localtree->nodes.first;
|
|
|
|
while (node != NULL) {
|
|
|
|
|
2020-03-15 21:46:18 +11:00
|
|
|
/* Ensure new user input gets handled ok. */
|
2013-05-27 08:04:07 +00:00
|
|
|
node->need_exec = 0;
|
2019-06-03 17:08:25 +02:00
|
|
|
local_node->original = node;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* move over the compbufs */
|
|
|
|
/* right after ntreeCopyTree() oldsock pointers are valid */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
|
|
|
|
if (node->id) {
|
2019-04-22 13:31:31 +10:00
|
|
|
if (node->flag & NODE_DO_OUTPUT) {
|
2019-06-03 17:08:25 +02:00
|
|
|
local_node->id = (ID *)node->id;
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
|
|
|
else {
|
2019-06-03 17:08:25 +02:00
|
|
|
local_node->id = NULL;
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-03 17:08:25 +02:00
|
|
|
bNodeSocket *output_sock = node->outputs.first;
|
|
|
|
bNodeSocket *local_output_sock = local_node->outputs.first;
|
|
|
|
while (output_sock != NULL) {
|
|
|
|
local_output_sock->cache = output_sock->cache;
|
|
|
|
output_sock->cache = NULL;
|
|
|
|
/* This is actually link to original: someone was just lazy enough and tried to save few
|
|
|
|
* bytes in the cost of readability. */
|
|
|
|
local_output_sock->new_sock = output_sock;
|
|
|
|
|
|
|
|
output_sock = output_sock->next;
|
|
|
|
local_output_sock = local_output_sock->next;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
2019-06-03 17:08:25 +02:00
|
|
|
|
|
|
|
node = node->next;
|
|
|
|
local_node = local_node->next;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-22 10:34:52 +00:00
|
|
|
static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2013-03-22 10:34:52 +00:00
|
|
|
BKE_node_preview_sync_tree(ntree, localtree);
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
2018-06-11 15:40:37 +02:00
|
|
|
static void local_merge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
|
|
|
bNode *lnode;
|
|
|
|
bNodeSocket *lsock;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* move over the compbufs and previews */
|
2013-03-22 10:34:52 +00:00
|
|
|
BKE_node_preview_merge_tree(ntree, localtree, true);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-27 08:04:07 +00:00
|
|
|
for (lnode = localtree->nodes.first; lnode; lnode = lnode->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ntreeNodeExists(ntree, lnode->new_node)) {
|
|
|
|
if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
|
|
|
|
if (lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
|
2011-09-05 21:01:50 +00:00
|
|
|
/* image_merge does sanity check for pointers */
|
2018-06-11 15:40:37 +02:00
|
|
|
BKE_image_merge(bmain, (Image *)lnode->new_node->id, (Image *)lnode->id);
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-27 08:04:07 +00:00
|
|
|
else if (lnode->type == CMP_NODE_MOVIEDISTORTION) {
|
2011-11-07 12:56:05 +00:00
|
|
|
/* special case for distortion node: distortion context is allocating in exec function
|
2012-09-26 20:05:38 +00:00
|
|
|
* and to achieve much better performance on further calls this context should be
|
2012-06-30 22:49:33 +00:00
|
|
|
* copied back to original node */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (lnode->storage) {
|
2019-04-22 13:31:31 +10:00
|
|
|
if (lnode->new_node->storage) {
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_distortion_free(lnode->new_node->storage);
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-27 08:04:07 +00:00
|
|
|
lnode->new_node->storage = BKE_tracking_distortion_copy(lnode->storage);
|
2011-11-07 12:56:05 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-27 08:04:07 +00:00
|
|
|
for (lsock = lnode->outputs.first; lsock; lsock = lsock->next) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
|
2013-05-27 08:04:07 +00:00
|
|
|
lsock->new_sock->cache = lsock->cache;
|
|
|
|
lsock->cache = NULL;
|
|
|
|
lsock->new_sock = NULL;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-19 17:08:35 +00:00
|
|
|
static void update(bNodeTree *ntree)
|
|
|
|
{
|
|
|
|
ntreeSetOutput(ntree);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2012-08-06 18:49:28 +00:00
|
|
|
ntree_update_reroute_nodes(ntree);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
if (ntree->update & NTREE_UPDATE_NODES) {
|
|
|
|
/* clean up preview cache, in case nodes have been removed */
|
|
|
|
BKE_node_preview_remove_unused(ntree);
|
|
|
|
}
|
2011-10-19 17:08:35 +00:00
|
|
|
}
|
|
|
|
|
2013-12-10 13:44:46 +11:00
|
|
|
static void composite_node_add_init(bNodeTree *UNUSED(bnodetree), bNode *bnode)
|
|
|
|
{
|
2018-06-08 08:07:48 +02:00
|
|
|
/* Composite node will only show previews for input classes
|
|
|
|
* by default, other will be hidden
|
2013-12-08 21:53:35 +01:00
|
|
|
* but can be made visible with the show_preview option */
|
|
|
|
if (bnode->typeinfo->nclass != NODE_CLASS_INPUT) {
|
|
|
|
bnode->flag &= ~NODE_PREVIEW;
|
2018-06-08 08:07:48 +02:00
|
|
|
}
|
2013-12-08 21:53:35 +01:00
|
|
|
}
|
|
|
|
|
2021-04-29 23:36:46 -05:00
|
|
|
static bool composite_node_tree_socket_type_valid(eNodeSocketDatatype socket_type,
|
|
|
|
bNodeTreeType *UNUSED(ntreetype))
|
|
|
|
{
|
|
|
|
return ELEM(socket_type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA);
|
|
|
|
}
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeTreeType *ntreeType_Composite;
|
|
|
|
|
2013-03-18 18:25:05 +00:00
|
|
|
void register_node_tree_type_cmp(void)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
|
|
|
bNodeTreeType *tt = ntreeType_Composite = MEM_callocN(sizeof(bNodeTreeType),
|
|
|
|
"compositor node tree type");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->type = NTREE_COMPOSIT;
|
|
|
|
strcpy(tt->idname, "CompositorNodeTree");
|
2019-03-22 16:45:30 +01:00
|
|
|
strcpy(tt->ui_name, N_("Compositor"));
|
2013-05-27 08:04:07 +00:00
|
|
|
tt->ui_icon = 0; /* defined in drawnode.c */
|
2019-02-13 16:18:19 +01:00
|
|
|
strcpy(tt->ui_description, N_("Compositing nodes"));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
tt->free_cache = free_cache;
|
|
|
|
tt->free_node_cache = free_node_cache;
|
|
|
|
tt->foreach_nodeclass = foreach_nodeclass;
|
|
|
|
tt->localize = localize;
|
|
|
|
tt->local_sync = local_sync;
|
|
|
|
tt->local_merge = local_merge;
|
|
|
|
tt->update = update;
|
|
|
|
tt->get_from_context = composite_get_from_context;
|
2013-12-08 21:53:35 +01:00
|
|
|
tt->node_add_init = composite_node_add_init;
|
2021-04-29 23:36:46 -05:00
|
|
|
tt->valid_socket_type = composite_node_tree_socket_type_valid;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 18:24:08 +02:00
|
|
|
tt->rna_ext.srna = &RNA_CompositorNodeTree;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
ntreeTypeAdd(tt);
|
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2019-02-23 19:17:30 +11:00
|
|
|
extern void *COM_linker_hack; /* Quiet warning. */
|
2012-07-16 08:42:55 +00:00
|
|
|
void *COM_linker_hack = NULL;
|
|
|
|
|
2014-02-05 13:51:51 +01:00
|
|
|
void ntreeCompositExecTree(Scene *scene,
|
|
|
|
bNodeTree *ntree,
|
|
|
|
RenderData *rd,
|
|
|
|
int rendering,
|
|
|
|
int do_preview,
|
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
|
|
|
const ColorManagedViewSettings *view_settings,
|
2015-04-06 10:40:12 -03:00
|
|
|
const ColorManagedDisplaySettings *display_settings,
|
|
|
|
const char *view_name)
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
merge to TRUNK!
* The old compositor is still available (Debug Menu: 200)
This commit was brought to you by:
Developers:
* Monique Dewanchand
* Jeroen Bakker
* Dalai Felinto
* Lukas Tönne
Review:
* Brecht van Lommel
Testers:
* Nate Wiebe
* Wolfgang Faehnle
* Carlo Andreacchio
* Daniel Salazar
* Artur Mag
* Christian Krupa
* Francesco Siddi
* Dan McGrath
* Bassam Kurdali
But mostly by the community:
Gold:
Joshua Faulkner
Michael Tiemann
Francesco Paglia
Blender Guru
Blender Developers Fund
Silver:
Pablo Vazquez
Joel Heethaar
Amrein Olivier
Ilias Karasavvidis
Thomas Kumlehn
Sebastian Koenig
Hannu Hoffrén
Benjamin Dansie
Fred M'ule
Michel Vilain
Bradley Cathey
Gianmichele Mariani
Gottfried Hofmann
Bjørnar Frøyse
Valentijn Bruning
Paul Holmes
Clemens Rudolph
Juris Graphix
David Strebel
Ronan Zeegers
François Tarlier
Felipe Andres Esquivel Reed
Olaf Beckman
Jesus Alberto Olmos Linares
Kajimba
Maria Figueiredo
Alexandr Galperin
Francesco Siddi
Julio Iglesias Lopez
Kjartan Tysdal
Thomas Torfs
Film Works
Teruyuki Nakamura
Roger Luethi
Benoit Bolsee
Stefan Abrahamsen
Andreas Mattijat
Xavier Bouchoux
Blender 3D Graphics and Animation
Henk Vostermans
Daniel Blanco Delgado
BlenderDay/2011
Bradley Cathey
Matthieu Dupont de Dinechin
Gianmichele Mariani
Jérôme Scaillet
Bronze (Ivo Grigull, Dylan Urquidi, Philippe Derungs, Phil Beauchamp, Bruce Parrott, Mathieu Quiblier, Daniel Martinez, Leandro Inocencio, Lluc Romaní Brasó,
Jonathan Williamson, Michael Ehlen, Karlis Stigis, Dreamsteep, Martin Lindelöf, Filippo Saracino, Douwe van der Veen, Olli Äkräs, Bruno D'Arcangeli,
Francisco Sedrez Warmling, Watchmike.ca, peter lener, Matteo Novellino, Martin Kirsch, Austars Schnore, KC Elliott, Massimiliano Puliero, Karl Stein,
Wood Design Studios, Omer Khan, Jyrki Kanto, Michał Krupa, Lars Brubaker, Neil Richmond, Adam Kalisz, Robert Garlington, Ian Wilson, Carlo Andreacchio,
Jeremias Boos, Robert Holcomb, Gabriel Zöller, Robert Cude, Natibel de Leon, Nathan Turnage, Nicolas Vergnes, Philipp Kleinhenz, Norman Hartig, Louis Kreusel,
Christopher Taylor, Giovanni Remondini, Daniel Rentzsch, Nico Partipilo, Thomas Ventresco, Johannes Schwarz, Александр Коротеев, Brendon Harvey,
Marcelo G. Malheiros, Marius Giurgi, Richard Burns, Perttu Iso-Metsälä, Steve Bazin, Radoslav Borisov, Yoshiyuki Shida, Julien Guigner, Andrew Hunter,
Philipp Oeser, Daniel Thul, Thobias Johansson, Mauro Bonecchi, Georg Piorczynski, Sebastian Michailidis, L M Weedy, Gen X, Stefan Hinze, Nicolò Zubbini,
Erik Pusch, Rob Scott, Florian Koch, Charles Razack, Adrian Baker, Oliver Villar Diz, David Revoy, Julio Iglesias Lopez, Coen Spoor, Carlos Folch,
Joseph Christie, Victor Hernández García, David Mcsween, James Finnerty, Cory Kruckenberg, Giacomo Graziosi, Olivier Saraja, Lars Brubaker, Eric Hudson,
Johannes Schwarz, David Elguea, Marcus Schulderinsky, Karel De Bruijn, Lucas van Wijngaarden, Stefano Ciarrocchi, Mehmet Eribol, Thomas Berglund, Zuofei Song,
Dylan Urquidi )
2012-05-17 12:49:33 +00:00
|
|
|
{
|
2012-06-30 14:14:22 +00:00
|
|
|
#ifdef WITH_COMPOSITOR
|
2015-04-06 10:40:12 -03:00
|
|
|
COM_execute(rd, scene, ntree, rendering, view_settings, display_settings, view_name);
|
2012-06-30 14:14:22 +00:00
|
|
|
#else
|
2015-04-06 10:40:12 -03:00
|
|
|
UNUSED_VARS(scene, ntree, rd, rendering, view_settings, display_settings, view_name);
|
2012-06-30 14:14:22 +00:00
|
|
|
#endif
|
2012-08-19 22:19:19 +00:00
|
|
|
|
2014-11-24 12:01:51 +01:00
|
|
|
UNUSED_VARS(do_preview);
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
merge to TRUNK!
* The old compositor is still available (Debug Menu: 200)
This commit was brought to you by:
Developers:
* Monique Dewanchand
* Jeroen Bakker
* Dalai Felinto
* Lukas Tönne
Review:
* Brecht van Lommel
Testers:
* Nate Wiebe
* Wolfgang Faehnle
* Carlo Andreacchio
* Daniel Salazar
* Artur Mag
* Christian Krupa
* Francesco Siddi
* Dan McGrath
* Bassam Kurdali
But mostly by the community:
Gold:
Joshua Faulkner
Michael Tiemann
Francesco Paglia
Blender Guru
Blender Developers Fund
Silver:
Pablo Vazquez
Joel Heethaar
Amrein Olivier
Ilias Karasavvidis
Thomas Kumlehn
Sebastian Koenig
Hannu Hoffrén
Benjamin Dansie
Fred M'ule
Michel Vilain
Bradley Cathey
Gianmichele Mariani
Gottfried Hofmann
Bjørnar Frøyse
Valentijn Bruning
Paul Holmes
Clemens Rudolph
Juris Graphix
David Strebel
Ronan Zeegers
François Tarlier
Felipe Andres Esquivel Reed
Olaf Beckman
Jesus Alberto Olmos Linares
Kajimba
Maria Figueiredo
Alexandr Galperin
Francesco Siddi
Julio Iglesias Lopez
Kjartan Tysdal
Thomas Torfs
Film Works
Teruyuki Nakamura
Roger Luethi
Benoit Bolsee
Stefan Abrahamsen
Andreas Mattijat
Xavier Bouchoux
Blender 3D Graphics and Animation
Henk Vostermans
Daniel Blanco Delgado
BlenderDay/2011
Bradley Cathey
Matthieu Dupont de Dinechin
Gianmichele Mariani
Jérôme Scaillet
Bronze (Ivo Grigull, Dylan Urquidi, Philippe Derungs, Phil Beauchamp, Bruce Parrott, Mathieu Quiblier, Daniel Martinez, Leandro Inocencio, Lluc Romaní Brasó,
Jonathan Williamson, Michael Ehlen, Karlis Stigis, Dreamsteep, Martin Lindelöf, Filippo Saracino, Douwe van der Veen, Olli Äkräs, Bruno D'Arcangeli,
Francisco Sedrez Warmling, Watchmike.ca, peter lener, Matteo Novellino, Martin Kirsch, Austars Schnore, KC Elliott, Massimiliano Puliero, Karl Stein,
Wood Design Studios, Omer Khan, Jyrki Kanto, Michał Krupa, Lars Brubaker, Neil Richmond, Adam Kalisz, Robert Garlington, Ian Wilson, Carlo Andreacchio,
Jeremias Boos, Robert Holcomb, Gabriel Zöller, Robert Cude, Natibel de Leon, Nathan Turnage, Nicolas Vergnes, Philipp Kleinhenz, Norman Hartig, Louis Kreusel,
Christopher Taylor, Giovanni Remondini, Daniel Rentzsch, Nico Partipilo, Thomas Ventresco, Johannes Schwarz, Александр Коротеев, Brendon Harvey,
Marcelo G. Malheiros, Marius Giurgi, Richard Burns, Perttu Iso-Metsälä, Steve Bazin, Radoslav Borisov, Yoshiyuki Shida, Julien Guigner, Andrew Hunter,
Philipp Oeser, Daniel Thul, Thobias Johansson, Mauro Bonecchi, Georg Piorczynski, Sebastian Michailidis, L M Weedy, Gen X, Stefan Hinze, Nicolò Zubbini,
Erik Pusch, Rob Scott, Florian Koch, Charles Razack, Adrian Baker, Oliver Villar Diz, David Revoy, Julio Iglesias Lopez, Coen Spoor, Carlos Folch,
Joseph Christie, Victor Hernández García, David Mcsween, James Finnerty, Cory Kruckenberg, Giacomo Graziosi, Olivier Saraja, Lars Brubaker, Eric Hudson,
Johannes Schwarz, David Elguea, Marcus Schulderinsky, Karel De Bruijn, Lucas van Wijngaarden, Stefano Ciarrocchi, Mehmet Eribol, Thomas Berglund, Zuofei Song,
Dylan Urquidi )
2012-05-17 12:49:33 +00:00
|
|
|
}
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* *********************************************** */
|
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
/* Update the outputs of the render layer nodes.
|
|
|
|
* Since the outputs depend on the render engine, this part is a bit complex:
|
2019-04-29 20:12:09 +10:00
|
|
|
* - ntreeCompositUpdateRLayers is called and loops over all render layer nodes.
|
|
|
|
* - Each render layer node calls the update function of the
|
|
|
|
* render engine that's used for its scene.
|
|
|
|
* - The render engine calls RE_engine_register_pass for each pass.
|
|
|
|
* - RE_engine_register_pass calls ntreeCompositRegisterPass,.
|
|
|
|
* which calls node_cmp_rlayers_register_pass for every render layer node.
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
*/
|
|
|
|
void ntreeCompositUpdateRLayers(bNodeTree *ntree)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
|
|
|
bNode *node;
|
2012-08-23 07:10:48 +00:00
|
|
|
|
2019-04-22 13:31:31 +10:00
|
|
|
if (ntree == NULL) {
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
return;
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
|
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
2019-04-22 13:31:31 +10:00
|
|
|
if (node->type == CMP_NODE_R_LAYERS) {
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
node_cmp_rlayers_outputs(ntree, node);
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
}
|
|
|
|
|
2020-02-20 14:53:53 +01:00
|
|
|
void ntreeCompositRegisterPass(bNodeTree *ntree,
|
|
|
|
Scene *scene,
|
|
|
|
ViewLayer *view_layer,
|
|
|
|
const char *name,
|
|
|
|
eNodeSocketDatatype type)
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
{
|
|
|
|
bNode *node;
|
|
|
|
|
2019-04-22 13:31:31 +10:00
|
|
|
if (ntree == NULL) {
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
return;
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
2019-04-22 13:31:31 +10:00
|
|
|
if (node->type == CMP_NODE_R_LAYERS) {
|
2017-11-22 10:52:39 -02:00
|
|
|
node_cmp_rlayers_register_pass(ntree, node, scene, view_layer, name, type);
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* called from render pipeline, to tag render input and output */
|
|
|
|
/* need to do all scenes, to prevent errors when you re-render 1 scene */
|
2020-09-04 20:59:13 +02:00
|
|
|
void ntreeCompositTagRender(Scene *scene)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2018-06-25 12:02:20 +02:00
|
|
|
/* XXX Think using G_MAIN here is valid, since you want to update current file's scene nodes,
|
|
|
|
* not the ones in temp main generated for rendering?
|
2019-04-29 20:12:09 +10:00
|
|
|
* This is still rather weak though,
|
|
|
|
* ideally render struct would store own main AND original G_MAIN. */
|
|
|
|
|
2020-09-04 20:59:13 +02:00
|
|
|
for (Scene *sce_iter = G_MAIN->scenes.first; sce_iter; sce_iter = sce_iter->id.next) {
|
|
|
|
if (sce_iter->nodetree) {
|
2011-09-05 21:01:50 +00:00
|
|
|
bNode *node;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-04 20:59:13 +02:00
|
|
|
for (node = sce_iter->nodetree->nodes.first; node; node = node->next) {
|
|
|
|
if (node->id == (ID *)scene || node->type == CMP_NODE_COMPOSITE) {
|
|
|
|
nodeUpdate(sce_iter->nodetree, node);
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
|
|
|
else if (node->type == CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ {
|
2020-09-04 20:59:13 +02:00
|
|
|
nodeUpdate(sce_iter->nodetree, node);
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XXX after render animation system gets a refresh, this call allows composite to end clean */
|
2011-10-19 17:08:35 +00:00
|
|
|
void ntreeCompositClearTags(bNodeTree *ntree)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
|
|
|
bNode *node;
|
2012-08-23 07:10:48 +00:00
|
|
|
|
2019-04-22 13:31:31 +10:00
|
|
|
if (ntree == NULL) {
|
2012-08-23 07:10:48 +00:00
|
|
|
return;
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2012-08-23 07:10:48 +00:00
|
|
|
|
|
|
|
for (node = ntree->nodes.first; node; node = node->next) {
|
|
|
|
node->need_exec = 0;
|
2019-04-22 13:31:31 +10:00
|
|
|
if (node->type == NODE_GROUP) {
|
2011-10-19 17:08:35 +00:00
|
|
|
ntreeCompositClearTags((bNodeTree *)node->id);
|
2019-04-22 13:31:31 +10:00
|
|
|
}
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
}
|