Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-14 18:31:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-14 18:31:39 +0400
commit9591142294fdcaded15663002e1f7bac568d7ed6 (patch)
tree52113a7107214478dc311733dae25f24410341ff /source
parent59fedc6b7c315cbf95035d7add1cdb6384eb13e7 (diff)
add variable size option to bokeh blur node, remove f_stop option (it wasnt used), and add `blur_max` to the interface.
Diffstat (limited to 'source')
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp20
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.cpp16
-rw-r--r--source/blender/editors/space_node/drawnode.c10
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c12
4 files changed, 40 insertions, 18 deletions
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 24c3c36b79e..37b53c44ef7 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -129,16 +129,16 @@ Node *Converter::convert(bNode *b_node, bool fast)
}
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);
}
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
index 434fcf2a608..9abf97aa16f 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
@@ -36,10 +36,9 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode)
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,13 +50,14 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
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 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
graph->addOperation(operation);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- operation->setSize(size);
+ if (!connectedSizeSocket) {
+ operation->setSize(size);
+ }
}
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index c45b54550f3..615c4fb4b46 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2351,6 +2351,13 @@ static void node_composit_buts_bokehimage(uiLayout *layout, bContext *UNUSED(C),
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 @@ static void node_composit_set_butfunc(bNodeType *ntype)
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;
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 19be68801ca..9e4d29eca52 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1723,6 +1723,7 @@ static void def_cmp_blur(StructRNA *srna)
{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_ellipsemask(StructRNA *srna)
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 @@ static void def_cmp_bokehblur(StructRNA *srna)
"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);