Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-15 15:16:01 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-15 15:16:01 +0400
commit98beda156c5e5c05c340abc929c585b8556e99fc (patch)
treefc210fe656d77a94d79868b5f72eeaa23e7112c7 /source/blender/editors/sculpt_paint
parente1cb4aade83dbee536e75fb15d64905c918d045d (diff)
Fix part of #35372: distorted strokes when painting zoomed out with a small brush
size. Interpolated mouse coordinates should not get rounded to integers.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h6
4 files changed, 12 insertions, 20 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 92b82d84c38..6547b336119 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -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");
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 48a23641bdb..956dcc858f8 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -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;
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 0aef1ccf9fe..d7cea395409 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -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);
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 0085998bd58..a4230439737 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -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);