Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-02-05 16:51:51 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-02-05 16:51:51 +0400
commit1687023776a3ce0de41a4cfe0ebc72a5ebadabe4 (patch)
tree28e8af3d7cbafbab07bc86f61b58a109d0091408 /source/blender/nodes
parente9fda259dac3d95018bc9378e2f8f3b10a8c46c4 (diff)
Fix T38340 and T38473: fixed Scene pointers in Composite and Defocus nodes don't get updated based on context.
As discussed in T38340 the solution is to use the current scene from context whenever feasible. Composite does not use node->id at all now, the scene which owns the compositing node tree is retrieved from context instead. Defocus node->id is made editable by the user. By default it is not set, which also will make it use the contextual scene and camera info. The node->id pointer in Defocus is **not** cleared in older blend files. This is done for backward compatibility: the node will then behave as before in untouched scenes. File Output nodes also don't store scene in node->id. This is only needed when creating a new node for initializing the file format. Reviewers: brecht, jbakker, mdewanchand Reviewed By: brecht Differential Revision: https://developer.blender.org/D290
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c2
4 files changed, 4 insertions, 19 deletions
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 31aefe4f027..c2ba6d32cb2 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -257,12 +257,12 @@ void register_node_tree_type_cmp(void)
void *COM_linker_hack = NULL;
-void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int do_preview,
+void ntreeCompositExecTree(Scene *scene, bNodeTree *ntree, RenderData *rd, int rendering, int do_preview,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings)
{
#ifdef WITH_COMPOSITOR
- COM_execute(rd, ntree, rendering, view_settings, display_settings);
+ COM_execute(rd, scene, ntree, rendering, view_settings, display_settings);
#else
(void)ntree, (void)rd, (void)rendering, (void)do_preview;
(void)view_settings, (void)display_settings;
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index c6c6a612bc4..41d417c2cb4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -43,21 +43,12 @@ static bNodeSocketTemplate cmp_node_composite_in[] = {
{ -1, 0, "" }
};
-static void init(const bContext *C, PointerRNA *ptr)
-{
- Scene *scene = CTX_data_scene(C);
- bNode *node = ptr->data;
-
- node->id = &scene->id;
-}
-
void register_node_type_cmp_composite(void)
{
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
- ntype.initfunc_api = init;
/* Do not allow muting for this node. */
node_type_internal_links(&ntype, NULL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index c057ba904ba..ef670b760c2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -48,10 +48,8 @@ static bNodeSocketTemplate cmp_node_defocus_out[] = {
{ -1, 0, "" }
};
-static void node_composit_init_defocus(const bContext *C, PointerRNA *ptr)
+static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node)
{
- Scene *scene = CTX_data_scene(C);
- bNode *node = ptr->data;
/* qdn: defocus node */
NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data");
nbd->bktype = 0;
@@ -65,8 +63,6 @@ static void node_composit_init_defocus(const bContext *C, PointerRNA *ptr)
nbd->scale = 1.f;
nbd->no_zbuf = 1;
node->storage = nbd;
-
- node->id = &scene->id;
}
void register_node_type_cmp_defocus(void)
@@ -75,7 +71,7 @@ void register_node_type_cmp_defocus(void)
cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0);
node_type_socket_templates(&ntype, cmp_node_defocus_in, cmp_node_defocus_out);
- ntype.initfunc_api = node_composit_init_defocus;
+ node_type_init(&ntype, node_composit_init_defocus);
node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index 89c6fbe4590..952ec15f2aa 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -179,8 +179,6 @@ static void init_output_file(const bContext *C, PointerRNA *ptr)
ImageFormatData *format = NULL;
node->storage = nimf;
- node->id = &scene->id;
-
if (scene) {
RenderData *rd = &scene->r;