forked from bartvdbraak/blender
2.5 Nodes:
* Added missing button set functions for Matte Nodes. * Wrapped some Matte Nodes to new Layout Engine.
This commit is contained in:
parent
b8a7f844ca
commit
b66046339b
@ -1362,7 +1362,6 @@ static void node_composit_buts_color_spill(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
static void node_composit_buts_chroma_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
|
||||
uiLayout *col;
|
||||
|
||||
col= uiLayoutColumn(layout, 0);
|
||||
@ -1373,26 +1372,6 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
uiItemR(col, NULL, 0, ptr, "lift", UI_ITEM_R_SLIDER);
|
||||
uiItemR(col, NULL, 0, ptr, "gain", UI_ITEM_R_SLIDER);
|
||||
uiItemR(col, NULL, 0, ptr, "shadow_adjust", UI_ITEM_R_SLIDER);
|
||||
|
||||
// uiBlock *block= uiLayoutAbsoluteBlock(layout);
|
||||
// bNode *node= ptr->data;
|
||||
// rctf *butr= &node->butr;
|
||||
// short dx=(butr->xmax-butr->xmin)/2;
|
||||
// NodeChroma *c= node->storage;
|
||||
|
||||
// uiBlockBeginAlign(block);
|
||||
//
|
||||
// uiDefButF(block, NUMSLI, B_NODE_EXEC, "Acceptance ", butr->xmin, butr->ymin+60, butr->xmax-butr->xmin, 20, &c->t1, 1.0f, 80.0f, 100, 0, "Tolerance for colors to be considered a keying color");
|
||||
// uiDefButF(block, NUMSLI, B_NODE_EXEC, "Cutoff ", butr->xmin, butr->ymin+40, butr->xmax-butr->xmin, 20, &c->t2, 0.0f, 30.0f, 100, 0, "Colors below this will be considered as exact matches for keying color");
|
||||
//
|
||||
// uiDefButF(block, NUMSLI, B_NODE_EXEC, "Lift ", butr->xmin, butr->ymin+20, dx, 20, &c->fsize, 0.0f, 1.0f, 100, 0, "Alpha Lift");
|
||||
// uiDefButF(block, NUMSLI, B_NODE_EXEC, "Gain ", butr->xmin+dx, butr->ymin+20, dx, 20, &c->fstrength, 0.0f, 1.0f, 100, 0, "Alpha Gain");
|
||||
//
|
||||
// uiDefButF(block, NUMSLI, B_NODE_EXEC, "Shadow Adjust ", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &c->t3, 0.0f, 1.0f, 100, 0, "Adjusts the brightness of any shadows captured");
|
||||
// uiBlockEndAlign(block);
|
||||
//
|
||||
// if(c->t2 > c->t1)
|
||||
// c->t2=c->t1;
|
||||
}
|
||||
|
||||
static void node_composit_buts_color_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
@ -1406,7 +1385,9 @@ static void node_composit_buts_color_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
}
|
||||
|
||||
static void node_composit_buts_channel_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
{
|
||||
uiLayout *col, *row;
|
||||
|
||||
uiBlock *block= uiLayoutAbsoluteBlock(layout);
|
||||
bNode *node= ptr->data;
|
||||
rctf *butr= &node->butr;
|
||||
@ -1415,16 +1396,9 @@ static void node_composit_buts_channel_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
NodeChroma *c=node->storage;
|
||||
char *c1, *c2, *c3;
|
||||
|
||||
/*color space selectors*/
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButS(block, ROW,B_NODE_EXEC,"RGB",
|
||||
butr->xmin,butr->ymin+60,sx,20,&node->custom1,1,1, 0, 0, "RGB Color Space");
|
||||
uiDefButS(block, ROW,B_NODE_EXEC,"HSV",
|
||||
butr->xmin+sx,butr->ymin+60,sx,20,&node->custom1,1,2, 0, 0, "HSV Color Space");
|
||||
uiDefButS(block, ROW,B_NODE_EXEC,"YUV",
|
||||
butr->xmin+2*sx,butr->ymin+60,sx,20,&node->custom1,1,3, 0, 0, "YUV Color Space");
|
||||
uiDefButS(block, ROW,B_NODE_EXEC,"YCC",
|
||||
butr->xmin+3*sx,butr->ymin+60,sx,20,&node->custom1,1,4, 0, 0, "YCbCr Color Space");
|
||||
/*color space selector*/
|
||||
row= uiLayoutRow(layout, 0);
|
||||
uiItemR(row, NULL, 0, ptr, "color_space", UI_ITEM_R_EXPAND);
|
||||
|
||||
if (node->custom1==1) {
|
||||
c1="R"; c2="G"; c3="B";
|
||||
@ -1440,48 +1414,30 @@ static void node_composit_buts_channel_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
}
|
||||
|
||||
/*channel selector */
|
||||
row= uiLayoutRow(layout, 0);
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButS(block, ROW, B_NODE_EXEC, c1,
|
||||
butr->xmin,butr->ymin+40,cx,20,&node->custom2,1, 1, 0, 0, "Channel 1");
|
||||
uiDefButS(block, ROW, B_NODE_EXEC, c2,
|
||||
butr->xmin+cx,butr->ymin+40,cx,20,&node->custom2,1, 2, 0, 0, "Channel 2");
|
||||
uiDefButS(block, ROW, B_NODE_EXEC, c3,
|
||||
butr->xmin+cx+cx,butr->ymin+40,cx,20,&node->custom2, 1, 3, 0, 0, "Channel 3");
|
||||
|
||||
/*tolerance sliders */
|
||||
uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ",
|
||||
butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
|
||||
&c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
|
||||
uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ",
|
||||
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
|
||||
&c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/*keep t2 (low) less than t1 (high) */
|
||||
if(c->t2 > c->t1) {
|
||||
c->t2=c->t1;
|
||||
}
|
||||
/*tolerance sliders */
|
||||
col =uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, NULL, 0, ptr, "high", UI_ITEM_R_SLIDER);
|
||||
uiItemR(col, NULL, 0, ptr, "low", UI_ITEM_R_SLIDER);
|
||||
|
||||
}
|
||||
|
||||
static void node_composit_buts_luma_matte(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
uiBlock *block= uiLayoutAbsoluteBlock(layout);
|
||||
bNode *node= ptr->data;
|
||||
rctf *butr= &node->butr;
|
||||
NodeChroma *c=node->storage;
|
||||
|
||||
/*tolerance sliders */
|
||||
uiDefButF(block, NUMSLI, B_NODE_EXEC, "High ",
|
||||
butr->xmin, butr->ymin+20.0, butr->xmax-butr->xmin, 20,
|
||||
&c->t1, 0.0f, 1.0f, 100, 0, "Values higher than this setting are 100% opaque");
|
||||
uiDefButF(block, NUMSLI, B_NODE_EXEC, "Low ",
|
||||
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
|
||||
&c->t2, 0.0f, 1.0f, 100, 0, "Values lower than this setting are 100% keyed");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/*keep t2 (low) less than t1 (high) */
|
||||
if(c->t2 > c->t1) {
|
||||
c->t2=c->t1;
|
||||
}
|
||||
uiLayout *col;
|
||||
|
||||
col= uiLayoutColumn(layout, 1);
|
||||
uiItemR(col, NULL, 0, ptr, "high", UI_ITEM_R_SLIDER);
|
||||
uiItemR(col, NULL, 0, ptr, "low", UI_ITEM_R_SLIDER);
|
||||
}
|
||||
|
||||
static void node_composit_buts_map_uv(uiLayout *layout, PointerRNA *ptr)
|
||||
|
@ -157,6 +157,29 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Button Set Funcs for Matte Nodes */
|
||||
static void rna_Matte_t1_set(PointerRNA *ptr, float value)
|
||||
{
|
||||
bNode *node= (bNode*)ptr->data;
|
||||
NodeChroma *chroma = node->storage;
|
||||
|
||||
chroma->t1 = value;
|
||||
|
||||
if(value < chroma->t2)
|
||||
chroma->t2 = value;
|
||||
}
|
||||
|
||||
static void rna_Matte_t2_set(PointerRNA *ptr, float value)
|
||||
{
|
||||
bNode *node= (bNode*)ptr->data;
|
||||
NodeChroma *chroma = node->storage;
|
||||
|
||||
if(value > chroma->t1)
|
||||
value = chroma->t1;
|
||||
|
||||
chroma->t2 = value;
|
||||
}
|
||||
|
||||
static void rna_Node_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Main *bmain= CTX_data_main(C);
|
||||
@ -948,17 +971,17 @@ static void def_cmp_diff_matte(StructRNA *srna)
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
|
||||
|
||||
/* TODO: nicer wrapping for tolerances */
|
||||
|
||||
prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t1");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed.");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t2");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed.");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
@ -969,9 +992,7 @@ static void def_cmp_color_matte(StructRNA *srna)
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
|
||||
|
||||
/* TODO: nicer wrapping for tolerances */
|
||||
|
||||
|
||||
prop = RNA_def_property(srna, "h", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t1");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
@ -997,16 +1018,16 @@ static void def_cmp_distance_matte(StructRNA *srna)
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
|
||||
|
||||
/* TODO: nicer wrapping for tolerances */
|
||||
|
||||
prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t1");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed.");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t2");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed.");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
@ -1038,6 +1059,27 @@ static void def_cmp_color_spill(StructRNA *srna)
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_luma_matte(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "high", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t1");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t2");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_chroma_matte(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@ -1046,12 +1088,14 @@ static void def_cmp_chroma_matte(StructRNA *srna)
|
||||
|
||||
prop = RNA_def_property(srna, "acceptance", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t1");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
|
||||
RNA_def_property_range(prop, 1.0f, 80.0f);
|
||||
RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "cutoff", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t2");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 30.0f);
|
||||
RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
@ -1073,11 +1117,6 @@ static void def_cmp_chroma_matte(StructRNA *srna)
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
/* TODO:
|
||||
if(c->t2 > c->t1)
|
||||
c->t2=c->t1;
|
||||
*/
|
||||
}
|
||||
|
||||
static void def_cmp_channel_matte(StructRNA *srna)
|
||||
@ -1085,10 +1124,10 @@ static void def_cmp_channel_matte(StructRNA *srna)
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem color_space_items[] = {
|
||||
{1, "RGB", 0, "RGB", ""},
|
||||
{2, "HSV", 0, "HSV", ""},
|
||||
{3, "YUV", 0, "YUV", ""},
|
||||
{4, "YCC", 0, "YCbCr", ""},
|
||||
{1, "RGB", 0, "RGB", "RGB Color Space"},
|
||||
{2, "HSV", 0, "HSV", "HSV Color Space"},
|
||||
{3, "YUV", 0, "YUV", "YUV Color Space"},
|
||||
{4, "YCC", 0, "YCbCr", "YCbCr Color Space"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
@ -1108,20 +1147,17 @@ static void def_cmp_channel_matte(StructRNA *srna)
|
||||
|
||||
prop = RNA_def_property(srna, "high", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t1");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t2");
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
/* TODO:
|
||||
if(c->t2 > c->t1)
|
||||
c->t2=c->t1;
|
||||
*/
|
||||
}
|
||||
|
||||
static void def_cmp_flip(StructRNA *srna)
|
||||
@ -1257,28 +1293,6 @@ static void def_cmp_defocus(StructRNA *srna)
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_cmp_luma_matte(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "high", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t1");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "t2");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
|
||||
RNA_def_property_update(prop, 0, "rna_Node_update");
|
||||
|
||||
/* TODO: keep low less than high */
|
||||
|
||||
}
|
||||
|
||||
static void def_cmp_invert(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
Loading…
Reference in New Issue
Block a user