diff options
author | Matt Ebb <matt@mke3.net> | 2010-01-19 04:32:06 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-01-19 04:32:06 +0300 |
commit | aab8196a1c16a1695a168c486fc6883953f97722 (patch) | |
tree | bcd6de7e916feba5f068936eb7e289605b0fb87a /source/blender/makesrna/intern | |
parent | 849024df83602758f134695495eb0b19a6993421 (diff) |
Finished some work from the weekend to keep local tree clean..
* Added a generic 'histogram' ui control, currently available in new image editor
'scopes' region (shortcut P). Shows the histogram of the currently viewed image.
It's a baby step in unifying the functionality and code from the sequence editor,
so eventually we can migrate the sequence preview to the image editor too,
like compositor.
Still a couple of rough edges to tweak, regarding when it updates. Also would
be very nice to have this region as a partially transparent overlapping region...
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 6 |
4 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index c4edd00045b..a9ef608cd6c 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -229,11 +229,22 @@ static void rna_def_curvemapping(BlenderRNA *brna) RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_white_level_set", NULL); } +static void rna_def_histogram(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "Histogram", NULL); + RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image"); + +} + void RNA_def_color(BlenderRNA *brna) { rna_def_curvemappoint(brna); rna_def_curvemap(brna); rna_def_curvemapping(brna); + rna_def_histogram(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 165f09d337a..4f75a7756d0 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -333,6 +333,19 @@ static void rna_SpaceImageEditor_curves_update(Main *bmain, Scene *scene, Pointe WM_main_add_notifier(NC_IMAGE, sima->image); } +static void rna_SpaceImageEditor_histogram_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + SpaceImage *sima= (SpaceImage*)ptr->data; + ImBuf *ibuf; + void *lock; + + ibuf= ED_space_image_acquire_buffer(sima, &lock); + histogram_update(&sima->hist, ibuf); + ED_space_image_release_buffer(sima, lock); + + WM_main_add_notifier(NC_IMAGE, sima->image); +} + /* Space Text Editor */ @@ -1004,6 +1017,12 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "cumap"); RNA_def_property_ui_text(prop, "Curves", "Color curve mapping to use for displaying the image."); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_curves_update"); + + prop= RNA_def_property(srna, "histogram", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "hist"); + RNA_def_property_struct_type(prop, "Histogram"); + RNA_def_property_ui_text(prop, "Histogram", "Histogram for viewing image statistics"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_histogram_update"); prop= RNA_def_property(srna, "image_pin", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pin", 0); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 011235c862f..2ea8f191822 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -326,6 +326,10 @@ void RNA_api_ui_layout(StructRNA *srna) api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); + func= RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); + api_ui_item_rna_common(func); + RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); + func= RNA_def_function(srna, "template_layers", "uiTemplateLayers"); api_ui_item_rna_common(func); parm= RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property."); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 903ed5796dc..4e3e6cb336d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1202,6 +1202,12 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna) RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "scope_back", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "preview_back"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Scope region background color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_space_seq(BlenderRNA *brna) |