* make it possible to composite without an compositor node [#31878]

Tiles Compositor: Fails without 'Compositor' output node. Regression.
This commit is contained in:
Jeroen Bakker
2012-06-21 17:58:12 +00:00
parent d406e274e0
commit 7a8d60ec7d
7 changed files with 32 additions and 33 deletions

View File

@@ -297,7 +297,7 @@ extern "C" {
* - output nodes can have different priorities in the WorkScheduler.
* This is implemented in the COM_execute function.
*/
void COM_execute(bNodeTree *editingtree, int rendering);
void COM_execute(RenderData* rd, bNodeTree *editingtree, int rendering);
#ifdef __cplusplus
}

View File

@@ -41,7 +41,7 @@
#include "BKE_global.h"
ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
ExecutionSystem::ExecutionSystem(Scene *scene, bNodeTree *editingtree, bool rendering)
{
context.setbNodeTree(editingtree);
bNode *gnode;
@@ -62,12 +62,9 @@ ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
context.setRendering(rendering);
context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
Node *mainOutputNode = NULL;
ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL);
mainOutputNode = ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL);
if (mainOutputNode) {
context.setScene((Scene *)mainOutputNode->getbNode()->id);
context.setScene(scene);
this->convertToOperations();
this->groupOperations(); /* group operations in ExecutionGroups */
unsigned int index;
@@ -78,7 +75,6 @@ ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
ExecutionGroup *executionGroup = groups[index];
executionGroup->determineResolution(resolution);
}
}
#ifdef COM_DEBUG
ExecutionSystemHelper::debugDump(this);

View File

@@ -156,7 +156,7 @@ public:
* @param editingtree [bNodeTree*]
* @param rendering [true false]
*/
ExecutionSystem(bNodeTree *editingtree, bool rendering);
ExecutionSystem(Scene *scene, bNodeTree *editingtree, bool rendering);
/**
* Destructor

View File

@@ -39,21 +39,17 @@
#include "COM_ReadBufferOperation.h"
#include "COM_ViewerBaseOperation.h"
Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode)
void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode)
{
vector<Node *>& nodes = system.getNodes();
vector<SocketConnection *>& links = system.getConnections();
Node *mainnode = NULL;
const bNode *activeGroupNode = system.getContext().getActivegNode();
bool isActiveGroup = activeGroupNode == groupnode;
/* add all nodes of the tree to the node list */
bNode *node = (bNode *)tree->nodes.first;
while (node != NULL) {
Node *execnode = addNode(nodes, node, isActiveGroup);
if (node->type == CMP_NODE_COMPOSITE) {
mainnode = execnode;
}
addNode(nodes, node, isActiveGroup);
node = (bNode *)node->next;
}
@@ -74,8 +70,6 @@ Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
groupNode->ungroup(system);
}
}
return mainnode;
}
void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)

View File

@@ -48,7 +48,7 @@ public:
* @param tree bNodeTree to add
* @return Node representing the "Compositor node" of the maintree. or NULL when a subtree is added
*/
static Node *addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode);
static void addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode);
/**
* @brief add an editor node to the system.

View File

@@ -25,6 +25,8 @@
extern "C" {
#include "BLI_threads.h"
}
#include "BKE_main.h"
#include "BKE_global.h"
#include "COM_compositor.h"
#include "COM_ExecutionSystem.h"
@@ -32,7 +34,7 @@ extern "C" {
#include "OCL_opencl.h"
static ThreadMutex *compositorMutex;
void COM_execute(bNodeTree *editingtree, int rendering)
void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
{
if (compositorMutex == NULL) { /// TODO: move to blender startup phase
compositorMutex = new ThreadMutex();
@@ -41,7 +43,7 @@ void COM_execute(bNodeTree *editingtree, int rendering)
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
}
BLI_mutex_lock(compositorMutex);
if (editingtree->test_break && editingtree->test_break(editingtree->tbh)) {
if (editingtree->test_break(editingtree->tbh)) {
// during editing multiple calls to this method can be triggered.
// make sure one the last one will be doing the work.
BLI_mutex_unlock(compositorMutex);
@@ -49,13 +51,20 @@ void COM_execute(bNodeTree *editingtree, int rendering)
}
/* set progress bar to 0% and status to init compositing*/
editingtree->progress(editingtree->prh, 0.0);
/* initialize execution system */
ExecutionSystem *system = new ExecutionSystem(editingtree, rendering);
Scene *scene;
for (scene = (Scene*)G.main->scene.first; scene != NULL ; scene = (Scene*)scene->id.next) {
if (&scene->r == rd) {
ExecutionSystem *system = new ExecutionSystem(scene, editingtree, rendering);
system->execute();
delete system;
break;
}
}
BLI_mutex_unlock(compositorMutex);
}

View File

@@ -683,7 +683,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int
if (G.rt == 200)
ntreeCompositExecTreeOld(ntree, rd, do_preview);
else
COM_execute(ntree, rendering);
COM_execute(rd, ntree, rendering);
}
/* *********************************************** */