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:
authorCampbell Barton <ideasman42@gmail.com>2012-06-21 18:37:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-21 18:37:56 +0400
commit5def0b6c55d13b07bd59863174379110395e1fed (patch)
tree200766f14226d049ed858ac51108467bf28b9923 /source/blender/editors
parentc896a9921371a01b95046dd3522a7758a4e9a878 (diff)
display a sample line in the hue correct, handy to sample the image to know what to change
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_draw.c16
-rw-r--r--source/blender/editors/space_image/image_ops.c4
-rw-r--r--source/blender/editors/space_node/drawnode.c11
-rw-r--r--source/blender/editors/space_node/node_edit.c14
4 files changed, 37 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index b797b5377e3..12c88a42888 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1346,7 +1346,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
cumap = (CurveMapping *)(but->editcumap ? but->editcumap : but->poin);
cuma = cumap->cm + cumap->cur;
-
+
/* need scissor test, curve can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
scissor_new.xmin = ar->winrct.xmin + rect->xmin;
@@ -1424,7 +1424,19 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* sample option */
if (cumap->flag & CUMA_DRAW_SAMPLE) {
- if (cumap->cur == 3) {
+ if (but->a1 == UI_GRAD_H) {
+ float tsample[3];
+ float hsv[3];
+ linearrgb_to_srgb_v3_v3(tsample, cumap->sample);
+ rgb_to_hsv_v(tsample, hsv);
+ glColor3ub(240, 240, 240);
+
+ glBegin(GL_LINES);
+ glVertex2f(rect->xmin + zoomx * (hsv[0] - offsx), rect->ymin);
+ glVertex2f(rect->xmin + zoomx * (hsv[0] - offsx), rect->ymax);
+ glEnd();
+ }
+ else if (cumap->cur == 3) {
float lum = cumap->sample[0] * 0.35f + cumap->sample[1] * 0.45f + cumap->sample[2] * 0.2f;
glColor3ub(240, 240, 240);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 7e67e737cc2..3dc1fbd738f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1926,6 +1926,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
if (ibuf == NULL) {
ED_space_image_release_buffer(sima, lock);
+ info->draw = 0;
return;
}
@@ -2018,8 +2019,9 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
}
#endif
}
- else
+ else {
info->draw = 0;
+ }
ED_space_image_release_buffer(sima, lock);
ED_area_tag_redraw(CTX_wm_area(C));
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 78de45dd219..22017a2d8b9 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2134,6 +2134,17 @@ static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUS
static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
+ bNode *node = ptr->data;
+ CurveMapping *cumap = node->storage;
+
+ if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
+ cumap->flag |= CUMA_DRAW_SAMPLE;
+ copy_v3_v3(cumap->sample, _sample_col);
+ }
+ else {
+ cumap->flag &= ~CUMA_DRAW_SAMPLE;
+ }
+
uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0);
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index fc7bf473f8f..48f772e8008 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1676,10 +1676,12 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
Scene *scene = CTX_data_scene(C);
ImageSampleInfo *info = arg_info;
- ED_image_draw_info(ar, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels,
- info->x, info->y, info->col, info->colf,
- NULL, NULL /* zbuf - unused for nodes */
- );
+ if (info->draw) {
+ ED_image_draw_info(ar, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels,
+ info->x, info->y, info->col, info->colf,
+ NULL, NULL /* zbuf - unused for nodes */
+ );
+ }
}
static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
@@ -1694,8 +1696,10 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (!ibuf)
+ if (!ibuf) {
+ info->draw = 0;
return;
+ }
if (!ibuf->rect) {
if (info->color_manage)