93namespace ed::sculpt_paint {
96#define PAINT_STROKE_MODAL_CANCEL 1
144 void *stroke_cursor_ =
nullptr;
147 std::optional<RandomNumberGenerator> rng_ = std::nullopt;
152 int num_samples_ = 0;
154 int tot_samples_ = 0;
156 float3 last_world_space_position_ =
float3(0.0f, 0.0f, 0.0f);
157 float3 last_scene_spacing_delta_ =
float3(0.0f, 0.0f, 0.0f);
159 bool stroke_over_mesh_ =
false;
161 float stroke_distance_ = 0.0f;
166 bool stroke_started_ =
false;
168 bool rake_started_ =
false;
172 bool stroke_init_ =
false;
174 bool input_init_ =
false;
176 float cached_size_pressure_ = 0.0f;
178 float last_pressure_ = 0.0f;
182 float last_tablet_event_pressure_ = 0.0f;
184 float zoom_2d_ = 0.0f;
185 bool pen_flip_ =
false;
190 bool original_ =
false;
239 return stroke_distance_;
281 virtual void done(
bool is_cancel,
bool stroke_started) = 0;
288 const float mouse_init[2],
292 bool *r_location_is_set);
295 void add_sample(
int input_samples,
float x,
float y,
float pressure);
301 float *length_residue,
442 ImBuf *ibuf,
int x,
int y,
int w,
int h,
int *tx,
int *ty,
int *tw,
int *th);
448 const float prev_mval[2],
458 const float color[3],
460 const float mouse_init[2],
461 const float mouse_final[2],
464 const bContext *
C,
Brush *br,
const float mouse_init[2],
const float mouse_final[2],
void *ps);
467 const float mouse[2],
472 const float prev_pos[2],
483 std::optional<float3> &initial_hsv_jitter,
542 const float cursor_position[2]);
604 return i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || !
ELEM(i, 3, 5)));
634#define PAINT_CURVE_NUM_SEGMENTS 40
#define PAINT_MAX_INPUT_SAMPLES
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
virtual ~PaintModeData()=default
float distance(float, float) RET
float2x2 invert(float2x2 mat)
void BRUSH_OT_asset_save(wmOperatorType *ot)
void PAINT_OT_sample_color(wmOperatorType *ot)
bool paint_supports_texture(PaintMode mode)
void BRUSH_OT_asset_delete(wmOperatorType *ot)
void BRUSH_OT_asset_edit_metadata(wmOperatorType *ot)
float3 symmetry_flip(const float3 &src, const ePaintSymmetryFlags symm)
bool paint_supports_dynamic_tex_coords(const Brush &br, PaintMode mode)
bool paint_supports_dynamic_size(const Brush &br, PaintMode mode)
float2 paint_stroke_jitter_pos(Paint *paint, PaintMode mode, const Brush &brush, float pressure, BrushStrokeMode stroke_mode, float zoom_2d, const float2 &mval)
void BRUSH_OT_asset_load_preview(wmOperatorType *ot)
bool paint_brush_cursor_poll(bContext *C)
void BRUSH_OT_asset_revert(wmOperatorType *ot)
bool paint_space_stroke_enabled(const Brush &br, PaintMode mode)
bool paint_supports_smooth_stroke(const Brush &brush, PaintMode mode, BrushSwitchMode brush_switch_mode)
void BRUSH_OT_asset_save_as(wmOperatorType *ot)
void BRUSH_OT_asset_activate(wmOperatorType *ot)
bool paint_brush_tool_poll(bContext *C)
bool is_symmetry_iteration_valid(const char i, const char symm)
void PAINT_OT_face_select_linked(wmOperatorType *ot)
void PAINT_OT_image_paint(wmOperatorType *ot)
bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
bool ED_wpaint_ensure_data(bContext *C, ReportList *reports, eWPaintFlag flag, WPaintVGroupIndex *vgroup_index)
void paint_2d_bucket_fill(const bContext *C, const float color[3], Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps)
void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot)
bool weight_paint_poll(bContext *C)
void PAINT_OT_project_image(wmOperatorType *ot)
bool vertex_paint_poll_ignore_tool(bContext *C)
void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
void PAINT_OT_vertex_color_set(wmOperatorType *ot)
bool image_texture_paint_poll(bContext *C)
void * paint_2d_new_stroke(bContext *C, wmOperator *op, const BrushStrokeMode mode)
void PAINT_OT_weight_sample_group(wmOperatorType *ot)
bool mask_paint_poll(bContext *C)
void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
void PALETTE_OT_new(wmOperatorType *ot)
void PAINT_OT_face_vert_reveal(wmOperatorType *ot)
void SCULPT_OT_uv_sculpt_relax(wmOperatorType *ot)
void PAINT_OT_vertex_paint(wmOperatorType *ot)
void PAINT_OT_vert_select_linked(wmOperatorType *ot)
void imapaint_image_update(ImBuf *ibuf)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
void * paint_proj_new_stroke(bContext *C, Object *ob, const float mouse[2], const BrushStrokeMode mode, const BrushSwitchMode brush_switch_mode)
void PAINT_OT_weight_paint(wmOperatorType *ot)
void paint_2d_stroke_done(void *ps, wmPaintCursor *cursor)
bool paint_curve_poll(bContext *C)
void PAINT_OT_vert_select_more(wmOperatorType *ot)
void PAINTCURVE_OT_new(wmOperatorType *ot)
void PALETTE_OT_extract_from_image(wmOperatorType *ot)
void paint_proj_redraw(const bContext *C, void *ps_handle_p, bool final)
int ED_wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
bool vert_paint_poll(bContext *C)
void paint_curve_mask_cache_free_data(CurveMaskCache *curve_mask_cache)
void PAINT_OT_grab_clone(wmOperatorType *ot)
VecBase< float, 2 > float2
void paint_brush_color_get(const Paint *paint, Brush *br, std::optional< float3 > &initial_hsv_jitter, bool invert, float distance, float pressure, float r_color[3])
bool weight_paint_mode_region_view3d_poll(bContext *C)
void PAINT_OT_vertex_color_hsv(wmOperatorType *ot)
void PAINT_OT_face_select_loop(wmOperatorType *ot)
void paint_2d_redraw(const bContext *C, void *ps, bool final)
void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
bool vertex_paint_poll(bContext *C)
void PAINT_OT_vertex_color_levels(wmOperatorType *ot)
void SCULPT_OT_uv_sculpt_pinch(wmOperatorType *ot)
void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
void paint_2d_gradient_fill(const bContext *C, Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps)
void SCULPT_OT_uv_sculpt_grab(wmOperatorType *ot)
void paint_proj_stroke(const bContext *C, void *ps_handle_p, const float prev_pos[2], const float pos[2], const bool eraser, float pressure, float distance, float size)
void PAINT_OT_vert_select_loop(wmOperatorType *ot)
void PAINTCURVE_OT_add_point(wmOperatorType *ot)
BlurKernel * paint_new_blur_kernel(Brush *br, bool proj)
void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
void PAINT_OT_vertex_color_invert(wmOperatorType *ot)
void PAINT_OT_image_from_view(wmOperatorType *ot)
void PAINT_OT_face_select_all(wmOperatorType *ot)
void PAINT_OT_weight_sample(wmOperatorType *ot)
bool paint_get_tex_pixel(const MTex *mtex, float u, float v, ImagePool *pool, int thread, float *r_intensity, float r_rgba[4])
void paint_brush_exit_tex(Brush *brush)
bool weight_paint_poll_ignore_tool(bContext *C)
bool paint_use_opacity_masking(const Paint *paint, const Brush *brush)
void imapaint_region_tiles(ImBuf *ibuf, int x, int y, int w, int h, int *tx, int *ty, int *tw, int *th)
void PAINTCURVE_OT_cursor(wmOperatorType *ot)
void paint_stroke_operator_properties(wmOperatorType *ot)
void PAINT_OT_vertex_color_smooth(wmOperatorType *ot)
void PAINT_OT_face_select_less(wmOperatorType *ot)
void PAINTCURVE_OT_slide(wmOperatorType *ot)
void PALETTE_OT_sort(wmOperatorType *ot)
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
void PAINT_OT_weight_set(wmOperatorType *ot)
bool vertex_paint_mode_poll(bContext *C)
void PAINTCURVE_OT_draw(wmOperatorType *ot)
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], const bool eraser, float pressure, float distance, float base_size)
void PALETTE_OT_color_add(wmOperatorType *ot)
void paint_init_pivot(Object *ob, Scene *scene, Paint *paint)
void PALETTE_OT_color_move(wmOperatorType *ot)
void PAINT_OT_weight_from_bones(wmOperatorType *ot)
float ED_wpaint_blend_tool(const int tool, const float weight, const float paintval, const float alpha)
ImagePaintPartialRedraw * get_imapaintpartial()
float paint_calc_object_space_radius(const ViewContext &vc, const float3 ¢er, float pixel_radius)
void paint_delete_blur_kernel(BlurKernel *kernel)
void PAINT_OT_vert_select_all(wmOperatorType *ot)
void PAINT_OT_weight_gradient(wmOperatorType *ot)
void PAINT_OT_face_select_more(wmOperatorType *ot)
void PAINT_OT_vert_select_hide(wmOperatorType *ot)
void PALETTE_OT_join(wmOperatorType *ot)
void PAINT_OT_add_simple_uvs(wmOperatorType *ot)
bool facemask_paint_poll(bContext *C)
void paint_proj_stroke_done(void *ps_handle_p, wmPaintCursor *cursor)
void PAINT_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
void PAINT_OT_vert_select_less(wmOperatorType *ot)
void PAINT_OT_face_select_hide(wmOperatorType *ot)
VecBase< float, 3 > float3
void PALETTE_OT_color_delete(wmOperatorType *ot)
void set_imapaintpartial(ImagePaintPartialRedraw *ippr)
bool weight_paint_mode_poll(bContext *C)
void PAINTCURVE_OT_select(wmOperatorType *ot)
void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
bool image_paint_poll_ignore_tool(bContext *C)
void PAINT_OT_vert_select_linked_pick(wmOperatorType *ot)
ocio::Display ColorManagedDisplay
void paint_brush_init_tex(Brush *brush)
void paint_curve_mask_cache_update(CurveMaskCache *curve_mask_cache, const Brush *brush, const int diameter, const float radius, const float cursor_position[2])
Caching structure for curve mask.
float * sampled_curve
sampled version of the brush curve-mapping.
ushort * curve_mask
Curve mask that can be passed as curve_mask parameter when.
int last_curve_timestamp
Last CurveMapping.changed_timestamp being read.
size_t curve_mask_size
Size in bytes of the curve_mask field.
UnifiedPaintSettings * ups
virtual void done(bool is_cancel, bool stroke_started)=0
virtual ~PaintStroke()=default
virtual void redraw(bool final)=0
virtual std::optional< float3 > get_location(float2 mouse, bool force_original)=0
virtual bool test_start(wmOperator *op, float2 mouse)=0
float2 last_mouse_position
float stroke_distance() const
virtual bool test_cancel()=0
bool stroke_inverted() const
wmOperatorStatus modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus exec(bContext *C, wmOperator *op)
bool stroke_flipped() const
virtual void update_step(wmOperator *op, const StrokeStep &stroke_step)=0
std::unique_ptr< PaintModeData > mode_data_