Math Lib: rename fill_*, to copy_*

matching convention for fixed length api, eg: copy_v3_fl
This commit is contained in:
2015-05-05 17:08:29 +10:00
parent ea5f9fee8d
commit e5e73ccc90
27 changed files with 70 additions and 70 deletions

View File

@@ -295,11 +295,11 @@ void DM_init(DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges,
dm->dirty = 0; dm->dirty = 0;
/* don't use CustomData_reset(...); because we dont want to touch customdata */ /* don't use CustomData_reset(...); because we dont want to touch customdata */
fill_vn_i(dm->vertData.typemap, CD_NUMTYPES, -1); copy_vn_i(dm->vertData.typemap, CD_NUMTYPES, -1);
fill_vn_i(dm->edgeData.typemap, CD_NUMTYPES, -1); copy_vn_i(dm->edgeData.typemap, CD_NUMTYPES, -1);
fill_vn_i(dm->faceData.typemap, CD_NUMTYPES, -1); copy_vn_i(dm->faceData.typemap, CD_NUMTYPES, -1);
fill_vn_i(dm->loopData.typemap, CD_NUMTYPES, -1); copy_vn_i(dm->loopData.typemap, CD_NUMTYPES, -1);
fill_vn_i(dm->polyData.typemap, CD_NUMTYPES, -1); copy_vn_i(dm->polyData.typemap, CD_NUMTYPES, -1);
} }
void DM_from_template(DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type, void DM_from_template(DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
@@ -1276,7 +1276,7 @@ static void calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, int const d
else { else {
weightpaint_color(col, dm_wcinfo, 0.0f); weightpaint_color(col, dm_wcinfo, 0.0f);
} }
fill_vn_i((int *)r_wtcol_v, numVerts, *((int *)col)); copy_vn_i((int *)r_wtcol_v, numVerts, *((int *)col));
} }
} }

View File

@@ -1091,7 +1091,7 @@ static void layerDefault_mcol(void *data, int count)
static void layerDefault_origindex(void *data, int count) static void layerDefault_origindex(void *data, int count)
{ {
fill_vn_i((int *)data, count, ORIGINDEX_NONE); copy_vn_i((int *)data, count, ORIGINDEX_NONE);
} }
static void layerInterp_bweight( static void layerInterp_bweight(
@@ -1542,7 +1542,7 @@ static void CustomData_external_free(CustomData *data)
void CustomData_reset(CustomData *data) void CustomData_reset(CustomData *data)
{ {
memset(data, 0, sizeof(*data)); memset(data, 0, sizeof(*data));
fill_vn_i(data->typemap, CD_NUMTYPES, -1); copy_vn_i(data->typemap, CD_NUMTYPES, -1);
} }
void CustomData_free(CustomData *data, int totelem) void CustomData_free(CustomData *data, int totelem)

View File

@@ -982,7 +982,7 @@ void BKE_defvert_extract_vgroup_to_vertweights(
} }
} }
else { else {
fill_vn_fl(r_weights, num_verts, invert_vgroup ? 1.0f : 0.0f); copy_vn_fl(r_weights, num_verts, invert_vgroup ? 1.0f : 0.0f);
} }
} }
@@ -1008,7 +1008,7 @@ void BKE_defvert_extract_vgroup_to_edgeweights(
MEM_freeN(tmp_weights); MEM_freeN(tmp_weights);
} }
else { else {
fill_vn_fl(r_weights, num_edges, 0.0f); copy_vn_fl(r_weights, num_edges, 0.0f);
} }
} }
@@ -1031,7 +1031,7 @@ void BKE_defvert_extract_vgroup_to_loopweights(
MEM_freeN(tmp_weights); MEM_freeN(tmp_weights);
} }
else { else {
fill_vn_fl(r_weights, num_loops, 0.0f); copy_vn_fl(r_weights, num_loops, 0.0f);
} }
} }
@@ -1060,7 +1060,7 @@ void BKE_defvert_extract_vgroup_to_polyweights(
MEM_freeN(tmp_weights); MEM_freeN(tmp_weights);
} }
else { else {
fill_vn_fl(r_weights, num_polys, 0.0f); copy_vn_fl(r_weights, num_polys, 0.0f);
} }
} }

View File

@@ -1968,7 +1968,7 @@ static void statvis_calc_thickness(
BLI_assert(min <= max); BLI_assert(min <= max);
fill_vn_fl(face_dists, em->bm->totface, max); copy_vn_fl(face_dists, em->bm->totface, max);
if (use_jit) { if (use_jit) {
int j; int j;
@@ -2223,7 +2223,7 @@ static void statvis_calc_sharp(
(void)vertexCos; /* TODO */ (void)vertexCos; /* TODO */
fill_vn_fl(vert_angles, em->bm->totvert, -M_PI); copy_vn_fl(vert_angles, em->bm->totvert, -M_PI);
/* first assign float values to verts */ /* first assign float values to verts */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {

View File

@@ -707,7 +707,7 @@ void BKE_mesh_remap_calc_edges_from_dm(
BLI_space_transform_apply_normal(space_transform, v2_no); BLI_space_transform_apply_normal(space_transform, v2_no);
} }
fill_vn_fl(weights, (int)numedges_src, 0.0f); copy_vn_fl(weights, (int)numedges_src, 0.0f);
/* We adjust our ray-casting grid to ray_radius (the smaller, the more rays are cast), /* We adjust our ray-casting grid to ray_radius (the smaller, the more rays are cast),
* with lower/upper bounds. */ * with lower/upper bounds. */
@@ -1916,7 +1916,7 @@ void BKE_mesh_remap_calc_polys_from_dm(
BLI_space_transform_apply_normal(space_transform, tmp_no); BLI_space_transform_apply_normal(space_transform, tmp_no);
} }
fill_vn_fl(weights, (int)numpolys_src, 0.0f); copy_vn_fl(weights, (int)numpolys_src, 0.0f);
if (UNLIKELY((size_t)mp->totloop > tmp_poly_size)) { if (UNLIKELY((size_t)mp->totloop > tmp_poly_size)) {
tmp_poly_size = (size_t)mp->totloop; tmp_poly_size = (size_t)mp->totloop;

View File

@@ -308,7 +308,7 @@ void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist);
void axis_sort_v3(const float axis_values[3], int r_axis_order[3]); void axis_sort_v3(const float axis_values[3], int r_axis_order[3]);
/***************************** Array Functions *******************************/ /***************************** Array Functions *******************************/
/* attempted to follow fixed length vertex functions. names could be improved*/ /* follow fixed length vector function conventions. */
double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size) ATTR_WARN_UNUSED_RESULT; double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size) ATTR_WARN_UNUSED_RESULT;
double len_squared_vn(const float *array, const int size) ATTR_WARN_UNUSED_RESULT; double len_squared_vn(const float *array, const int size) ATTR_WARN_UNUSED_RESULT;
float normalize_vn_vn(float *array_tar, const float *array_src, const int size); float normalize_vn_vn(float *array_tar, const float *array_src, const int size);
@@ -329,11 +329,11 @@ void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_
void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size); void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size);
void msub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size); void msub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size);
void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size); void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size);
void fill_vn_i(int *array_tar, const int size, const int val); void copy_vn_i(int *array_tar, const int size, const int val);
void fill_vn_short(short *array_tar, const int size, const short val); void copy_vn_short(short *array_tar, const int size, const short val);
void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val); void copy_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val);
void fill_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val); void copy_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val);
void fill_vn_fl(float *array_tar, const int size, const float val); void copy_vn_fl(float *array_tar, const int size, const float val);
/**************************** Inline Definitions ******************************/ /**************************** Inline Definitions ******************************/

View File

@@ -229,7 +229,7 @@ bool BLI_astar_graph_solve(
r_solution->steps = 0; r_solution->steps = 0;
prev_nodes[node_index_src] = -1; prev_nodes[node_index_src] = -1;
BLI_BITMAP_SET_ALL(done_nodes, false, as_graph->node_num); BLI_BITMAP_SET_ALL(done_nodes, false, as_graph->node_num);
fill_vn_fl(g_costs, as_graph->node_num, FLT_MAX); copy_vn_fl(g_costs, as_graph->node_num, FLT_MAX);
g_costs[node_index_src] = 0.0f; g_costs[node_index_src] = 0.0f;
g_steps[node_index_src] = 0; g_steps[node_index_src] = 0;

View File

@@ -112,10 +112,10 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl
/* sample area entirely outside image? */ /* sample area entirely outside image? */
if (ceil(u) < 0 || floor(u) > width - 1 || ceil(v) < 0 || floor(v) > height - 1) { if (ceil(u) < 0 || floor(u) > width - 1 || ceil(v) < 0 || floor(v) > height - 1) {
if (float_output) { if (float_output) {
fill_vn_fl(float_output, components, 0.0f); copy_vn_fl(float_output, components, 0.0f);
} }
if (byte_output) { if (byte_output) {
fill_vn_uchar(byte_output, components, 0); copy_vn_uchar(byte_output, components, 0);
} }
return; return;
} }
@@ -281,7 +281,7 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
/* sample area entirely outside image? */ /* sample area entirely outside image? */
if (x2 < 0 || x1 > width - 1 || y2 < 0 || y1 > height - 1) { if (x2 < 0 || x1 > width - 1 || y2 < 0 || y1 > height - 1) {
fill_vn_fl(float_output, components, 0.0f); copy_vn_fl(float_output, components, 0.0f);
return; return;
} }
@@ -323,7 +323,7 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
/* sample area entirely outside image? */ /* sample area entirely outside image? */
if (x2 < 0 || x1 > width - 1 || y2 < 0 || y1 > height - 1) { if (x2 < 0 || x1 > width - 1 || y2 < 0 || y1 > height - 1) {
fill_vn_uchar(byte_output, components, 0); copy_vn_uchar(byte_output, components, 0);
return; return;
} }

View File

@@ -876,7 +876,7 @@ float normalize_vn_vn(float *array_tar, const float *array_src, const int size)
mul_vn_vn_fl(array_tar, array_src, size, 1.0f / d_sqrt); mul_vn_vn_fl(array_tar, array_src, size, 1.0f / d_sqrt);
} }
else { else {
fill_vn_fl(array_tar, size, 0.0f); copy_vn_fl(array_tar, size, 0.0f);
d_sqrt = 0.0f; d_sqrt = 0.0f;
} }
return d_sqrt; return d_sqrt;
@@ -1051,7 +1051,7 @@ void interp_vn_vn(float *array_tar, const float *array_src, const float t, const
} }
} }
void fill_vn_i(int *array_tar, const int size, const int val) void copy_vn_i(int *array_tar, const int size, const int val)
{ {
int *tar = array_tar + (size - 1); int *tar = array_tar + (size - 1);
int i = size; int i = size;
@@ -1060,7 +1060,7 @@ void fill_vn_i(int *array_tar, const int size, const int val)
} }
} }
void fill_vn_short(short *array_tar, const int size, const short val) void copy_vn_short(short *array_tar, const int size, const short val)
{ {
short *tar = array_tar + (size - 1); short *tar = array_tar + (size - 1);
int i = size; int i = size;
@@ -1069,7 +1069,7 @@ void fill_vn_short(short *array_tar, const int size, const short val)
} }
} }
void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val) void copy_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val)
{ {
unsigned short *tar = array_tar + (size - 1); unsigned short *tar = array_tar + (size - 1);
int i = size; int i = size;
@@ -1078,7 +1078,7 @@ void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned sh
} }
} }
void fill_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val) void copy_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val)
{ {
unsigned char *tar = array_tar + (size - 1); unsigned char *tar = array_tar + (size - 1);
int i = size; int i = size;
@@ -1087,7 +1087,7 @@ void fill_vn_uchar(unsigned char *array_tar, const int size, const unsigned char
} }
} }
void fill_vn_fl(float *array_tar, const int size, const float val) void copy_vn_fl(float *array_tar, const int size, const float val)
{ {
float *tar = array_tar + (size - 1); float *tar = array_tar + (size - 1);
int i = size; int i = size;

View File

@@ -845,7 +845,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
Object *ob; Object *ob;
for (ob = main->object.first; ob; ob = ob->id.next) { for (ob = main->object.first; ob; ob = ob->id.next) {
if (is_zero_v3(ob->dscale)) { if (is_zero_v3(ob->dscale)) {
fill_vn_fl(ob->dscale, 3, 1.0f); copy_vn_fl(ob->dscale, 3, 1.0f);
} }
} }
} }

View File

@@ -1057,7 +1057,7 @@ LinkNode *BM_vert_loop_groups_data_layer_create(
mul_vn_fl(lf->data_weights, lf->data_len, 1.0f / lwc.weight_accum); mul_vn_fl(lf->data_weights, lf->data_len, 1.0f / lwc.weight_accum);
} }
else { else {
fill_vn_fl(lf->data_weights, lf->data_len, 1.0f / (float)lf->data_len); copy_vn_fl(lf->data_weights, lf->data_len, 1.0f / (float)lf->data_len);
} }
BLI_linklist_prepend_arena(&groups, lf, lwc.arena); BLI_linklist_prepend_arena(&groups, lf, lwc.arena);

View File

@@ -190,7 +190,7 @@ void BM_mesh_decimate_dissolve_ex(
/* prepare for cleanup */ /* prepare for cleanup */
BM_mesh_elem_index_ensure(bm, BM_VERT); BM_mesh_elem_index_ensure(bm, BM_VERT);
vert_reverse_lookup = MEM_mallocN(sizeof(int) * bm->totvert, __func__); vert_reverse_lookup = MEM_mallocN(sizeof(int) * bm->totvert, __func__);
fill_vn_i(vert_reverse_lookup, bm->totvert, -1); copy_vn_i(vert_reverse_lookup, bm->totvert, -1);
for (i = 0; i < vinput_len; i++) { for (i = 0; i < vinput_len; i++) {
BMVert *v = vinput_arr[i]; BMVert *v = vinput_arr[i];
vert_reverse_lookup[BM_elem_index_get(v)] = i; vert_reverse_lookup[BM_elem_index_get(v)] = i;

View File

@@ -126,7 +126,7 @@ LinkNode *BM_mesh_calc_path_vert(
verts_prev = MEM_callocN(sizeof(*verts_prev) * totvert, __func__); verts_prev = MEM_callocN(sizeof(*verts_prev) * totvert, __func__);
cost = MEM_mallocN(sizeof(*cost) * totvert, __func__); cost = MEM_mallocN(sizeof(*cost) * totvert, __func__);
fill_vn_fl(cost, totvert, 1e20f); copy_vn_fl(cost, totvert, 1e20f);
/* /*
* Arrays are now filled as follows: * Arrays are now filled as follows:
@@ -252,7 +252,7 @@ LinkNode *BM_mesh_calc_path_edge(
edges_prev = MEM_callocN(sizeof(*edges_prev) * totedge, "SeamPathPrevious"); edges_prev = MEM_callocN(sizeof(*edges_prev) * totedge, "SeamPathPrevious");
cost = MEM_mallocN(sizeof(*cost) * totedge, "SeamPathCost"); cost = MEM_mallocN(sizeof(*cost) * totedge, "SeamPathCost");
fill_vn_fl(cost, totedge, 1e20f); copy_vn_fl(cost, totedge, 1e20f);
/* /*
* Arrays are now filled as follows: * Arrays are now filled as follows:
@@ -378,7 +378,7 @@ LinkNode *BM_mesh_calc_path_face(
faces_prev = MEM_callocN(sizeof(*faces_prev) * totface, __func__); faces_prev = MEM_callocN(sizeof(*faces_prev) * totface, __func__);
cost = MEM_mallocN(sizeof(*cost) * totface, __func__); cost = MEM_mallocN(sizeof(*cost) * totface, __func__);
fill_vn_fl(cost, totface, 1e20f); copy_vn_fl(cost, totface, 1e20f);
/* /*
* Arrays are now filled as follows: * Arrays are now filled as follows:

View File

@@ -186,7 +186,7 @@ static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle,
/* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */ /* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */
if (LIKELY(dm->foreachMappedVert)) { if (LIKELY(dm->foreachMappedVert)) {
fill_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX); copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL); dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL);
} }

View File

@@ -199,7 +199,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
bool has_skinradius = false; bool has_skinradius = false;
PointerRNA data_ptr; PointerRNA data_ptr;
fill_vn_fl(median, NBR_TRANSFORM_PROPERTIES, 0.0f); copy_vn_fl(median, NBR_TRANSFORM_PROPERTIES, 0.0f);
tot = totedgedata = totcurvedata = totlattdata = totcurvebweight = 0; tot = totedgedata = totcurvedata = totlattdata = totcurvebweight = 0;
/* make sure we got storage */ /* make sure we got storage */

View File

@@ -6017,7 +6017,7 @@ static bool createEdgeSlideVerts(TransInfo *t)
loop_dir = MEM_callocN(sizeof(float) * 3 * loop_nr, "sv loop_dir"); loop_dir = MEM_callocN(sizeof(float) * 3 * loop_nr, "sv loop_dir");
loop_maxdist = MEM_mallocN(sizeof(float) * loop_nr, "sv loop_maxdist"); loop_maxdist = MEM_mallocN(sizeof(float) * loop_nr, "sv loop_maxdist");
fill_vn_fl(loop_maxdist, loop_nr, -1.0f); copy_vn_fl(loop_maxdist, loop_nr, -1.0f);
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {

View File

@@ -2124,7 +2124,7 @@ static struct TransIslandData *editmesh_islands_info_calc(BMEditMesh *em, int *r
vert_map = MEM_mallocN(sizeof(*vert_map) * bm->totvert, __func__); vert_map = MEM_mallocN(sizeof(*vert_map) * bm->totvert, __func__);
/* we shouldn't need this, but with incorrect selection flushing /* we shouldn't need this, but with incorrect selection flushing
* its possible we have a selected vertex thats not in a face, for now best not crash in that case. */ * its possible we have a selected vertex thats not in a face, for now best not crash in that case. */
fill_vn_i(vert_map, bm->totvert, -1); copy_vn_i(vert_map, bm->totvert, -1);
BM_mesh_elem_table_ensure(bm, htype); BM_mesh_elem_table_ensure(bm, htype);
ele_array = (htype == BM_FACE) ? (void **)bm->ftable : (void **)bm->etable; ele_array = (htype == BM_FACE) ? (void **)bm->ftable : (void **)bm->etable;

View File

@@ -73,14 +73,14 @@ void initNumInput(NumInput *n)
{ {
n->idx_max = 0; n->idx_max = 0;
n->unit_sys = USER_UNIT_NONE; n->unit_sys = USER_UNIT_NONE;
fill_vn_i(n->unit_type, NUM_MAX_ELEMENTS, B_UNIT_NONE); copy_vn_i(n->unit_type, NUM_MAX_ELEMENTS, B_UNIT_NONE);
n->unit_use_radians = false; n->unit_use_radians = false;
n->flag = 0; n->flag = 0;
fill_vn_short(n->val_flag, NUM_MAX_ELEMENTS, 0); copy_vn_short(n->val_flag, NUM_MAX_ELEMENTS, 0);
zero_v3(n->val); zero_v3(n->val);
fill_vn_fl(n->val_org, NUM_MAX_ELEMENTS, 0.0f); copy_vn_fl(n->val_org, NUM_MAX_ELEMENTS, 0.0f);
fill_vn_fl(n->val_inc, NUM_MAX_ELEMENTS, 1.0f); copy_vn_fl(n->val_inc, NUM_MAX_ELEMENTS, 1.0f);
n->idx = 0; n->idx = 0;
n->str[0] = '\0'; n->str[0] = '\0';

View File

@@ -2120,7 +2120,7 @@ static int uv_mouse_select(bContext *C, const float co[2], bool extend, bool loo
/* mark 1 vertex as being hit */ /* mark 1 vertex as being hit */
hitv = BLI_array_alloca(hitv, hit.efa->len); hitv = BLI_array_alloca(hitv, hit.efa->len);
hituv = BLI_array_alloca(hituv, hit.efa->len); hituv = BLI_array_alloca(hituv, hit.efa->len);
fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF); copy_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
hitv[hit.lindex] = BM_elem_index_get(hit.l->v); hitv[hit.lindex] = BM_elem_index_get(hit.l->v);
hituv[hit.lindex] = hit.luv->uv; hituv[hit.lindex] = hit.luv->uv;
@@ -2137,7 +2137,7 @@ static int uv_mouse_select(bContext *C, const float co[2], bool extend, bool loo
/* mark 2 edge vertices as being hit */ /* mark 2 edge vertices as being hit */
hitv = BLI_array_alloca(hitv, hit.efa->len); hitv = BLI_array_alloca(hitv, hit.efa->len);
hituv = BLI_array_alloca(hituv, hit.efa->len); hituv = BLI_array_alloca(hituv, hit.efa->len);
fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF); copy_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
hitv[hit.lindex] = BM_elem_index_get(hit.l->v); hitv[hit.lindex] = BM_elem_index_get(hit.l->v);
hitv[(hit.lindex + 1) % hit.efa->len] = BM_elem_index_get(hit.l->next->v); hitv[(hit.lindex + 1) % hit.efa->len] = BM_elem_index_get(hit.l->next->v);

View File

@@ -454,7 +454,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
if (bitspersample == 32) { if (bitspersample == 32) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
fill_vn_fl(fbuf, ibuf->x, 1.0f); copy_vn_fl(fbuf, ibuf->x, 1.0f);
else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */ else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */
success |= TIFFReadScanline(image, fbuf, row, 0); success |= TIFFReadScanline(image, fbuf, row, 0);
else else
@@ -464,7 +464,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
} }
else if (bitspersample == 16) { else if (bitspersample == 16) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
fill_vn_ushort(sbuf, ibuf->x, 65535); copy_vn_ushort(sbuf, ibuf->x, 65535);
else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */ else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */
success |= TIFFReadScanline(image, fbuf, row, 0); success |= TIFFReadScanline(image, fbuf, row, 0);
else else

View File

@@ -1387,7 +1387,7 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
memcpy(values, bb->vec, sizeof(bb->vec)); memcpy(values, bb->vec, sizeof(bb->vec));
} }
else { else {
fill_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f); copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f);
} }
} }

View File

@@ -364,22 +364,22 @@ static void dm_merge_transform(
/* set origindex */ /* set origindex */
index_orig = result->getVertDataArray(result, CD_ORIGINDEX); index_orig = result->getVertDataArray(result, CD_ORIGINDEX);
if (index_orig) { if (index_orig) {
fill_vn_i(index_orig + cap_verts_index, cap_nverts, ORIGINDEX_NONE); copy_vn_i(index_orig + cap_verts_index, cap_nverts, ORIGINDEX_NONE);
} }
index_orig = result->getEdgeDataArray(result, CD_ORIGINDEX); index_orig = result->getEdgeDataArray(result, CD_ORIGINDEX);
if (index_orig) { if (index_orig) {
fill_vn_i(index_orig + cap_edges_index, cap_nedges, ORIGINDEX_NONE); copy_vn_i(index_orig + cap_edges_index, cap_nedges, ORIGINDEX_NONE);
} }
index_orig = result->getPolyDataArray(result, CD_ORIGINDEX); index_orig = result->getPolyDataArray(result, CD_ORIGINDEX);
if (index_orig) { if (index_orig) {
fill_vn_i(index_orig + cap_polys_index, cap_npolys, ORIGINDEX_NONE); copy_vn_i(index_orig + cap_polys_index, cap_npolys, ORIGINDEX_NONE);
} }
index_orig = result->getLoopDataArray(result, CD_ORIGINDEX); index_orig = result->getLoopDataArray(result, CD_ORIGINDEX);
if (index_orig) { if (index_orig) {
fill_vn_i(index_orig + cap_loops_index, cap_nloops, ORIGINDEX_NONE); copy_vn_i(index_orig + cap_loops_index, cap_nloops, ORIGINDEX_NONE);
} }
} }
@@ -525,7 +525,7 @@ static DerivedMesh *arrayModifier_doArray(
if (use_merge) { if (use_merge) {
/* Will need full_doubles_map for handling merge */ /* Will need full_doubles_map for handling merge */
full_doubles_map = MEM_mallocN(sizeof(int) * result_nverts, "mod array doubles map"); full_doubles_map = MEM_mallocN(sizeof(int) * result_nverts, "mod array doubles map");
fill_vn_i(full_doubles_map, result_nverts, -1); copy_vn_i(full_doubles_map, result_nverts, -1);
} }
/* copy customdata to original geometry */ /* copy customdata to original geometry */

View File

@@ -391,7 +391,7 @@ static void smooth_verts(
smooth_weights); smooth_weights);
} }
else { else {
fill_vn_fl(smooth_weights, (int)numVerts, 1.0f); copy_vn_fl(smooth_weights, (int)numVerts, 1.0f);
} }
if (csmd->flag & MOD_CORRECTIVESMOOTH_PIN_BOUNDARY) { if (csmd->flag & MOD_CORRECTIVESMOOTH_PIN_BOUNDARY) {

View File

@@ -1801,7 +1801,7 @@ static void skin_set_orig_indices(DerivedMesh *dm)
totpoly = dm->getNumPolys(dm); totpoly = dm->getNumPolys(dm);
orig = CustomData_add_layer(&dm->polyData, CD_ORIGINDEX, orig = CustomData_add_layer(&dm->polyData, CD_ORIGINDEX,
CD_CALLOC, NULL, totpoly); CD_CALLOC, NULL, totpoly);
fill_vn_i(orig, totpoly, ORIGINDEX_NONE); copy_vn_i(orig, totpoly, ORIGINDEX_NONE);
} }
/* /*

View File

@@ -298,7 +298,7 @@ static DerivedMesh *applyModifier(
/* save doing 2 loops here... */ /* save doing 2 loops here... */
#if 0 #if 0
fill_vn_i(edge_users, numEdges, INVALID_UNUSED); copy_vn_i(edge_users, numEdges, INVALID_UNUSED);
#endif #endif
for (eidx = 0, ed = orig_medge; eidx < numEdges; eidx++, ed++) { for (eidx = 0, ed = orig_medge; eidx < numEdges; eidx++, ed++) {
@@ -505,7 +505,7 @@ static DerivedMesh *applyModifier(
unsigned int i; unsigned int i;
vert_lens = MEM_mallocN(sizeof(float) * numVerts, "vert_lens"); vert_lens = MEM_mallocN(sizeof(float) * numVerts, "vert_lens");
fill_vn_fl(vert_lens, (int)numVerts, FLT_MAX); copy_vn_fl(vert_lens, (int)numVerts, FLT_MAX);
for (i = 0; i < numEdges; i++) { for (i = 0; i < numEdges; i++) {
const float ed_len_sq = len_squared_v3v3(mvert[medge[i].v1].co, mvert[medge[i].v2].co); const float ed_len_sq = len_squared_v3v3(mvert[medge[i].v1].co, mvert[medge[i].v2].co);
vert_lens[medge[i].v1] = min_ff(vert_lens[medge[i].v1], ed_len_sq); vert_lens[medge[i].v1] = min_ff(vert_lens[medge[i].v1], ed_len_sq);
@@ -672,7 +672,7 @@ static DerivedMesh *applyModifier(
float *vert_lens_sq = MEM_mallocN(sizeof(float) * numVerts, "vert_lens"); float *vert_lens_sq = MEM_mallocN(sizeof(float) * numVerts, "vert_lens");
const float offset = fabsf(smd->offset) * smd->offset_clamp; const float offset = fabsf(smd->offset) * smd->offset_clamp;
const float offset_sq = offset * offset; const float offset_sq = offset * offset;
fill_vn_fl(vert_lens_sq, (int)numVerts, FLT_MAX); copy_vn_fl(vert_lens_sq, (int)numVerts, FLT_MAX);
for (i = 0; i < numEdges; i++) { for (i = 0; i < numEdges; i++) {
const float ed_len = len_squared_v3v3(mvert[medge[i].v1].co, mvert[medge[i].v2].co); const float ed_len = len_squared_v3v3(mvert[medge[i].v1].co, mvert[medge[i].v2].co);
vert_lens_sq[medge[i].v1] = min_ff(vert_lens_sq[medge[i].v1], ed_len); vert_lens_sq[medge[i].v1] = min_ff(vert_lens_sq[medge[i].v1], ed_len);

View File

@@ -1858,7 +1858,7 @@ static PyObject *Matrix_zero(MatrixObject *self)
if (BaseMath_Prepare_ForWrite(self) == -1) if (BaseMath_Prepare_ForWrite(self) == -1)
return NULL; return NULL;
fill_vn_fl(self->matrix, self->num_col * self->num_row, 0.0f); copy_vn_fl(self->matrix, self->num_col * self->num_row, 0.0f);
if (BaseMath_WriteCallback(self) == -1) if (BaseMath_WriteCallback(self) == -1)
return NULL; return NULL;

View File

@@ -76,7 +76,7 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL; return NULL;
} }
fill_vn_fl(vec, size, 0.0f); copy_vn_fl(vec, size, 0.0f);
break; break;
case 1: case 1:
if ((size = mathutils_array_parse_alloc(&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) { if ((size = mathutils_array_parse_alloc(&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) {
@@ -142,7 +142,7 @@ static PyObject *C_Vector_Fill(PyObject *cls, PyObject *args)
return NULL; return NULL;
} }
fill_vn_fl(vec, size, fill); copy_vn_fl(vec, size, fill);
return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls); return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
} }
@@ -339,7 +339,7 @@ static PyObject *Vector_zero(VectorObject *self)
if (BaseMath_Prepare_ForWrite(self) == -1) if (BaseMath_Prepare_ForWrite(self) == -1)
return NULL; return NULL;
fill_vn_fl(self->vec, self->size, 0.0f); copy_vn_fl(self->vec, self->size, 0.0f);
if (BaseMath_WriteCallback(self) == -1) if (BaseMath_WriteCallback(self) == -1)
return NULL; return NULL;
@@ -426,7 +426,7 @@ static PyObject *Vector_resize(VectorObject *self, PyObject *value)
/* If the vector has increased in length, set all new elements to 0.0f */ /* If the vector has increased in length, set all new elements to 0.0f */
if (size > self->size) { if (size > self->size) {
fill_vn_fl(self->vec + self->size, size - self->size, 0.0f); copy_vn_fl(self->vec + self->size, size - self->size, 0.0f);
} }
self->size = size; self->size = size;
@@ -465,7 +465,7 @@ static PyObject *Vector_resized(VectorObject *self, PyObject *value)
return NULL; return NULL;
} }
fill_vn_fl(vec, size, 0.0f); copy_vn_fl(vec, size, 0.0f);
memcpy(vec, self->vec, self->size * sizeof(float)); memcpy(vec, self->vec, self->size * sizeof(float));
return Vector_CreatePyObject_alloc(vec, size, NULL); return Vector_CreatePyObject_alloc(vec, size, NULL);
@@ -2236,7 +2236,7 @@ static int Vector_length_set(VectorObject *self, PyObject *value)
return -1; return -1;
} }
if (param == 0.0) { if (param == 0.0) {
fill_vn_fl(self->vec, self->size, 0.0f); copy_vn_fl(self->vec, self->size, 0.0f);
return 0; return 0;
} }
@@ -3030,7 +3030,7 @@ PyObject *Vector_CreatePyObject(
memcpy(self->vec, vec, size * sizeof(float)); memcpy(self->vec, vec, size * sizeof(float));
} }
else { /* new empty */ else { /* new empty */
fill_vn_fl(self->vec, size, 0.0f); copy_vn_fl(self->vec, size, 0.0f);
if (size == 4) { /* do the homogeneous thing */ if (size == 4) { /* do the homogeneous thing */
self->vec[3] = 1.0f; self->vec[3] = 1.0f;
} }