svn merge ^/trunk/blender -r43381:43392
[blender.git] / source / blender / editors / sculpt_paint / paint_image.c
index b7c4404c143e7b1398555057f069187ddc505f59..5f4777331c3bc47802e26a86f81cf219e99faf58 100644 (file)
@@ -2937,7 +2937,7 @@ static void project_paint_begin(ProjPaintState *ps)
        
        MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
 
-       const int diameter= 2*brush_size(ps->brush);
+       const int diameter= 2*brush_size(ps->scene, ps->brush);
        
        /* ---- end defines ---- */
        
@@ -3580,7 +3580,7 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
 {
        if(ps->source==PROJ_SRC_VIEW) {
                float min_brush[2], max_brush[2];
-               const float radius = (float)brush_size(ps->brush);
+               const float radius = (float)brush_size(ps->scene, ps->brush);
 
                /* so we dont have a bucket bounds that is way too small to paint into */
                // if (radius < 1.0f) radius = 1.0f; // this doesn't work yet :/
@@ -3618,7 +3618,7 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
 
 static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf *bucket_bounds, const float mval[2])
 {
-       const int diameter= 2*brush_size(ps->brush);
+       const int diameter= 2*brush_size(ps->scene, ps->brush);
 
        if (ps->thread_tot > 1)
                BLI_lock_thread(LOCK_CUSTOM1);
@@ -3844,7 +3844,7 @@ static void *do_projectpaint_thread(void *ph_v)
        float co[2];
        float mask = 1.0f; /* airbrush wont use mask */
        unsigned short mask_short;
-       const float radius= (float)brush_size(ps->brush);
+       const float radius= (float)brush_size(ps->scene, ps->brush);
        const float radius_squared= radius*radius; /* avoid a square root with every dist comparison */
        
        short lock_alpha= ELEM(ps->brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ? 0 : ps->brush->flag & BRUSH_LOCK_ALPHA;
@@ -3903,7 +3903,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                        if (falloff > 0.0f) {
                                                if (ps->is_texbrush) {
                                                        /* note, for clone and smear, we only use the alpha, could be a special function */
-                                                       brush_sample_tex(ps->brush, projPixel->projCoSS, rgba, thread_index);
+                                                       brush_sample_tex(ps->scene, ps->brush, projPixel->projCoSS, rgba, thread_index);
                                                        alpha = rgba[3];
                                                } else {
                                                        alpha = 1.0f;
@@ -3911,7 +3911,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                                
                                                if (ps->is_airbrush) {
                                                        /* for an aurbrush there is no real mask, so just multiply the alpha by it */
-                                                       alpha *= falloff * brush_alpha(ps->brush);
+                                                       alpha *= falloff * brush_alpha(ps->scene, ps->brush);
                                                        mask = ((float)projPixel->mask)/65535.0f;
                                                }
                                                else {
@@ -3919,7 +3919,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                                        falloff = 1.0f - falloff;
                                                        falloff = 1.0f - (falloff * falloff);
                                                        
-                                                       mask_short = (unsigned short)(projPixel->mask * (brush_alpha(ps->brush) * falloff));
+                                                       mask_short = (unsigned short)(projPixel->mask * (brush_alpha(ps->scene, ps->brush) * falloff));
                                                        if (mask_short > projPixel->mask_max) {
                                                                mask = ((float)mask_short)/65535.0f;
                                                                projPixel->mask_max = mask_short;
@@ -4801,7 +4801,7 @@ static int texture_paint_init(bContext *C, wmOperator *op)
        if(pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
                pop->s.tool = PAINT_TOOL_DRAW;
        pop->s.blend = brush->blend;
-       pop->orig_brush_size= brush_size(brush);
+       pop->orig_brush_size= brush_size(scene, brush);
 
        if(pop->mode != PAINT_MODE_2D) {
                pop->s.ob = OBACT;
@@ -4837,8 +4837,8 @@ static int texture_paint_init(bContext *C, wmOperator *op)
                        return 0;
 
                /* Dont allow brush size below 2 */
-               if (brush_size(brush) < 2)
-                       brush_set_size(brush, 2);
+               if (brush_size(scene, brush) < 2)
+                       brush_set_size(scene, brush, 2);
 
                /* allocate and initialize spacial data structures */
                project_paint_begin(&pop->ps);
@@ -4922,7 +4922,7 @@ static void paint_exit(bContext *C, wmOperator *op)
        brush_painter_free(pop->painter);
 
        if(pop->mode == PAINT_MODE_3D_PROJECT) {
-               brush_set_size(pop->ps.brush, pop->orig_brush_size);
+               brush_set_size(scene, pop->ps.brush, pop->orig_brush_size);
                paint_brush_exit_tex(pop->ps.brush);
                
                project_paint_end(&pop->ps);
@@ -5111,12 +5111,13 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
 #define PX_SIZE_FADE_MAX 12.0f
 #define PX_SIZE_FADE_MIN 4.0f
 
+       Scene *scene= CTX_data_scene(C);
        Brush *brush= image_paint_brush(C);
-       Paint *paint= paint_get_active(CTX_data_scene(C));
+       Paint *paint= paint_get_active(scene);
 
        if(paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
                float zoomx, zoomy;
-               const float size= (float)brush_size(brush);
+               const float size= (float)brush_size(scene, brush);
                const short use_zoom= get_imapaint_zoom(C, &zoomx, &zoomy);
                const float pixel_size= MAX2(size * zoomx, size * zoomy);
                float alpha= 0.5f;
@@ -5570,8 +5571,8 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
        /* override */
        ps.is_texbrush= 0;
        ps.is_airbrush= 1;
-       orig_brush_size= brush_size(ps.brush);
-       brush_set_size(ps.brush, 32); /* cover the whole image */
+       orig_brush_size= brush_size(scene, ps.brush);
+       brush_set_size(scene, ps.brush, 32); /* cover the whole image */
 
        ps.tool= PAINT_TOOL_DRAW; /* so pixels are initialized with minimal info */
 
@@ -5584,7 +5585,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
        project_paint_begin(&ps);
 
        if(ps.dm==NULL) {
-               brush_set_size(ps.brush, orig_brush_size);
+               brush_set_size(scene, ps.brush, orig_brush_size);
                return OPERATOR_CANCELLED;
        }
        else {
@@ -5608,7 +5609,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
        project_paint_end(&ps);
 
        scene->toolsettings->imapaint.flag &= ~IMAGEPAINT_DRAWING;
-       brush_set_size(ps.brush, orig_brush_size);
+       brush_set_size(scene, ps.brush, orig_brush_size);
 
        return OPERATOR_FINISHED;
 }