diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-04-15 18:06:12 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-04-15 18:28:10 +0400 |
commit | 09874df135888b89f51d7becaa369ebb1d1623c6 (patch) | |
tree | bccf5950d42963992adff95dbc3f00ed7db1cf16 /source/blender/compositor/operations | |
parent | 28a829893c702918afc5ac1945a06eaefa611594 (diff) |
Structural cleanup and improvements for the compositor.
Many parts of the compositor are unnecessarily complicated. This patch
aims at reducing the complexity of writing nodes and making the code
more transparent.
== Separating Nodes and Operations ==
Currently these are both mixed in the same graph, even though they have
very different purposes and are used at distinct stages in the
compositing process. The patch introduces dedicated graph classes for
nodes and for operations.
This removes the need for a lot of special case checks (isOperation etc.)
and explicit type casts. It simplifies the code since it becomes clear
at every stage what type of node we are dealing with. The compiler can
use static typing to avoid common bugs from mixing up these types and
fewer runtime sanity checks are needed.
== Simplified Node Conversion ==
Converting nodes to operations was previously based on "relinking", i.e.
nodes would start with by mirroring links in the Blender DNA node trees,
then add operations and redirect these links to them. This was very hard
to follow in many cases and required a lot of attention to avoid invalid
states.
Now there is a helper class called the NodeConverter, which is passed to
nodes and implements a much simpler API for this process. Nodes can add
operations and explicit connections as before, but defining "external"
links to the inputs/outputs of the original node now uses mapping
instead of directly modifying link data. Input data (node graph) and
result (operations graph) are cleanly separated.
== Removed Redundant Data Structures ==
A few redundant data structures have been removed, notably the
SocketConnection. These are only needed temporarily during graph
construction. For executing the compositor operations it is perfectly
sufficient to store only the direct input link pointers. A common
pointer indirection is avoided this way (which might also give a little
performance improvement).
== Avoid virtual recursive functions ==
Recursive virtual functions are evil. They are very hard to follow
during debugging. At least in the parts this patch is concerned with
these functions have been replaced by a non-virtual recursive core
function (which might then call virtual non-recursive functions if
needed). See for example NodeOperationBuilder::group_operations.
Diffstat (limited to 'source/blender/compositor/operations')
28 files changed, 72 insertions, 106 deletions
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index 0f7afe484b1..e7af9319f88 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -36,30 +36,29 @@ BlurBaseOperation::BlurBaseOperation(DataType data_type) : NodeOperation() this->addOutputSocket(data_type); this->setComplex(true); this->m_inputProgram = NULL; - this->m_data = NULL; + memset(&m_data, 0, sizeof(NodeBlurData)); this->m_size = 1.0f; - this->m_deleteData = false; this->m_sizeavailable = false; } void BlurBaseOperation::initExecution() { this->m_inputProgram = this->getInputSocketReader(0); this->m_inputSize = this->getInputSocketReader(1); - this->m_data->image_in_width = this->getWidth(); - this->m_data->image_in_height = this->getHeight(); - if (this->m_data->relative) { - switch (this->m_data->aspect) { + this->m_data.image_in_width = this->getWidth(); + this->m_data.image_in_height = this->getHeight(); + if (this->m_data.relative) { + switch (this->m_data.aspect) { case CMP_NODE_BLUR_ASPECT_NONE: - this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width); - this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height); + this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width); + this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height); break; case CMP_NODE_BLUR_ASPECT_Y: - this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width); - this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_width); + this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width); + this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_width); break; case CMP_NODE_BLUR_ASPECT_X: - this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_height); - this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height); + this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_height); + this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height); break; } } @@ -80,7 +79,7 @@ float *BlurBaseOperation::make_gausstab(float rad, int size) sum = 0.0f; float fac = (rad > 0.0f ? 1.0f / rad : 0.0f); for (i = -size; i <= size; i++) { - val = RE_filter_value(this->m_data->filtertype, (float)i * fac); + val = RE_filter_value(this->m_data.filtertype, (float)i * fac); sum += val; gausstab[i + size] = val; } @@ -144,10 +143,11 @@ void BlurBaseOperation::deinitExecution() { this->m_inputProgram = NULL; this->m_inputSize = NULL; - if (this->m_deleteData) { - delete this->m_data; - } - this->m_data = NULL; +} + +void BlurBaseOperation::setData(const NodeBlurData *data) +{ + memcpy(&m_data, data, sizeof(NodeBlurData)); } void BlurBaseOperation::updateSize() diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index c5d89b1bc91..052a525ef2c 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -43,10 +43,9 @@ protected: */ SocketReader *m_inputProgram; SocketReader *m_inputSize; - NodeBlurData *m_data; + NodeBlurData m_data; float m_size; - bool m_deleteData; bool m_sizeavailable; public: @@ -60,9 +59,7 @@ public: */ void deinitExecution(); - void setData(NodeBlurData *data) { this->m_data = data; } - - void deleteDataWhenFinished() { this->m_deleteData = true; } + void setData(const NodeBlurData *data); void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; } }; diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index d4629a8d527..14aba267a23 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -21,7 +21,6 @@ */ #include "COM_CompositorOperation.h" -#include "COM_SocketConnection.h" #include "BLI_listbase.h" #include "BKE_image.h" diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index ff53ef22e29..9d96ebbb33f 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -45,13 +45,13 @@ void FastGaussianBlurOperation::executePixel(float output[4], int x, int y, void // the whole image. bool FastGaussianBlurOperation::getDAI(rcti *rect, rcti *output) { - // m_data->sizex * m_size should be enough? For some reason there + // m_data.sizex * m_size should be enough? For some reason there // seem to be errors in the boundary between tiles. float size = this->m_size * COM_FAST_GAUSSIAN_MULTIPLIER; - int sx = this->m_data->sizex * size; + int sx = this->m_data.sizex * size; if (sx < 1) sx = 1; - int sy = this->m_data->sizey * size; + int sy = this->m_data.sizey * size; if (sy < 1) sy = 1; @@ -125,8 +125,8 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect) updateSize(); int c; - this->m_sx = this->m_data->sizex * this->m_size / 2.0f; - this->m_sy = this->m_data->sizey * this->m_size / 2.0f; + this->m_sx = this->m_data.sizex * this->m_size / 2.0f; + this->m_sy = this->m_data.sizey * this->m_size / 2.0f; if ((this->m_sx == this->m_sy) && (this->m_sx > 0.f)) { for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c) @@ -174,8 +174,8 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect) tile->copyContentFrom(buffer); int c; - float sx = this->m_data->sizex * this->m_size / 2.0f; - float sy = this->m_data->sizey * this->m_size / 2.0f; + float sx = this->m_data.sizex * this->m_size / 2.0f; + float sy = this->m_data.sizey * this->m_size / 2.0f; if ((sx == sy) && (sx > 0.f)) { for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c) diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp index 4ae0b4e78b2..69aa7d0fee5 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp @@ -54,7 +54,7 @@ void GaussianAlphaXBlurOperation::initExecution() initMutex(); if (this->m_sizeavailable) { - float rad = max_ff(m_size * m_data->sizex, 0.0f); + float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); @@ -66,7 +66,7 @@ void GaussianAlphaXBlurOperation::updateGauss() { if (this->m_gausstab == NULL) { updateSize(); - float rad = max_ff(m_size * m_data->sizex, 0.0f); + float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); @@ -74,7 +74,7 @@ void GaussianAlphaXBlurOperation::updateGauss() if (this->m_distbuf_inv == NULL) { updateSize(); - float rad = max_ff(m_size * m_data->sizex, 0.0f); + float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp index fb407bf9ee4..ae1f309c54f 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp @@ -54,7 +54,7 @@ void GaussianAlphaYBlurOperation::initExecution() initMutex(); if (this->m_sizeavailable) { - float rad = max_ff(m_size * m_data->sizey, 0.0f); + float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); @@ -66,7 +66,7 @@ void GaussianAlphaYBlurOperation::updateGauss() { if (this->m_gausstab == NULL) { updateSize(); - float rad = max_ff(m_size * m_data->sizey, 0.0f); + float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); @@ -74,7 +74,7 @@ void GaussianAlphaYBlurOperation::updateGauss() if (this->m_distbuf_inv == NULL) { updateSize(); - float rad = max_ff(m_size * m_data->sizey, 0.0f); + float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index 1d02f5389b1..d5743c41c94 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -68,11 +68,11 @@ void GaussianBokehBlurOperation::updateGauss() if (!this->m_sizeavailable) { updateSize(); } - radxf = this->m_size * (float)this->m_data->sizex; + radxf = this->m_size * (float)this->m_data.sizex; CLAMP(radxf, 0.0f, width / 2.0f); /* vertical */ - radyf = this->m_size * (float)this->m_data->sizey; + radyf = this->m_size * (float)this->m_data.sizey; CLAMP(radyf, 0.0f, height / 2.0f); this->m_radx = ceil(radxf); @@ -93,7 +93,7 @@ void GaussianBokehBlurOperation::updateGauss() float fj = (float)j * facy; float fi = (float)i * facx; float dist = sqrt(fj * fj + fi * fi); - *dgauss = RE_filter_value(this->m_data->filtertype, dist); + *dgauss = RE_filter_value(this->m_data.filtertype, dist); sum += *dgauss; } @@ -212,28 +212,28 @@ void GaussianBlurReferenceOperation::initExecution() { BlurBaseOperation::initExecution(); // setup gaustab - this->m_data->image_in_width = this->getWidth(); - this->m_data->image_in_height = this->getHeight(); - if (this->m_data->relative) { - switch (this->m_data->aspect) { + this->m_data.image_in_width = this->getWidth(); + this->m_data.image_in_height = this->getHeight(); + if (this->m_data.relative) { + switch (this->m_data.aspect) { case CMP_NODE_BLUR_ASPECT_NONE: - this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width); - this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height); + this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width); + this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height); break; case CMP_NODE_BLUR_ASPECT_Y: - this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width); - this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_width); + this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width); + this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_width); break; case CMP_NODE_BLUR_ASPECT_X: - this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_height); - this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height); + this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_height); + this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height); break; } } /* horizontal */ - m_filtersizex = (float)this->m_data->sizex; + m_filtersizex = (float)this->m_data.sizex; int imgx = getWidth() / 2; if (m_filtersizex > imgx) m_filtersizex = imgx; @@ -242,7 +242,7 @@ void GaussianBlurReferenceOperation::initExecution() m_radx = (float)m_filtersizex; /* vertical */ - m_filtersizey = (float)this->m_data->sizey; + m_filtersizey = (float)this->m_data.sizey; int imgy = getHeight() / 2; if (m_filtersizey > imgy) m_filtersizey = imgy; @@ -342,8 +342,8 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(rcti *inpu return true; } else { - int addx = this->m_data->sizex + 2; - int addy = this->m_data->sizey + 2; + int addx = this->m_data.sizex + 2; + int addy = this->m_data.sizey + 2; newInput.xmax = input->xmax + addx; newInput.xmin = input->xmin - addx; newInput.ymax = input->ymax + addy; diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index 127417bf701..815b89ae8d9 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -52,7 +52,7 @@ void GaussianXBlurOperation::initExecution() initMutex(); if (this->m_sizeavailable) { - float rad = max_ff(m_size * m_data->sizex, 0.0f); + float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); @@ -63,7 +63,7 @@ void GaussianXBlurOperation::updateGauss() { if (this->m_gausstab == NULL) { updateSize(); - float rad = max_ff(m_size * m_data->sizex, 0.0f); + float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index 583305a0fc4..47c031757fb 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -52,7 +52,7 @@ void GaussianYBlurOperation::initExecution() initMutex(); if (this->m_sizeavailable) { - float rad = max_ff(m_size * m_data->sizey, 0.0f); + float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); @@ -63,7 +63,7 @@ void GaussianYBlurOperation::updateGauss() { if (this->m_gausstab == NULL) { updateSize(); - float rad = max_ff(m_size * m_data->sizey, 0.0f); + float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp index 8bfc3e436df..99c745d7fb0 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp @@ -23,7 +23,7 @@ #include "COM_GlareBaseOperation.h" #include "BLI_math.h" -GlareBaseOperation::GlareBaseOperation() : SingleThreadedNodeOperation() +GlareBaseOperation::GlareBaseOperation() : SingleThreadedOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -31,14 +31,14 @@ GlareBaseOperation::GlareBaseOperation() : SingleThreadedNodeOperation() } void GlareBaseOperation::initExecution() { - SingleThreadedNodeOperation::initExecution(); + SingleThreadedOperation::initExecution(); this->m_inputProgram = getInputSocketReader(0); } void GlareBaseOperation::deinitExecution() { this->m_inputProgram = NULL; - SingleThreadedNodeOperation::deinitExecution(); + SingleThreadedOperation::deinitExecution(); } MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2) diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index f6a8f6879da..3f0893d895f 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -23,7 +23,7 @@ #ifndef _COM_GlareBaseOperation_h #define _COM_GlareBaseOperation_h -#include "COM_SingleThreadedNodeOperation.h" +#include "COM_SingleThreadedOperation.h" #include "DNA_node_types.h" @@ -36,7 +36,7 @@ typedef float fRGB[4]; #define fRGB_rgbmult(c, r, g, b) { c[0] *= (r); c[1] *= (g); c[2] *= (b); } (void)0 -class GlareBaseOperation : public SingleThreadedNodeOperation { +class GlareBaseOperation : public SingleThreadedOperation { private: /** * @brief Cached reference to the inputProgram diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index cc7511bb9fc..9da55df476d 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -50,7 +50,7 @@ void MathBaseOperation::deinitExecution() void MathBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { - InputSocket *socket; + NodeOperationInput *socket; unsigned int tempPreferredResolution[2] = {0, 0}; unsigned int tempResolution[2]; diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp index 125de842892..247880c84e3 100644 --- a/source/blender/compositor/operations/COM_MixOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOperation.cpp @@ -71,7 +71,7 @@ void MixBaseOperation::executePixelSampled(float output[4], float x, float y, Pi void MixBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { - InputSocket *socket; + NodeOperationInput *socket; unsigned int tempPreferredResolution[2] = {0, 0}; unsigned int tempResolution[2]; diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 75b36d7672a..db2f8445db7 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -22,7 +22,6 @@ */ #include "COM_OutputFileOperation.h" -#include "COM_SocketConnection.h" #include <string.h> #include "BLI_listbase.h" #include "BLI_path_util.h" diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index ada40bba014..6bb2e7d7320 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -57,7 +57,7 @@ public: void deinitExecution(); const CompositorPriority getRenderPriority() const { return COM_PRIORITY_LOW; } - bool isFileOutputOperation() { return true; } + bool isFileOutputOperation() const { return true; } }; /* extra info for OpenEXR layers */ @@ -93,7 +93,7 @@ public: void deinitExecution(); const CompositorPriority getRenderPriority() const { return COM_PRIORITY_LOW; } - bool isFileOutputOperation() { return true; } + bool isFileOutputOperation() const { return true; } }; #endif diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index 85c7f449fd5..69290cd7c3c 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -21,7 +21,6 @@ */ #include "COM_PreviewOperation.h" -#include "COM_SocketConnection.h" #include "BLI_listbase.h" #include "BKE_image.h" #include "WM_api.h" diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h index bb60dfa0420..3e97acec7bb 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.h +++ b/source/blender/compositor/operations/COM_PreviewOperation.h @@ -53,7 +53,7 @@ public: void executeRegion(rcti *rect, unsigned int tileNumber); void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - bool isPreviewOperation() { return true; } + bool isPreviewOperation() const { return true; } }; #endif diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index cce519c6eb3..569920d51ef 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -34,7 +34,6 @@ private: MemoryBuffer *m_buffer; public: ReadBufferOperation(); - int isBufferOperation() { return true; } void setMemoryProxy(MemoryProxy *memoryProxy) { this->m_memoryProxy = memoryProxy; } MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; } void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index 6fd1b9768fc..d29ca726056 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -59,7 +59,7 @@ public: void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); bool isSetOperation() const { return true; } - void setVector(float vector[3]) { + void setVector(const float vector[3]) { setX(vector[0]); setY(vector[1]); setZ(vector[2]); diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp index d047198ac93..da345b282fd 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp @@ -26,22 +26,4 @@ SocketProxyOperation::SocketProxyOperation(DataType type) : NodeOperation() { this->addInputSocket(type); this->addOutputSocket(type); - this->m_inputOperation = NULL; -} - -void SocketProxyOperation::initExecution() -{ - this->m_inputOperation = this->getInputSocketReader(0); -} - -void SocketProxyOperation::deinitExecution() -{ - this->m_inputOperation = NULL; -} - -void SocketProxyOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) -{ - if (this->m_inputOperation) { - this->m_inputOperation->readSampled(output, x, y, sampler); - } } diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h index 6a6a0b351b0..9733a1fbeec 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.h +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h @@ -26,14 +26,10 @@ #include "COM_NodeOperation.h" class SocketProxyOperation : public NodeOperation { -private: - SocketReader *m_inputOperation; public: SocketProxyOperation(DataType type); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - void initExecution(); - void deinitExecution(); + bool isProxyOperation() const { return true; } }; #endif diff --git a/source/blender/compositor/operations/COM_SplitOperation.cpp b/source/blender/compositor/operations/COM_SplitOperation.cpp index 9278f1c3ec4..367c7eefa25 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.cpp +++ b/source/blender/compositor/operations/COM_SplitOperation.cpp @@ -21,7 +21,6 @@ */ #include "COM_SplitOperation.h" -#include "COM_SocketConnection.h" #include "BLI_listbase.h" #include "BKE_image.h" #include "BLI_utildefines.h" diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index 96aea56050f..ede767cbff7 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -25,7 +25,7 @@ #include "BLI_listbase.h" #include "BKE_image.h" -TextureBaseOperation::TextureBaseOperation() : SingleThreadedNodeOperation() +TextureBaseOperation::TextureBaseOperation() : SingleThreadedOperation() { this->addInputSocket(COM_DT_VECTOR); //offset this->addInputSocket(COM_DT_VECTOR); //size @@ -50,7 +50,7 @@ void TextureBaseOperation::initExecution() this->m_inputOffset = getInputSocketReader(0); this->m_inputSize = getInputSocketReader(1); this->m_pool = BKE_image_pool_new(); - SingleThreadedNodeOperation::initExecution(); + SingleThreadedOperation::initExecution(); } void TextureBaseOperation::deinitExecution() { @@ -58,7 +58,7 @@ void TextureBaseOperation::deinitExecution() this->m_inputOffset = NULL; BKE_image_pool_free(this->m_pool); this->m_pool = NULL; - SingleThreadedNodeOperation::deinitExecution(); + SingleThreadedOperation::deinitExecution(); } void TextureBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index 114cee00530..47ef40882c5 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -24,7 +24,7 @@ #ifndef _COM_TextureOperation_h #define _COM_TextureOperation_h -#include "COM_SingleThreadedNodeOperation.h" +#include "COM_SingleThreadedOperation.h" #include "DNA_texture_types.h" #include "BLI_listbase.h" extern "C" { @@ -39,7 +39,7 @@ extern "C" { * * @todo: rename to operation. */ -class TextureBaseOperation : public SingleThreadedNodeOperation { +class TextureBaseOperation : public SingleThreadedOperation { private: Tex *m_texture; const RenderData *m_rd; diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp index 2d944b70f75..e8a578fa131 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cpp +++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp @@ -24,8 +24,6 @@ #include "BLI_math.h" #include "BLI_utildefines.h" - - TonemapOperation::TonemapOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index c54a4971e54..6579eb268a6 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -21,7 +21,6 @@ */ #include "COM_ViewerOperation.h" -#include "COM_SocketConnection.h" #include "BLI_listbase.h" #include "BKE_image.h" #include "WM_api.h" diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index 0b8d08d3974..34954382b82 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -65,7 +65,7 @@ public: float getCenterY() const { return this->m_centerY; } OrderOfChunks getChunkOrder() const { return this->m_chunkOrder; } const CompositorPriority getRenderPriority() const; - bool isViewerOperation() { return true; } + bool isViewerOperation() const { return true; } void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; } void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; } diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index 1f1f58b18f1..96466df979c 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -27,7 +27,7 @@ #include "COM_MemoryProxy.h" #include "COM_SocketReader.h" /** - * @brief Operation to write to a tile + * @brief NodeOperation to write to a tile * @ingroup Operation */ class WriteBufferOperation : public NodeOperation { @@ -37,7 +37,6 @@ class WriteBufferOperation : public NodeOperation { public: WriteBufferOperation(); ~WriteBufferOperation(); - int isBufferOperation() { return true; } MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); const bool isWriteBufferOperation() const { return true; } |