Cleanup: Use BKE_colorband prefix
authorCampbell Barton <ideasman42@gmail.com>
Thu, 7 Dec 2017 04:52:59 +0000 (15:52 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 7 Dec 2017 04:52:59 +0000 (15:52 +1100)
28 files changed:
source/blender/blenkernel/BKE_colorband.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/colorband.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/linestyle.c
source/blender/blenkernel/intern/texture.c
source/blender/compositor/operations/COM_ColorRampOperation.cpp
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/resources.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_image_2d.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/freestyle/intern/python/BPy_Freestyle.cpp
source/blender/gpu/intern/gpu_material.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_color.c
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_smoke.c
source/blender/makesrna/intern/rna_texture.c
source/blender/nodes/composite/nodes/node_composite_valToRgb.c
source/blender/nodes/shader/nodes/node_shader_valToRgb.c
source/blender/nodes/texture/nodes/node_texture_valToRgb.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/shadeoutput.c

index 09ed9a604770b954d929813e4e764eaada0e0bf9..aa64e79333151c0f1b88020af5b2df3fdefff1a7 100644 (file)
@@ -35,13 +35,13 @@ struct ColorBand;
 /*  in ColorBand struct */
 #define MAXCOLORBAND 32
 
-void init_colorband(struct ColorBand *coba, bool rangetype);
-struct ColorBand *add_colorband(bool rangetype);
-bool do_colorband(const struct ColorBand *coba, float in, float out[4]);
-void colorband_table_RGBA(struct ColorBand *coba, float **array, int *size);
-struct CBData *colorband_element_add(struct ColorBand *coba, float position);
-int colorband_element_remove(struct ColorBand *coba, int index);
-void colorband_update_sort(struct ColorBand *coba);
+void              BKE_colorband_init(struct ColorBand *coba, bool rangetype);
+struct ColorBand *BKE_colorband_add(bool rangetype);
+bool              BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4]);
+void              BKE_colorband_evaluate_table_rgba(const struct ColorBand *coba, float **array, int *size);
+struct CBData    *BKE_colorband_element_add(struct ColorBand *coba, float position);
+int               BKE_colorband_element_remove(struct ColorBand *coba, int index);
+void              BKE_colorband_update_sort(struct ColorBand *coba);
 
 #ifdef __cplusplus
 }
index b588cd07aec1079eba37ab928ceb676ccd0bea6f..7ccd00b3f62058c4f32bed576e835ed8a5c9a37d 100644 (file)
@@ -1377,7 +1377,7 @@ static void weightpaint_color(unsigned char r_col[4], DMWeightColorInfo *dm_wcin
        float colf[4];
 
        if (dm_wcinfo && dm_wcinfo->coba) {
-               do_colorband(dm_wcinfo->coba, input, colf);
+               BKE_colorband_evaluate(dm_wcinfo->coba, input, colf);
        }
        else {
                weight_to_rgb(colf, input);
index b1f6431019d21e1d889f19a4af268998263815b3..a9f4ae083d0b2ae96dd07b9c9912cbe674db1994 100644 (file)
@@ -38,7 +38,7 @@
 #include "BKE_material.h"
 #include "BKE_key.h"
 
-void init_colorband(ColorBand *coba, bool rangetype)
+void BKE_colorband_init(ColorBand *coba, bool rangetype)
 {
        int a;
 
@@ -80,12 +80,12 @@ void init_colorband(ColorBand *coba, bool rangetype)
        coba->color_mode = COLBAND_BLEND_RGB;
 }
 
-ColorBand *add_colorband(bool rangetype)
+ColorBand *BKE_colorband_add(bool rangetype)
 {
        ColorBand *coba;
 
        coba = MEM_callocN(sizeof(ColorBand), "colorband");
-       init_colorband(coba, rangetype);
+       BKE_colorband_init(coba, rangetype);
 
        return coba;
 }
@@ -160,7 +160,7 @@ static float colorband_hue_interp(
        return h_interp;
 }
 
-bool do_colorband(const ColorBand *coba, float in, float out[4])
+bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
 {
        const CBData *cbd1, *cbd2, *cbd0, *cbd3;
        float fac;
@@ -310,7 +310,7 @@ bool do_colorband(const ColorBand *coba, float in, float out[4])
        return true;   /* OK */
 }
 
-void colorband_table_RGBA(ColorBand *coba, float **array, int *size)
+void BKE_colorband_evaluate_table_rgba(const ColorBand *coba, float **array, int *size)
 {
        int a;
 
@@ -318,7 +318,7 @@ void colorband_table_RGBA(ColorBand *coba, float **array, int *size)
        *array = MEM_callocN(sizeof(float) * (*size) * 4, "ColorBand");
 
        for (a = 0; a < *size; a++)
-               do_colorband(coba, (float)a / (float)CM_TABLE, &(*array)[a * 4]);
+               BKE_colorband_evaluate(coba, (float)a / (float)CM_TABLE, &(*array)[a * 4]);
 }
 
 static int vergcband(const void *a1, const void *a2)
@@ -330,7 +330,7 @@ static int vergcband(const void *a1, const void *a2)
        return 0;
 }
 
-void colorband_update_sort(ColorBand *coba)
+void BKE_colorband_update_sort(ColorBand *coba)
 {
        int a;
 
@@ -350,7 +350,7 @@ void colorband_update_sort(ColorBand *coba)
        }
 }
 
-CBData *colorband_element_add(struct ColorBand *coba, float position)
+CBData *BKE_colorband_element_add(struct ColorBand *coba, float position)
 {
        if (coba->tot == MAXCOLORBAND) {
                return NULL;
@@ -362,7 +362,7 @@ CBData *colorband_element_add(struct ColorBand *coba, float position)
                xnew->pos = position;
 
                if (coba->tot != 0) {
-                       do_colorband(coba, position, &xnew->r);
+                       BKE_colorband_evaluate(coba, position, &xnew->r);
                }
                else {
                        zero_v4(&xnew->r);
@@ -372,12 +372,12 @@ CBData *colorband_element_add(struct ColorBand *coba, float position)
        coba->tot++;
        coba->cur = coba->tot - 1;
 
-       colorband_update_sort(coba);
+       BKE_colorband_update_sort(coba);
 
        return coba->data + coba->cur;
 }
 
-int colorband_element_remove(struct ColorBand *coba, int index)
+int BKE_colorband_element_remove(struct ColorBand *coba, int index)
 {
        int a;
 
index b809e13d1a0121b93fa79fcf357d6d48d1763b0d..b44ee21432cbe491247c0669d5c7e9af3e89aa5a 100644 (file)
@@ -1092,7 +1092,7 @@ bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, str
                        {
                                CBData *ramp;
 
-                               brush->paint_ramp = add_colorband(false);
+                               brush->paint_ramp = BKE_colorband_add(false);
                                if (!brush->paint_ramp)
                                        return false;
                                ramp = brush->paint_ramp->data;
@@ -1108,7 +1108,7 @@ bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, str
                        {
                                CBData *ramp;
 
-                               brush->vel_ramp = add_colorband(false);
+                               brush->vel_ramp = BKE_colorband_add(false);
                                if (!brush->vel_ramp)
                                        return false;
                                ramp = brush->vel_ramp->data;
@@ -3462,7 +3462,7 @@ static void dynamicPaint_updatePointData(
                vel_factor /= brush->max_velocity;
                CLAMP(vel_factor, 0.0f, 1.0f);
 
-               if (do_colorband(brush->vel_ramp, vel_factor, coba_res)) {
+               if (BKE_colorband_evaluate(brush->vel_ramp, vel_factor, coba_res)) {
                        if (brush->flags & MOD_DPAINT_VELOCITY_COLOR) {
                                copy_v3_v3(paint, coba_res);
                        }
@@ -3908,7 +3908,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex(
                        else if (hit_found == HIT_PROXIMITY) {
                                /* apply falloff curve to the proximity_factor */
                                if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP &&
-                                   do_colorband(brush->paint_ramp, (1.0f - proximity_factor), prox_colorband))
+                                   BKE_colorband_evaluate(brush->paint_ramp, (1.0f - proximity_factor), prox_colorband))
                                {
                                        proximity_factor = prox_colorband[3];
                                }
@@ -4472,7 +4472,7 @@ static void dynamic_paint_paint_single_point_cb_ex(
 
                /* color ramp */
                if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP &&
-                   do_colorband(brush->paint_ramp, (1.0f - strength), colorband))
+                   BKE_colorband_evaluate(brush->paint_ramp, (1.0f - strength), colorband))
                {
                        strength = colorband[3];
                }
index 653b79709e664cca1432be004e08e43659d05f7d..0465c5d54f7930aedc6b0af6dbdee322692e97cd 100644 (file)
@@ -295,39 +295,39 @@ LineStyleModifier *BKE_linestyle_color_modifier_add(FreestyleLineStyle *linestyl
 
        switch (type) {
                case LS_MODIFIER_ALONG_STROKE:
-                       ((LineStyleColorModifier_AlongStroke *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_AlongStroke *)m)->color_ramp = BKE_colorband_add(true);
                        break;
                case LS_MODIFIER_DISTANCE_FROM_CAMERA:
-                       ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp = BKE_colorband_add(true);
                        ((LineStyleColorModifier_DistanceFromCamera *)m)->range_min = 0.0f;
                        ((LineStyleColorModifier_DistanceFromCamera *)m)->range_max = 10000.0f;
                        break;
                case LS_MODIFIER_DISTANCE_FROM_OBJECT:
                        ((LineStyleColorModifier_DistanceFromObject *)m)->target = NULL;
-                       ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp = BKE_colorband_add(true);
                        ((LineStyleColorModifier_DistanceFromObject *)m)->range_min = 0.0f;
                        ((LineStyleColorModifier_DistanceFromObject *)m)->range_max = 10000.0f;
                        break;
                case LS_MODIFIER_MATERIAL:
-                       ((LineStyleColorModifier_Material *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_Material *)m)->color_ramp = BKE_colorband_add(true);
                        ((LineStyleColorModifier_Material *)m)->mat_attr = LS_MODIFIER_MATERIAL_LINE;
                        break;
                case LS_MODIFIER_TANGENT:
-                       ((LineStyleColorModifier_Tangent *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_Tangent *)m)->color_ramp = BKE_colorband_add(true);
                        break;
                case LS_MODIFIER_NOISE:
-                       ((LineStyleColorModifier_Noise *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_Noise *)m)->color_ramp = BKE_colorband_add(true);
                        ((LineStyleColorModifier_Noise *)m)->amplitude = 10.0f;
                        ((LineStyleColorModifier_Noise *)m)->period = 10.0f;
                        ((LineStyleColorModifier_Noise *)m)->seed = 512;
                        break;
                case LS_MODIFIER_CREASE_ANGLE:
-                       ((LineStyleColorModifier_CreaseAngle *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_CreaseAngle *)m)->color_ramp = BKE_colorband_add(true);
                        ((LineStyleColorModifier_CreaseAngle *)m)->min_angle = 0.0f;
                        ((LineStyleColorModifier_CreaseAngle *)m)->max_angle = DEG2RADF(180.0f);
                        break;
                case LS_MODIFIER_CURVATURE_3D:
-                       ((LineStyleColorModifier_Curvature_3D *)m)->color_ramp = add_colorband(1);
+                       ((LineStyleColorModifier_Curvature_3D *)m)->color_ramp = BKE_colorband_add(true);
                        ((LineStyleColorModifier_Curvature_3D *)m)->min_curvature = 0.0f;
                        ((LineStyleColorModifier_Curvature_3D *)m)->max_curvature = 0.5f;
                        break;
index fc41815737d42b2a45d97f804af0755566a5efa9..fcedd8806158177b985d633ea270f8af19a77241 100644 (file)
@@ -186,7 +186,7 @@ void BKE_texture_colormapping_default(ColorMapping *colormap)
 {
        memset(colormap, 0, sizeof(ColorMapping));
 
-       init_colorband(&colormap->coba, true);
+       BKE_colorband_init(&colormap->coba, true);
 
        colormap->bright = 1.0;
        colormap->contrast = 1.0;
@@ -999,7 +999,7 @@ void BKE_texture_pointdensity_init_data(PointDensity *pd)
        pd->noise_depth = 1;
        pd->noise_fac = 1.0f;
        pd->noise_influence = TEX_PD_NOISE_STATIC;
-       pd->coba = add_colorband(true);
+       pd->coba = BKE_colorband_add(true);
        pd->speed_scale = 1.0f;
        pd->totpoints = 0;
        pd->object = NULL;
index bbc09747ae17991ca2e4fa89cb9a18c8c68e0d97..c67f906b3747508558e26ed3a089710f5fcb875f 100644 (file)
@@ -48,7 +48,7 @@ void ColorRampOperation::executePixelSampled(float output[4], float x, float y,
        float values[4];
 
        this->m_inputProgram->readSampled(values, x, y, sampler);
-       do_colorband(this->m_colorBand, values[0], output);
+       BKE_colorband_evaluate(this->m_colorBand, values[0], output);
 }
 
 void ColorRampOperation::deinitExecution()
index 04e0a20243b1389c85d11587df903d4f7347295f..9a05c12e00a0aa12f31a2e9079dab0399b089c96 100644 (file)
@@ -1121,7 +1121,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
        glBegin(GL_TRIANGLE_STRIP);
        for (int a = 0; a <= sizex; a++) {
                float pos = ((float)a) / sizex;
-               do_colorband(coba, pos, colf);
+               BKE_colorband_evaluate(coba, pos, colf);
                if (display)
                        IMB_colormanagement_scene_linear_to_display_v3(colf, display);
                
@@ -1140,7 +1140,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
        glBegin(GL_TRIANGLE_STRIP);
        for (int a = 0; a <= sizex; a++) {
                float pos = ((float)a) / sizex;
-               do_colorband(coba, pos, colf);
+               BKE_colorband_evaluate(coba, pos, colf);
                if (display)
                        IMB_colormanagement_scene_linear_to_display_v3(colf, display);
 
index 06196b5722072a59e1c1c88c6fe7a6578fde89f4..c78fe34e84981b6a5e8ec5049568ee8ab92e3a73 100644 (file)
@@ -5933,7 +5933,7 @@ static bool ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int m
        data->dragcbd->pos += dx;
        CLAMP(data->dragcbd->pos, 0.0f, 1.0f);
        
-       colorband_update_sort(data->coba);
+       BKE_colorband_update_sort(data->coba);
        data->dragcbd = data->coba->data + data->coba->cur;  /* because qsort */
        
        data->draglastx = mx;
@@ -5963,7 +5963,7 @@ static int ui_do_but_COLORBAND(
                        if (event->ctrl) {
                                /* insert new key on mouse location */
                                float pos = ((float)(mx - but->rect.xmin)) / BLI_rctf_size_x(&but->rect);
-                               colorband_element_add(coba, pos);
+                               BKE_colorband_element_add(coba, pos);
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
                        else {
index 37d1146e97b467e7ac00c2f72fe31bb864f9c5aa..63bc42f6d10c718ef339afc5091f4671516298b9 100644 (file)
@@ -1451,7 +1451,7 @@ static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v)
                else pos = (coba->data[coba->cur + 1].pos + coba->data[coba->cur].pos) * 0.5f;
        }
 
-       if (colorband_element_add(coba, pos)) {
+       if (BKE_colorband_element_add(coba, pos)) {
                rna_update_cb(C, cb_v, NULL);
                ED_undo_push(C, "Add colorband");
        }
@@ -1461,7 +1461,7 @@ static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v)
 {
        ColorBand *coba = coba_v;
 
-       if (colorband_element_remove(coba, coba->cur)) {
+       if (BKE_colorband_element_remove(coba, coba->cur)) {
                ED_undo_push(C, "Delete colorband");
                rna_update_cb(C, cb_v, NULL);
        }
@@ -1497,7 +1497,7 @@ static void colorband_update_cb(bContext *UNUSED(C), void *bt_v, void *coba_v)
 
        /* sneaky update here, we need to sort the colorband points to be in order,
         * however the RNA pointer then is wrong, so we update it */
-       colorband_update_sort(coba);
+       BKE_colorband_update_sort(coba);
        bt->rnapoin.data = coba->data + coba->cur;
 }
 
index a73ecbac85fc522d923fbf5cfc0f5bdf58446137..d12e7cc036b658a9ee405852fbad99597dd069a8 100644 (file)
@@ -1839,7 +1839,7 @@ void init_userdef_do_versions(void)
                        rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
                }
                if (U.coba_weight.tot == 0)
-                       init_colorband(&U.coba_weight, true);
+                       BKE_colorband_init(&U.coba_weight, true);
        }
        if (!USER_VERSION_ATLEAST(245, 3)) {
                bTheme *btheme;
index 427d4a7bb7b0640853cbcc622635187a933fe20d..3ecece580ee284ba5d281da2b9e62d0ad1d6d872 100644 (file)
@@ -665,17 +665,17 @@ void paint_brush_color_get(struct Scene *scene, struct Brush *br, bool color_cor
                        float color_gr[4];
                        switch (br->gradient_stroke_mode) {
                                case BRUSH_GRADIENT_PRESSURE:
-                                       do_colorband(br->gradient, pressure, color_gr);
+                                       BKE_colorband_evaluate(br->gradient, pressure, color_gr);
                                        break;
                                case BRUSH_GRADIENT_SPACING_REPEAT:
                                {
                                        float coord = fmod(distance / br->gradient_spacing, 1.0);
-                                       do_colorband(br->gradient, coord, color_gr);
+                                       BKE_colorband_evaluate(br->gradient, coord, color_gr);
                                        break;
                                }
                                case BRUSH_GRADIENT_SPACING_CLAMP:
                                {
-                                       do_colorband(br->gradient, distance / br->gradient_spacing, color_gr);
+                                       BKE_colorband_evaluate(br->gradient, distance / br->gradient_spacing, color_gr);
                                        break;
                                }
                        }
index 766942a5fce0686829130345a281d26cd023cf09..a1aad2bdc5776b96c1b59824109fd6d9e794f325 100644 (file)
@@ -1666,7 +1666,7 @@ void paint_2d_gradient_fill(
                                                break;
                                        }
                                }
-                               do_colorband(br->gradient, f, color_f);
+                               BKE_colorband_evaluate(br->gradient, f, color_f);
                                /* convert to premultiplied */
                                mul_v3_fl(color_f, color_f[3]);
                                color_f[3] *= br->alpha;
@@ -1696,7 +1696,7 @@ void paint_2d_gradient_fill(
                                        }
                                }
 
-                               do_colorband(br->gradient, f, color_f);
+                               BKE_colorband_evaluate(br->gradient, f, color_f);
                                linearrgb_to_srgb_v3_v3(color_f, color_f);
                                rgba_float_to_uchar((unsigned char *)&color_b, color_f);
                                ((unsigned char *)&color_b)[3] *= br->alpha;
index 60a4cd86aa586dbca4623537a5716bd91e5ca75f..c309b223a8120c92b22089190f6063bb4131bd0e 100644 (file)
@@ -4579,7 +4579,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                                                break;
                                                        }
                                                }
-                                               do_colorband(brush->gradient, f, color_f);
+                                               BKE_colorband_evaluate(brush->gradient, f, color_f);
                                                color_f[3] *= ((float)projPixel->mask) * (1.0f / 65535.0f) * brush->alpha;
 
                                                if (is_floatbuf) {
index dafe25a70721527459a1756cfa84c32cdc2d632b..cf11840418348a3618accd89fd5ee5caeef92bbe 100644 (file)
@@ -112,7 +112,7 @@ static void create_flame_spectrum_texture(float *data)
 static void create_color_ramp(const ColorBand *coba, float *data)
 {
        for (int i = 0; i < TFUNC_WIDTH; i++) {
-               do_colorband(coba, (float)i / TFUNC_WIDTH, &data[i * 4]);
+               BKE_colorband_evaluate(coba, (float)i / TFUNC_WIDTH, &data[i * 4]);
        }
 }
 
index b2a6d53f992dd189307e143a14ffc7df0ab463c5..0b09a3c24423f7fdeb5621e065bdb05c7a50ef85 100644 (file)
@@ -157,7 +157,7 @@ static PyObject *Freestyle_blendRamp(PyObject * /*self*/, PyObject *args)
        return Vector_CreatePyObject(a, 3, NULL);
 }
 
-#include "BKE_colorband.h" /* do_colorband() */
+#include "BKE_colorband.h" /* BKE_colorband_evaluate() */
 
 static char Freestyle_evaluateColorRamp___doc__[] =
 ".. function:: evaluateColorRamp(ramp, in)\n"
@@ -184,7 +184,7 @@ static PyObject *Freestyle_evaluateColorRamp(PyObject * /*self*/, PyObject *args
                return NULL;
        }
        coba = (ColorBand *)py_srna->ptr.data;
-       if (!do_colorband(coba, in, out)) {
+       if (!BKE_colorband_evaluate(coba, in, out)) {
                PyErr_SetString(PyExc_ValueError, "failed to evaluate the color ramp");
                return NULL;
        }
index b46a1b6f48eade584f974e8ad5bf3921df61af6f..33eac16dadfe2f87728618710e26d0d444b58308 100644 (file)
@@ -679,7 +679,7 @@ static void ramp_blend(
        GPU_link(mat, names[type], fac, col1, col2, r_col);
 }
 
-static void do_colorband_blend(
+static void BKE_colorband_eval_blend(
         GPUMaterial *mat, ColorBand *coba, GPUNodeLink *fac, float rampfac, int type,
         GPUNodeLink *incol, GPUNodeLink **r_col)
 {
@@ -688,7 +688,7 @@ static void do_colorband_blend(
        int size;
 
        /* do colorband */
-       colorband_table_RGBA(coba, &array, &size);
+       BKE_colorband_evaluate_table_rgba(coba, &array, &size);
        GPU_link(mat, "valtorgb", fac, GPU_texture(size, array), &col, &tmp);
 
        /* use alpha in fac */
@@ -711,7 +711,7 @@ static void ramp_diffuse_result(GPUShadeInput *shi, GPUNodeLink **diff)
                                GPU_link(mat, "ramp_rgbtobw", *diff, &fac);
                                
                                /* colorband + blend */
-                               do_colorband_blend(mat, ma->ramp_col, fac, ma->rampfac_col, ma->rampblend_col, *diff, diff);
+                               BKE_colorband_eval_blend(mat, ma->ramp_col, fac, ma->rampfac_col, ma->rampblend_col, *diff, diff);
                        }
                }
        }
@@ -748,7 +748,7 @@ static void add_to_diffuse(
                        }
 
                        /* colorband + blend */
-                       do_colorband_blend(mat, ma->ramp_col, fac, ma->rampfac_col, ma->rampblend_col, shi->rgb, &addcol);
+                       BKE_colorband_eval_blend(mat, ma->ramp_col, fac, ma->rampfac_col, ma->rampblend_col, shi->rgb, &addcol);
                }
        }
        else
@@ -770,7 +770,7 @@ static void ramp_spec_result(GPUShadeInput *shi, GPUNodeLink **spec)
                GPU_link(mat, "ramp_rgbtobw", *spec, &fac);
                
                /* colorband + blend */
-               do_colorband_blend(mat, ma->ramp_spec, fac, ma->rampfac_spec, ma->rampblend_spec, *spec, spec);
+               BKE_colorband_eval_blend(mat, ma->ramp_spec, fac, ma->rampfac_spec, ma->rampblend_spec, *spec, spec);
        }
 }
 
@@ -802,7 +802,7 @@ static void do_specular_ramp(GPUShadeInput *shi, GPUNodeLink *is, GPUNodeLink *t
                }
                
                /* colorband + blend */
-               do_colorband_blend(mat, ma->ramp_spec, fac, ma->rampfac_spec, ma->rampblend_spec, *spec, spec);
+               BKE_colorband_eval_blend(mat, ma->ramp_spec, fac, ma->rampfac_spec, ma->rampblend_spec, *spec, spec);
        }
 }
 
index 816ab5783c6a24c3d544696e59a4a91848307e1f..6a67e036c5d3ca78b4cab635f4cc753038b98cb7 100644 (file)
@@ -465,7 +465,7 @@ static void rna_Brush_use_gradient_set(PointerRNA *ptr, int value)
        else br->flag &= ~BRUSH_USE_GRADIENT;
 
        if ((br->flag & BRUSH_USE_GRADIENT) && br->gradient == NULL)
-               br->gradient = add_colorband(true);
+               br->gradient = BKE_colorband_add(true);
 }
 
 static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
index 95b14ab11ddf56ca7253521530104f01a4b087f5..d51436df5636e3274221bd6e802e6d21db35519a 100644 (file)
@@ -361,12 +361,12 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *
 
 static void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4])
 {
-       do_colorband(coba, position, color);
+       BKE_colorband_evaluate(coba, position, color);
 }
 
 static CBData *rna_ColorRampElement_new(struct ColorBand *coba, ReportList *reports, float position)
 {
-       CBData *element = colorband_element_add(coba, position);
+       CBData *element = BKE_colorband_element_add(coba, position);
 
        if (element == NULL)
                BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND);
@@ -378,7 +378,7 @@ static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *repo
 {
        CBData *element = element_ptr->data;
        int index = (int)(element - coba->data);
-       if (colorband_element_remove(coba, index) == false) {
+       if (BKE_colorband_element_remove(coba, index) == false) {
                BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element");
                return;
        }
index ea712f993f120d403b9fe75a632be6cea30d4c7b..1965361b81b7a91aa48700e888c901d3a4d6259c 100644 (file)
@@ -322,7 +322,7 @@ static void rna_Material_use_diffuse_ramp_set(PointerRNA *ptr, int value)
        else ma->mode &= ~MA_RAMP_COL;
 
        if ((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL)
-               ma->ramp_col = add_colorband(false);
+               ma->ramp_col = BKE_colorband_add(false);
 }
 
 static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
@@ -333,7 +333,7 @@ static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
        else ma->mode &= ~MA_RAMP_SPEC;
 
        if ((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL)
-               ma->ramp_spec = add_colorband(false);
+               ma->ramp_spec = BKE_colorband_add(false);
 }
 
 static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
index 4ffd1f004264c98974932a031f060d59fb3df5f9..9b206f3ee124599af2260f5d72d7c23e7ff95a67 100644 (file)
@@ -393,7 +393,7 @@ static void rna_Smoke_use_color_ramp_set(PointerRNA *ptr, int value)
        sds->use_coba = value;
 
        if (value && sds->coba == NULL) {
-               sds->coba = add_colorband(false);
+               sds->coba = BKE_colorband_add(false);
        }
 }
 
index 831fc8beb89fa106b1ad2fe74134cb580ab0e28c..396747248890b7b3c753645fe645f9728eb389d7 100644 (file)
@@ -405,7 +405,7 @@ static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value)
        else tex->flag &= ~TEX_COLORBAND;
 
        if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
-               tex->coba = add_colorband(false);
+               tex->coba = BKE_colorband_add(false);
 }
 
 static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr)
index 32d68550cd4d4aa4733ec69fd75e776c88e1319d..707f1d22efdd0212df3bc85d9a180e6046003ca3 100644 (file)
@@ -46,7 +46,7 @@ static bNodeSocketTemplate cmp_node_valtorgb_out[] = {
 
 static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node)
 {
-       node->storage = add_colorband(true);
+       node->storage = BKE_colorband_add(true);
 }
 
 void register_node_type_cmp_valtorgb(void)
index 72942cce9c56b0f719bc68ad580bdc43caddb10e..c960e006a9ba305dd46274fe884086925fcd549f 100644 (file)
@@ -53,14 +53,14 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), int UNUSED(thread), bN
                float fac;
                nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
 
-               do_colorband(node->storage, fac, out[0]->vec);
+               BKE_colorband_evaluate(node->storage, fac, out[0]->vec);
                out[1]->vec[0] = out[0]->vec[3];
        }
 }
 
 static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node)
 {
-       node->storage = add_colorband(true);
+       node->storage = BKE_colorband_add(true);
 }
 
 static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
@@ -68,7 +68,7 @@ static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNU
        float *array;
        int size;
 
-       colorband_table_RGBA(node->storage, &array, &size);
+       BKE_colorband_evaluate_table_rgba(node->storage, &array, &size);
        return GPU_stack_link(mat, "valtorgb", in, out, GPU_texture(size, array));
 }
 
index a49d82d27a9b78f21356328308a720e474a8161f..8b016c5aa50f7700752dad7f16bd6c500e06efaf 100644 (file)
@@ -49,7 +49,7 @@ static void valtorgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack *
        if (node->storage) {
                float fac = tex_input_value(in[0], p, thread);
 
-               do_colorband(node->storage, fac, out);
+               BKE_colorband_evaluate(node->storage, fac, out);
        }
 }
 
@@ -60,7 +60,7 @@ static void valtorgb_exec(void *data, int UNUSED(thread), bNode *node, bNodeExec
 
 static void valtorgb_init(bNodeTree *UNUSED(ntree), bNode *node)
 {
-       node->storage = add_colorband(true);
+       node->storage = BKE_colorband_add(true);
 }
 
 void register_node_type_tex_valtorgb(void)
index 1fd6cec0d4d7eb52ccc11a495e7dd329f77f6ba9..b215db49264fda545b08c8f19b645349e40eeff4 100644 (file)
@@ -781,7 +781,7 @@ static int pointdensity_color(PointDensity *pd, TexResult *texres, float age, co
                switch (pd->color_source) {
                        case TEX_PD_COLOR_PARTAGE:
                                if (pd->coba) {
-                                       if (do_colorband(pd->coba, age, rgba)) {
+                                       if (BKE_colorband_evaluate(pd->coba, age, rgba)) {
                                                texres->talpha = true;
                                                copy_v3_v3(&texres->tr, rgba);
                                                texres->tin *= rgba[3];
@@ -794,7 +794,7 @@ static int pointdensity_color(PointDensity *pd, TexResult *texres, float age, co
                                float speed = len_v3(vec) * pd->speed_scale;
                                
                                if (pd->coba) {
-                                       if (do_colorband(pd->coba, speed, rgba)) {
+                                       if (BKE_colorband_evaluate(pd->coba, speed, rgba)) {
                                                texres->talpha = true;
                                                copy_v3_v3(&texres->tr, rgba);
                                                texres->tin *= rgba[3];
@@ -826,7 +826,7 @@ static int pointdensity_color(PointDensity *pd, TexResult *texres, float age, co
                                break;
                        case TEX_PD_COLOR_VERTWEIGHT:
                                texres->talpha = true;
-                               if (pd->coba && do_colorband(pd->coba, col[0], rgba)) {
+                               if (pd->coba && BKE_colorband_evaluate(pd->coba, col[0], rgba)) {
                                        copy_v3_v3(&texres->tr, rgba);
                                        texres->tin *= rgba[3];
                                }
index db0f2b57d901016e4a16b2ff143a24bf7d24fc15..e6138842f090cce69436a588f8a3d557cdd12ce9 100644 (file)
@@ -162,15 +162,15 @@ static void tex_normal_derivate(Tex *tex, TexResult *texres)
 {
        if (tex->flag & TEX_COLORBAND) {
                float col[4];
-               if (do_colorband(tex->coba, texres->tin, col)) {
+               if (BKE_colorband_evaluate(tex->coba, texres->tin, col)) {
                        float fac0, fac1, fac2, fac3;
                        
                        fac0= (col[0]+col[1]+col[2]);
-                       do_colorband(tex->coba, texres->nor[0], col);
+                       BKE_colorband_evaluate(tex->coba, texres->nor[0], col);
                        fac1= (col[0]+col[1]+col[2]);
-                       do_colorband(tex->coba, texres->nor[1], col);
+                       BKE_colorband_evaluate(tex->coba, texres->nor[1], col);
                        fac2= (col[0]+col[1]+col[2]);
-                       do_colorband(tex->coba, texres->nor[2], col);
+                       BKE_colorband_evaluate(tex->coba, texres->nor[2], col);
                        fac3= (col[0]+col[1]+col[2]);
                        
                        texres->nor[0]= (fac0 - fac1) / 3.0f;
@@ -1219,7 +1219,7 @@ static int multitex(Tex *tex,
 
        if (tex->flag & TEX_COLORBAND) {
                float col[4];
-               if (do_colorband(tex->coba, texres->tin, col)) {
+               if (BKE_colorband_evaluate(tex->coba, texres->tin, col)) {
                        texres->talpha = true;
                        texres->tr= col[0];
                        texres->tg= col[1];
index 75fb6e8a2408a76911010332115b6edbc281033a..b10389538c2ed138bed5ca404c91309fd1dca6e2 100644 (file)
@@ -949,7 +949,7 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi)
        if (ma->ramp_col) {
                if (ma->rampin_col==MA_RAMP_IN_RESULT) {
                        float fac = IMB_colormanagement_get_luminance(diff);
-                       do_colorband(ma->ramp_col, fac, col);
+                       BKE_colorband_evaluate(ma->ramp_col, fac, col);
                        
                        /* blending method */
                        fac= col[3]*ma->rampfac_col;
@@ -993,7 +993,7 @@ static void add_to_diffuse(float diff[3], const ShadeInput *shi, const float is,
                                break;
                        }
        
-                       do_colorband(ma->ramp_col, fac, col);
+                       BKE_colorband_evaluate(ma->ramp_col, fac, col);
                        
                        /* blending method */
                        fac = col[3] * ma->rampfac_col;
@@ -1022,7 +1022,7 @@ static void ramp_spec_result(float spec_col[3], ShadeInput *shi)
                float col[4];
                float fac = IMB_colormanagement_get_luminance(spec_col);
 
-               do_colorband(ma->ramp_spec, fac, col);
+               BKE_colorband_evaluate(ma->ramp_spec, fac, col);
                
                /* blending method */
                fac= col[3]*ma->rampfac_spec;
@@ -1062,7 +1062,7 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
                        break;
                }
                
-               do_colorband(ma->ramp_spec, fac, col);
+               BKE_colorband_evaluate(ma->ramp_spec, fac, col);
                
                /* blending method */
                fac= col[3]*ma->rampfac_spec;