* Composite result is updated when editing (preview were already
calculated, now the final result is also updated in the image space * default texture size when not connected to any resolution depended operation defaults to render size
This commit is contained in:
@@ -37,6 +37,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, system);
|
||||
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, system);
|
||||
operation->setTexture(texture);
|
||||
operation->setScene(context->getScene());
|
||||
system->addOperation(operation);
|
||||
addPreviewOperation(system, operation->getOutputSocket(), 9);
|
||||
|
||||
@@ -46,6 +47,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
|
||||
addLink(system, operation->getInputSocket(0)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(0));
|
||||
addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(1));
|
||||
alphaOperation->setTexture(texture);
|
||||
alphaOperation->setScene(context->getScene());
|
||||
system->addOperation(alphaOperation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
#include "RE_shader_ext.h"
|
||||
#include "RE_render_ext.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "render_types.h"
|
||||
#include "render_types.h"
|
||||
}
|
||||
#include "PIL_time.h"
|
||||
|
||||
@@ -55,24 +55,31 @@ void CompositorOperation::initExecution()
|
||||
if (this->getWidth() * this->getHeight() != 0) {
|
||||
this->outputBuffer=(float*) MEM_callocN(this->getWidth()*this->getHeight()*4*sizeof(float), "CompositorOperation");
|
||||
}
|
||||
const Scene * scene = this->scene;
|
||||
Render *re = RE_GetRender(scene->id.name);
|
||||
RenderResult *rr = RE_AcquireResultWrite(re);
|
||||
if (rr) {
|
||||
if (rr->rectf != NULL) {
|
||||
MEM_freeN(rr->rectf);
|
||||
}
|
||||
rr->rectf = outputBuffer;
|
||||
}
|
||||
if (re) {
|
||||
RE_ReleaseResult(re);
|
||||
re = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CompositorOperation::deinitExecution()
|
||||
{
|
||||
if (tree->test_break && !tree->test_break(tree->tbh)) {
|
||||
const Scene * scene = this->scene;
|
||||
Render *re = RE_GetRender(scene->id.name);
|
||||
RenderResult *rr = RE_AcquireResultWrite(re);
|
||||
if (rr) {
|
||||
if (rr->rectf != NULL) {
|
||||
MEM_freeN(rr->rectf);
|
||||
}
|
||||
rr->rectf = outputBuffer;
|
||||
}
|
||||
if (re) {
|
||||
RE_ReleaseResult(re);
|
||||
re = NULL;
|
||||
}
|
||||
BKE_image_signal(BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"), NULL, IMA_SIGNAL_FREE);
|
||||
} else {
|
||||
if (this->outputBuffer) {
|
||||
MEM_freeN(this->outputBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
this->outputBuffer = NULL;
|
||||
this->imageInput = NULL;
|
||||
this->alphaInput = NULL;
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers);
|
||||
void setScene(const Scene *scene) {this->scene = scene;}
|
||||
void setbNodeTree(const bNodeTree *tree) {this->tree = tree;}
|
||||
bool isOutputOperation(bool rendering) const {return rendering;}
|
||||
bool isOutputOperation(bool rendering) const {return true;}
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
const int getRenderPriority() const {return 7;}
|
||||
|
||||
@@ -32,6 +32,7 @@ TextureBaseOperation::TextureBaseOperation(): NodeOperation()
|
||||
this->texture = NULL;
|
||||
this->inputSize = NULL;
|
||||
this->inputOffset = NULL;
|
||||
this->scene = NULL;
|
||||
}
|
||||
TextureOperation::TextureOperation() : TextureBaseOperation()
|
||||
{
|
||||
@@ -56,8 +57,10 @@ void TextureBaseOperation::deinitExecution()
|
||||
void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
if (preferredResolution[0] == 0 || preferredResolution[1] == 0) {
|
||||
resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH;
|
||||
resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT;
|
||||
int width = this->scene->r.xsch*this->scene->r.size/100;
|
||||
int height = this->scene->r.ysch*this->scene->r.size/100;
|
||||
resolution[0] = width;
|
||||
resolution[1] = height;
|
||||
}
|
||||
else {
|
||||
resolution[0] = preferredResolution[0];
|
||||
|
||||
@@ -43,6 +43,7 @@ extern "C" {
|
||||
class TextureBaseOperation : public NodeOperation {
|
||||
private:
|
||||
Tex *texture;
|
||||
const Scene *scene;
|
||||
SocketReader *inputSize;
|
||||
SocketReader *inputOffset;
|
||||
|
||||
@@ -64,6 +65,7 @@ public:
|
||||
void setTexture(Tex *texture) {this->texture = texture;}
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void setScene(const Scene *scene) {this->scene = scene;}
|
||||
};
|
||||
|
||||
class TextureOperation:public TextureBaseOperation {
|
||||
|
||||
Reference in New Issue
Block a user