forked from bartvdbraak/blender
Fix part of #35372: distorted strokes when painting zoomed out with a small brush
size. Interpolated mouse coordinates should not get rounded to integers.
This commit is contained in:
parent
e1cb4aade8
commit
98beda156c
@ -189,7 +189,7 @@ void UI_view2d_listview_visible_cells(struct View2D *v2d, short columnwidth, sho
|
||||
int *row_min, int *row_max);
|
||||
|
||||
/* coordinate conversion */
|
||||
void UI_view2d_region_to_view(struct View2D *v2d, int x, int y, float *viewx, float *viewy);
|
||||
void UI_view2d_region_to_view(struct View2D *v2d, float x, float y, float *viewx, float *viewy);
|
||||
void UI_view2d_view_to_region(struct View2D *v2d, float x, float y, int *regionx, int *regiony);
|
||||
void UI_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, int *regionx, int *region_y);
|
||||
|
||||
|
@ -1961,7 +1961,7 @@ void UI_view2d_listview_visible_cells(View2D *v2d, short columnwidth, short rowh
|
||||
* - x,y = coordinates to convert
|
||||
* - viewx,viewy = resultant coordinates
|
||||
*/
|
||||
void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *r_viewx, float *r_viewy)
|
||||
void UI_view2d_region_to_view(View2D *v2d, float x, float y, float *r_viewx, float *r_viewy)
|
||||
{
|
||||
float div, ofs;
|
||||
|
||||
|
@ -446,7 +446,7 @@ typedef struct PaintOperation {
|
||||
|
||||
void *custom_paint;
|
||||
|
||||
int prevmouse[2];
|
||||
float prevmouse[2];
|
||||
double starttime;
|
||||
|
||||
ViewContext vc;
|
||||
@ -545,13 +545,11 @@ static void paint_stroke_update_step(bContext *C, struct PaintStroke *stroke, Po
|
||||
float startsize = BKE_brush_size_get(scene, brush);
|
||||
float startalpha = BKE_brush_alpha_get(scene, brush);
|
||||
|
||||
float mousef[2];
|
||||
float mouse[2];
|
||||
float pressure;
|
||||
int mouse[2], redraw, eraser;
|
||||
int redraw, eraser;
|
||||
|
||||
RNA_float_get_array(itemptr, "mouse", mousef);
|
||||
mouse[0] = (int)(mousef[0]);
|
||||
mouse[1] = (int)(mousef[1]);
|
||||
RNA_float_get_array(itemptr, "mouse", mouse);
|
||||
pressure = RNA_float_get(itemptr, "pressure");
|
||||
eraser = RNA_boolean_get(itemptr, "pen_flip");
|
||||
|
||||
|
@ -1016,7 +1016,7 @@ static void paint_2d_canvas_free(ImagePaintState *s)
|
||||
image_undo_remove_masks();
|
||||
}
|
||||
|
||||
int paint_2d_stroke(void *ps, const int prev_mval[2], const int mval[2], int eraser)
|
||||
int paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], int eraser)
|
||||
{
|
||||
float newuv[2], olduv[2];
|
||||
int redraw = 0;
|
||||
|
@ -3206,7 +3206,7 @@ static void project_paint_begin(ProjPaintState *ps)
|
||||
BLI_linklist_free(image_LinkList, NULL);
|
||||
}
|
||||
|
||||
static void paint_proj_begin_clone(ProjPaintState *ps, const int mouse[2])
|
||||
static void paint_proj_begin_clone(ProjPaintState *ps, const float mouse[2])
|
||||
{
|
||||
/* setup clone offset */
|
||||
if (ps->tool == PAINT_TOOL_CLONE) {
|
||||
@ -4044,23 +4044,17 @@ static int project_paint_op(void *state, const float lastpos[2], const float pos
|
||||
}
|
||||
|
||||
|
||||
int paint_proj_stroke(bContext *C, void *pps, const int prevmval_i[2], const int mval_i[2])
|
||||
int paint_proj_stroke(bContext *C, void *pps, const float prev_pos[2], const float pos[2])
|
||||
{
|
||||
ProjPaintState *ps = pps;
|
||||
int a, redraw;
|
||||
float pos[2], prev_pos[2];
|
||||
|
||||
pos[0] = (float)(mval_i[0]);
|
||||
pos[1] = (float)(mval_i[1]);
|
||||
|
||||
prev_pos[0] = (float)(prevmval_i[0]);
|
||||
prev_pos[1] = (float)(prevmval_i[1]);
|
||||
|
||||
/* clone gets special treatment here to avoid going through image initialization */
|
||||
if (ps->tool == PAINT_TOOL_CLONE && ps->mode == BRUSH_STROKE_INVERT) {
|
||||
Scene *scene = ps->scene;
|
||||
View3D *v3d = ps->v3d;
|
||||
float *cursor = give_cursor(scene, v3d);
|
||||
int mval_i[2] = {(int)pos[0], (int)pos[1]};
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
@ -4160,7 +4154,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
|
||||
return;
|
||||
}
|
||||
|
||||
void *paint_proj_new_stroke(bContext *C, Object *ob, const int mouse[2], int mode)
|
||||
void *paint_proj_new_stroke(bContext *C, Object *ob, const float mouse[2], int mode)
|
||||
{
|
||||
ProjPaintState *ps = MEM_callocN(sizeof(ProjPaintState), "ProjectionPaintState");
|
||||
project_state_init(C, ob, ps, mode);
|
||||
|
@ -141,9 +141,9 @@ int get_imapaint_zoom(struct bContext *C, float *zoomx, float *zoomy);
|
||||
void *paint_2d_new_stroke(struct bContext *, struct wmOperator *);
|
||||
void paint_2d_redraw(const bContext *C, void *ps, int final);
|
||||
void paint_2d_stroke_done(void *ps);
|
||||
int paint_2d_stroke(void *ps, const int prev_mval[2], const int mval[2], int eraser);
|
||||
void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const int mouse[2], int mode);
|
||||
int paint_proj_stroke(struct bContext *C, void *ps, const int prevmval_i[2], const int mval_i[2]);
|
||||
int paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], int eraser);
|
||||
void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const float mouse[2], int mode);
|
||||
int paint_proj_stroke(struct bContext *C, void *ps, const float prevmval_i[2], const float mval_i[2]);
|
||||
void paint_proj_stroke_done(void *ps);
|
||||
void paint_brush_init_tex(struct Brush *brush);
|
||||
void paint_brush_exit_tex(struct Brush *brush);
|
||||
|
Loading…
Reference in New Issue
Block a user