Added alpha output to movie clip compositor node
Pretty much straightforward change, made in the same way as texture input node. Shall not be any regressions or crashes when mixing usage of 2.66 and current trunk.
This commit is contained in:
@@ -41,10 +41,11 @@ MovieClipNode::MovieClipNode(bNode *editorNode) : Node(editorNode)
|
||||
void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
OutputSocket *outputMovieClip = this->getOutputSocket(0);
|
||||
OutputSocket *offsetXMovieClip = this->getOutputSocket(1);
|
||||
OutputSocket *offsetYMovieClip = this->getOutputSocket(2);
|
||||
OutputSocket *scaleMovieClip = this->getOutputSocket(3);
|
||||
OutputSocket *angleMovieClip = this->getOutputSocket(4);
|
||||
OutputSocket *alphaMovieClip = this->getOutputSocket(1);
|
||||
OutputSocket *offsetXMovieClip = this->getOutputSocket(2);
|
||||
OutputSocket *offsetYMovieClip = this->getOutputSocket(3);
|
||||
OutputSocket *scaleMovieClip = this->getOutputSocket(4);
|
||||
OutputSocket *angleMovieClip = this->getOutputSocket(5);
|
||||
|
||||
bNode *editorNode = this->getbNode();
|
||||
MovieClip *movieClip = (MovieClip *)editorNode->id;
|
||||
@@ -73,6 +74,16 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
|
||||
operation->setCacheFrame(cacheFrame);
|
||||
graph->addOperation(operation);
|
||||
|
||||
if (alphaMovieClip->isConnected()) {
|
||||
MovieClipAlphaOperation *alphaOperation = new MovieClipAlphaOperation();
|
||||
alphaOperation->setMovieClip(movieClip);
|
||||
alphaOperation->setMovieClipUser(movieClipUser);
|
||||
alphaOperation->setFramenumber(context->getFramenumber());
|
||||
alphaOperation->setCacheFrame(cacheFrame);
|
||||
alphaMovieClip->relinkConnections(alphaOperation->getOutputSocket());
|
||||
graph->addOperation(alphaOperation);
|
||||
}
|
||||
|
||||
MovieTrackingStabilization *stab = &movieClip->tracking.stabilization;
|
||||
float loc[2], scale, angle;
|
||||
loc[0] = 0.0f;
|
||||
@@ -87,7 +98,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
|
||||
BKE_tracking_stabilization_data_get(&movieClip->tracking, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (offsetXMovieClip->isConnected()) {
|
||||
SetValueOperation *operationSetValue = new SetValueOperation();
|
||||
operationSetValue->setValue(loc[0]);
|
||||
|
||||
@@ -30,9 +30,8 @@ extern "C" {
|
||||
}
|
||||
#include "BKE_image.h"
|
||||
|
||||
MovieClipOperation::MovieClipOperation() : NodeOperation()
|
||||
MovieClipBaseOperation::MovieClipBaseOperation() : NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_movieClip = NULL;
|
||||
this->m_movieClipBuffer = NULL;
|
||||
this->m_movieClipUser = NULL;
|
||||
@@ -42,7 +41,7 @@ MovieClipOperation::MovieClipOperation() : NodeOperation()
|
||||
}
|
||||
|
||||
|
||||
void MovieClipOperation::initExecution()
|
||||
void MovieClipBaseOperation::initExecution()
|
||||
{
|
||||
if (this->m_movieClip) {
|
||||
BKE_movieclip_user_set_frame(this->m_movieClipUser, this->m_framenumber);
|
||||
@@ -63,7 +62,7 @@ void MovieClipOperation::initExecution()
|
||||
}
|
||||
}
|
||||
|
||||
void MovieClipOperation::deinitExecution()
|
||||
void MovieClipBaseOperation::deinitExecution()
|
||||
{
|
||||
if (this->m_movieClipBuffer) {
|
||||
IMB_freeImBuf(this->m_movieClipBuffer);
|
||||
@@ -72,7 +71,7 @@ void MovieClipOperation::deinitExecution()
|
||||
}
|
||||
}
|
||||
|
||||
void MovieClipOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
|
||||
void MovieClipBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
|
||||
{
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
@@ -87,7 +86,7 @@ void MovieClipOperation::determineResolution(unsigned int resolution[2], unsigne
|
||||
}
|
||||
}
|
||||
|
||||
void MovieClipOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
void MovieClipBaseOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
if (this->m_movieClipBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
|
||||
zero_v4(output);
|
||||
@@ -106,3 +105,22 @@ void MovieClipOperation::executePixel(float output[4], float x, float y, PixelSa
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MovieClipOperation::MovieClipOperation() : MovieClipBaseOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
MovieClipAlphaOperation::MovieClipAlphaOperation() : MovieClipBaseOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void MovieClipAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
MovieClipBaseOperation::executePixel(output, x, y, sampler);
|
||||
output[0] = output[3];
|
||||
output[1] = 0.0f;
|
||||
output[2] = 0.0f;
|
||||
output[3] = 0.0f;
|
||||
}
|
||||
|
||||
@@ -30,11 +30,9 @@
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
/**
|
||||
* Base class for all renderlayeroperations
|
||||
*
|
||||
* @todo: rename to operation.
|
||||
* Base class for movie clip
|
||||
*/
|
||||
class MovieClipOperation : public NodeOperation {
|
||||
class MovieClipBaseOperation : public NodeOperation {
|
||||
protected:
|
||||
MovieClip *m_movieClip;
|
||||
MovieClipUser *m_movieClipUser;
|
||||
@@ -50,7 +48,7 @@ protected:
|
||||
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
|
||||
|
||||
public:
|
||||
MovieClipOperation();
|
||||
MovieClipBaseOperation();
|
||||
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
@@ -62,4 +60,15 @@ public:
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MovieClipOperation : public MovieClipBaseOperation {
|
||||
public:
|
||||
MovieClipOperation();
|
||||
};
|
||||
|
||||
class MovieClipAlphaOperation : public MovieClipBaseOperation {
|
||||
public:
|
||||
MovieClipAlphaOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
static bNodeSocketTemplate cmp_node_movieclip_out[] = {
|
||||
{ SOCK_RGBA, 0, N_("Image")},
|
||||
{ SOCK_FLOAT, 0, N_("Alpha")},
|
||||
{ SOCK_FLOAT, 1, N_("Offset X")},
|
||||
{ SOCK_FLOAT, 1, N_("Offset Y")},
|
||||
{ SOCK_FLOAT, 1, N_("Scale")},
|
||||
|
||||
Reference in New Issue
Block a user