Skip to content

Commit daae18d

Browse files
committed
wb: keep CCT / illuminant / color swatch updated for DT_ILLUMINANT_FROM_WB is wb_coeffs are adjusted by user in _white balance_
1 parent e93e74f commit daae18d

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

src/iop/channelmixerrgb.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,6 +3076,38 @@ static void _preview_pipe_finished_callback(gpointer instance, dt_iop_module_t *
30763076

30773077
dt_iop_gui_enter_critical_section(self);
30783078
gtk_label_set_markup(GTK_LABEL(g->label_delta_E), g->delta_E_label_text);
3079+
3080+
dt_iop_channelmixer_rgb_params_t *p = self->params;
3081+
if(p->illuminant == DT_ILLUMINANT_FROM_WB)
3082+
{
3083+
// The WB coefficients might have changed in the temperature module.
3084+
// We need to re-calculate the chromaticity (x, y) to update the GUI feedback.
3085+
float x = p->x;
3086+
float y = p->y;
3087+
3088+
if(find_temperature_from_wb_coeffs(&(self->dev->image_storage), self->dev->chroma.wb_coeffs, &x, &y))
3089+
{
3090+
p->x = x;
3091+
p->y = y;
3092+
3093+
darktable.gui->reset++;
3094+
// Update derived GUI widgets (CCT label, color patch)
3095+
_update_approx_cct(self);
3096+
_update_illuminant_color(self);
3097+
3098+
// Update Hue/Chroma sliders to match the new coordinates
3099+
dt_aligned_pixel_t xyY = { p->x, p->y, 1.f };
3100+
dt_aligned_pixel_t Lch;
3101+
dt_xyY_to_Lch(xyY, Lch);
3102+
3103+
if(Lch[1] > 0)
3104+
dt_bauhaus_slider_set(g->illum_x, rad2degf(Lch[2]));
3105+
dt_bauhaus_slider_set(g->illum_y, Lch[1]);
3106+
3107+
darktable.gui->reset--;
3108+
}
3109+
}
3110+
30793111
dt_iop_gui_leave_critical_section(self);
30803112
_set_trouble_messages(self);
30813113
}

0 commit comments

Comments
 (0)