[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49893] trunk/blender/source/blender: add variable size option to bokeh blur node, remove f_stop option ( it wasnt used), and add `blur_max` to the interface.

Campbell Barton ideasman42 at gmail.com
Tue Aug 14 16:31:39 CEST 2012


Revision: 49893
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49893
Author:   campbellbarton
Date:     2012-08-14 14:31:39 +0000 (Tue, 14 Aug 2012)
Log Message:
-----------
add variable size option to bokeh blur node, remove f_stop option (it wasnt used), and add `blur_max` to the interface.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/intern/COM_Converter.cpp
    trunk/blender/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c

Modified: trunk/blender/source/blender/compositor/intern/COM_Converter.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_Converter.cpp	2012-08-14 12:39:12 UTC (rev 49892)
+++ trunk/blender/source/blender/compositor/intern/COM_Converter.cpp	2012-08-14 14:31:39 UTC (rev 49893)
@@ -129,16 +129,16 @@
 	}
 	if (fast) {
 		if (b_node->type == CMP_NODE_BLUR ||
-		        b_node->type == CMP_NODE_VECBLUR ||
-		        b_node->type == CMP_NODE_BILATERALBLUR ||
-		        b_node->type == CMP_NODE_DEFOCUS ||
-		        b_node->type == CMP_NODE_BOKEHBLUR ||
-		        b_node->type == CMP_NODE_GLARE ||
-		        b_node->type == CMP_NODE_DBLUR ||
-		        b_node->type == CMP_NODE_MOVIEDISTORTION ||
-		        b_node->type == CMP_NODE_LENSDIST ||
-		        b_node->type == CMP_NODE_DOUBLEEDGEMASK ||
-		        b_node->type == CMP_NODE_DILATEERODE) 
+		    b_node->type == CMP_NODE_VECBLUR ||
+		    b_node->type == CMP_NODE_BILATERALBLUR ||
+		    b_node->type == CMP_NODE_DEFOCUS ||
+		    b_node->type == CMP_NODE_BOKEHBLUR ||
+		    b_node->type == CMP_NODE_GLARE ||
+		    b_node->type == CMP_NODE_DBLUR ||
+		    b_node->type == CMP_NODE_MOVIEDISTORTION ||
+		    b_node->type == CMP_NODE_LENSDIST ||
+		    b_node->type == CMP_NODE_DOUBLEEDGEMASK ||
+		    b_node->type == CMP_NODE_DILATEERODE)
 		{
 			return new MuteNode(b_node);
 		}

Modified: trunk/blender/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_BokehBlurNode.cpp	2012-08-14 12:39:12 UTC (rev 49892)
+++ trunk/blender/source/blender/compositor/nodes/COM_BokehBlurNode.cpp	2012-08-14 14:31:39 UTC (rev 49893)
@@ -36,10 +36,9 @@
 
 void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
 {
-	InputSocket *inputSizeSocket = this->getInputSocket(2);
-	bool connectedSizeSocket = inputSizeSocket->isConnected();
+	bNode *b_node = this->getbNode();
 
-	if (connectedSizeSocket) {
+	if (b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
 		VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
 
 		this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
@@ -51,14 +50,15 @@
 		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
 
 		operation->setThreshold(0.0f);
-
-		/* TODO, we need to know the max input pixel of the input, this value is arbitrary! */
-		operation->setMaxBlur(100.0f);
+		operation->setMaxBlur(b_node->custom4);
 		operation->setDoScaleSize(true);
 	}
 	else {
 		BokehBlurOperation *operation = new BokehBlurOperation();
+		InputSocket *inputSizeSocket = this->getInputSocket(2);
 
+		bool connectedSizeSocket = inputSizeSocket->isConnected();
+
 		const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket();
 		const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
 
@@ -72,6 +72,8 @@
 		graph->addOperation(operation);
 		this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
 
-		operation->setSize(size);
+		if (!connectedSizeSocket) {
+			operation->setSize(size);
+		}
 	}
 }

Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c	2012-08-14 12:39:12 UTC (rev 49892)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c	2012-08-14 14:31:39 UTC (rev 49893)
@@ -2351,6 +2351,13 @@
 	uiItemR(layout, ptr, "shift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 }
 
+static void node_composit_buts_bokehblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+	uiItemR(layout, ptr, "use_variable_size", 0, NULL, ICON_NONE);
+	// uiItemR(layout, ptr, "f_stop", 0, NULL, ICON_NONE);  // UNUSED
+	uiItemR(layout, ptr, "blur_max", 0, NULL, ICON_NONE);
+}
+
 void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
 {
 //	node_composit_backdrop_canvas(snode, backdrop, node, x, y);
@@ -2764,6 +2771,9 @@
 		case CMP_NODE_BOKEHIMAGE:
 			ntype->uifunc = node_composit_buts_bokehimage;
 			break;
+		case CMP_NODE_BOKEHBLUR:
+			ntype->uifunc = node_composit_buts_bokehblur;
+			break;
 		case CMP_NODE_VIEWER:
 			ntype->uifunc = NULL;
 			ntype->uifuncbut = node_composit_buts_viewer_but;

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-08-14 12:39:12 UTC (rev 49892)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-08-14 14:31:39 UTC (rev 49893)
@@ -1723,6 +1723,7 @@
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	/* duplicated in def_cmp_bokehblur */
 	prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
 	RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input");
@@ -3354,6 +3355,14 @@
 static void def_cmp_bokehblur(StructRNA *srna)
 {
 	PropertyRNA *prop;
+
+	/* duplicated in def_cmp_blur */
+	prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
+	RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+#if 0
 	prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "custom3");
 	RNA_def_property_range(prop, 0.0f, 128.0f);
@@ -3361,7 +3370,8 @@
 	                         "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
 	                         "the blur radius");
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-	
+#endif
+
 	prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "custom4");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);




More information about the Bf-blender-cvs mailing list