[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44328] branches/tile/source/blender/ compositor: TileBranch

Jeroen Bakker j.bakker at atmind.nl
Wed Feb 22 15:34:23 CET 2012


Revision: 44328
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44328
Author:   jbakker
Date:     2012-02-22 14:34:17 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
TileBranch
 * Added Output file node
 * Fixed issue during deinitialization of the compositor

Note:
 * There is a change in the render pipeline of blender that the 
   render vs editor attribute is not correct anymore.
This needs to be fixed, have noted in the todo list

 - At Mind - 

Modified Paths:
--------------
    branches/tile/source/blender/compositor/CMakeLists.txt
    branches/tile/source/blender/compositor/intern/COM_Converter.cpp
    branches/tile/source/blender/compositor/intern/COM_NodeOperation.h
    branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h

Added Paths:
-----------
    branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.h
    branches/tile/source/blender/compositor/operations/COM_OutputFileOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_OutputFileOperation.h

Modified: branches/tile/source/blender/compositor/CMakeLists.txt
===================================================================
--- branches/tile/source/blender/compositor/CMakeLists.txt	2012-02-22 14:19:39 UTC (rev 44327)
+++ branches/tile/source/blender/compositor/CMakeLists.txt	2012-02-22 14:34:17 UTC (rev 44328)
@@ -133,6 +133,8 @@
 	nodes/COM_SwitchNode.h
 	nodes/COM_MovieClipNode.cpp
 	nodes/COM_MovieClipNode.h
+	nodes/COM_OutputFileNode.cpp
+	nodes/COM_OutputFileNode.h
 
 # output nodes
 		nodes/COM_CompositorNode.cpp
@@ -347,6 +349,8 @@
 
 		operations/COM_CompositorOperation.h
 		operations/COM_CompositorOperation.cpp
+	operations/COM_OutputFileOperation.h
+	operations/COM_OutputFileOperation.cpp
 		operations/COM_ViewerBaseOperation.h
 		operations/COM_ViewerBaseOperation.cpp
 		operations/COM_ViewerOperation.h

Modified: branches/tile/source/blender/compositor/intern/COM_Converter.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_Converter.cpp	2012-02-22 14:19:39 UTC (rev 44327)
+++ branches/tile/source/blender/compositor/intern/COM_Converter.cpp	2012-02-22 14:34:17 UTC (rev 44328)
@@ -103,6 +103,7 @@
 #include "COM_GlareNode.h"
 #include "COM_MovieClipNode.h"
 #include "COM_ColorSpillNode.h"
+#include "COM_OutputFileNode.h"
 
 Node* Converter::convert(bNode *bNode) {
 	Node * node;
@@ -312,10 +313,12 @@
 	case CMP_NODE_COLOR_SPILL:
 		node = new ColorSpillNode(bNode);
 		break;
+	case CMP_NODE_OUTPUT_FILE:
+		node = new OutputFileNode(bNode);
+		break;
 	/* not inplemented yet */
 	case CMP_NODE_MAP_VALUE:
 	case CMP_NODE_VECBLUR:
-	case CMP_NODE_OUTPUT_FILE:
 	case CMP_NODE_DOUBLEEDGEMASK:
 	case CMP_NODE_DEFOCUS:
 	case CMP_NODE_CROP:

Modified: branches/tile/source/blender/compositor/intern/COM_NodeOperation.h
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_NodeOperation.h	2012-02-22 14:19:39 UTC (rev 44327)
+++ branches/tile/source/blender/compositor/intern/COM_NodeOperation.h	2012-02-22 14:34:17 UTC (rev 44328)
@@ -154,7 +154,7 @@
 	  * @param clKernelsToCleanUp all created cl_kernel references must be added to this list. Framework will clean this after execution
 	  */
 	virtual void executeOpenCL(cl_context context,cl_program program, cl_command_queue queue, MemoryBuffer* outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer** inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
-	void deinitExecution();
+	virtual void deinitExecution();
 	void deinitMutex();
 
 	/**

Added: branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.cpp	                        (rev 0)
+++ branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.cpp	2012-02-22 14:34:17 UTC (rev 44328)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Jeroen Bakker 
+ *		Monique Dewanchand
+ */
+
+#include "COM_OutputFileNode.h"
+#include "COM_OutputFileOperation.h"
+#include "COM_ExecutionSystem.h"
+
+OutputFileNode::OutputFileNode(bNode *editorNode): Node(editorNode) {
+}
+
+void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
+	InputSocket *imageSocket = this->getInputSocket(0);
+	InputSocket *zSocket = this->getInputSocket(1);
+	NodeImageFile* storage = (NodeImageFile*)this->getbNode()->storage;
+	if (imageSocket->isConnected()) {
+//		if (context->isRendering()) {
+			if (storage->sfra == storage->efra || (context->getFramenumber()<=storage->efra && context->getFramenumber()>=storage->sfra)) {
+				OutputFileOperation *outputFileOperation = new OutputFileOperation();
+				outputFileOperation->setScene(context->getScene());
+				outputFileOperation->setNodeImageFile(storage);
+				outputFileOperation->setbNodeTree(context->getbNodeTree());
+				imageSocket->relinkConnections(outputFileOperation->getInputSocket(0));
+				zSocket->relinkConnections(outputFileOperation->getInputSocket(1));
+				graph->addOperation(outputFileOperation);
+				addPreviewOperation(graph, outputFileOperation->getInputSocket(0), 5);
+//			}
+		} else {
+			addPreviewOperation(graph, imageSocket->getOperation()->getOutputSocket(), 5);
+		}
+	}
+}

Added: branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.h
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.h	                        (rev 0)
+++ branches/tile/source/blender/compositor/nodes/COM_OutputFileNode.h	2012-02-22 14:34:17 UTC (rev 44328)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Jeroen Bakker 
+ *		Monique Dewanchand
+ */
+
+#ifndef _COM_OutputFileNode_h
+#define _COM_OutputFileNode_h
+
+#include "COM_Node.h"
+#include "DNA_node_types.h"
+/**
+  * @brief OutputFileNode
+  * @ingroup Node
+  */
+class OutputFileNode : public Node {
+public:
+	OutputFileNode(bNode *editorNode);
+	void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
+};
+#endif

Modified: branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h	2012-02-22 14:19:39 UTC (rev 44327)
+++ branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h	2012-02-22 14:34:17 UTC (rev 44328)
@@ -39,7 +39,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 true;}
+	bool isOutputOperation(bool rendering) const {return rendering;}
     void initExecution();
     void deinitExecution();
 	const int getRenderPriority() const {return 7;}

Added: branches/tile/source/blender/compositor/operations/COM_OutputFileOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_OutputFileOperation.cpp	                        (rev 0)
+++ branches/tile/source/blender/compositor/operations/COM_OutputFileOperation.cpp	2012-02-22 14:34:17 UTC (rev 44328)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Jeroen Bakker 
+ *		Monique Dewanchand
+ */
+
+#include "COM_OutputFileOperation.h"
+#include "COM_SocketConnection.h"
+#include "BLI_listbase.h"
+#include "DNA_scene_types.h"
+#include "BKE_image.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+
+extern "C" {
+	#include "MEM_guardedalloc.h"
+	#include "IMB_imbuf.h"
+	#include "IMB_imbuf_types.h"
+}
+
+
+OutputFileOperation::OutputFileOperation() : NodeOperation() {
+	this->addInputSocket(COM_DT_COLOR);
+	this->addInputSocket(COM_DT_VALUE);
+
+	this->setScene(NULL);
+	this->outputBuffer = NULL;
+	this->zBuffer = NULL;
+	this->imageInput = NULL;
+	this->zInput = NULL;
+}
+
+void OutputFileOperation::initExecution() {
+	// When initializing the tree during initial load the width and height can be zero.
+	this->imageInput = getInputSocketReader(0);
+	this->zInput = getInputSocketReader(1);
+	if (this->getWidth() * this->getHeight() != 0) {
+		this->outputBuffer=(float*) MEM_callocN(this->getWidth()*this->getHeight()*4*sizeof(float), "OutputFileOperation");
+		this->zBuffer=(float*) MEM_callocN(this->getWidth()*this->getHeight()*sizeof(float), "OutputFileOperation");
+	}
+}
+
+void OutputFileOperation::deinitExecution() {
+	// TODO: create ImBuf
+	if (this->getWidth() * this->getHeight() != 0) {
+		
+		ImBuf *ibuf= IMB_allocImBuf(this->getWidth(), this->getHeight(), 32, 0);
+		Main *bmain= G.main; /* TODO, have this passed along */
+		char string[256];
+		
+		ibuf->rect_float= this->outputBuffer;
+		ibuf->dither= scene->r.dither_intensity;
+		
+		if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+			ibuf->profile = IB_PROFILE_LINEAR_RGB;
+		
+		if (zInput != NULL) {
+			this->imageFile->im_format.flag |= R_IMF_FLAG_ZBUF;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list