Cleanup: Use blender::Vector.
This commit is contained in:
parent
0729376a13
commit
ffd5b0d91e
|
@ -121,7 +121,7 @@ ExecutionSystem::~ExecutionSystem()
|
|||
this->m_groups.clear();
|
||||
}
|
||||
|
||||
void ExecutionSystem::set_operations(const Operations &operations,
|
||||
void ExecutionSystem::set_operations(const blender::Vector<NodeOperation *> &operations,
|
||||
const blender::Vector<ExecutionGroup *> &groups)
|
||||
{
|
||||
m_operations = operations;
|
||||
|
@ -136,10 +136,7 @@ void ExecutionSystem::execute()
|
|||
DebugInfo::execute_started(this);
|
||||
|
||||
unsigned int order = 0;
|
||||
for (std::vector<NodeOperation *>::iterator iter = this->m_operations.begin();
|
||||
iter != this->m_operations.end();
|
||||
++iter) {
|
||||
NodeOperation *operation = *iter;
|
||||
for (NodeOperation *operation : m_operations) {
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
|
||||
readOperation->setOffset(order);
|
||||
|
|
|
@ -21,12 +21,16 @@ class ExecutionGroup;
|
|||
#pragma once
|
||||
|
||||
#include "BKE_text.h"
|
||||
|
||||
#include "COM_ExecutionGroup.h"
|
||||
#include "COM_Node.h"
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
/**
|
||||
* \page execution Execution model
|
||||
* In order to get to an efficient model for execution, several steps are being done. these steps
|
||||
|
@ -113,8 +117,6 @@ class ExecutionGroup;
|
|||
* \brief the ExecutionSystem contains the whole compositor tree.
|
||||
*/
|
||||
class ExecutionSystem {
|
||||
public:
|
||||
typedef std::vector<NodeOperation *> Operations;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -125,7 +127,7 @@ class ExecutionSystem {
|
|||
/**
|
||||
* \brief vector of operations
|
||||
*/
|
||||
Operations m_operations;
|
||||
blender::Vector<NodeOperation *> m_operations;
|
||||
|
||||
/**
|
||||
* \brief vector of groups
|
||||
|
@ -161,7 +163,7 @@ class ExecutionSystem {
|
|||
*/
|
||||
~ExecutionSystem();
|
||||
|
||||
void set_operations(const Operations &operations,
|
||||
void set_operations(const blender::Vector<NodeOperation *> &operations,
|
||||
const blender::Vector<ExecutionGroup *> &groups);
|
||||
|
||||
/**
|
||||
|
|
|
@ -123,7 +123,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
|
|||
|
||||
void NodeOperationBuilder::addOperation(NodeOperation *operation)
|
||||
{
|
||||
m_operations.push_back(operation);
|
||||
m_operations.append(operation);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket,
|
||||
|
@ -304,8 +304,7 @@ void NodeOperationBuilder::add_operation_input_constants()
|
|||
*/
|
||||
using Inputs = std::vector<NodeOperationInput *>;
|
||||
Inputs pending_inputs;
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
NodeOperation *op = *it;
|
||||
for (NodeOperation *op : m_operations) {
|
||||
for (int k = 0; k < op->getNumberOfInputSockets(); ++k) {
|
||||
NodeOperationInput *input = op->getInputSocket(k);
|
||||
if (!input->isConnected()) {
|
||||
|
@ -406,9 +405,7 @@ void NodeOperationBuilder::resolve_proxies()
|
|||
void NodeOperationBuilder::determineResolutions()
|
||||
{
|
||||
/* determine all resolutions of the operations (Width/Height) */
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
NodeOperation *op = *it;
|
||||
|
||||
for (NodeOperation *op : m_operations) {
|
||||
if (op->isOutputOperation(m_context->isRendering()) && !op->isPreviewOperation()) {
|
||||
unsigned int resolution[2] = {0, 0};
|
||||
unsigned int preferredResolution[2] = {0, 0};
|
||||
|
@ -417,9 +414,7 @@ void NodeOperationBuilder::determineResolutions()
|
|||
}
|
||||
}
|
||||
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
NodeOperation *op = *it;
|
||||
|
||||
for (NodeOperation *op : m_operations) {
|
||||
if (op->isOutputOperation(m_context->isRendering()) && op->isPreviewOperation()) {
|
||||
unsigned int resolution[2] = {0, 0};
|
||||
unsigned int preferredResolution[2] = {0, 0};
|
||||
|
@ -573,16 +568,14 @@ void NodeOperationBuilder::add_complex_operation_buffers()
|
|||
/* note: complex ops and get cached here first, since adding operations
|
||||
* will invalidate iterators over the main m_operations
|
||||
*/
|
||||
Operations complex_ops;
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
if ((*it)->isComplex()) {
|
||||
complex_ops.push_back(*it);
|
||||
blender::Vector<NodeOperation *> complex_ops;
|
||||
for (NodeOperation *operation : m_operations) {
|
||||
if (operation->isComplex()) {
|
||||
complex_ops.append(operation);
|
||||
}
|
||||
}
|
||||
|
||||
for (Operations::const_iterator it = complex_ops.begin(); it != complex_ops.end(); ++it) {
|
||||
NodeOperation *op = *it;
|
||||
|
||||
for (NodeOperation *op : complex_ops) {
|
||||
DebugInfo::operation_read_write_buffer(op);
|
||||
|
||||
for (int index = 0; index < op->getNumberOfInputSockets(); index++) {
|
||||
|
@ -622,9 +615,7 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *
|
|||
void NodeOperationBuilder::prune_operations()
|
||||
{
|
||||
Tags reachable;
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
NodeOperation *op = *it;
|
||||
|
||||
for (NodeOperation *op : m_operations) {
|
||||
/* output operations are primary executed operations */
|
||||
if (op->isOutputOperation(m_context->isRendering())) {
|
||||
find_reachable_operations_recursive(reachable, op);
|
||||
|
@ -632,12 +623,10 @@ void NodeOperationBuilder::prune_operations()
|
|||
}
|
||||
|
||||
/* delete unreachable operations */
|
||||
Operations reachable_ops;
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
NodeOperation *op = *it;
|
||||
|
||||
blender::Vector<NodeOperation *> reachable_ops;
|
||||
for (NodeOperation *op : m_operations) {
|
||||
if (reachable.find(op) != reachable.end()) {
|
||||
reachable_ops.push_back(op);
|
||||
reachable_ops.append(op);
|
||||
}
|
||||
else {
|
||||
delete op;
|
||||
|
@ -648,7 +637,7 @@ void NodeOperationBuilder::prune_operations()
|
|||
}
|
||||
|
||||
/* topological (depth-first) sorting of operations */
|
||||
static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted,
|
||||
static void sort_operations_recursive(blender::Vector<NodeOperation *> &sorted,
|
||||
Tags &visited,
|
||||
NodeOperation *op)
|
||||
{
|
||||
|
@ -664,17 +653,17 @@ static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted,
|
|||
}
|
||||
}
|
||||
|
||||
sorted.push_back(op);
|
||||
sorted.append(op);
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::sort_operations()
|
||||
{
|
||||
Operations sorted;
|
||||
blender::Vector<NodeOperation *> sorted;
|
||||
sorted.reserve(m_operations.size());
|
||||
Tags visited;
|
||||
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
sort_operations_recursive(sorted, visited, *it);
|
||||
for (NodeOperation *operation : m_operations) {
|
||||
sort_operations_recursive(sorted, visited, operation);
|
||||
}
|
||||
|
||||
m_operations = sorted;
|
||||
|
@ -713,9 +702,7 @@ ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op)
|
|||
|
||||
void NodeOperationBuilder::group_operations()
|
||||
{
|
||||
for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) {
|
||||
NodeOperation *op = *it;
|
||||
|
||||
for (NodeOperation *op : m_operations) {
|
||||
if (op->isOutputOperation(m_context->isRendering())) {
|
||||
ExecutionGroup *group = make_group(op);
|
||||
group->setOutputExecutionGroup(true);
|
||||
|
|
|
@ -62,7 +62,6 @@ class NodeOperationBuilder {
|
|||
}
|
||||
};
|
||||
|
||||
typedef std::vector<NodeOperation *> Operations;
|
||||
typedef std::vector<Link> Links;
|
||||
|
||||
typedef std::map<NodeOperationInput *, NodeInput *> InputSocketMap;
|
||||
|
@ -75,7 +74,7 @@ class NodeOperationBuilder {
|
|||
const CompositorContext *m_context;
|
||||
NodeGraph m_graph;
|
||||
|
||||
Operations m_operations;
|
||||
blender::Vector<NodeOperation *> m_operations;
|
||||
Links m_links;
|
||||
blender::Vector<ExecutionGroup *> m_groups;
|
||||
|
||||
|
|
Loading…
Reference in New Issue