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 Toenne <lukas.toenne@googlemail.com>2013-04-24 20:36:50 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-04-24 20:36:50 +0400
commit6cdc12dc749bc1feeb44cb9f5740404605ae830e (patch)
tree2c53b06998eba1c035dad1bcba0ac0e489377edb /source/blender/compositor
parent48b3dab64a2ccc5a344b46429df4803e7df4f155 (diff)
Fix for #34739 and #35060, avoid ambiguity in compositor viewer nodes.
The design changes coming with pynodes for the node editor allow editing multiple node groups or pinning. This is great for working on different node groups without switching between them all the time, but it causes a problem for viewer nodes: these nodes all write to the same Image data by design, causing access conflicts and in some cases memory corruption. This was not a problem before pynodes because the editor would only allow 1 edited node group at any time. With the new flexibility of node editors this restriction is gone. In order to avoid concurrent write access to the viewer image buffer and resolve the ambiguity this patch adds an "active viewer key" to the scene->nodetree (added in bNodeTree instead of Scene due to otherwise circular DNA includes). This key identifies a specific node tree/group instance, which enables the compositor to selectively enable only 1 viewer node. The active viewer key is switched when opening/closing node groups (push/pop on the snode->treepath stack) or when selecting a viewer node. This way only the "last edited" viewer will be active. Eventually it would be nicer if each viewer had its own buffer per node space so one could actually compare viewers without switching. But that is a major redesign of viewer nodes and images, not a quick fix for bcon4 ...
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.h1
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp10
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp6
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp3
4 files changed, 6 insertions, 14 deletions
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h
index 3c7db703bf9..2120c12b04e 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.h
+++ b/source/blender/compositor/intern/COM_CompositorContext.h
@@ -84,6 +84,7 @@ private:
/* @brief color management settings */
const ColorManagedViewSettings *m_viewSettings;
const ColorManagedDisplaySettings *m_displaySettings;
+
public:
/**
* @brief constructor initializes the context with default values.
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 450d1b03917..ad29405d2e9 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -53,16 +53,6 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool re
this->m_context.setbNodeTree(editingtree);
this->m_context.setPreviewHash(editingtree->previews);
this->m_context.setFastCalculation(fastcalculation);
-#if 0 /* XXX TODO find a better way to define visible output nodes from all editors */
- bNode *gnode;
- for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = gnode->next) {
- if (gnode->type == NODE_GROUP && gnode->typeinfo->group_edit_get(gnode)) {
- this->m_context.setActivegNode(gnode);
- break;
- }
- }
-#endif
-
/* initialize the CompositorContext */
if (rendering) {
this->m_context.setQuality((CompositorQuality)editingtree->render_quality);
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
index eb0c9cbdf11..9f0a943c8a2 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
@@ -47,12 +47,12 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star
vector<Node *>& nodes = system.getNodes();
vector<SocketConnection *>& links = system.getConnections();
+ bool is_active_group = (parent_key.value == system.getContext().getbNodeTree()->active_viewer_key.value);
+
/* add all nodes of the tree to the node list */
bNode *node = (bNode *)tree->nodes.first;
while (node != NULL) {
- /* XXX TODO replace isActiveGroup by a more accurate check, all visible editors should do this! */
- bool isActiveGroup = true;
- Node *nnode = addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation());
+ Node *nnode = addNode(nodes, node, is_active_group, system.getContext().isFastCalculation());
if (nnode) {
nnode->setbNodeTree(tree);
nnode->setInstanceKey(BKE_node_instance_key(parent_key, tree, node));
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index a0f660058f9..a0eb5206805 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -92,7 +92,8 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering,
}
}
- ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false, viewSettings, displaySettings);
+ ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false,
+ viewSettings, displaySettings);
system->execute();
delete system;