[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47273] branches/soc-2011-tomato: svn merge ^/trunk/blender -r47253:47272

Campbell Barton ideasman42 at gmail.com
Thu May 31 13:58:14 CEST 2012


Revision: 47273
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47273
Author:   campbellbarton
Date:     2012-05-31 11:58:14 +0000 (Thu, 31 May 2012)
Log Message:
-----------
svn merge ^/trunk/blender -r47253:47272

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47253

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenlib/BLI_math_vector.h
    branches/soc-2011-tomato/source/blender/blenlib/intern/math_vector.c
    branches/soc-2011-tomato/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
    branches/soc-2011-tomato/source/blender/compositor/nodes/COM_ImageNode.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_DilateErodeOperation.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

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-47253
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-47272

Modified: branches/soc-2011-tomato/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/BLI_math_vector.h	2012-05-31 11:57:09 UTC (rev 47272)
+++ branches/soc-2011-tomato/source/blender/blenlib/BLI_math_vector.h	2012-05-31 11:58:14 UTC (rev 47273)
@@ -228,8 +228,12 @@
 void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f);
 void add_vn_vn(float *array_tar, const float *array_src, const int size);
 void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
+void madd_vn_vn(float *array_tar, const float *array_src, const float f, const int size);
+void madd_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size);
 void sub_vn_vn(float *array_tar, const float *array_src, const int size);
 void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
+void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size);
+void msub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size);
 void fill_vn_i(int *array_tar, const int size, const int val);
 void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val);
 void fill_vn_fl(float *array_tar, const int size, const float val);

Modified: branches/soc-2011-tomato/source/blender/blenlib/intern/math_vector.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/intern/math_vector.c	2012-05-31 11:57:09 UTC (rev 47272)
+++ branches/soc-2011-tomato/source/blender/blenlib/intern/math_vector.c	2012-05-31 11:58:14 UTC (rev 47273)
@@ -550,6 +550,27 @@
 	}
 }
 
+void madd_vn_vn(float *array_tar, const float *array_src, const float f, const int size)
+{
+	float *tar = array_tar + (size - 1);
+	const float *src = array_src + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) += *(src--) * f;
+	}
+}
+
+void madd_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size)
+{
+	float *tar = array_tar + (size - 1);
+	const float *src_a = array_src_a + (size - 1);
+	const float *src_b = array_src_b + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = *(src_a--) + (*(src_b--) * f);
+	}
+}
+
 void sub_vn_vn(float *array_tar, const float *array_src, const int size)
 {
 	float *tar = array_tar + (size - 1);
@@ -571,6 +592,27 @@
 	}
 }
 
+void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size)
+{
+	float *tar = array_tar + (size - 1);
+	const float *src = array_src + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) -= *(src--) * f;
+	}
+}
+
+void msub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size)
+{
+	float *tar = array_tar + (size - 1);
+	const float *src_a = array_src_a + (size - 1);
+	const float *src_b = array_src_b + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = *(src_a--) - (*(src_b--) * f);
+	}
+}
+
 void fill_vn_i(int *array_tar, const int size, const int val)
 {
 	int *tar = array_tar + (size - 1);

Modified: branches/soc-2011-tomato/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/nodes/COM_DilateErodeNode.cpp	2012-05-31 11:57:09 UTC (rev 47272)
+++ branches/soc-2011-tomato/source/blender/compositor/nodes/COM_DilateErodeNode.cpp	2012-05-31 11:58:14 UTC (rev 47273)
@@ -35,7 +35,7 @@
 {
 	
 	bNode *editorNode = this->getbNode();
-	if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) {
+	if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) {
 		DilateErodeDistanceOperation *operation = new DilateErodeDistanceOperation();
 		operation->setDistance(editorNode->custom2);
 		operation->setInset(editorNode->custom3);
@@ -52,9 +52,23 @@
 			this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
 		}
 		graph->addOperation(operation);
-	}
-	else {
+	} else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) {
 		if (editorNode->custom2 > 0) {
+			DilateDistanceOperation * operation = new DilateDistanceOperation();
+			operation->setDistance(editorNode->custom2);
+			this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+			this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+			graph->addOperation(operation);
+		}
+		else {
+			ErodeDistanceOperation * operation = new ErodeDistanceOperation();
+			operation->setDistance(-editorNode->custom2);
+			this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+			this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
+			graph->addOperation(operation);
+		}
+	} else {
+		if (editorNode->custom2 > 0) {
 			DilateStepOperation * operation = new DilateStepOperation();
 			operation->setIterations(editorNode->custom2);
 			this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);

Modified: branches/soc-2011-tomato/source/blender/compositor/nodes/COM_ImageNode.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/nodes/COM_ImageNode.cpp	2012-05-31 11:57:09 UTC (rev 47272)
+++ branches/soc-2011-tomato/source/blender/compositor/nodes/COM_ImageNode.cpp	2012-05-31 11:58:14 UTC (rev 47273)
@@ -66,6 +66,7 @@
 	ImageUser *imageuser = (ImageUser*)editorNode->storage;
 	int framenumber = context->getFramenumber();
 	int numberOfOutputs = this->getNumberOfOutputSockets();
+	BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);
 
 	/* force a load, we assume iuser index will be set OK anyway */
 	if (image && image->type==IMA_TYPE_MULTILAYER) {

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_DilateErodeOperation.cpp	2012-05-31 11:57:09 UTC (rev 47272)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_DilateErodeOperation.cpp	2012-05-31 11:58:14 UTC (rev 47273)
@@ -23,6 +23,7 @@
 #include "COM_DilateErodeOperation.h"
 #include "BLI_math.h"
 
+// DilateErode Distance Threshold
 DilateErodeDistanceOperation::DilateErodeDistanceOperation(): NodeOperation()
 {
 	this->addInputSocket(COM_DT_VALUE);
@@ -158,6 +159,115 @@
 	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
 
+// Dilate Distance
+DilateDistanceOperation::DilateDistanceOperation(): NodeOperation()
+{
+	this->addInputSocket(COM_DT_VALUE);
+	this->addOutputSocket(COM_DT_VALUE);
+	this->setComplex(true);
+	this->inputProgram = NULL;
+	this->distance = 0.0f;
+}
+void DilateDistanceOperation::initExecution()
+{
+	this->inputProgram = this->getInputSocketReader(0);
+	this->scope = distance;
+	if (scope < 3) {
+		scope = 3;
+	}
+}
+
+void *DilateDistanceOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+{
+	void *buffer = inputProgram->initializeTileData(NULL, memoryBuffers);
+	return buffer;
+}
+
+void DilateDistanceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+{
+	const float distance = this->distance;
+	float mindist = distance * distance;
+
+	MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+	float *buffer = inputBuffer->getBuffer();
+	rcti *rect = inputBuffer->getRect();
+	const int minx = max(x - scope, rect->xmin);
+	const int miny = max(y - scope, rect->ymin);
+	const int maxx = min(x + scope, rect->xmax);
+	const int maxy = min(y + scope, rect->ymax);
+	const int bufferWidth = rect->xmax-rect->xmin;
+	int offset;
+	
+	float value = 0.0f;
+
+	for (int yi = miny ; yi<maxy;yi++) {
+		offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
+		for (int xi = minx ; xi<maxx;xi++) {
+			const float dx = xi-x;
+			const float dy = yi-y;
+			const float dis = dx*dx+dy*dy;
+			if (dis <= mindist) {
+				value = max(buffer[offset], value);
+			}
+			offset +=4;
+		}
+	}
+	color[0] = value;
+}
+
+void DilateDistanceOperation::deinitExecution()
+{
+	this->inputProgram = NULL;
+}
+
+bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
+	rcti newInput;
+
+	newInput.xmax = input->xmax + scope;
+	newInput.xmin = input->xmin - scope;
+	newInput.ymax = input->ymax + scope;
+	newInput.ymin = input->ymin - scope;
+
+	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+}
+// Erode Distance
+ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation() 
+{
+}
+
+void ErodeDistanceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+{
+	const float distance = this->distance;
+	float mindist = distance * distance;
+
+	MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+	float *buffer = inputBuffer->getBuffer();
+	rcti *rect = inputBuffer->getRect();
+	const int minx = max(x - scope, rect->xmin);
+	const int miny = max(y - scope, rect->ymin);
+	const int maxx = min(x + scope, rect->xmax);
+	const int maxy = min(y + scope, rect->ymax);
+	const int bufferWidth = rect->xmax-rect->xmin;
+	int offset;
+	
+	float value = 1.0f;
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list