diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-05 04:23:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-05 04:23:55 +0400 |
commit | 4c5502bfd690cad5c02aa6a0be0bd59400ef3407 (patch) | |
tree | 6c421d2c324166a682952476e7a1f9aa924c7c51 /source/blender/blenlib/intern | |
parent | 9466af0eabf05bfcb966cac01ee72dca544f7dd1 (diff) |
code cleanup: function naming for BLI functions.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/boxpack2d.c | 22 | ||||
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 42 | ||||
-rw-r--r-- | source/blender/blenlib/intern/callbacks.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/jitter.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 22 | ||||
-rw-r--r-- | source/blender/blenlib/intern/uvproject.c | 20 | ||||
-rw-r--r-- | source/blender/blenlib/intern/voxel.c | 16 |
7 files changed, 66 insertions, 66 deletions
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 6631e36fc72..f1931d35819 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -38,14 +38,14 @@ typedef struct boxVert { float y; short free; - struct boxPack *trb; /* top right box */ - struct boxPack *blb; /* bottom left box */ - struct boxPack *brb; /* bottom right box */ - struct boxPack *tlb; /* top left box */ + struct BoxPack *trb; /* top right box */ + struct BoxPack *blb; /* bottom left box */ + struct BoxPack *brb; /* bottom right box */ + struct BoxPack *tlb; /* top left box */ /* Store last intersecting boxes here * speedup intersection testing */ - struct boxPack *isect_cache[4]; + struct BoxPack *isect_cache[4]; int index; } boxVert; @@ -105,7 +105,7 @@ typedef struct boxVert { /* qsort function - sort largest to smallest */ static int box_areasort(const void *p1, const void *p2) { - const boxPack *b1 = p1, *b2 = p2; + const BoxPack *b1 = p1, *b2 = p2; const float a1 = BOXAREA(b1); const float a2 = BOXAREA(b2); @@ -152,12 +152,12 @@ static int vertex_sort(const void *p1, const void *p2) * len - the number of boxes in the array. * tot_width and tot_height are set so you can normalize the data. * */ -void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_height) +void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height) { boxVert *vert; /* the current vert */ int box_index, verts_pack_len, i, j, k, isect; int quad_flags[4] = {BLF, TRF, TLF, BRF}; /* use for looping */ - boxPack *box, *box_test; /*current box and another for intersection tests*/ + BoxPack *box, *box_test; /*current box and another for intersection tests*/ int *vertex_pack_indices; /*an array of indices used for sorting verts*/ if (!len) { @@ -167,11 +167,11 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he } /* Sort boxes, biggest first */ - qsort(boxarray, len, sizeof(boxPack), box_areasort); + qsort(boxarray, len, sizeof(BoxPack), box_areasort); /* add verts to the boxes, these are only used internally */ - vert = vertarray = MEM_mallocN(len * 4 * sizeof(boxVert), "boxPack Verts"); - vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "boxPack Indices"); + vert = vertarray = MEM_mallocN(len * 4 * sizeof(boxVert), "BoxPack Verts"); + vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "BoxPack Indices"); for (box = boxarray, box_index = 0, i = 0; box_index < len; box_index++, box++) { diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 739c4e00cc7..48912eb927a 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -92,9 +92,9 @@ static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), co } /* high level function */ -void checkMissingFiles(Main *bmain, ReportList *reports) +void BLI_bpath_missing_files_check(Main *bmain, ReportList *reports) { - bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BPATH_TRAVERSE_ABS, reports); + BLI_bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BLI_BPATH_TRAVERSE_ABS, reports); } typedef struct BPathRemap_Data { @@ -129,7 +129,7 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char } } -void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) +void BLI_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports) { BPathRemap_Data data = {NULL}; @@ -141,7 +141,7 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) data.basedir = basedir; data.reports = reports; - bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data); + BLI_bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data); BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO, "Total files %d|Changed %d|Failed %d", @@ -171,8 +171,8 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char } } -/* similar to makeFilesRelative - keep in sync! */ -void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports) +/* similar to BLI_bpath_relative_convert - keep in sync! */ +void BLI_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports) { BPathRemap_Data data = {NULL}; @@ -184,7 +184,7 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports) data.basedir = basedir; data.reports = reports; - bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data); + BLI_bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data); BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO, "Total files %d|Changed %d|Failed %d", @@ -293,14 +293,14 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char } } -void findMissingFiles(Main *bmain, const char *searchpath, ReportList *reports) +void BLI_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports) { struct BPathFind_Data data = {NULL}; data.reports = reports; BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir)); - bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data); + BLI_bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data); } /* Run a visitor on a string, replacing the contents of the string as needed. */ @@ -378,19 +378,19 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab } /* Run visitor function 'visit' on all paths contained in 'id'. */ -void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data) +void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data) { Image *ima; - const char *absbase = (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL; + const char *absbase = (flag & BLI_BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL; - if ((flag & BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) { + if ((flag & BLI_BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) { return; } switch (GS(id->name)) { case ID_IM: ima= (Image *)id; - if (ima->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) { + if (ima->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) { if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data); } @@ -470,7 +470,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla case ID_SO: { bSound *sound= (bSound *)id; - if (sound->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) { + if (sound->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) { rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data); } } @@ -483,7 +483,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla case ID_VF: { VFont *vf= (VFont *)id; - if (vf->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) { + if (vf->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) { if (strcmp(vf->name, FO_BUILTIN_NAME) != 0) { rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data); } @@ -523,7 +523,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla int len= MEM_allocN_len(se) / sizeof(*se); int i; - if (flag & BPATH_TRAVERSE_SKIP_MULTIFILE) { + if (flag & BLI_BPATH_TRAVERSE_SKIP_MULTIFILE) { /* only operate on one path */ len= MIN2(1, len); } @@ -575,26 +575,26 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla } } -void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data) +void BLI_bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data) { ID *id; for (id = lb->first; id; id = id->next) { - bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data); + BLI_bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data); } } -void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data) +void BLI_bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data) { ListBase *lbarray[MAX_LIBARRAY]; int a = set_listbasepointers(bmain, lbarray); while (a--) { - bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data); + BLI_bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data); } } /* Rewrites a relative path to be relative to the main file - unless the path is * absolute, in which case it is not altered. */ -int bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src) +int BLI_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src) { /* be sure there is low chance of the path being too short */ char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE]; diff --git a/source/blender/blenlib/intern/callbacks.c b/source/blender/blenlib/intern/callbacks.c index 0cb986d9090..876599f7480 100644 --- a/source/blender/blenlib/intern/callbacks.c +++ b/source/blender/blenlib/intern/callbacks.c @@ -28,7 +28,7 @@ static ListBase callback_slots[BLI_CB_EVT_TOT]= {{NULL}}; -void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt) +void BLI_callback_exec(struct Main *main, struct ID *self, eCbEvent evt) { ListBase *lb= &callback_slots[evt]; bCallbackFuncStore *funcstore; @@ -38,19 +38,19 @@ void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt) } } -void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt) +void BLI_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt) { ListBase *lb= &callback_slots[evt]; BLI_addtail(lb, funcstore); } -void BLI_cb_init(void) +void BLI_callback_global_init(void) { /* do nothing */ } /* call on application exit */ -void BLI_cb_finalize(void) +void BLI_callback_global_finalize(void) { eCbEvent evt; for (evt= 0; evt < BLI_CB_EVT_TOT; evt++) { diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c index c7977378f6a..afe31fb1377 100644 --- a/source/blender/blenlib/intern/jitter.c +++ b/source/blender/blenlib/intern/jitter.c @@ -136,7 +136,7 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2) } -void BLI_initjit(float *jitarr, int num) +void BLI_jitter_init(float *jitarr, int num) { float *jit2, x, rad1, rad2, rad3; int i; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 25850e14ae7..503de31616a 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -99,7 +99,7 @@ typedef struct ScanFillVertLink { #define SF_VERT_ZERO_LEN 255 /* Optionally set ScanFillEdge f to this to mark original boundary edges. - * Only needed if there are internal diagonal edges passed to BLI_edgefill. */ + * Only needed if there are internal diagonal edges passed to BLI_scanfill_calc. */ #define SF_EDGE_BOUNDARY 1 #define SF_EDGE_UNKNOWN 2 /* TODO, what is this for exactly? - need to document it! */ @@ -191,7 +191,7 @@ static void mem_element_reset(ScanFillContext *sf_ctx, int keep_first) sf_ctx->melem__offs = 0; } -void BLI_end_edgefill(ScanFillContext *sf_ctx) +void BLI_scanfill_end(ScanFillContext *sf_ctx) { mem_element_reset(sf_ctx, FALSE); @@ -202,7 +202,7 @@ void BLI_end_edgefill(ScanFillContext *sf_ctx) /* **** FILL ROUTINES *************************** */ -ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]) +ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3]) { ScanFillVert *eve; @@ -214,7 +214,7 @@ ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]) return eve; } -ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2) +ScanFillEdge *BLI_scanfill_edge_add(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2) { ScanFillEdge *newed; @@ -453,7 +453,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) const float dist = dist_to_line_v2(eed->v1->xy, eed->v2->xy, eve->xy); if (dist < SF_EPSILON) { /* new edge */ - ed1 = BLI_addfilledge(sf_ctx, eed->v1, eve); + ed1 = BLI_scanfill_edge_add(sf_ctx, eed->v1, eve); /* printf("fill: vertex near edge %x\n",eve); */ ed1->f = 0; @@ -681,7 +681,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) /* make new edge, and start over */ /* printf("add new edge %x %x and start again\n",v2,sc1->v1); */ - ed3 = BLI_addfilledge(sf_ctx, v2, sc1->v1); + ed3 = BLI_scanfill_edge_add(sf_ctx, v2, sc1->v1); BLI_remlink(&sf_ctx->filledgebase, ed3); BLI_insertlinkbefore((ListBase *)&(sc->first), ed2, ed3); ed3->v2->f = SF_VERT_UNKNOWN; @@ -709,7 +709,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) } /* new edge */ - ed3 = BLI_addfilledge(sf_ctx, v1, v3); + ed3 = BLI_scanfill_edge_add(sf_ctx, v1, v3); BLI_remlink(&sf_ctx->filledgebase, ed3); ed3->f = SF_EDGE_UNKNOWN; ed3->v1->h++; @@ -764,19 +764,19 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) } -int BLI_begin_edgefill(ScanFillContext *sf_ctx) +int BLI_scanfill_begin(ScanFillContext *sf_ctx) { memset(sf_ctx, 0, sizeof(*sf_ctx)); return 1; } -int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup) +int BLI_scanfill_calc(ScanFillContext *sf_ctx, const short do_quad_tri_speedup) { - return BLI_edgefill_ex(sf_ctx, do_quad_tri_speedup, NULL); + return BLI_scanfill_calc_ex(sf_ctx, do_quad_tri_speedup, NULL); } -int BLI_edgefill_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, const float nor_proj[3]) +int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, const float nor_proj[3]) { /* * - fill works with its own lists, so create that first (no faces!) diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index 268b4cbe4a3..a630084e79d 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -32,7 +32,7 @@ #include "BLI_math.h" #include "BLI_uvproject.h" -typedef struct UvCameraInfo { +typedef struct ProjCameraInfo { float camangle; float camsize; float xasp, yasp; @@ -40,9 +40,9 @@ typedef struct UvCameraInfo { float rotmat[4][4]; float caminv[4][4]; short do_persp, do_pano, do_rotmat; -} UvCameraInfo; +} ProjCameraInfo; -void project_from_camera(float target[2], float source[3], UvCameraInfo *uci) +void BLI_uvproject_from_camera(float target[2], float source[3], ProjCameraInfo *uci) { float pv4[4]; @@ -93,7 +93,7 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci) } /* could rv3d->persmat */ -void project_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy) +void BLI_uvproject_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy) { float pv[3], pv4[4], x = 0.0, y = 0.0; @@ -133,9 +133,9 @@ void project_from_view(float target[2], float source[3], float persmat[4][4], fl /* 'rotmat' can be obedit->obmat when uv project is used. * 'winx' and 'winy' can be from scene->r.xsch/ysch */ -UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy) +ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy) { - UvCameraInfo uci; + ProjCameraInfo uci; Camera *camera = ob->data; uci.do_pano = (camera->type == CAM_PANO); @@ -149,7 +149,7 @@ UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, flo normalize_m4(uci.caminv); if (invert_m4(uci.caminv)) { - UvCameraInfo *uci_pt; + ProjCameraInfo *uci_pt; /* normal projection */ if (rotmat) { @@ -174,7 +174,7 @@ UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, flo uci.shiftx = 0.5f - (camera->shiftx * uci.xasp); uci.shifty = 0.5f - (camera->shifty * uci.yasp); - uci_pt = MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo"); + uci_pt = MEM_mallocN(sizeof(ProjCameraInfo), "ProjCameraInfo"); *uci_pt = uci; return uci_pt; } @@ -182,7 +182,7 @@ UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, flo return NULL; } -void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4]) +void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]) { float pv[3]; @@ -193,7 +193,7 @@ void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4 target[1] = pv[2]; } -void project_camera_info_scale(UvCameraInfo *uci, float scale_x, float scale_y) +void BLI_uvproject_camera_info_scale(ProjCameraInfo *uci, float scale_x, float scale_y) { uci->xasp *= scale_x; uci->yasp *= scale_y; diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index 34862c724e1..1fe42384eb6 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -37,15 +37,15 @@ BLI_INLINE float D(float *data, const int res[3], int x, int y, int z) { - CLAMP(x, 0, res[0]-1); - CLAMP(y, 0, res[1]-1); - CLAMP(z, 0, res[2]-1); - return data[ V_I(x, y, z, res) ]; + CLAMP(x, 0, res[0] - 1); + CLAMP(y, 0, res[1] - 1); + CLAMP(z, 0, res[2] - 1); + return data[ BLI_VEXEL_INDEX(x, y, z, res) ]; } /* *** nearest neighbor *** */ /* input coordinates must be in bounding box 0.0 - 1.0 */ -float voxel_sample_nearest(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3]) { int xi, yi, zi; @@ -70,7 +70,7 @@ BLI_INLINE int _clamp(int a, int b, int c) return (a < b) ? b : ((a > c) ? c : a); } -float voxel_sample_trilinear(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3]) { if (data) { @@ -102,7 +102,7 @@ float voxel_sample_trilinear(float *data, const int res[3], const float co[3]) } -float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float co[3]) { if (data) { @@ -132,7 +132,7 @@ float voxel_sample_triquadratic(float *data, const int res[3], const float co[3] return 0.f; } -float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline) +float BLI_voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline) { if (data) { |