[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46204] branches/tile/source/blender/ compositor/operations: TileBranch
Jeroen Bakker
j.bakker at atmind.nl
Wed May 2 20:08:55 CEST 2012
Revision: 46204
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46204
Author: jbakker
Date: 2012-05-02 18:08:55 +0000 (Wed, 02 May 2012)
Log Message:
-----------
TileBranch
* Implemented the Crop Image
Monique & Jeroen
- At Mind -
Modified Paths:
--------------
branches/tile/source/blender/compositor/operations/COM_CropOperation.cpp
branches/tile/source/blender/compositor/operations/COM_CropOperation.h
Modified: branches/tile/source/blender/compositor/operations/COM_CropOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_CropOperation.cpp 2012-05-02 18:07:01 UTC (rev 46203)
+++ branches/tile/source/blender/compositor/operations/COM_CropOperation.cpp 2012-05-02 18:08:55 UTC (rev 46204)
@@ -24,28 +24,30 @@
#include "BLI_math.h"
CropBaseOperation::CropBaseOperation() :NodeOperation(){
- this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->addOutputSocket(COM_DT_COLOR);
this->inputOperation = NULL;
this->settings = NULL;
}
-void CropBaseOperation::initExecution(){
- this->inputOperation = this->getInputSocketReader(0);
+void CropBaseOperation::updateArea() {
+ SocketReader * inputReference = this->getInputSocketReader(0);
+ float width = inputReference->getWidth();
+ float height = inputReference->getHeight();
if (this->relative){
- settings->x1= this->width * settings->fac_x1;
- settings->x2= this->width * settings->fac_x2;
- settings->y1= this->height * settings->fac_y1;
- settings->y2= this->height * settings->fac_y2;
+ settings->x1= width * settings->fac_x1;
+ settings->x2= width * settings->fac_x2;
+ settings->y1= height * settings->fac_y1;
+ settings->y2= height * settings->fac_y2;
}
- if (this->width <= settings->x1 + 1)
- settings->x1 = this->width - 1;
- if (this->height <= settings->y1 + 1)
- settings->y1 = this->height - 1;
- if (this->width <= settings->x2 + 1)
- settings->x2 = this->width - 1;
- if (this->height <= settings->y2 + 1)
- settings->y2 = this->height - 1;
+ if (width <= settings->x1 + 1)
+ settings->x1 = width - 1;
+ if (height <= settings->y1 + 1)
+ settings->y1 = height - 1;
+ if (width <= settings->x2 + 1)
+ settings->x2 = width - 1;
+ if (height <= settings->y2 + 1)
+ settings->y2 = height - 1;
this->xmax = MAX2(settings->x1, settings->x2) + 1;
this->xmin = MIN2(settings->x1, settings->x2);
@@ -53,6 +55,11 @@
this->ymin = MIN2(settings->y1, settings->y2);
}
+void CropBaseOperation::initExecution(){
+ this->inputOperation = this->getInputSocketReader(0);
+ updateArea();
+}
+
void CropBaseOperation::deinitExecution(){
this->inputOperation = NULL;
}
@@ -87,7 +94,7 @@
void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[]){
NodeOperation::determineResolution(resolution, preferedResolution);
-
+ updateArea();
resolution[0] = this->xmax - this->xmin;
resolution[1] = this->ymax - this->ymin;
}
Modified: branches/tile/source/blender/compositor/operations/COM_CropOperation.h
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_CropOperation.h 2012-05-02 18:07:01 UTC (rev 46203)
+++ branches/tile/source/blender/compositor/operations/COM_CropOperation.h 2012-05-02 18:08:55 UTC (rev 46204)
@@ -34,6 +34,8 @@
int xmin;
int ymax;
int ymin;
+
+ void updateArea();
public:
CropBaseOperation();
void initExecution();
More information about the Bf-blender-cvs
mailing list