[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44150] branches/tile/source/blender/ compositor: Tile Branch:

Jeroen Bakker j.bakker at atmind.nl
Thu Feb 16 14:23:44 CET 2012


Revision: 44150
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44150
Author:   jbakker
Date:     2012-02-16 13:23:36 +0000 (Thu, 16 Feb 2012)
Log Message:
-----------
Tile Branch:
 * converted the MovieClip node to tiles.
 * added color profile conversion operation

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

Added Paths:
-----------
    branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.h
    branches/tile/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h
    branches/tile/source/blender/compositor/operations/COM_MovieClipOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_MovieClipOperation.h

Modified: branches/tile/source/blender/compositor/CMakeLists.txt
===================================================================
--- branches/tile/source/blender/compositor/CMakeLists.txt	2012-02-16 13:15:01 UTC (rev 44149)
+++ branches/tile/source/blender/compositor/CMakeLists.txt	2012-02-16 13:23:36 UTC (rev 44150)
@@ -131,6 +131,8 @@
 	nodes/COM_TimeNode.h
 	nodes/COM_SwitchNode.cpp
 	nodes/COM_SwitchNode.h
+	nodes/COM_MovieClipNode.cpp
+	nodes/COM_MovieClipNode.h
 
 # output nodes
 		nodes/COM_CompositorNode.cpp
@@ -544,6 +546,12 @@
 	nodes/COM_OpenCLTestNode.h
 	operations/COM_OpenCLTestOperation.cpp
 	operations/COM_OpenCLTestOperation.h
+
+	operations/COM_MovieClipOperation.cpp
+	operations/COM_MovieClipOperation.h
+	operations/COM_ConvertColorProfileOperation.cpp
+	operations/COM_ConvertColorProfileOperation.h
+
 #     operations/COM_OpenCLKernels.cl.cpp
 )
 

Modified: branches/tile/source/blender/compositor/intern/COM_CompositorContext.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_CompositorContext.cpp	2012-02-16 13:15:01 UTC (rev 44149)
+++ branches/tile/source/blender/compositor/intern/COM_CompositorContext.cpp	2012-02-16 13:23:36 UTC (rev 44150)
@@ -37,3 +37,11 @@
 		return -1; /* this should never happen */
 	}
 }
+
+const int CompositorContext::isColorManaged() const {
+	if (this->scene) {
+		return this->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
+	} else {
+		return 0; /* this should never happen */
+	}
+}

Modified: branches/tile/source/blender/compositor/intern/COM_CompositorContext.h
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_CompositorContext.h	2012-02-16 13:15:01 UTC (rev 44149)
+++ branches/tile/source/blender/compositor/intern/COM_CompositorContext.h	2012-02-16 13:23:36 UTC (rev 44150)
@@ -139,6 +139,8 @@
 	}
 	
 	int getChunksize() {return this->getbNodeTree()->chunksize;}
+	
+	const int isColorManaged() const;
 };
 
 

Modified: branches/tile/source/blender/compositor/intern/COM_Converter.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_Converter.cpp	2012-02-16 13:15:01 UTC (rev 44149)
+++ branches/tile/source/blender/compositor/intern/COM_Converter.cpp	2012-02-16 13:23:36 UTC (rev 44150)
@@ -101,6 +101,7 @@
 #include "COM_SwitchNode.h"
 #include "COM_OpenCLTestNode.h"
 #include "COM_GlareNode.h"
+#include "COM_MovieClipNode.h"
 
 Node* Converter::convert(bNode *bNode) {
 	Node * node;
@@ -304,6 +305,9 @@
 	case CMP_NODE_GLARE:
 		node = new GlareNode(bNode);
 		break;
+	case CMP_NODE_MOVIECLIP:
+		node = new MovieClipNode(bNode);
+		break;
 	/* not inplemented yet */
 	case CMP_NODE_MAP_VALUE:
 	case CMP_NODE_VECBLUR:
@@ -315,7 +319,6 @@
 	case CMP_NODE_BILATERALBLUR:
 	case CMP_NODE_PREMULKEY:
 	case CMP_NODE_VIEW_LEVELS:
-	case CMP_NODE_MOVIECLIP:
 	case CMP_NODE_TRANSFORM:
 	case CMP_NODE_STABILIZE2D:
 	case CMP_NODE_MOVIEDISTORTION:

Added: branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.cpp	                        (rev 0)
+++ branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.cpp	2012-02-16 13:23:36 UTC (rev 44150)
@@ -0,0 +1,118 @@
+/*
+ * 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_MovieClipNode.h"
+#include "COM_ExecutionSystem.h"
+#include "COM_MovieClipOperation.h"
+#include "COM_SetValueOperation.h"
+#include "COM_ConvertColorProfileOperation.h"
+
+extern "C" {
+	#include "DNA_movieclip_types.h"
+	#include "BKE_movieclip.h"
+	#include "BKE_tracking.h"
+}
+
+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);
+	
+    bNode *editorNode = this->getbNode();
+    MovieClip *movieClip = (MovieClip*)editorNode->id;
+    MovieClipUser *movieClipUser = (MovieClipUser*)editorNode->storage;
+	
+	ImBuf * ibuf= NULL;
+	if (movieClip) {
+		ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser);
+	}
+	
+	// always connect the output image
+	MovieClipOperation *operation = new MovieClipOperation();
+	
+	if (ibuf && context->isColorManaged() && ibuf->profile == IB_PROFILE_NONE) {
+		ConvertColorProfileOperation *converter = new ConvertColorProfileOperation();
+		converter->setFromColorProfile(IB_PROFILE_LINEAR_RGB);
+		converter->setToColorProfile(IB_PROFILE_SRGB);
+		addLink(graph, operation->getOutputSocket(), converter->getInputSocket(0));
+		addPreviewOperation(graph, converter->getOutputSocket(), 9);
+		if (outputMovieClip->isConnected()) {
+			outputMovieClip->relinkConnections(converter->getOutputSocket());
+		}
+		graph->addOperation(converter);
+		if (ibuf) {
+			converter->setPredivided(ibuf->flags & IB_cm_predivide);
+		}
+	} else {
+		addPreviewOperation(graph, operation->getOutputSocket(), 9);
+		if (outputMovieClip->isConnected()) {
+			outputMovieClip->relinkConnections(operation->getOutputSocket());
+		}
+	}
+	operation->setMovieClip(movieClip);
+	operation->setMovieClipUser(movieClipUser);
+	operation->setFramenumber(context->getFramenumber());
+	graph->addOperation(operation);
+
+	MovieTrackingStabilization *stab= &movieClip->tracking.stabilization;
+	float loc[2], scale, angle;
+	loc[0] = 0.0f;
+	loc[1] = 0.0f;
+	scale = 1.0f;
+	angle = 0.0f;
+
+	if (ibuf) {
+		if(stab->flag&TRACKING_2D_STABILIZATION) {
+			BKE_tracking_stabilization_data(&movieClip->tracking, context->getFramenumber(), ibuf->x, ibuf->y, loc, &scale, &angle);
+		}
+	}
+	
+	if (offsetXMovieClip->isConnected()) {
+		SetValueOperation * operationSetValue = new SetValueOperation();
+		operationSetValue->setValue(loc[0]);
+		offsetXMovieClip->relinkConnections(operation->getOutputSocket());
+		graph->addOperation(operationSetValue);
+	}
+	if (offsetYMovieClip->isConnected()) {
+		SetValueOperation * operationSetValue = new SetValueOperation();
+		operationSetValue->setValue(loc[1]);
+		offsetYMovieClip->relinkConnections(operation->getOutputSocket());
+		graph->addOperation(operationSetValue);
+	}
+	if (scaleMovieClip->isConnected()) {
+		SetValueOperation * operationSetValue = new SetValueOperation();
+		operationSetValue->setValue(scale);
+		scaleMovieClip->relinkConnections(operation->getOutputSocket());
+		graph->addOperation(operationSetValue);
+	}
+	if (angleMovieClip->isConnected()) {
+		SetValueOperation * operationSetValue = new SetValueOperation();
+		operationSetValue->setValue(angle);
+		angleMovieClip->relinkConnections(operation->getOutputSocket());
+		graph->addOperation(operationSetValue);
+	}
+}

Added: branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.h
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.h	                        (rev 0)
+++ branches/tile/source/blender/compositor/nodes/COM_MovieClipNode.h	2012-02-16 13:23:36 UTC (rev 44150)
@@ -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
+ */
+
+#include "COM_Node.h"
+#include "DNA_node_types.h"
+
+/**
+  * @brief MovieClipNode
+  * @ingroup Node
+  */
+class MovieClipNode : public Node {
+
+
+public:
+    MovieClipNode(bNode* editorNode);
+	void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
+
+};

Added: branches/tile/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp	                        (rev 0)
+++ branches/tile/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp	2012-02-16 13:23:36 UTC (rev 44150)
@@ -0,0 +1,47 @@
+/*
+ * 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

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list