Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_stroke.c
| Show First 20 Lines • Show All 1,456 Lines • ▼ Show 20 Lines | #endif | ||||
| /* one time initialization */ | /* one time initialization */ | ||||
| if (!stroke->stroke_init) { | if (!stroke->stroke_init) { | ||||
| if (paint_stroke_curve_end(C, op, stroke)) { | if (paint_stroke_curve_end(C, op, stroke)) { | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| if (paint_supports_smooth_stroke(br, mode)) { | if (paint_supports_smooth_stroke(br, mode)) { | ||||
| stroke->stroke_cursor = WM_paint_cursor_activate( | stroke->stroke_cursor = WM_paint_cursor_activate( | ||||
| SPACE_TYPE_ANY, RGN_TYPE_ANY, paint_poll, paint_draw_smooth_cursor, stroke); | SPACE_TYPE_ANY, RGN_TYPE_ANY, PAINT_brush_tool_poll, paint_draw_smooth_cursor, stroke); | ||||
| } | } | ||||
| stroke->stroke_init = true; | stroke->stroke_init = true; | ||||
| first_modal = true; | first_modal = true; | ||||
| } | } | ||||
| /* one time stroke initialization */ | /* one time stroke initialization */ | ||||
| if (!stroke->stroke_started) { | if (!stroke->stroke_started) { | ||||
| Show All 10 Lines | if (!stroke->stroke_started) { | ||||
| if (stroke->stroke_started) { | if (stroke->stroke_started) { | ||||
| if (br->flag & BRUSH_AIRBRUSH) { | if (br->flag & BRUSH_AIRBRUSH) { | ||||
| stroke->timer = WM_event_add_timer( | stroke->timer = WM_event_add_timer( | ||||
| CTX_wm_manager(C), CTX_wm_window(C), TIMER, stroke->brush->rate); | CTX_wm_manager(C), CTX_wm_window(C), TIMER, stroke->brush->rate); | ||||
| } | } | ||||
| if (br->flag & BRUSH_LINE) { | if (br->flag & BRUSH_LINE) { | ||||
| stroke->stroke_cursor = WM_paint_cursor_activate( | stroke->stroke_cursor = WM_paint_cursor_activate( | ||||
| SPACE_TYPE_ANY, RGN_TYPE_ANY, paint_poll, paint_draw_line_cursor, stroke); | SPACE_TYPE_ANY, RGN_TYPE_ANY, PAINT_brush_tool_poll, paint_draw_line_cursor, stroke); | ||||
| } | } | ||||
| first_dab = true; | first_dab = true; | ||||
| } | } | ||||
| } | } | ||||
| /* Cancel */ | /* Cancel */ | ||||
| if (event->type == EVT_MODAL_MAP && event->val == PAINT_STROKE_MODAL_CANCEL) { | if (event->type == EVT_MODAL_MAP && event->val == PAINT_STROKE_MODAL_CANCEL) { | ||||
| ▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | float paint_stroke_distance_get(struct PaintStroke *stroke) | ||||
| return stroke->stroke_distance; | return stroke->stroke_distance; | ||||
| } | } | ||||
| void paint_stroke_set_mode_data(PaintStroke *stroke, void *mode_data) | void paint_stroke_set_mode_data(PaintStroke *stroke, void *mode_data) | ||||
| { | { | ||||
| stroke->mode_data = mode_data; | stroke->mode_data = mode_data; | ||||
| } | } | ||||
| bool paint_poll(bContext *C) | bool PAINT_brush_tool_poll(bContext *C) | ||||
| { | { | ||||
| Paint *p = BKE_paint_get_active_from_context(C); | Paint *p = BKE_paint_get_active_from_context(C); | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| if (p && ob && BKE_paint_brush(p) && | if (p && ob && BKE_paint_brush(p) && | ||||
| (area && ELEM(area->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) && | (area && ELEM(area->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) && | ||||
| Show All 9 Lines | |||||