diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-05 16:51:51 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-05 16:51:51 +0400 |
commit | 1687023776a3ce0de41a4cfe0ebc72a5ebadabe4 (patch) | |
tree | 28e8af3d7cbafbab07bc86f61b58a109d0091408 /source/blender/compositor/intern | |
parent | e9fda259dac3d95018bc9378e2f8f3b10a8c46c4 (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/compositor/intern')
5 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp index 6008a889205..807d78b620d 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cpp +++ b/source/blender/compositor/intern/COM_CompositorContext.cpp @@ -26,6 +26,7 @@ CompositorContext::CompositorContext() { + this->m_scene = NULL; this->m_rd = NULL; this->m_quality = COM_QUALITY_HIGH; this->m_hasActiveOpenCLDevices = false; diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 2120c12b04e..223f900b391 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -51,6 +51,8 @@ private: */ CompositorQuality m_quality; + Scene *m_scene; + /** * @brief Reference to the render data that is being composited. * This field is initialized in ExecutionSystem and must only be read from that point on. @@ -120,6 +122,9 @@ public: * @brief get the scene of the context */ const RenderData *getRenderData() const { return this->m_rd; } + + void setScene(Scene *scene) { m_scene = scene; } + Scene *getScene() const { return m_scene; } /** * @brief set the preview image hash table diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 716e99a0fa3..6a208001f46 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -46,9 +46,10 @@ extern "C" { #include "MEM_guardedalloc.h" #endif -ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation, +ExecutionSystem::ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editingtree, bool rendering, bool fastcalculation, const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings) { + this->m_context.setScene(scene); this->m_context.setbNodeTree(editingtree); this->m_context.setPreviewHash(editingtree->previews); this->m_context.setFastCalculation(fastcalculation); diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index 9beccba0c73..7402ff90fb5 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -167,7 +167,7 @@ public: * @param editingtree [bNodeTree *] * @param rendering [true false] */ - ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation, + ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editingtree, bool rendering, bool fastcalculation, const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings); /** diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index 59714282d93..1c1dcf1c37d 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -43,7 +43,7 @@ static void intern_freeCompositorCaches() deintializeDistortionCache(); } -void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering, +void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rendering, const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings) { @@ -81,7 +81,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering, bool twopass = (editingtree->flag & NTREE_TWO_PASS) > 0 && !rendering; /* initialize execution system */ if (twopass) { - ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass, viewSettings, displaySettings); + ExecutionSystem *system = new ExecutionSystem(rd, scene, editingtree, rendering, twopass, viewSettings, displaySettings); system->execute(); delete system; @@ -93,7 +93,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering, } } - ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false, + ExecutionSystem *system = new ExecutionSystem(rd, scene, editingtree, rendering, false, viewSettings, displaySettings); system->execute(); delete system; |