diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-09-23 02:40:19 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-09-23 02:40:19 +0300 |
commit | 1dfb89d229304c302b8849756aa0ddd7e8d96488 (patch) | |
tree | db7a2ed403101788b2cb308538d73a99c95621d6 /source/blender/editors/sculpt_paint | |
parent | 4a1feaa5558ed60388fd3be41db74fbc54f2ab08 (diff) | |
parent | 1b2b7cfa2007172e07d78324bb941d0160b59c42 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/ghost/intern/GHOST_ContextCGL.mm
intern/ghost/intern/GHOST_WindowCocoa.mm
source/blender/makesrna/intern/rna_main.c
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index d60c8e8dbd9..f5d115442c6 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -371,6 +371,8 @@ typedef struct ProjPaintState { */ const MLoopUV **dm_mloopuv; const MLoopUV **dm_mloopuv_clone; /* other UV map, use for cloning between layers */ + + bool use_colormanagement; } ProjPaintState; typedef union pixelPointer { @@ -1623,7 +1625,12 @@ static ProjPixel *project_paint_uvpixel_init( unsigned char rgba_ub[4]; float rgba[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, rgba_ub, NULL); - srgb_to_linearrgb_uchar4(rgba, rgba_ub); + if (ps->use_colormanagement) { + srgb_to_linearrgb_uchar4(rgba, rgba_ub); + } + else { + rgba_uchar_to_float(rgba, rgba_ub); + } straight_to_premul_v4_v4(((ProjPixelClone *)projPixel)->clonepx.f, rgba); } } @@ -1632,7 +1639,12 @@ static ProjPixel *project_paint_uvpixel_init( float rgba[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, NULL, rgba); premul_to_straight_v4(rgba); - linearrgb_to_srgb_uchar3(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + if (ps->use_colormanagement) { + linearrgb_to_srgb_uchar3(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + } + else { + rgb_float_to_uchar(((ProjPixelClone *)projPixel)->clonepx.ch, rgba); + } ((ProjPixelClone *)projPixel)->clonepx.ch[3] = rgba[3] * 255; } else { /* char to char */ @@ -4359,7 +4371,12 @@ static void do_projectpaint_draw( if (ps->is_texbrush) { mul_v3_v3v3(rgb, texrgb, ps->paint_color_linear); /* TODO(sergey): Support texture paint color space. */ - linearrgb_to_srgb_v3_v3(rgb, rgb); + if (ps->use_colormanagement) { + linearrgb_to_srgb_v3_v3(rgb, rgb); + } + else { + copy_v3_v3(rgb, rgb); + } } else { copy_v3_v3(rgb, ps->paint_color); @@ -4957,11 +4974,21 @@ static void paint_proj_stroke_ps( /* handle gradient and inverted stroke color here */ if (ps->tool == PAINT_TOOL_DRAW) { paint_brush_color_get(scene, brush, false, ps->mode == BRUSH_STROKE_INVERT, distance, pressure, ps->paint_color, NULL); - srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + if (ps->use_colormanagement) { + srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + } + else { + copy_v3_v3(ps->paint_color_linear, ps->paint_color); + } } else if (ps->tool == PAINT_TOOL_FILL) { copy_v3_v3(ps->paint_color, BKE_brush_color_get(scene, brush)); - srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + if (ps->use_colormanagement) { + srgb_to_linearrgb_v3_v3(ps->paint_color_linear, ps->paint_color); + } + else { + copy_v3_v3(ps->paint_color_linear, ps->paint_color); + } } else if (ps->tool == PAINT_TOOL_MASK) { ps->stencil_value = brush->weight; @@ -5112,7 +5139,9 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->normal_angle_inner__cos = cosf(ps->normal_angle_inner); ps->dither = settings->imapaint.dither; - + + ps->use_colormanagement = BKE_scene_check_color_management_enabled(CTX_data_scene(C)); + return; } @@ -5783,7 +5812,7 @@ void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot) /* properties */ prop = RNA_def_enum(ot->srna, "type", layer_type_items, 0, "Type", "Merge method to use"); RNA_def_property_flag(prop, PROP_HIDDEN); - RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image datablock name"); + RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image data-block name"); prop = RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384); RNA_def_property_subtype(prop, PROP_PIXEL); prop = RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384); |