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
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2011-02-10 23:54:02 +0300
committerLukas Toenne <lukas.toenne@googlemail.com>2011-02-10 23:54:02 +0300
commit46bb5643b7660033bc0d15c5fcc752324a1b519f (patch)
treeae9f798b1ce120af18a1b3bb98e876349b605000
parentcbe53cc48d5e4460c2d04d1344bd30a882b2cadb (diff)
Different method for blur node aspect correction. Now the user can still set different sizes for x/y blurring in relative mode, but choose to use aspect correction on either of the axes.
-rw-r--r--source/blender/editors/space_node/drawnode.c30
-rw-r--r--source/blender/makesdna/DNA_node_types.h13
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c22
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_blur.c24
4 files changed, 45 insertions, 44 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 42b5835c6df..e1577309afa 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -538,7 +538,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
- uiLayout *col;
+ uiLayout *col, *row;
col= uiLayoutColumn(layout, 0);
@@ -548,23 +548,21 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point
uiItemR(col, ptr, "use_gamma_correction", 0, NULL, ICON_NULL);
}
- uiItemR(col, ptr, "size_type", 0, NULL, ICON_NULL);
- col= uiLayoutColumn(layout, 1);
- switch (RNA_enum_get(ptr, "size_type")) {
- case CMP_NODE_BLUR_SIZE_PIXEL:
- uiItemR(col, ptr, "size_x", 0, "X", ICON_NULL);
- uiItemR(col, ptr, "size_y", 0, "Y", ICON_NULL);
- break;
- case CMP_NODE_BLUR_SIZE_WIDTH:
- uiItemR(col, ptr, "factor_x", 0, "X", ICON_NULL);
- break;
- case CMP_NODE_BLUR_SIZE_HEIGHT:
- uiItemR(col, ptr, "factor_y", 0, "Y", ICON_NULL);
- break;
- case CMP_NODE_BLUR_SIZE_BOTH:
+ uiItemR(col, ptr, "use_relative", 0, NULL, ICON_NULL);
+
+ if (RNA_boolean_get(ptr, "use_relative")) {
+ uiItemL(col, "Aspect Correction", 0);
+ row= uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "aspect_correction", UI_ITEM_R_EXPAND, NULL, 0);
+
+ col= uiLayoutColumn(layout, 1);
uiItemR(col, ptr, "factor_x", 0, "X", ICON_NULL);
uiItemR(col, ptr, "factor_y", 0, "Y", ICON_NULL);
- break;
+ }
+ else {
+ col= uiLayoutColumn(layout, 1);
+ uiItemR(col, ptr, "size_x", 0, "X", ICON_NULL);
+ uiItemR(col, ptr, "size_y", 0, "Y", ICON_NULL);
}
}
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 85523c3369f..5fbbf4338c4 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -216,12 +216,11 @@ typedef struct NodeImageAnim {
typedef struct NodeBlurData {
short sizex, sizey;
- short samples, maxspeed, minspeed, size_type;
+ short samples, maxspeed, minspeed, relative, aspect;
+ short curved;
float fac, percentx, percenty;
short filtertype;
char bokeh, gamma;
- short curved;
- short pad;
int image_in_width, image_in_height; /* needed for absolute/relative conversions */
} NodeBlurData;
@@ -336,10 +335,8 @@ typedef struct TexNodeOutput {
#define CMP_NODE_CHANNEL_MATTE_CS_YUV 3
#define CMP_NODE_CHANNEL_MATTE_CS_YCC 4
-/* comp blur relative filter size */
-#define CMP_NODE_BLUR_SIZE_PIXEL 0
-#define CMP_NODE_BLUR_SIZE_WIDTH 1
-#define CMP_NODE_BLUR_SIZE_HEIGHT 2
-#define CMP_NODE_BLUR_SIZE_BOTH 3
+#define CMP_NODE_BLUR_ASPECT_NONE 0
+#define CMP_NODE_BLUR_ASPECT_Y 1
+#define CMP_NODE_BLUR_ASPECT_X 2
#endif
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 7c8d57b3191..bb5c867f789 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1029,11 +1029,10 @@ static void def_cmp_blur(StructRNA *srna)
{R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
{0, NULL, 0, NULL, NULL}};
- static EnumPropertyItem size_type_items[] = {
- {CMP_NODE_BLUR_SIZE_PIXEL, "PIXEL", 0, "Pixel", ""},
- {CMP_NODE_BLUR_SIZE_WIDTH, "WIDTH", 0, "Width", ""},
- {CMP_NODE_BLUR_SIZE_HEIGHT, "HEIGHT", 0, "Height", ""},
- {CMP_NODE_BLUR_SIZE_BOTH, "BOTH", 0, "Both", ""},
+ static EnumPropertyItem aspect_correction_type_items[] = {
+ {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
+ {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
+ {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
{0, NULL, 0, NULL, NULL}};
RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
@@ -1050,12 +1049,17 @@ static void def_cmp_blur(StructRNA *srna)
RNA_def_property_ui_text(prop, "Size Y", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "size_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "size_type");
- RNA_def_property_enum_items(prop, size_type_items);
- RNA_def_property_ui_text(prop, "Size Type", "Mode of filter size calculation");
+ prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
+ RNA_def_property_ui_text(prop, "Relative", "Use relative (percent) values to define blur radius");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "aspect");
+ RNA_def_property_enum_items(prop, aspect_correction_type_items);
+ RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fac");
RNA_def_property_range(prop, 0.0f, 2.0f);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
index d92ee6924c9..75aca3e0428 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
@@ -577,17 +577,19 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
if(out[0]->hasoutput==0) return;
- switch (nbd->size_type) {
- case CMP_NODE_BLUR_SIZE_WIDTH:
- nbd->sizex= nbd->sizey= (int)(nbd->percentx*0.01f*nbd->image_in_width);
- break;
- case CMP_NODE_BLUR_SIZE_HEIGHT:
- nbd->sizex= nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
- break;
- case CMP_NODE_BLUR_SIZE_BOTH:
- nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width);
- nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
- break;
+ if(nbd->relative) {
+ if (nbd->aspect==CMP_NODE_BLUR_ASPECT_NONE) {
+ nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width);
+ nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
+ }
+ else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_Y) {
+ nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width);
+ nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_width);
+ }
+ else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_X) {
+ nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_height);
+ nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
+ }
}
if (nbd->sizex==0 && nbd->sizey==0) {