Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-14 19:04:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-14 19:04:40 +0400
commit0b2fcf43680eb0c6877bd111580fa98ae7ccb7e7 (patch)
treea7e8128cd82b18df3ca0dcda5a458dc2e1cfaa02 /source/blender
parent91eed57e62f2c820a9d1b4764ff3d4c7adafd51c (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.cpp5
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.cpp7
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.h10
-rw-r--r--source/blender/makesdna/DNA_scene_types.h5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c9
5 files changed, 33 insertions, 3 deletions
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp
index fd4e4331fca..09fd40be31e 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.cpp
+++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp
@@ -77,6 +77,11 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
case CMP_SCALE_ABSOLUTE: {
ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); // TODO: what is the use of this one.... perhaps some issues when the ui was updated....
+#ifdef USE_SCENE_COMPO_SCALE
+ const RenderData *data = &context->getScene()->r;
+ operation->setRenderPercentage(data->size / 100.0f);
+#endif
+
inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp
index 341bcdd1b62..ae640bf7057 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp
@@ -136,8 +136,14 @@ void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelS
this->inputXOperation->read(scaleX, x, y, sampler, inputBuffers);
this->inputYOperation->read(scaleY, x, y, sampler, inputBuffers);
+#ifdef USE_SCENE_COMPO_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
+#else
const float scx = scaleX[0]; // target absolute scale
const float scy = scaleY[0]; // target absolute scale
+#endif
+
const float width = this->getWidth();
const float height = this->getHeight();
//div
@@ -146,6 +152,7 @@ void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelS
float nx = this->centerX + (x - this->centerX) / relativeXScale;
float ny = this->centerY + (y - this->centerY) / relativeYScale;
+
this->inputOperation->read(color, nx, ny, sampler, inputBuffers);
}
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h
index 9e24ab3d1ca..cc666187f36 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.h
+++ b/source/blender/compositor/operations/COM_ScaleOperation.h
@@ -47,6 +47,12 @@ class ScaleAbsoluteOperation : public NodeOperation {
SocketReader *inputYOperation;
float centerX;
float centerY;
+
+#ifdef USE_SCENE_COMPO_SCALE
+ /* scene->r.size / 100.0f */ /* added after 2.63, this may be done differently/better */
+ float render_perc;
+#endif
+
public:
ScaleAbsoluteOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
@@ -54,6 +60,10 @@ public:
void initExecution();
void deinitExecution();
+
+#ifdef USE_SCENE_COMPO_SCALE
+ void setRenderPercentage(float render_perc) { this->render_perc = render_perc; }
+#endif
};
class ScaleFixedSizeOperation : public NodeOperation {
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 75b0b18879d..33b28a6abff 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -34,9 +34,12 @@
#include "DNA_defs.h"
-// XXX, temp feature - campbell
+/* XXX, temp feature - campbell */
#define DURIAN_CAMERA_SWITCH
+/* XXX - We cant agree on this and it might get deprecated - campbell */
+#define USE_SCENE_COMPO_SCALE
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index a36919ba553..90ab485af75 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -49,11 +49,12 @@ static bNodeSocketTemplate cmp_node_scale_out[]= {
/* 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,9 +115,13 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
int a, x, y;
float *fp;
+#ifdef USE_SCENE_COMPO_SCALE
+ x = MAX2((int)in[1]->vec[0], 1) * (rd->size / 100.0f);
+ y = MAX2((int)in[2]->vec[0], 1) * (rd->size / 100.0f);
+#else
x = MAX2((int)in[1]->vec[0], 1);
y = MAX2((int)in[2]->vec[0], 1);
-
+#endif
stackbuf = alloc_compbuf(x, y, CB_RGBA, 1);
fp = stackbuf->rect;