[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47184] branches/soc-2011-tomato/source/ blender: Fixed stupid typo: dispill vs.

Sergey Sharybin sergey.vfx at gmail.com
Tue May 29 16:55:02 CEST 2012


Revision: 47184
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47184
Author:   nazgul
Date:     2012-05-29 14:55:01 +0000 (Tue, 29 May 2012)
Log Message:
-----------
Fixed stupid typo: dispill vs. despill

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt
    branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.cpp
    branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.h
    branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_node_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c
    branches/soc-2011-tomato/source/blender/nodes/composite/nodes/node_composite_keying.c

Added Paths:
-----------
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.h

Removed Paths:
-------------
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDispillOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDispillOperation.h

Modified: branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt	2012-05-29 14:54:40 UTC (rev 47183)
+++ branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt	2012-05-29 14:55:01 UTC (rev 47184)
@@ -340,8 +340,8 @@
 	operations/COM_KeyingOperation.h
 	operations/COM_KeyingScreenOperation.cpp
 	operations/COM_KeyingScreenOperation.h
-	operations/COM_KeyingDispillOperation.cpp
-	operations/COM_KeyingDispillOperation.h
+	operations/COM_KeyingDespillOperation.cpp
+	operations/COM_KeyingDespillOperation.h
 
 operations/COM_ColorSpillOperation.cpp
 operations/COM_ColorSpillOperation.h

Modified: branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.cpp	2012-05-29 14:54:40 UTC (rev 47183)
+++ branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.cpp	2012-05-29 14:55:01 UTC (rev 47184)
@@ -26,7 +26,7 @@
 #include "COM_ExecutionSystem.h"
 
 #include "COM_KeyingOperation.h"
-#include "COM_KeyingDispillOperation.h"
+#include "COM_KeyingDespillOperation.h"
 
 #include "COM_SeparateChannelOperation.h"
 #include "COM_CombineChannelsOperation.h"
@@ -135,18 +135,18 @@
 	return dilateErodeOperation->getOutputSocket(0);
 }
 
-OutputSocket *KeyingNode::setupDispill(ExecutionSystem *graph, OutputSocket *dispillInput, InputSocket *inputScreen, float factor)
+OutputSocket *KeyingNode::setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, InputSocket *inputScreen, float factor)
 {
-	KeyingDispillOperation *dispillOperation = new KeyingDispillOperation();
+	KeyingDespillOperation *despillOperation = new KeyingDespillOperation();
 
-	dispillOperation->setDispillFactor(factor);
+	despillOperation->setDespillFactor(factor);
 
-	addLink(graph, dispillInput, dispillOperation->getInputSocket(0));
-	inputScreen->relinkConnections(dispillOperation->getInputSocket(1), 1, graph);
+	addLink(graph, despillInput, despillOperation->getInputSocket(0));
+	inputScreen->relinkConnections(despillOperation->getInputSocket(1), 1, graph);
 
-	graph->addOperation(dispillOperation);
+	graph->addOperation(despillOperation);
 
-	return dispillOperation->getOutputSocket(0);
+	return despillOperation->getOutputSocket(0);
 }
 
 void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
@@ -198,9 +198,9 @@
 
 	postprocessedImage = alphaOperation->getOutputSocket();
 
-	/* dispill output image */
-	if (keying_data->dispill_factor > 0.0f) {
-		postprocessedImage = setupDispill(graph, postprocessedImage, inputScreen, keying_data->dispill_factor);
+	/* despill output image */
+	if (keying_data->despill_factor > 0.0f) {
+		postprocessedImage = setupDespill(graph, postprocessedImage, inputScreen, keying_data->despill_factor);
 	}
 
 	/* connect result to output sockets */

Modified: branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.h
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.h	2012-05-29 14:54:40 UTC (rev 47183)
+++ branches/soc-2011-tomato/source/blender/compositor/nodes/COM_KeyingNode.h	2012-05-29 14:55:01 UTC (rev 47184)
@@ -36,7 +36,7 @@
 	OutputSocket *setupPreBlur(ExecutionSystem *graph, InputSocket *inputImage, int size, OutputSocket **originalImage);
 	OutputSocket *setupPostBlur(ExecutionSystem *graph, OutputSocket *postBLurInput, int size);
 	OutputSocket *setupDilateErode(ExecutionSystem *graph, OutputSocket *dilateErodeInput, int distance);
-	OutputSocket *setupDispill(ExecutionSystem *graph, OutputSocket *dispillInput, InputSocket *inputSrceen, float factor);
+	OutputSocket *setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, InputSocket *inputSrceen, float factor);
 public:
 	KeyingNode(bNode *editorNode);
 	void convertToOperations(ExecutionSystem *graph, CompositorContext *context);

Copied: branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp (from rev 47179, branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDispillOperation.cpp)
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp	                        (rev 0)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp	2012-05-29 14:55:01 UTC (rev 47184)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2012, 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
+ *		Sergey Sharybin
+ */
+
+#include "COM_KeyingDespillOperation.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+
+static int get_pixel_primary_channel(float *pixel)
+{
+	float max_value = MAX3(pixel[0], pixel[1], pixel[2]);
+
+	if (max_value == pixel[0])
+		return 0;
+	else if (max_value == pixel[1])
+		return 1;
+
+	return 2;
+}
+
+KeyingDespillOperation::KeyingDespillOperation(): NodeOperation()
+{
+	this->addInputSocket(COM_DT_COLOR);
+	this->addInputSocket(COM_DT_COLOR);
+	this->addOutputSocket(COM_DT_COLOR);
+
+	this->despillFactor = 0.5f;
+
+	this->pixelReader = NULL;
+	this->screenReader = NULL;
+}
+
+void KeyingDespillOperation::initExecution()
+{
+	this->pixelReader = this->getInputSocketReader(0);
+	this->screenReader = this->getInputSocketReader(1);
+}
+
+void KeyingDespillOperation::deinitExecution()
+{
+	this->pixelReader = NULL;
+	this->screenReader = NULL;
+}
+
+void KeyingDespillOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
+	float pixelColor[4];
+	float screenColor[4];
+
+	this->pixelReader->read(pixelColor, x, y, sampler, inputBuffers);
+	this->screenReader->read(screenColor, x, y, sampler, inputBuffers);
+
+	int screen_primary_channel = get_pixel_primary_channel(screenColor);
+	float average_value, amount;
+
+	average_value = (pixelColor[0] + pixelColor[1] + pixelColor[2] - pixelColor[screen_primary_channel]) / 2.0f;
+	amount = pixelColor[screen_primary_channel] - average_value;
+
+	color[0] = pixelColor[0];
+	color[1] = pixelColor[1];
+	color[2] = pixelColor[2];
+	color[3] = pixelColor[3];
+	
+	if (this->despillFactor * amount > 0) {
+		color[screen_primary_channel] = pixelColor[screen_primary_channel] - this->despillFactor * amount;
+	}
+}

Copied: branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.h (from rev 47179, branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDispillOperation.h)
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.h	                        (rev 0)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDespillOperation.h	2012-05-29 14:55:01 UTC (rev 47184)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2012, 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
+ *		Sergey Sharybin
+ */
+
+#ifndef _COM_KeyingDespillOperation_h
+#define _COM_KeyingDespillOperation_h
+
+#include "COM_NodeOperation.h"
+
+/**
+  * Class with implementation of keying despill node
+  */
+class KeyingDespillOperation : public NodeOperation {
+protected:
+	SocketReader *pixelReader;
+	SocketReader *screenReader;
+	float despillFactor;
+
+public:
+	KeyingDespillOperation();
+
+	void initExecution();
+	void deinitExecution();
+
+	void setDespillFactor(float value) {this->despillFactor = value;}
+
+	void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+};
+
+#endif

Deleted: branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDispillOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDispillOperation.cpp	2012-05-29 14:54:40 UTC (rev 47183)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_KeyingDispillOperation.cpp	2012-05-29 14:55:01 UTC (rev 47184)
@@ -1,89 +0,0 @@
-/*
- * Copyright 2012, 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