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:
authorMatt Ebb <matt@mke3.net>2010-04-06 06:05:54 +0400
committerMatt Ebb <matt@mke3.net>2010-04-06 06:05:54 +0400
commitbfe248b3d629d28fed3798e9f6a42bccb5d40f9e (patch)
treed4b75ad54067d790cdabaa7e843624b1d423a5af /source/blender/makesrna
parentea7fdb55a3e8f088161b218b96220c1cba9380a1 (diff)
Patch [#21750] Add luma waveform and vectorscope to image view
by Xavier Thomas This adds the waveform monitor and vectorscope to the image editor 'scopes' region, bringing it inline (plus a bit more) with sequence editor functionality, and a big step closer to the end goal of unifying the display code for image/ comp/sequence editor. It's non-intrusive, using the same code paths as the histogram. There's still room for more tweaks - I modified the original patch, changing the openGL immediate mode drawing of the waveform display to vertex arrays for speed optimisation. Xavier can look at doing this for the vectorscope now too. Thanks very much Xavier!
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_color.c72
-rw-r--r--source/blender/makesrna/intern/rna_space.c17
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c8
4 files changed, 89 insertions, 9 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index e72c5eb9a4d..3ee251c4437 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -383,6 +383,7 @@ extern StructRNA RNA_Scene;
extern StructRNA RNA_SceneGameData;
extern StructRNA RNA_SceneRenderLayer;
extern StructRNA RNA_SceneSequence;
+extern StructRNA RNA_Scopes;
extern StructRNA RNA_Screen;
extern StructRNA RNA_ScrewModifier;
extern StructRNA RNA_Sculpt;
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index daf3f73a3d7..6e409f4b613 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include "RNA_define.h"
+#include "rna_internal.h"
#include "DNA_color_types.h"
@@ -269,6 +270,11 @@ static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
}
}
+static void rna_Scopes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Scopes *s= (Scopes*)ptr->data;
+ s->ok = 0;
+}
#else
@@ -443,12 +449,77 @@ static void rna_def_color_ramp(BlenderRNA *brna)
static void rna_def_histogram(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
+ static EnumPropertyItem prop_mode_items[] = {
+ {HISTO_MODE_LUMA, "Luma", ICON_COLOR, "Luma", ""},
+ {HISTO_MODE_RGB, "RGB", ICON_COLOR, "RGB", ""},
+ {HISTO_MODE_R, "R", ICON_COLOR, "R", ""},
+ {HISTO_MODE_G, "G", ICON_COLOR, "G", ""},
+ {HISTO_MODE_B, "B", ICON_COLOR, "B", ""},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "Histogram", NULL);
RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image");
+ prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, prop_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Channels to display when drawing the histogram");
+
+}
+
+static void rna_def_scopes(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem prop_wavefrm_mode_items[] = {
+ {SCOPES_WAVEFRM_LUM, "LUMINANCE", ICON_COLOR, "Luminance", ""},
+ {SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
+ {SCOPES_WAVEFRM_YCC_601, "YCBCR601", ICON_COLOR, "YCbCr (ITU 601)", ""},
+ {SCOPES_WAVEFRM_YCC_709, "YCBCR709", ICON_COLOR, "YCbCr (ITU 709)", ""},
+ {SCOPES_WAVEFRM_YCC_JPEG, "YCBCRJPG", ICON_COLOR, "YCbCr (Jpeg)", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "Scopes", NULL);
+ RNA_def_struct_ui_text(srna, "Scopes", "Scopes for statistical view of an image");
+
+ prop= RNA_def_property(srna, "use_full_resolution", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, "Scopes", "sample_full", 1);
+ RNA_def_property_ui_text(prop, "Full Sample", "Sample every pixel of the image");
+ RNA_def_property_update(prop, 0, "rna_Scopes_update");
+
+ prop= RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, "Scopes", "accuracy");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
+ RNA_def_property_ui_text(prop, "Accuracy", "Proportion of original image source pixel lines to sample");
+ RNA_def_property_update(prop, 0, "rna_Scopes_update");
+
+ prop= RNA_def_property(srna, "histogram", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, "Scopes", "hist");
+ RNA_def_property_struct_type(prop, "Histogram");
+ RNA_def_property_ui_text(prop, "Histogram", "Histogram for viewing image statistics");
+
+ prop= RNA_def_property(srna, "waveform_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, "Scopes", "wavefrm_mode");
+ RNA_def_property_enum_items(prop, prop_wavefrm_mode_items);
+ RNA_def_property_ui_text(prop, "Wavefrom Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Scopes_update");
+
+ prop= RNA_def_property(srna, "waveform_alpha", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, "Scopes", "wavefrm_alpha");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Waveform Opacity", "Opacity of the points");
+
+ prop= RNA_def_property(srna, "vectorscope_alpha", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, "Scopes", "vecscope_alpha");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Vectorscope Opacity", "Opacity of the points");
}
+
void RNA_def_color(BlenderRNA *brna)
{
rna_def_curvemappoint(brna);
@@ -457,6 +528,7 @@ void RNA_def_color(BlenderRNA *brna)
rna_def_color_ramp_element(brna);
rna_def_color_ramp(brna);
rna_def_histogram(brna);
+ rna_def_scopes(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 8b3a54af4c2..b7165234ef2 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -458,7 +458,7 @@ 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)
+static void rna_SpaceImageEditor_scopes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
ImBuf *ibuf;
@@ -466,13 +466,12 @@ static void rna_SpaceImageEditor_histogram_update(Main *bmain, Scene *scene, Poi
ibuf= ED_space_image_acquire_buffer(sima, &lock);
if(ibuf) {
- histogram_update(&sima->hist, ibuf);
+ scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT);
WM_main_add_notifier(NC_IMAGE, sima->image);
}
ED_space_image_release_buffer(sima, lock);
}
-
/* Space Text Editor */
static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value)
@@ -1215,12 +1214,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, "scopes", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "scopes");
+ RNA_def_property_struct_type(prop, "Scopes");
+ RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize image statistics.");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_scopes_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 89c7876f6e0..7c78d8a74e7 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -335,6 +335,14 @@ 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_waveform", "uiTemplateWaveform");
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
+
+ func= RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
+ 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.");