[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51586] trunk/blender/source/blender/ compositor: Oeps... Enabled the pixelate node added documentation, removed unneeded

Jeroen Bakker j.bakker at atmind.nl
Wed Oct 24 15:43:33 CEST 2012


Revision: 51586
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51586
Author:   jbakker
Date:     2012-10-24 13:43:32 +0000 (Wed, 24 Oct 2012)
Log Message:
-----------
Oeps... Enabled the pixelate node added documentation, removed unneeded
code

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/intern/COM_Converter.cpp
    trunk/blender/source/blender/compositor/intern/COM_InputSocket.h
    trunk/blender/source/blender/compositor/nodes/COM_PixelateNode.cpp
    trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.h

Modified: trunk/blender/source/blender/compositor/intern/COM_Converter.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_Converter.cpp	2012-10-24 13:24:34 UTC (rev 51585)
+++ trunk/blender/source/blender/compositor/intern/COM_Converter.cpp	2012-10-24 13:43:32 UTC (rev 51586)
@@ -119,6 +119,7 @@
 #include "COM_ViewLevelsNode.h"
 #include "COM_ViewerNode.h"
 #include "COM_ZCombineNode.h"
+#include "COM_PixelateNode.h"
 
 Node *Converter::convert(bNode *b_node, bool fast)
 {
@@ -390,6 +391,9 @@
 			node = new TrackPositionNode(b_node);
 			break;
 		/* not inplemented yet */
+		case CMP_NODE_PIXELATE:
+			node = new PixelateNode(b_node);
+			break;
 		default:
 			node = new MuteNode(b_node);
 			break;

Modified: trunk/blender/source/blender/compositor/intern/COM_InputSocket.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_InputSocket.h	2012-10-24 13:24:34 UTC (rev 51585)
+++ trunk/blender/source/blender/compositor/intern/COM_InputSocket.h	2012-10-24 13:43:32 UTC (rev 51586)
@@ -92,12 +92,6 @@
 	void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
 	
 	/**
-	 * @brief Notifies the Input of the data type (via a SocketConnection)
-	 * @param datatype the datatype to evaluate
-	 */
-	void notifyActualInputType(DataType datatype);
-	
-	/**
 	 * @brief move all connections of this input socket to another socket
 	 * only use this method when already checked the availability of a SocketConnection
 	 * @param relinkToSocket the socket to move to connections to

Modified: trunk/blender/source/blender/compositor/nodes/COM_PixelateNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_PixelateNode.cpp	2012-10-24 13:24:34 UTC (rev 51585)
+++ trunk/blender/source/blender/compositor/nodes/COM_PixelateNode.cpp	2012-10-24 13:43:32 UTC (rev 51586)
@@ -34,8 +34,14 @@
 {
 	InputSocket *inputSocket = this->getInputSocket(0);
 	OutputSocket *outputSocket = this->getOutputSocket(0);
+	DataType datatype = inputSocket->getDataType();
+	if (inputSocket->isConnected()) {
+		SocketConnection * connection = inputSocket->getConnection();
+		OutputSocket* otherOutputSocket = connection->getFromSocket();
+		datatype = otherOutputSocket->getDataType();
+	}
 
-	PixelateOperation *operation = new PixelateOperation(inputSocket->getDataType());
+	PixelateOperation *operation = new PixelateOperation(datatype);
 	inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
 	outputSocket->relinkConnections(operation->getOutputSocket(0));
 	graph->addOperation(operation);

Modified: trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.cpp	2012-10-24 13:24:34 UTC (rev 51585)
+++ trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.cpp	2012-10-24 13:43:32 UTC (rev 51586)
@@ -24,26 +24,26 @@
 
 PixelateOperation::PixelateOperation(DataType datatype) : NodeOperation()
 {
-    this->addInputSocket(datatype);
-    this->addOutputSocket(datatype);
-    this->setResolutionInputSocketIndex(0);
-    this->m_inputOperation = NULL;
+	this->addInputSocket(datatype);
+	this->addOutputSocket(datatype);
+	this->setResolutionInputSocketIndex(0);
+	this->m_inputOperation = NULL;
 }
+
 void PixelateOperation::initExecution()
 {
-    this->m_inputOperation = this->getInputSocketReader(0);
+	this->m_inputOperation = this->getInputSocketReader(0);
 }
 
 void PixelateOperation::deinitExecution()
 {
-    this->m_inputOperation = NULL;
+	this->m_inputOperation = NULL;
 }
 
-
 void PixelateOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
 {
-    float nx = round(x);
-    float ny = round(y);
-    this->m_inputOperation->read(output, nx, ny, sampler);
+	float nx = round(x);
+	float ny = round(y);
+	this->m_inputOperation->read(output, nx, ny, sampler);
 }
 

Modified: trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.h	2012-10-24 13:24:34 UTC (rev 51585)
+++ trunk/blender/source/blender/compositor/operations/COM_PixelateOperation.h	2012-10-24 13:43:32 UTC (rev 51586)
@@ -25,13 +25,43 @@
 
 #include "COM_NodeOperation.h"
 
+/**
+ * @brief Pixelate operation
+ *
+ * The Tile compositor is by default sub-pixel accurate.
+ * For some setups you don want this.
+ * This operation will remove the sub-pixel accuracy
+ */
 class PixelateOperation : public NodeOperation {
 private:
+	/**
+	 * @brief cached refeerence to the input operation
+	 */
 	SocketReader *m_inputOperation;
 public:
+	/**
+	 * @brief PixelateOperation
+	 * @param dataType the datatype to create this operator for (saves datatype conversions)
+	 */
 	PixelateOperation(DataType dataType);
+
+	/**
+	 * @brief initialization of the execution
+	 */
 	void initExecution();
+
+	/**
+	 * @brief de-initialization of the execution
+	 */
 	void deinitExecution();
+
+	/**
+	 * @brief executePixel
+	 * @param output result
+	 * @param x x-coordinate
+	 * @param y y-coordinate
+	 * @param sampler sampler
+	 */
 	void executePixel(float output[4], float x, float y, PixelSampler sampler);
 };
 




More information about the Bf-blender-cvs mailing list