Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_image.c
| Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void paint_brush_color_get(struct Scene *scene, | void paint_brush_color_get(struct Scene *scene, | ||||
| struct Brush *br, | struct Brush *br, | ||||
| bool color_correction, | bool color_correction, | ||||
| bool invert, | bool invert, | ||||
| float distance, | float distance, | ||||
| float pressure, | float pressure, | ||||
| float color[3], | float color[4], | ||||
| struct ColorManagedDisplay *display) | struct ColorManagedDisplay *display) | ||||
| { | { | ||||
| if (invert) { | if (invert) { | ||||
| copy_v3_v3(color, BKE_brush_secondary_color_get(scene, br)); | copy_v3_v3(color, BKE_brush_secondary_color_get(scene, br)); | ||||
| color[3] = 1.0f; | |||||
| } | } | ||||
| else { | else { | ||||
| if (br->flag & BRUSH_USE_GRADIENT) { | if (br->flag & BRUSH_USE_GRADIENT) { | ||||
| float color_gr[4]; | float color_gr[4]; | ||||
| switch (br->gradient_stroke_mode) { | switch (br->gradient_stroke_mode) { | ||||
| case BRUSH_GRADIENT_PRESSURE: | case BRUSH_GRADIENT_PRESSURE: | ||||
| BKE_colorband_evaluate(br->gradient, pressure, color_gr); | BKE_colorband_evaluate(br->gradient, pressure, color_gr); | ||||
| break; | break; | ||||
| case BRUSH_GRADIENT_SPACING_REPEAT: { | case BRUSH_GRADIENT_SPACING_REPEAT: { | ||||
| float coord = fmod(distance / br->gradient_spacing, 1.0); | float coord = fmod(distance / br->gradient_spacing, 1.0); | ||||
| BKE_colorband_evaluate(br->gradient, coord, color_gr); | BKE_colorband_evaluate(br->gradient, coord, color_gr); | ||||
| break; | break; | ||||
| } | } | ||||
| case BRUSH_GRADIENT_SPACING_CLAMP: { | case BRUSH_GRADIENT_SPACING_CLAMP: { | ||||
| BKE_colorband_evaluate(br->gradient, distance / br->gradient_spacing, color_gr); | BKE_colorband_evaluate(br->gradient, distance / br->gradient_spacing, color_gr); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| copy_v3_v3(color, color_gr); | copy_v4_v4(color, color_gr); | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v3_v3(color, BKE_brush_color_get(scene, br)); | copy_v3_v3(color, BKE_brush_color_get(scene, br)); | ||||
| color[3] = 1.0f; | |||||
| } | } | ||||
| } | } | ||||
| if (color_correction) { | if (color_correction) { | ||||
| IMB_colormanagement_display_to_scene_linear_v3(color, display); | IMB_colormanagement_display_to_scene_linear_v3(color, display); | ||||
| } | } | ||||
| } | } | ||||
| void paint_brush_init_tex(Brush *brush) | void paint_brush_init_tex(Brush *brush) | ||||
| ▲ Show 20 Lines • Show All 947 Lines • Show Last 20 Lines | |||||