add variable size option to bokeh blur node, remove f_stop option (it wasnt used), and add `blur_max` to the interface.

This commit is contained in:
Campbell Barton 2012-08-14 14:31:39 +00:00
parent 59fedc6b7c
commit 9591142294
4 changed files with 40 additions and 18 deletions

View File

@ -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);
}

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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);