svn merge ^/trunk/blender -r46300:46330
[blender.git] / source / blender / editors / sculpt_paint / sculpt.c
index 8d2dfc8dbfa81ade43588add49340087e9040061..81b418b51f5824b3ca4bac359ffad4c5301d201b 100644 (file)
@@ -437,7 +437,7 @@ static float overlapped_curve(Brush *br, float x)
                xx = fabs(x0 + i * h);
 
                if (xx < 1.0f)
-                       sum += brush_curve_strength(br, xx, 1);
+                       sum += BKE_brush_curve_strength(br, xx, 1);
        }
 
        return sum;
@@ -550,10 +550,10 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
        Brush *brush = paint_brush(&sd->paint);
 
        /* Primary strength input; square it to make lower values more sensitive */
-       const float root_alpha = brush_alpha(scene, brush);
+       const float root_alpha = BKE_brush_alpha_get(scene, brush);
        float alpha        = root_alpha * root_alpha;
        float dir          = brush->flag & BRUSH_DIR_IN ? -1 : 1;
-       float pressure     = brush_use_alpha_pressure(scene, brush) ? cache->pressure : 1;
+       float pressure     = BKE_brush_use_alpha_pressure(scene, brush) ? cache->pressure : 1;
        float pen_flip     = cache->pen_flip ? -1 : 1;
        float invert       = cache->invert ? -1 : 1;
        float accum        = integrate_overlap(brush);
@@ -684,7 +684,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
                           /* leave the coordinates relative to the screen */
 
                        /* use unadjusted size for tiled mode */
-                       radius = brush_size(ss->cache->vc->scene, br);
+                       radius = BKE_brush_size_get(ss->cache->vc->scene, br);
                
                        x = point_2d[0];
                        y = point_2d[1];
@@ -724,7 +724,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
        avg += br->texture_sample_bias;
 
        /* Falloff curve */
-       avg *= brush_curve_strength(br, len, ss->cache->radius);
+       avg *= BKE_brush_curve_strength(br, len, ss->cache->radius);
 
        avg *= frontface(br, sculpt_normal, vno, fno);
 
@@ -1182,8 +1182,8 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
        
        /* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */
        
-       if (brush_alpha(scene, brush) > 0.0f)
-               crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor / (brush_alpha(scene, brush) * brush_alpha(scene, brush));
+       if (BKE_brush_alpha_get(scene, brush) > 0.0f)
+               crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor / (BKE_brush_alpha_get(scene, brush) * BKE_brush_alpha_get(scene, brush));
        else
                crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor;
 
@@ -2652,7 +2652,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd, Object *ob)
 static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
 {
        Brush *brush = paint_brush(&sd->paint);
-       const int radius = brush_size(scene, brush);
+       const int radius = BKE_brush_size_get(scene, brush);
 
        if (ss->texcache) {
                MEM_freeN(ss->texcache);
@@ -2662,7 +2662,7 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
        /* Need to allocate a bigger buffer for bigger brush size */
        ss->texcache_side = 2 * radius;
        if (!ss->texcache || ss->texcache_side > ss->texcache_actual) {
-               ss->texcache = brush_gen_texture_cache(brush, radius);
+               ss->texcache = BKE_brush_gen_texture_cache(brush, radius);
                ss->texcache_actual = ss->texcache_side;
        }
 }
@@ -2688,7 +2688,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
                ss->face_normals = NULL;
        }
        else {
-               Mesh *me = get_mesh(ob);
+               Mesh *me = BKE_mesh_from_object(ob);
                ss->totvert = me->totvert;
                ss->totpoly = me->totpoly;
                ss->mvert = me->mvert;
@@ -2877,7 +2877,7 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
                
                BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name));
 
-               br = (Brush *)find_id("BR", "Smooth");
+               br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth");
                if (br) {
                        paint_brush_set(p, br);
                        brush = br;
@@ -3062,19 +3062,19 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
        sd->pressure_value = cache->pressure;
 
        cache->previous_pixel_radius = cache->pixel_radius;
-       cache->pixel_radius = brush_size(scene, brush);
+       cache->pixel_radius = BKE_brush_size_get(scene, brush);
 
        if (cache->first_time) {
-               if (!brush_use_locked_size(scene, brush)) {
-                       cache->initial_radius = paint_calc_object_space_radius(cache->vc, cache->true_location, brush_size(scene, brush));
-                       brush_set_unprojected_radius(scene, brush, cache->initial_radius);
+               if (!BKE_brush_use_locked_size(scene, brush)) {
+                       cache->initial_radius = paint_calc_object_space_radius(cache->vc, cache->true_location, BKE_brush_size_get(scene, brush));
+                       BKE_brush_unprojected_radius_set(scene, brush, cache->initial_radius);
                }
                else {
-                       cache->initial_radius = brush_unprojected_radius(scene, brush);
+                       cache->initial_radius = BKE_brush_unprojected_radius_get(scene, brush);
                }
        }
 
-       if (brush_use_size_pressure(scene, brush)) {
+       if (BKE_brush_use_size_pressure(scene, brush)) {
                cache->pixel_radius *= cache->pressure;
                cache->radius = cache->initial_radius * cache->pressure;
        }
@@ -3306,7 +3306,7 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
        /* Restore the mesh before continuing with anchored stroke */
        if ((brush->flag & BRUSH_ANCHORED) ||
            (brush->sculpt_tool == SCULPT_TOOL_GRAB &&
-            brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
+            BKE_brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
            (brush->flag & BRUSH_RESTORE_MESH))
        {
                StrokeCache *cache = ss->cache;
@@ -3476,7 +3476,7 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
                /* Alt-Smooth */
                if (ss->cache->alt_smooth) {
                        Paint *p = &sd->paint;
-                       brush = (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
+                       brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name);
                        if (brush) {
                                paint_brush_set(p, brush);
                        }