[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47429] trunk/blender/source/blender/ compositor: * modified vieweroperation to not calculate based on the DO_NODE_OUTPUT
Jeroen Bakker
j.bakker at atmind.nl
Mon Jun 4 20:07:39 CEST 2012
Revision: 47429
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47429
Author: jbakker
Date: 2012-06-04 18:07:29 +0000 (Mon, 04 Jun 2012)
Log Message:
-----------
* modified vieweroperation to not calculate based on the DO_NODE_OUTPUT
flag of the editorbNode.
Modified Paths:
--------------
trunk/blender/source/blender/compositor/nodes/COM_ViewerNode.cpp
trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.h
Modified: trunk/blender/source/blender/compositor/nodes/COM_ViewerNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_ViewerNode.cpp 2012-06-04 17:30:54 UTC (rev 47428)
+++ trunk/blender/source/blender/compositor/nodes/COM_ViewerNode.cpp 2012-06-04 18:07:29 UTC (rev 47429)
@@ -37,7 +37,7 @@
Image *image = (Image*)this->getbNode()->id;
ImageUser * imageUser = (ImageUser*) this->getbNode()->storage;
bNode *editorNode = this->getbNode();
- if (imageSocket->isConnected() && (editorNode->flag & NODE_DO_OUTPUT)) {
+ if (imageSocket->isConnected()) {
ViewerOperation *viewerOperation = new ViewerOperation();
viewerOperation->setColorManagement(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT);
viewerOperation->setColorPredivide(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
Modified: trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-06-04 17:30:54 UTC (rev 47428)
+++ trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-06-04 18:07:29 UTC (rev 47429)
@@ -101,7 +101,10 @@
void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers)
{
- float result[4];
- this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
- this->size = result[0];
+ if (!this->sizeavailable) {
+ float result[4];
+ this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
+ this->size = result[0];
+ this->sizeavailable = true;
+ }
}
Modified: trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp 2012-06-04 17:30:54 UTC (rev 47428)
+++ trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp 2012-06-04 18:07:29 UTC (rev 47429)
@@ -26,13 +26,12 @@
FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation()
{
- this->iirgaus = false;
+ this->iirgaus = NULL;
}
void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data)
{
MemoryBuffer *newData = (MemoryBuffer*)data;
-
newData->read(color, x, y);
}
@@ -51,10 +50,7 @@
}
else {
if (this->iirgaus) {
- newInput.xmax = input->xmax + (sx);
- newInput.xmin = input->xmin - (sx);
- newInput.ymax = input->ymax + (sy);
- newInput.ymin = input->ymin - (sy);
+ return false;
}
else {
newInput.xmin = 0;
@@ -66,40 +62,53 @@
}
}
+void FastGaussianBlurOperation::initExecution()
+{
+ BlurBaseOperation::initExecution();
+ BlurBaseOperation::initMutex();
+}
+
+void FastGaussianBlurOperation::deinitExecution()
+{
+ if (this->iirgaus) {
+ delete this->iirgaus;
+ this->iirgaus = NULL;
+ }
+ BlurBaseOperation::deinitMutex();
+}
+
void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
{
- MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers);
- MemoryBuffer *copy = newBuf->duplicate();
- updateSize(memoryBuffers);
-
- int c;
- sx = data->sizex * this->size/2.0f;
- sy = data->sizey * this->size/2.0f;
- this->iirgaus = true;
-
- if ((sx == sy) && (sx > 0.f)) {
- for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
- IIR_gauss(copy, sx, c, 3);
- }
- else {
- if (sx > 0.f) {
+ BLI_mutex_lock(this->getMutex());
+ if (!iirgaus) {
+ MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers);
+ MemoryBuffer *copy = newBuf->duplicate();
+ updateSize(memoryBuffers);
+
+ int c;
+ sx = data->sizex * this->size/2.0f;
+ sy = data->sizey * this->size/2.0f;
+
+ if ((sx == sy) && (sx > 0.f)) {
for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
- IIR_gauss(copy, sx, c, 1);
+ IIR_gauss(copy, sx, c, 3);
}
- if (sy > 0.f) {
- for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
- IIR_gauss(copy, sy, c, 2);
+ else {
+ if (sx > 0.f) {
+ for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
+ IIR_gauss(copy, sx, c, 1);
+ }
+ if (sy > 0.f) {
+ for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c)
+ IIR_gauss(copy, sy, c, 2);
+ }
}
+ this->iirgaus = copy;
}
- return copy;
+ BLI_mutex_unlock(this->getMutex());
+ return iirgaus;
}
-void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
-{
- MemoryBuffer *newData = (MemoryBuffer*)data;
- delete newData;
-}
-
void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int chan, int xy)
{
double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
Modified: trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h 2012-06-04 17:30:54 UTC (rev 47428)
+++ trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h 2012-06-04 18:07:29 UTC (rev 47429)
@@ -30,7 +30,7 @@
private:
float sx;
float sy;
- bool iirgaus;
+ MemoryBuffer* iirgaus;
public:
FastGaussianBlurOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
@@ -38,7 +38,8 @@
static void IIR_gauss(MemoryBuffer *src, float sigma, int channel, int xy);
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
- void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
+ void deinitExecution();
+ void initExecution();
};
#endif
Modified: trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp 2012-06-04 17:30:54 UTC (rev 47428)
+++ trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp 2012-06-04 18:07:29 UTC (rev 47429)
@@ -50,8 +50,9 @@
void ViewerBaseOperation::initExecution()
{
- // When initializing the tree during initial load the width and height can be zero.
- initImage();
+ if (isActiveViewerOutput()) {
+ initImage();
+ }
}
void ViewerBaseOperation::initImage()
@@ -79,7 +80,6 @@
}
void ViewerBaseOperation:: updateImage(rcti *rect)
{
- /// @todo: introduce new event to update smaller area
WM_main_add_notifier(NC_WINDOW|ND_DRAW, NULL);
}
Modified: trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.h 2012-06-04 17:30:54 UTC (rev 47428)
+++ trunk/blender/source/blender/compositor/operations/COM_ViewerBaseOperation.h 2012-06-04 18:07:29 UTC (rev 47429)
@@ -42,7 +42,7 @@
bool doColorPredivide;
public:
- bool isOutputOperation(bool rendering) const {return true;}
+ bool isOutputOperation(bool rendering) const {return isActiveViewerOutput();}
void initExecution();
void deinitExecution();
void setImage(Image *image) {this->image = image;}
More information about the Bf-blender-cvs
mailing list