[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47907] trunk/blender/source/blender: change to scale node - multiply scale by scene size, without this theres no reliable way to match different scaled footage to an output and still have useful preview 's at <100 percentage.

Campbell Barton ideasman42 at gmail.com
Thu Jun 14 17:04:44 CEST 2012


Revision: 47907
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47907
Author:   campbellbarton
Date:     2012-06-14 15:04:40 +0000 (Thu, 14 Jun 2012)
Log Message:
-----------
change to scale node - multiply scale by scene size, without this theres no reliable way to match different scaled footage to an output and still have useful preview's at <100 percentage.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/nodes/COM_ScaleNode.cpp
    trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.h
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_scale.c

Modified: trunk/blender/source/blender/compositor/nodes/COM_ScaleNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_ScaleNode.cpp	2012-06-14 14:48:52 UTC (rev 47906)
+++ trunk/blender/source/blender/compositor/nodes/COM_ScaleNode.cpp	2012-06-14 15:04:40 UTC (rev 47907)
@@ -75,8 +75,10 @@
 		break;
 
 		case CMP_SCALE_ABSOLUTE: {
+			const RenderData *data = &context->getScene()->r;
 			ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); // TODO: what is the use of this one.... perhaps some issues when the ui was updated....
 
+			operation->setRenderPercentage(data->size / 100.0f);
 			inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
 			inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
 			inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);

Modified: trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.cpp	2012-06-14 14:48:52 UTC (rev 47906)
+++ trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.cpp	2012-06-14 15:04:40 UTC (rev 47907)
@@ -136,8 +136,8 @@
 	this->inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
 	this->inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
 
-	const float scx = scaleX[0]; // target absolute scale
-	const float scy = scaleY[0]; // target absolute scale
+	const float scx = scaleX[0] * this->render_perc; // target absolute scale * render_percentage
+	const float scy = scaleY[0] * this->render_perc; // target absolute scale * render_percentage
 	const float width = this->getWidth();
 	const float height = this->getHeight();
 	//div
@@ -146,6 +146,7 @@
 
 	float nx = this->centerX + (x - this->centerX) / relativeXScale;
 	float ny = this->centerY + (y - this->centerY) / relativeYScale;
+
 	this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
 }
 

Modified: trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.h	2012-06-14 14:48:52 UTC (rev 47906)
+++ trunk/blender/source/blender/compositor/operations/COM_ScaleOperation.h	2012-06-14 15:04:40 UTC (rev 47907)
@@ -47,6 +47,9 @@
 	SocketReader *inputYOperation;
 	float centerX;
 	float centerY;
+
+	/* scene->r.size / 100.0f */ /* added after 2.63, this may be done differently/better */
+	float render_perc;
 public:
 	ScaleAbsoluteOperation();
 	bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
@@ -54,6 +57,7 @@
 
 	void initExecution();
 	void deinitExecution();
+	void setRenderPercentage(float render_perc) { this->render_perc = render_perc; }
 };
 
 class ScaleFixedSizeOperation : public NodeOperation {

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_scale.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_scale.c	2012-06-14 14:48:52 UTC (rev 47906)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_scale.c	2012-06-14 15:04:40 UTC (rev 47907)
@@ -49,11 +49,12 @@
 /* node->custom1 stores if input values are absolute or relative scale */
 static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
+	RenderData *rd = data;
+
 	if (out[0]->hasoutput==0)
 		return;
 	
 	if (in[0]->data) {
-		RenderData *rd= data;
 		CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 		ImBuf *ibuf;
 		int newx, newy;
@@ -114,8 +115,8 @@
 		int a, x, y;
 		float *fp;
 
-		x = MAX2((int)in[1]->vec[0], 1);
-		y = MAX2((int)in[2]->vec[0], 1);
+		x = MAX2((int)in[1]->vec[0], 1) * (rd->size / 100.0f);
+		y = MAX2((int)in[2]->vec[0], 1) * (rd->size / 100.0f);
 
 		stackbuf = alloc_compbuf(x, y, CB_RGBA, 1);
 		fp = stackbuf->rect;




More information about the Bf-blender-cvs mailing list