Support table erasor in projective painting as well.
This commit is contained in:
@@ -819,7 +819,7 @@ static void paint_stroke_update_step(bContext *C, struct PaintStroke *stroke, Po
|
||||
}
|
||||
|
||||
if (pop->mode == PAINT_MODE_3D_PROJECT) {
|
||||
paint_proj_stroke(C, pop->custom_paint, pop->prevmouse, mouse, pressure, distance, size);
|
||||
paint_proj_stroke(C, pop->custom_paint, pop->prevmouse, mouse, eraser, pressure, distance, size);
|
||||
}
|
||||
else {
|
||||
paint_2d_stroke(pop->custom_paint, pop->prevmouse, mouse, eraser, pressure, distance, size);
|
||||
@@ -858,7 +858,8 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
|
||||
paint_2d_gradient_fill(C, brush, pop->startmouse, pop->prevmouse, pop->custom_paint);
|
||||
}
|
||||
else {
|
||||
paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, 1.0, 0.0, BKE_brush_size_get(scene, brush));
|
||||
paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
|
||||
1.0, 0.0, BKE_brush_size_get(scene, brush));
|
||||
/* two redraws, one for GPU update, one for notification */
|
||||
paint_proj_redraw(C, pop->custom_paint, false);
|
||||
paint_proj_redraw(C, pop->custom_paint, true);
|
||||
@@ -872,7 +873,8 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
|
||||
paint_2d_bucket_fill(C, color, brush, pop->prevmouse, pop->custom_paint);
|
||||
}
|
||||
else {
|
||||
paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, 1.0, 0.0, BKE_brush_size_get(scene, brush));
|
||||
paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
|
||||
1.0, 0.0, BKE_brush_size_get(scene, brush));
|
||||
/* two redraws, one for GPU update, one for notification */
|
||||
paint_proj_redraw(C, pop->custom_paint, false);
|
||||
paint_proj_redraw(C, pop->custom_paint, true);
|
||||
|
||||
@@ -1166,7 +1166,7 @@ static void paint_2d_canvas_free(ImagePaintState *s)
|
||||
image_undo_remove_masks();
|
||||
}
|
||||
|
||||
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], int eraser, float pressure, float distance, float size)
|
||||
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], const bool eraser, float pressure, float distance, float size)
|
||||
{
|
||||
float newuv[2], olduv[2];
|
||||
ImagePaintState *s = ps;
|
||||
|
||||
@@ -4377,7 +4377,7 @@ static bool project_paint_op(void *state, const float lastpos[2], const float po
|
||||
}
|
||||
|
||||
|
||||
void paint_proj_stroke(const bContext *C, void *pps, const float prev_pos[2], const float pos[2], float pressure, float distance, float size)
|
||||
void paint_proj_stroke(const bContext *C, void *pps, const float prev_pos[2], const float pos[2], const bool eraser, float pressure, float distance, float size)
|
||||
{
|
||||
ProjPaintState *ps = pps;
|
||||
Brush *brush = ps->brush;
|
||||
@@ -4385,7 +4385,10 @@ void paint_proj_stroke(const bContext *C, void *pps, const float prev_pos[2], co
|
||||
int a;
|
||||
|
||||
ps->brush_size = size;
|
||||
|
||||
ps->blend = brush->blend;
|
||||
if (eraser)
|
||||
ps->blend = IMB_BLEND_ERASE_ALPHA;
|
||||
|
||||
/* clone gets special treatment here to avoid going through image initialization */
|
||||
if (ps->tool == PAINT_TOOL_CLONE && ps->mode == BRUSH_STROKE_INVERT) {
|
||||
View3D *v3d = ps->v3d;
|
||||
|
||||
@@ -84,6 +84,7 @@ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
|
||||
int paint_stroke_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||
int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
|
||||
void paint_stroke_cancel(struct bContext *C, struct wmOperator *op);
|
||||
bool paint_stroke_flipped(struct PaintStroke *stroke);
|
||||
struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);
|
||||
void *paint_stroke_mode_data(struct PaintStroke *stroke);
|
||||
float paint_stroke_distance_get(struct PaintStroke *stroke);
|
||||
@@ -161,11 +162,11 @@ int get_imapaint_zoom(struct bContext *C, float *zoomx, float *zoomy);
|
||||
void *paint_2d_new_stroke(struct bContext *, struct wmOperator *, int mode);
|
||||
void paint_2d_redraw(const bContext *C, void *ps, bool final);
|
||||
void paint_2d_stroke_done(void *ps);
|
||||
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], int eraser, float pressure, float distance, float size);
|
||||
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], const bool eraser, float pressure, float distance, float size);
|
||||
void paint_2d_bucket_fill(const struct bContext *C, const float color[3], struct Brush *br, const float mouse_init[2], void *ps);
|
||||
void paint_2d_gradient_fill (const struct bContext *C, struct Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps);
|
||||
void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const float mouse[2], int mode);
|
||||
void paint_proj_stroke(const struct bContext *C, void *ps, const float prevmval_i[2], const float mval_i[2], float pressure, float distance, float size);
|
||||
void paint_proj_stroke(const struct bContext *C, void *ps, const float prevmval_i[2], const float mval_i[2], const bool eraser, float pressure, float distance, float size);
|
||||
void paint_proj_redraw(const struct bContext *C, void *pps, bool final);
|
||||
void paint_proj_stroke_done(void *ps);
|
||||
void paint_proj_mesh_data_ensure(bContext *C, struct Object *ob, struct wmOperator *op);
|
||||
|
||||
@@ -1123,6 +1123,11 @@ void *paint_stroke_mode_data(struct PaintStroke *stroke)
|
||||
return stroke->mode_data;
|
||||
}
|
||||
|
||||
bool paint_stroke_flipped(struct PaintStroke *stroke)
|
||||
{
|
||||
return stroke->pen_flip;
|
||||
}
|
||||
|
||||
float paint_stroke_distance_get(struct PaintStroke *stroke)
|
||||
{
|
||||
return stroke->stroke_distance;
|
||||
|
||||
Reference in New Issue
Block a user