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

Jeroen Bakker j.bakker at atmind.nl
Wed Apr 11 20:37:46 CEST 2012


Revision: 45546
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45546
Author:   jbakker
Date:     2012-04-11 18:37:46 +0000 (Wed, 11 Apr 2012)
Log Message:
-----------
TileBranch
 * added initial version of the MovieDistortion/MovieDistortion node.

 - At Mind - 

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

Added Paths:
-----------
    branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.h
    branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.h
    branches/tile/source/blender/compositor/operations/COM_MovieUndistortionOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_MovieUndistortionOperation.h

Modified: branches/tile/source/blender/compositor/CMakeLists.txt
===================================================================
--- branches/tile/source/blender/compositor/CMakeLists.txt	2012-04-11 15:59:50 UTC (rev 45545)
+++ branches/tile/source/blender/compositor/CMakeLists.txt	2012-04-11 18:37:46 UTC (rev 45546)
@@ -187,6 +187,8 @@
 	nodes/COM_TransformNode.h
 	nodes/COM_Stabilize2dNode.cpp
 	nodes/COM_Stabilize2dNode.h
+	nodes/COM_MovieDistortionNode.cpp
+	nodes/COM_MovieDistortionNode.h
 
 # color nodes
 		nodes/COM_VectorCurveNode.cpp
@@ -302,6 +304,11 @@
 	operations/COM_DirectionalBlurOperation.h
 	operations/COM_MovieClipAttributeOperation.cpp
 	operations/COM_MovieClipAttributeOperation.h
+	operations/COM_MovieDistortionOperation.cpp
+	operations/COM_MovieDistortionOperation.h
+	operations/COM_MovieUndistortionOperation.cpp
+	operations/COM_MovieUndistortionOperation.h
+
 # Matte nodes
 nodes/COM_BoxMaskNode.cpp
 nodes/COM_BoxMaskNode.h

Modified: branches/tile/source/blender/compositor/intern/COM_Converter.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_Converter.cpp	2012-04-11 15:59:50 UTC (rev 45545)
+++ branches/tile/source/blender/compositor/intern/COM_Converter.cpp	2012-04-11 18:37:46 UTC (rev 45546)
@@ -110,6 +110,7 @@
 #include "COM_SamplerNode.h"
 #include "COM_BilateralBlurNode.h"
 #include "COM_VectorBlurNode.h"
+#include "COM_MovieDistortionNode.h"
 
 Node* Converter::convert(bNode *bNode) {
 	Node * node;
@@ -340,13 +341,15 @@
 	case CMP_NODE_VECBLUR:
 		node = new VectorBlurNode(bNode);
 		break;
+	case CMP_NODE_MOVIEDISTORTION:
+		node = new MovieDistortionNode(bNode);
+		break;
 	/* not inplemented yet */
 	case CMP_NODE_DOUBLEEDGEMASK:
 	case CMP_NODE_DEFOCUS:
 	case CMP_NODE_CROP:
 	case CMP_NODE_PREMULKEY:
 	case CMP_NODE_VIEW_LEVELS:
-	case CMP_NODE_MOVIEDISTORTION:
 	default:
 		node = new MuteNode(bNode);
 		break;
@@ -378,8 +381,6 @@
 		inputSocket->relinkConnections(converter->getInputSocket(0));
 		ExecutionSystemHelper::addLink(system->getConnections(), converter->getOutputSocket(), inputSocket);
 		system->addOperation(converter);
-//		converter->getInputSocket(0)->setActualDataType(fromDatatype);
-//		converter->getOutputSocket(1)->setActualDataType(toDatatype);
 	}
 }
 

Added: branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp	                        (rev 0)
+++ branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp	2012-04-11 18:37:46 UTC (rev 45546)
@@ -0,0 +1,51 @@
+/*
+ * 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_MovieDistortionNode.h"
+
+#include "COM_MovieDistortionOperation.h"
+#include "COM_MovieUndistortionOperation.h"
+#include "COM_ExecutionSystem.h"
+#include "DNA_movieclip_types.h"
+
+MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode) {
+}
+
+void MovieDistortionNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
+    InputSocket *inputSocket = this->getInputSocket(0);
+    OutputSocket *outputSocket = this->getOutputSocket(0);
+	bNode* bnode = this->getbNode();
+	MovieClip * clip = (MovieClip*)bnode->id;
+	
+	MovieDistortionOperation * operation;
+	if (bnode->custom1 == 0) {
+		operation = new MovieUndistortionOperation();
+		
+	} else {
+		operation = new MovieDistortionOperation();
+	}
+	operation->setMovieClip(clip);
+
+	inputSocket->relinkConnections(operation->getInputSocket(0), true, 0, system);
+	outputSocket->relinkConnections(operation->getOutputSocket(0));
+	system->addOperation(operation);
+}

Added: branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.h
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.h	                        (rev 0)
+++ branches/tile/source/blender/compositor/nodes/COM_MovieDistortionNode.h	2012-04-11 18:37:46 UTC (rev 45546)
@@ -0,0 +1,38 @@
+/*
+ * 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_MovieDistortionNode_h_
+#define _COM_MovieDistortionNode_h_
+
+#include "COM_Node.h"
+
+/**
+  * @brief MovieDistortionNode
+  * @ingroup Node
+  */
+class MovieDistortionNode: public Node {
+public:
+    MovieDistortionNode(bNode *editorNode);
+    void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
+};
+
+#endif

Added: branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp	                        (rev 0)
+++ branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp	2012-04-11 18:37:46 UTC (rev 45546)
@@ -0,0 +1,73 @@
+/*
+ * 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_MovieDistortionOperation.h"
+
+extern "C" {
+	#include "BKE_tracking.h"
+}
+
+MovieDistortionOperation::MovieDistortionOperation() : NodeOperation() {
+    this->addInputSocket(COM_DT_COLOR);
+    this->addOutputSocket(COM_DT_COLOR);
+    this->setResolutionInputSocketIndex(0);
+    this->inputOperation = NULL;
+	this->movieClip = NULL;
+}
+void MovieDistortionOperation::initExecution() {
+	this->inputOperation = this->getInputSocketReader(0);
+}
+
+void MovieDistortionOperation::deinitExecution() {
+	this->inputOperation = NULL;
+	this->movieClip = NULL;
+}
+
+
+void MovieDistortionOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+	
+	if (this->movieClip != NULL) {
+		float in[2];
+		float out[2];
+		
+		in[0] = x;
+		in[1] = y;
+		
+		BKE_tracking_invert_intrinsics(&this->movieClip->tracking, in, out);
+		this->inputOperation->read(color, out[0], out[1], sampler, inputBuffers);
+	} 
+	else {
+		this->inputOperation->read(color, x, y, sampler, inputBuffers);
+		
+	}
+}
+
+bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) {
+	rcti newInput;
+	
+	newInput.xmax = input->xmax + 100;
+	newInput.xmin = input->xmin - 100;
+	newInput.ymax = input->ymax + 100;
+	newInput.ymin = input->ymin - 100;
+	
+	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+}

Added: branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.h
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.h	                        (rev 0)
+++ branches/tile/source/blender/compositor/operations/COM_MovieDistortionOperation.h	2012-04-11 18:37:46 UTC (rev 45546)
@@ -0,0 +1,45 @@
+/*
+ * 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_MovieDistortionOperation_h_
+#define _COM_MovieDistortionOperation_h_
+
+#include "COM_NodeOperation.h"
+#include "DNA_movieclip_types.h"
+
+class MovieDistortionOperation: public NodeOperation {
+protected:
+	SocketReader *inputOperation;
+	MovieClip * movieClip;
+public:
+	MovieDistortionOperation();

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list