[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46876] trunk/blender/source/blender/ compositor: * Composite result is updated when editing ( preview were already
Jeroen Bakker
j.bakker at atmind.nl
Tue May 22 11:54:08 CEST 2012
Revision: 46876
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46876
Author: jbakker
Date: 2012-05-22 09:54:08 +0000 (Tue, 22 May 2012)
Log Message:
-----------
* 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
Modified Paths:
--------------
trunk/blender/source/blender/compositor/nodes/COM_TextureNode.cpp
trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h
trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h
Modified: trunk/blender/source/blender/compositor/nodes/COM_TextureNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_TextureNode.cpp 2012-05-22 09:53:33 UTC (rev 46875)
+++ trunk/blender/source/blender/compositor/nodes/COM_TextureNode.cpp 2012-05-22 09:54:08 UTC (rev 46876)
@@ -37,6 +37,7 @@
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 @@
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);
}
}
Modified: trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.cpp 2012-05-22 09:53:33 UTC (rev 46875)
+++ trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.cpp 2012-05-22 09:54:08 UTC (rev 46876)
@@ -31,7 +31,7 @@
#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 @@
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;
Modified: trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h 2012-05-22 09:53:33 UTC (rev 46875)
+++ trunk/blender/source/blender/compositor/operations/COM_CompositorOperation.h 2012-05-22 09:54:08 UTC (rev 46876)
@@ -60,7 +60,7 @@
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;}
Modified: trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp 2012-05-22 09:53:33 UTC (rev 46875)
+++ trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp 2012-05-22 09:54:08 UTC (rev 46876)
@@ -32,6 +32,7 @@
this->texture = NULL;
this->inputSize = NULL;
this->inputOffset = NULL;
+ this->scene = NULL;
}
TextureOperation::TextureOperation() : TextureBaseOperation()
{
@@ -56,8 +57,10 @@
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];
Modified: trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h 2012-05-22 09:53:33 UTC (rev 46875)
+++ trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h 2012-05-22 09:54:08 UTC (rev 46876)
@@ -43,6 +43,7 @@
class TextureBaseOperation : public NodeOperation {
private:
Tex *texture;
+ const Scene *scene;
SocketReader *inputSize;
SocketReader *inputOffset;
@@ -64,6 +65,7 @@
void setTexture(Tex *texture) {this->texture = texture;}
void initExecution();
void deinitExecution();
+ void setScene(const Scene *scene) {this->scene = scene;}
};
class TextureOperation:public TextureBaseOperation {
More information about the Bf-blender-cvs
mailing list