Image Editor Vectorscope Improvement #116974

Merged
Aras Pranckevicius merged 13 commits from JonasDichelle/blender:vectorscope-update into main 2024-02-06 12:22:57 +01:00
4 changed files with 39 additions and 10 deletions
Showing only changes of commit 6a02924793 - Show all commits

View File

@ -1427,8 +1427,11 @@ class IMAGE_PT_view_vectorscope(ImageScopesPanel, Panel):
layout = self.layout
sima = context.space_data
layout.template_vectorscope(sima, "scopes")
layout.prop(sima.scopes, "vectorscope_alpha")
row = layout.split(factor=0.75)
row.prop(sima.scopes, "vectorscope_alpha")
row.prop(sima.scopes, "vectorscope_mode", text="")
class IMAGE_PT_sample_line(ImageScopesPanel, Panel):

View File

@ -991,8 +991,7 @@ void ui_draw_but_VECTORSCOPE(ARegion * /*region*/,
const float centery = rect.ymin + h * 0.5f;
const float diam = (w < h) ? w : h;
const float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
const float vecsope_col[3] = {alpha, alpha, alpha};
const float alpha = scopes->vecscope_alpha;
GPU_blend(GPU_BLEND_ALPHA);
@ -1123,14 +1122,21 @@ void ui_draw_but_VECTORSCOPE(ARegion * /*region*/,
if (scopes->ok && scopes->vecscope != nullptr) {
/* pixel point cloud */
GPU_blend(GPU_BLEND_ALPHA);
GPU_point_size(1.0);
GPU_matrix_push();
GPU_matrix_translate_2f(centerx, centery);
GPU_matrix_scale_1f(diam);
waveform_draw_rgb(scopes->vecscope, scopes->waveform_tot, scopes->vecscope_rgb);
const float col[3] = {alpha, alpha, alpha};
if (scopes->vecscope_mode == SCOPES_VECSCOPE_RGB) {
GPU_blend(GPU_BLEND_ALPHA);
waveform_draw_rgb(scopes->vecscope, scopes->waveform_tot, scopes->vecscope_rgb);
}
else if (scopes->vecscope_mode == SCOPES_VECSCOPE_LUMA) {
GPU_blend(GPU_BLEND_ADDITIVE);
waveform_draw_one(scopes->vecscope, scopes->waveform_tot, col);
}
GPU_matrix_pop();
}

View File

@ -150,13 +150,15 @@ typedef struct Scopes {
int ok;
int sample_full;
int sample_lines;
float accuracy;
int wavefrm_mode;
int vecscope_mode;
int wavefrm_height;
int vecscope_height;
int waveform_tot;
float accuracy;
float wavefrm_alpha;
float wavefrm_yfac;
int wavefrm_height;
float vecscope_alpha;
int vecscope_height;
float minmax[3][2];
struct Histogram hist;
float *waveform_1;
@ -164,8 +166,7 @@ typedef struct Scopes {
float *waveform_3;
float *vecscope;
float *vecscope_rgb;
int waveform_tot;
char _pad[4];
char _pad[8]; // Adjusted for alignment
JonasDichelle marked this conversation as resolved Outdated

Is the _pad needed at all now?

Is the `_pad` needed at all now?

good catch thanks!

good catch thanks!
} Scopes;
/** #Scopes.wavefrm_mode */
@ -178,6 +179,12 @@ enum {
SCOPES_WAVEFRM_RGB = 5,
};
/** #Scopes.vecscope_mode */
enum {
SCOPES_VECSCOPE_RGB = 0,
SCOPES_VECSCOPE_LUMA = 1,
};
typedef struct ColorManagedViewSettings {
int flag;
char _pad[4];

View File

@ -1145,6 +1145,12 @@ static void rna_def_scopes(BlenderRNA *brna)
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem prop_vecscope_mode_items[] = {
{SCOPES_VECSCOPE_LUMA, "LUMA", ICON_COLOR, "Luma", ""},
{SCOPES_VECSCOPE_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
aras_p marked this conversation as resolved Outdated

"Red Green Blue" as a UI label feels a bit weird (and hardly fits into UI control space). Maybe "RGB" or "Color" instead?

"Red Green Blue" as a UI label feels a bit weird (and hardly fits into UI control space). Maybe "RGB" or "Color" instead?

I had the same issue with this but looking at all other scopes they use Red Green Blue. This patch is just following what's already there.

Once this gets in we can do a pass and rename that for all scopes. I'd also like to make a few changes in that UI later for all scopes (the opacity slider after the type selector, leave just "opacity" in the label so it's less verbose, remove icon from enum, etc).

I had the same issue with this but looking at all other scopes they use `Red Green Blue`. This patch is just following what's already there. Once this gets in we can do a pass and rename that for all scopes. I'd also like to make a few changes in that UI later for all scopes (the opacity slider after the type selector, leave just "opacity" in the label so it's less verbose, remove icon from enum, etc).

I agree RGB would be better.
I just copied the label from the Waveform which has "Red Green Blue".
But I'm also in favor of changing this.

I agree RGB would be better. I just copied the label from the Waveform which has "Red Green Blue". But I'm also in favor of changing this.
{0, nullptr, 0, nullptr, nullptr},
};
srna = RNA_def_struct(brna, "Scopes", nullptr);
RNA_def_struct_ui_text(srna, "Scopes", "Scopes for statistical view of an image");
@ -1177,10 +1183,17 @@ static void rna_def_scopes(BlenderRNA *brna)
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_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, "Scopes", "vecscope_mode");
RNA_def_property_enum_items(prop, prop_vecscope_mode_items);
RNA_def_property_ui_text(prop, "Vectorscope Mode", "");
RNA_def_property_update(prop, 0, "rna_Scopes_update");
prop = RNA_def_property(srna, "vectorscope_alpha", PROP_FLOAT, PROP_FACTOR);
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");
RNA_def_property_update(prop, 0, "rna_Scopes_update");
}
static void rna_def_colormanage(BlenderRNA *brna)