Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_cursor.c
| Show First 20 Lines • Show All 1,222 Lines • ▼ Show 20 Lines | if (brush->flag & BRUSH_CURVE) { | ||||
| return; | return; | ||||
| } | } | ||||
| float zoomx, zoomy; | float zoomx, zoomy; | ||||
| get_imapaint_zoom(C, &zoomx, &zoomy); | get_imapaint_zoom(C, &zoomx, &zoomy); | ||||
| zoomx = max_ff(zoomx, zoomy); | zoomx = max_ff(zoomx, zoomy); | ||||
| /* set various defaults */ | /* set various defaults */ | ||||
| const float *outline_col = brush->add_col; | float outline_col[4]; | ||||
| const float outline_alpha = 0.5f; | const float outline_alpha = 0.5f; | ||||
| float translation[2] = {x, y}; | float translation[2] = {x, y}; | ||||
| float final_radius = (BKE_brush_size_get(scene, brush) * zoomx); | float final_radius = (BKE_brush_size_get(scene, brush) * zoomx); | ||||
| UI_GetThemeColor4fv(TH_PAINT_CURSOR, outline_col); | |||||
| /* don't calculate rake angles while a stroke is active because the rake variables are global | /* don't calculate rake angles while a stroke is active because the rake variables are global | ||||
| * and we may get interference with the stroke itself. | * and we may get interference with the stroke itself. | ||||
| * For line strokes, such interference is visible */ | * For line strokes, such interference is visible */ | ||||
| if (!ups->stroke_active) { | if (!ups->stroke_active) { | ||||
| paint_calculate_rake_rotation(ups, brush, translation); | paint_calculate_rake_rotation(ups, brush, translation); | ||||
| } | } | ||||
| /* draw overlay */ | /* draw overlay */ | ||||
| bool alpha_overlay_active = paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode); | bool alpha_overlay_active = paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode); | ||||
| /* TODO: as sculpt and other paint modes are unified, this | /* TODO: as sculpt and other paint modes are unified, this | ||||
| * special mode of drawing will go away */ | * special mode of drawing will go away */ | ||||
| if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt) { | if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt) { | ||||
| float location[3]; | float location[3]; | ||||
| int pixel_radius; | int pixel_radius; | ||||
| /* test if brush is over the mesh */ | /* test if brush is over the mesh */ | ||||
| bool hit = sculpt_get_brush_geometry(C, &vc, x, y, &pixel_radius, location, ups); | bool hit = sculpt_get_brush_geometry(C, &vc, x, y, &pixel_radius, location, ups); | ||||
| if (BKE_brush_use_locked_size(scene, brush)) { | if (BKE_brush_use_locked_size(scene, brush)) { | ||||
| BKE_brush_size_set(scene, brush, pixel_radius); | BKE_brush_size_set(scene, brush, pixel_radius); | ||||
| } | } | ||||
| /* check if brush is subtracting, use different color then */ | |||||
| /* TODO: no way currently to know state of pen flip or | |||||
| * invert key modifier without starting a stroke */ | |||||
| if (((ups->draw_inverted == 0) ^ ((brush->flag & BRUSH_DIR_IN) == 0)) && | |||||
| BKE_brush_sculpt_has_secondary_color(brush)) { | |||||
| outline_col = brush->sub_col; | |||||
| } | |||||
| /* only do if brush is over the mesh */ | /* only do if brush is over the mesh */ | ||||
| if (hit) { | if (hit) { | ||||
| paint_cursor_on_hit(ups, brush, &vc, location); | paint_cursor_on_hit(ups, brush, &vc, location); | ||||
| } | } | ||||
| } | } | ||||
| if (ups->draw_anchored) { | if (ups->draw_anchored) { | ||||
| final_radius = ups->anchored_size; | final_radius = ups->anchored_size; | ||||
| ▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines | |||||