Cleanup: Use BKE_colorband prefix
This commit is contained in:
parent
cc811d1fd6
commit
2e2e6e3bdb
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue