diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2012-05-22 13:54:08 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2012-05-22 13:54:08 +0400 |
commit | dbd70c05f799afb4d8a3584eae58af384ee14353 (patch) | |
tree | cd2edf5b6920cedc3d6311680509cffc9b165404 /source/blender/compositor/operations | |
parent | e7647e15859f524c1989847656e4ea228507d71b (diff) |
* 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
Diffstat (limited to 'source/blender/compositor/operations')
4 files changed, 30 insertions, 18 deletions
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index ce9484d0d9f..8b343374f1c 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -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; diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index 39c81b8292a..41d43f896bb 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -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;} diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index f7edd922376..0d85f71c691 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -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]; diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index ee067df2c64..de42b144730 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -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 { |