* make it possible to composite without an compositor node [#31878]
Tiles Compositor: Fails without 'Compositor' output node. Regression.
This commit is contained in:
@@ -297,7 +297,7 @@ extern "C" {
|
|||||||
* - output nodes can have different priorities in the WorkScheduler.
|
* - output nodes can have different priorities in the WorkScheduler.
|
||||||
* This is implemented in the COM_execute function.
|
* 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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
|
|
||||||
ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
|
ExecutionSystem::ExecutionSystem(Scene *scene, bNodeTree *editingtree, bool rendering)
|
||||||
{
|
{
|
||||||
context.setbNodeTree(editingtree);
|
context.setbNodeTree(editingtree);
|
||||||
bNode *gnode;
|
bNode *gnode;
|
||||||
@@ -62,22 +62,18 @@ ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
|
|||||||
context.setRendering(rendering);
|
context.setRendering(rendering);
|
||||||
context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
|
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);
|
context.setScene(scene);
|
||||||
|
this->convertToOperations();
|
||||||
if (mainOutputNode) {
|
this->groupOperations(); /* group operations in ExecutionGroups */
|
||||||
context.setScene((Scene *)mainOutputNode->getbNode()->id);
|
unsigned int index;
|
||||||
this->convertToOperations();
|
unsigned int resolution[2];
|
||||||
this->groupOperations(); /* group operations in ExecutionGroups */
|
for (index = 0; index < this->groups.size(); index++) {
|
||||||
unsigned int index;
|
resolution[0] = 0;
|
||||||
unsigned int resolution[2];
|
resolution[1] = 0;
|
||||||
for (index = 0; index < this->groups.size(); index++) {
|
ExecutionGroup *executionGroup = groups[index];
|
||||||
resolution[0] = 0;
|
executionGroup->determineResolution(resolution);
|
||||||
resolution[1] = 0;
|
|
||||||
ExecutionGroup *executionGroup = groups[index];
|
|
||||||
executionGroup->determineResolution(resolution);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COM_DEBUG
|
#ifdef COM_DEBUG
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
* @param editingtree [bNodeTree*]
|
* @param editingtree [bNodeTree*]
|
||||||
* @param rendering [true false]
|
* @param rendering [true false]
|
||||||
*/
|
*/
|
||||||
ExecutionSystem(bNodeTree *editingtree, bool rendering);
|
ExecutionSystem(Scene *scene, bNodeTree *editingtree, bool rendering);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
|
|||||||
@@ -39,21 +39,17 @@
|
|||||||
#include "COM_ReadBufferOperation.h"
|
#include "COM_ReadBufferOperation.h"
|
||||||
#include "COM_ViewerBaseOperation.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<Node *>& nodes = system.getNodes();
|
||||||
vector<SocketConnection *>& links = system.getConnections();
|
vector<SocketConnection *>& links = system.getConnections();
|
||||||
Node *mainnode = NULL;
|
|
||||||
const bNode *activeGroupNode = system.getContext().getActivegNode();
|
const bNode *activeGroupNode = system.getContext().getActivegNode();
|
||||||
bool isActiveGroup = activeGroupNode == groupnode;
|
bool isActiveGroup = activeGroupNode == groupnode;
|
||||||
|
|
||||||
/* add all nodes of the tree to the node list */
|
/* add all nodes of the tree to the node list */
|
||||||
bNode *node = (bNode *)tree->nodes.first;
|
bNode *node = (bNode *)tree->nodes.first;
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
Node *execnode = addNode(nodes, node, isActiveGroup);
|
addNode(nodes, node, isActiveGroup);
|
||||||
if (node->type == CMP_NODE_COMPOSITE) {
|
|
||||||
mainnode = execnode;
|
|
||||||
}
|
|
||||||
node = (bNode *)node->next;
|
node = (bNode *)node->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +70,6 @@ Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
|
|||||||
groupNode->ungroup(system);
|
groupNode->ungroup(system);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mainnode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)
|
void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
* @param tree bNodeTree to add
|
* @param tree bNodeTree to add
|
||||||
* @return Node representing the "Compositor node" of the maintree. or NULL when a subtree is added
|
* @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.
|
* @brief add an editor node to the system.
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#include "BLI_threads.h"
|
#include "BLI_threads.h"
|
||||||
}
|
}
|
||||||
|
#include "BKE_main.h"
|
||||||
|
#include "BKE_global.h"
|
||||||
|
|
||||||
#include "COM_compositor.h"
|
#include "COM_compositor.h"
|
||||||
#include "COM_ExecutionSystem.h"
|
#include "COM_ExecutionSystem.h"
|
||||||
@@ -32,7 +34,7 @@ extern "C" {
|
|||||||
#include "OCL_opencl.h"
|
#include "OCL_opencl.h"
|
||||||
|
|
||||||
static ThreadMutex *compositorMutex;
|
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
|
if (compositorMutex == NULL) { /// TODO: move to blender startup phase
|
||||||
compositorMutex = new ThreadMutex();
|
compositorMutex = new ThreadMutex();
|
||||||
@@ -41,7 +43,7 @@ void COM_execute(bNodeTree *editingtree, int rendering)
|
|||||||
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
|
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
|
||||||
}
|
}
|
||||||
BLI_mutex_lock(compositorMutex);
|
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.
|
// during editing multiple calls to this method can be triggered.
|
||||||
// make sure one the last one will be doing the work.
|
// make sure one the last one will be doing the work.
|
||||||
BLI_mutex_unlock(compositorMutex);
|
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*/
|
/* set progress bar to 0% and status to init compositing*/
|
||||||
editingtree->progress(editingtree->prh, 0.0);
|
editingtree->progress(editingtree->prh, 0.0);
|
||||||
|
|
||||||
/* initialize execution system */
|
/* initialize execution system */
|
||||||
ExecutionSystem *system = new ExecutionSystem(editingtree, rendering);
|
Scene *scene;
|
||||||
system->execute();
|
for (scene = (Scene*)G.main->scene.first; scene != NULL ; scene = (Scene*)scene->id.next) {
|
||||||
delete system;
|
if (&scene->r == rd) {
|
||||||
|
ExecutionSystem *system = new ExecutionSystem(scene, editingtree, rendering);
|
||||||
|
system->execute();
|
||||||
|
delete system;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BLI_mutex_unlock(compositorMutex);
|
BLI_mutex_unlock(compositorMutex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -683,7 +683,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int
|
|||||||
if (G.rt == 200)
|
if (G.rt == 200)
|
||||||
ntreeCompositExecTreeOld(ntree, rd, do_preview);
|
ntreeCompositExecTreeOld(ntree, rd, do_preview);
|
||||||
else
|
else
|
||||||
COM_execute(ntree, rendering);
|
COM_execute(rd, ntree, rendering);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *********************************************** */
|
/* *********************************************** */
|
||||||
|
|||||||
Reference in New Issue
Block a user