[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46508] branches/tile/source/blender/ compositor: Tile Branch
Monique Dewanchand
m.dewanchand at atmind.nl
Thu May 10 22:24:20 CEST 2012
Revision: 46508
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46508
Author: mdewanchand
Date: 2012-05-10 20:24:20 +0000 (Thu, 10 May 2012)
Log Message:
-----------
Tile Branch
[#31298] plugging anything into size socket of blur node does nothing
Modified Paths:
--------------
branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp
branches/tile/source/blender/compositor/nodes/COM_MixNode.cpp
branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.h
branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
branches/tile/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
branches/tile/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
branches/tile/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
branches/tile/source/blender/compositor/operations/COM_GaussianXBlurOperation.h
branches/tile/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
branches/tile/source/blender/compositor/operations/COM_GaussianYBlurOperation.h
branches/tile/source/blender/compositor/operations/COM_MixBaseOperation.cpp
branches/tile/source/blender/compositor/operations/COM_MixBaseOperation.h
Modified: branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp 2012-05-10 19:25:18 UTC (rev 46507)
+++ branches/tile/source/blender/compositor/nodes/COM_BlurNode.cpp 2012-05-10 20:24:20 UTC (rev 46508)
@@ -36,7 +36,8 @@
bNode* editorNode = this->getbNode();
NodeBlurData * data = (NodeBlurData*)editorNode->storage;
const bNodeSocket *sock = this->getInputSocket(1)->getbNodeSocket();
- const float size = ((const bNodeSocketValueFloat*)sock->default_value)->value;
+ //const float size = ((const bNodeSocketValueFloat*)sock->default_value)->value;
+
CompositorQuality quality = context->getQuality();
if (data->filtertype == R_FILTER_MITCH || data->filtertype == R_FILTER_CATROM) {
@@ -45,8 +46,8 @@
if (data->filtertype == R_FILTER_FAST_GAUSS) {
FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation();
operationfgb->setData(data);
- operationfgb->setSize(size);
this->getInputSocket(0)->relinkConnections(operationfgb->getInputSocket(0), true, 0, graph);
+ this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), true, 1, graph);
this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0));
graph->addOperation(operationfgb);
addPreviewOperation(graph, operationfgb->getOutputSocket(), 5);
@@ -55,21 +56,21 @@
operationx->setData(data);
operationx->setQuality(quality);
this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), true, 0, graph);
- operationx->setSize(size);
+ this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), true, 1, graph);
graph->addOperation(operationx);
GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
operationy->setData(data);
operationy->setQuality(quality);
this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket());
- operationy->setSize(size);
graph->addOperation(operationy);
addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
+ addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1));
addPreviewOperation(graph, operationy->getOutputSocket(), 5);
} else {
GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation();
operation->setData(data);
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
- operation->setSize(size);
+ this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, graph);
operation->setQuality(quality);
graph->addOperation(operation);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
Modified: branches/tile/source/blender/compositor/nodes/COM_MixNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_MixNode.cpp 2012-05-10 19:25:18 UTC (rev 46507)
+++ branches/tile/source/blender/compositor/nodes/COM_MixNode.cpp 2012-05-10 20:24:20 UTC (rev 46508)
@@ -118,6 +118,7 @@
break;
}
convertProg->setUseValueAlphaMultiply(this->getbNode()->custom2);
+
valueSocket->relinkConnections(convertProg->getInputSocket(0), true, 0, graph);
color1Socket->relinkConnections(convertProg->getInputSocket(1), true, 1, graph);
color2Socket->relinkConnections(convertProg->getInputSocket(2), true, 2, graph);
Modified: branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-05-10 19:25:18 UTC (rev 46507)
+++ branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-05-10 20:24:20 UTC (rev 46508)
@@ -29,6 +29,7 @@
BlurBaseOperation::BlurBaseOperation(): NodeOperation() {
this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
this->setComplex(true);
this->inputProgram = NULL;
@@ -38,6 +39,7 @@
}
void BlurBaseOperation::initExecution() {
this->inputProgram = this->getInputSocketReader(0);
+ this->inputSize = this->getInputSocketReader(1);
this->data->image_in_width= this->getWidth();
this->data->image_in_height= this->getHeight();
if(this->data->relative) {
@@ -86,8 +88,15 @@
void BlurBaseOperation::deinitExecution() {
this->inputProgram = NULL;
+ this->inputSize = NULL;
if (this->deleteData) {
delete this->data;
}
this->data = NULL;
}
+
+void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers){
+ float result[4];
+ this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers);
+ this->size = result[0];
+}
Modified: branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.h
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.h 2012-05-10 19:25:18 UTC (rev 46507)
+++ branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.h 2012-05-10 20:24:20 UTC (rev 46508)
@@ -33,12 +33,13 @@
* Cached reference to the inputProgram
*/
SocketReader* inputProgram;
+ SocketReader* inputSize;
NodeBlurData * data;
BlurBaseOperation();
float* make_gausstab(int rad);
float size;
bool deleteData;
-
+ void updateSize(MemoryBuffer **memoryBuffers);
public:
/**
* Initialize the execution
@@ -52,8 +53,6 @@
void setData(NodeBlurData* data) {this->data= data;}
- void setSize(float size) {this->size = size;}
-
void deleteDataWhenFinished() {this->deleteData = true;}
};
#endif
Modified: branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp 2012-05-10 19:25:18 UTC (rev 46507)
+++ branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp 2012-05-10 20:24:20 UTC (rev 46508)
@@ -25,37 +25,47 @@
#include "BLI_utildefines.h"
FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation(){
+ this->iirgaus = false;
}
-void FastGaussianBlurOperation::initExecution(){
- BlurBaseOperation::initExecution();
- sx = data->sizex * this->size/2.0f;
- sy = data->sizey * this->size/2.0f;
-}
-
void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data) {
MemoryBuffer *newData = (MemoryBuffer*)data;
- newData->read(color, x, y);
-
+ newData->read(color, x, y);
}
bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output){
rcti newInput;
- newInput.xmax = input->xmax + (sx);
- newInput.xmin = input->xmin - (sx);
- newInput.ymax = input->ymax + (sy);
- newInput.ymin = input->ymin - (sy);
-
- return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+ NodeOperation * operation = this->getInputOperation(1);
+ if (operation->determineDependingAreaOfInterest(input, readOperation, output)) {
+ return true;
+ }else {
+ if(this->iirgaus){
+ newInput.xmax = input->xmax + (sx);
+ newInput.xmin = input->xmin - (sx);
+ newInput.ymax = input->ymax + (sy);
+ newInput.ymin = input->ymin - (sy);
+ }else {
+ newInput.xmin = 0;
+ newInput.ymin = 0;
+ newInput.xmax = this->getWidth();
+ newInput.ymax = this->getHeight();
+ }
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+ }
}
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);
Modified: branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h 2012-05-10 19:25:18 UTC (rev 46507)
+++ branches/tile/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h 2012-05-10 20:24:20 UTC (rev 46508)
@@ -30,12 +30,12 @@
private:
float sx;
float sy;
+ bool iirgaus;
public:
FastGaussianBlurOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
- void initExecution();
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);
Modified: branches/tile/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp 2012-05-10 19:25:18 UTC (rev 46507)
+++ branches/tile/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp 2012-05-10 20:24:20 UTC (rev 46508)
@@ -32,61 +32,65 @@
}
void* GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) {
+ updateGauss(memoryBuffers);
void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers);
return buffer;
}
-void GaussianBokehBlurOperation::initExecution() {
- BlurBaseOperation::initExecution();
-
- float radxf;
- float radyf;
- int n;
- float* dgauss;
- float val;
- int j, i;
- const float width = this->getWidth();
- const float height = this->getHeight();
-
- radxf = size*(float)this->data->sizex;
- if(radxf>width/2.0f)
- radxf= width/2.0f;
- else if(radxf<1.0f)
- radxf= 1.0f;
-
- /* vertical */
- radyf = size*(float)this->data->sizey;
- if(radyf>height/2.0f)
- radyf= height/2.0f;
- else if(radyf<1.0f)
- radyf= 1.0f;
-
- radx= ceil(radxf);
- rady= ceil(radyf);
-
- n = (2*radx+1)*(2*rady+1);
-
- /* create a full filter image */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list