[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42310] branches/tile/source/blender/ compositor: optimized the interface of nodes and operations sockets

Jeroen Bakker j.bakker at atmind.nl
Thu Dec 1 11:27:36 CET 2011


Revision: 42310
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42310
Author:   jbakker
Date:     2011-12-01 10:27:35 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
optimized the interface of nodes and operations sockets

Modified Paths:
--------------
    branches/tile/source/blender/compositor/intern/COM_Node.cpp
    branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp
    branches/tile/source/blender/compositor/intern/COM_NodeBase.h
    branches/tile/source/blender/compositor/nodes/COM_BrightnessNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_FlipNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_IDMaskNode.cpp
    branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
    branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_BokehImageOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_BoxMaskOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_BrightnessOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ColorRampOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_CompositorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_DotproductOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_FlipOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_GammaOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_IDMaskOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ImageOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_InvertOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_LensGhostOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_LensGlowImageOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_LensGlowOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_MathBaseOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_MixBaseOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_OpenCLTestOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_PreviewOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_RotateOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ScaleOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_SetColorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_SetValueOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_SetVectorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_SocketProxyOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_TextureOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_TonemapOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_TranslateOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ViewerOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_WriteBufferOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ZCombineOperation.cpp

Modified: branches/tile/source/blender/compositor/intern/COM_Node.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_Node.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/intern/COM_Node.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -23,9 +23,7 @@
         if (input->type == SOCK_RGBA) dt = COM_DT_COLOR;
         if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
 
-		InputSocket * inputsocket = new InputSocket(dt, (InputSocketResizeMode)input->resizemode);
-        inputsocket->setEditorSocket(input);
-        this->addInputSocket(*inputsocket);
+		this->addInputSocket(dt, (InputSocketResizeMode)input->resizemode, input);
         input = (bNodeSocket*)input->next;
     }
     bNodeSocket *output = (bNodeSocket*)editorNode->outputs.first;
@@ -34,9 +32,7 @@
         if (output->type == SOCK_RGBA) dt = COM_DT_COLOR;
         if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
 
-        OutputSocket * outputsocket = new OutputSocket(dt);
-        outputsocket->setEditorSocket(output);
-        this->addOutputSocket(*outputsocket);
+        this->addOutputSocket(dt, output);
         output = (bNodeSocket*)output->next;
     }
 }

Modified: branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -16,14 +16,30 @@
     this->inputsockets.clear();
 }
 
-void NodeBase::addInputSocket(InputSocket &socket) {
-    socket.setNode(this);
-    this->inputsockets.push_back(socket);
+void NodeBase::addInputSocket(DataType datatype) {
+	this->addInputSocket(datatype, COM_SC_CENTER, NULL);
 }
-void NodeBase::addOutputSocket(OutputSocket &socket) {
-    socket.setNode(this);
-    this->outputsockets.push_back(socket);
+
+void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode) {
+	this->addInputSocket(datatype, resizeMode, NULL);
 }
+void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket* bSocket) {
+	InputSocket *socket = new InputSocket(datatype, resizeMode);
+	socket->setEditorSocket(bSocket);
+    socket->setNode(this);
+    this->inputsockets.push_back(*socket);
+}
+
+void NodeBase::addOutputSocket(DataType datatype) {
+	this->addOutputSocket(datatype, NULL);
+	
+}
+void NodeBase::addOutputSocket(DataType datatype, bNodeSocket* bSocket) {
+	OutputSocket *socket = new OutputSocket(datatype);
+	socket->setEditorSocket(bSocket);
+    socket->setNode(this);
+    this->outputsockets.push_back(*socket);
+}
 const bool NodeBase::isInputNode() const {
     return this->inputsockets.size() == 0;
 }

Modified: branches/tile/source/blender/compositor/intern/COM_NodeBase.h
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_NodeBase.h	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/intern/COM_NodeBase.h	2011-12-01 10:27:35 UTC (rev 42310)
@@ -36,7 +36,7 @@
 	/**
 	  * @brief get access to the vector of input sockets
 	  */
-        inline vector<InputSocket>& getInputSockets() {return this->inputsockets;}
+    inline vector<InputSocket>& getInputSockets() {return this->inputsockets;}
 
 	/**
 	  * @brief get access to the vector of input sockets
@@ -136,14 +136,17 @@
 	  * @note may only be called in an constructor
 	  * @param socket the InputSocket to add
 	  */
-    void addInputSocket(InputSocket &socket);
+	void addInputSocket(DataType datatype);
+	void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode);
+	void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket* socket);
 
 	/**
 	  * @brief add an OutputSocket to the collection of outputsockets
 	  * @note may only be called in an constructor
 	  * @param socket the OutputSocket to add
 	  */
-	void addOutputSocket(OutputSocket &socket);
+	void addOutputSocket(DataType datatype);
+	void addOutputSocket(DataType datatype, bNodeSocket* socket);
 };
 
 #endif

Modified: branches/tile/source/blender/compositor/nodes/COM_BrightnessNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_BrightnessNode.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/nodes/COM_BrightnessNode.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -4,11 +4,11 @@
 #include "COM_ExecutionSystem.h"
 
 BrightnessNode::BrightnessNode(bNode *editorNode): Node(editorNode) {
-//    this->addInputSocket(*(new InputSocket(COM_DT_COLOR)));
-//    this->addInputSocket(*(new InputSocket("Bright", COM_DT_VALUE)));
-//    this->addInputSocket(*(new InputSocket("Contrast", COM_DT_VALUE)));
+//    this->addInputSocket(COM_DT_COLOR);
+//    this->addInputSocket("Bright", COM_DT_VALUE);
+//    this->addInputSocket("Contrast", COM_DT_VALUE);
 
-//    this->addOutputSocket(*(new OutputSocket(COM_DT_COLOR)));
+//    this->addOutputSocket(COM_DT_COLOR);
 
 }
 /// @todo: add anti alias when not FSA

Modified: branches/tile/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -7,9 +7,9 @@
 
 ColorBalanceNode::ColorBalanceNode(bNode* editorNode): Node(editorNode)
 {
-//    this->addInputSocket(*(new InputSocket(COM_DT_VALUE)));
-//    this->addInputSocket(*(new InputSocket(COM_DT_COLOR)));
-//    this->addOutputSocket(*(new OutputSocket(COM_DT_COLOR)));
+//    this->addInputSocket(COM_DT_VALUE);
+//    this->addInputSocket(COM_DT_COLOR);
+//    this->addOutputSocket(COM_DT_COLOR);
 
 }
 void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {

Modified: branches/tile/source/blender/compositor/nodes/COM_ColorToBWNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_ColorToBWNode.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/nodes/COM_ColorToBWNode.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -4,8 +4,8 @@
 #include "COM_ExecutionSystem.h"
 
 ColourToBWNode::ColourToBWNode(bNode *editorNode): Node(editorNode) {
-//    this->addInputSocket(*(new InputSocket(COM_DT_COLOR)));
-//    this->addOutputSocket(*(new OutputSocket(COM_DT_VALUE)));
+//    this->addInputSocket(COM_DT_COLOR);
+//    this->addOutputSocket(COM_DT_VALUE);
 }
 
 void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {

Modified: branches/tile/source/blender/compositor/nodes/COM_FlipNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_FlipNode.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/nodes/COM_FlipNode.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -4,8 +4,8 @@
 #include "COM_ExecutionSystem.h"
 
 FlipNode::FlipNode(bNode *editorNode) : Node(editorNode) {
-//    this->addInputSocket(*(new InputSocket(COM_DT_COLOR)));
-//    this->addOutputSocket(*(new OutputSocket(COM_DT_COLOR)));
+//    this->addInputSocket(COM_DT_COLOR);
+//    this->addOutputSocket(COM_DT_COLOR);
 }
 
 void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {

Modified: branches/tile/source/blender/compositor/nodes/COM_IDMaskNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_IDMaskNode.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/nodes/COM_IDMaskNode.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -4,9 +4,9 @@
 #include "COM_ExecutionSystem.h"
 
 IDMaskNode::IDMaskNode(bNode *editorNode): Node(editorNode) {
-//    this->addInputSocket(*(new InputSocket("ID value", COM_DT_VALUE)));
+//    this->addInputSocket("ID value", COM_DT_VALUE);
 
-//    this->addOutputSocket(*(new OutputSocket(COM_DT_VALUE)));
+//    this->addOutputSocket(COM_DT_VALUE);
 
 }
 /// @todo: add anti alias when not FSA

Modified: branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/nodes/COM_SocketProxyNode.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -6,8 +6,8 @@
 
 SocketProxyNode::SocketProxyNode(bNode *editorNode): Node(editorNode) {
 	this->clearInputAndOutputSockets();
-	this->addInputSocket(*(new InputSocket(COM_DT_COLOR)));
-	this->addOutputSocket(*(new OutputSocket(COM_DT_COLOR)));
+	this->addInputSocket(COM_DT_COLOR);
+	this->addOutputSocket(COM_DT_COLOR);
 }
 
 void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {

Modified: branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/operations/COM_BlurBaseOperation.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -8,8 +8,8 @@
 }
 
 BlurBaseOperation::BlurBaseOperation(): NodeOperation() {
-	this->addInputSocket(*(new InputSocket(COM_DT_COLOR)));
-	this->addOutputSocket(*(new OutputSocket(COM_DT_COLOR)));
+	this->addInputSocket(COM_DT_COLOR);
+	this->addOutputSocket(COM_DT_COLOR);
 	this->setComplex(true);
 	this->inputProgram = NULL;
 	this->data = NULL;

Modified: branches/tile/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_BokehBlurOperation.cpp	2011-12-01 10:25:16 UTC (rev 42309)
+++ branches/tile/source/blender/compositor/operations/COM_BokehBlurOperation.cpp	2011-12-01 10:27:35 UTC (rev 42310)
@@ -8,10 +8,10 @@
 }
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list