From 950ed6929792952044a57cad00833bddc8d39f45 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 28 Apr 2012 08:29:20 +0000 Subject: code cleanup: - replace inline face UV center calc. - use const float[3] for mesh and uv functions. - remove unused define --- source/blender/blenkernel/BKE_lattice.h | 2 +- source/blender/blenkernel/intern/dynamicpaint.c | 2 +- source/blender/blenkernel/intern/lattice.c | 2 +- source/blender/blenlib/intern/math_rotation.c | 2 +- .../editors/animation/anim_channels_defines.c | 38 ++++++++-------- source/blender/editors/include/ED_anim_api.h | 2 +- source/blender/editors/include/ED_mesh.h | 8 ++-- source/blender/editors/include/ED_uvedit.h | 5 +- source/blender/editors/mesh/editface.c | 8 ++-- source/blender/editors/mesh/editmesh_bvh.c | 18 ++++---- source/blender/editors/mesh/editmesh_bvh.h | 5 +- source/blender/editors/mesh/editmesh_knife.c | 2 +- source/blender/editors/mesh/editmesh_rip.c | 3 +- source/blender/editors/mesh/editmesh_utils.c | 2 +- source/blender/editors/mesh/meshtools.c | 10 ++-- source/blender/editors/sculpt_paint/sculpt.c | 2 +- source/blender/editors/uvedit/uvedit_intern.h | 11 +++-- source/blender/editors/uvedit/uvedit_ops.c | 53 +++++++++------------- source/blender/modifiers/intern/MOD_hook.c | 2 +- 19 files changed, 85 insertions(+), 92 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 29c78510fd8..a0075c4d6be 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -49,7 +49,7 @@ void make_local_lattice(struct Lattice *lt); void calc_lat_fudu(int flag, int res, float *fu, float *du); void init_latt_deform(struct Object *oblatt, struct Object *ob); -void calc_latt_deform(struct Object *, float *co, float weight); +void calc_latt_deform(struct Object *, float co[3], float weight); void end_latt_deform(struct Object *); int object_deform_mball(struct Object *ob, struct ListBase *dispbase); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 31544dd5ca0..e6f38a3a334 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2791,7 +2791,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay * To optimize brush detection speed this doesn't calculate hit normal. * If ray hit the second half of a quad, no[0] is set to 1.0f, else 0.0f */ -static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *co, BVHTreeNearest *nearest) +static void mesh_faces_nearest_point_dp(void *userdata, int index, const float co[3], BVHTreeNearest *nearest) { const BVHTreeFromMesh *data = (BVHTreeFromMesh*) userdata; MVert *vert = data->vert; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index f182d7bcb7c..12f11a9dee1 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -342,7 +342,7 @@ void init_latt_deform(Object *oblatt, Object *ob) } } -void calc_latt_deform(Object *ob, float *co, float weight) +void calc_latt_deform(Object *ob, float co[3], float weight) { Lattice *lt= ob->data; float u, v, w, tu[4], tv[4], tw[4]; diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index ec5fd39cd87..bb3265bdf33 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1615,7 +1615,7 @@ void normalize_dq(DualQuat *dq, float totweight) } } -void mul_v3m3_dq(float *co, float mat[][3], DualQuat *dq) +void mul_v3m3_dq(float co[3], float mat[][3], DualQuat *dq) { float M[3][3], t[3], scalemat[3][3], len2; float w = dq->quat[0], x = dq->quat[1], y = dq->quat[2], z = dq->quat[3]; diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 01ab36133fd..fbed5cc539a 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -98,10 +98,10 @@ /* Draw Backdrop ---------------------------------- */ /* get backdrop color for top-level widgets (Scene and Object only) */ -static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) +static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3]) { /* darker blue for top-level widgets */ - UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, color); + UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, r_color); } /* backdrop for top-level widgets (Scene and Object only) */ @@ -124,10 +124,10 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa /* get backdrop color for data expanders under top-level Scene/Object */ -static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) +static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3]) { /* lighter color than top-level widget */ - UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, color); + UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, r_color); } /* backdrop for data expanders under top-level Scene/Object */ @@ -147,7 +147,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale } /* get backdrop color for generic channels */ -static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3]) { bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale); SpaceAction *saction = NULL; @@ -183,12 +183,12 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa } /* copy the colors over, transforming from bytes to floats */ - rgb_uchar_to_float(color, cp); + rgb_uchar_to_float(r_color, cp); } else { // FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)? int colOfs= 20 - 20*indent; - UI_GetThemeColorShade3fv(TH_HEADER, colOfs, color); + UI_GetThemeColorShade3fv(TH_HEADER, colOfs, r_color); } } @@ -374,13 +374,13 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle /* Animation Summary ----------------------------------- */ /* get backdrop color for summary widget */ -static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) +static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3]) { // FIXME: hardcoded color - same as the 'action' line in NLA // reddish color - color[0] = 0.8f; - color[1] = 0.2f; - color[2] = 0.0f; + r_color[0] = 0.8f; + r_color[1] = 0.2f; + r_color[2] = 0.0f; } /* backdrop for summary widget */ @@ -730,13 +730,13 @@ static bAnimChannelType ACF_OBJECT = /* Group ------------------------------------------- */ /* get backdrop color for group widget */ -static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color) +static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3]) { /* highlight only for action group channels */ if (ale->flag & AGRP_ACTIVE) - UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, color); + UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color); else - UI_GetThemeColorShade3fv(TH_GROUP, 20, color); + UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color); } /* backdrop for group widget */ @@ -2322,10 +2322,10 @@ static bAnimChannelType ACF_SHAPEKEY= /* GPencil Datablock ------------------------------------------- */ /* get backdrop color for gpencil datablock widget */ -static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) +static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3]) { /* these are ID-blocks, but not exactly standalone... */ - UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, color); + UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color); } // TODO: just get this from RNA? @@ -3043,7 +3043,8 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi } /* Draw a widget for some setting */ -static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting) +static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, + uiBlock *block, int xpos, int ypos, int setting) { short negflag, ptrsize /* , enabled */ /* UNUSED */, butType; int flag, icon; @@ -3222,7 +3223,8 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al uiBlockSetEmboss(block, UI_EMBOSS); - but = uiDefButR(block, TEX, 1, "", offset+3, yminc, RENAME_TEXT_WIDTH, channel_height, &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL); + but = uiDefButR(block, TEX, 1, "", offset+3, yminc, RENAME_TEXT_WIDTH, channel_height, + &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL); uiButSetFunc(but, achannel_setting_rename_done_cb, ac->ads, NULL); uiButActiveOnly(C, block, but); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index a9affbcd342..391286a2a88 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -366,7 +366,7 @@ typedef struct bAnimChannelType { /* drawing */ /* get RGB color that is used to draw the majority of the backdrop */ - void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float *color); + void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float r_color[3]); /* draw backdrop strip for channel */ void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc); /* get depth of indention (relative to the depth channel is nested at) */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 4c503a2687c..71d37d5c6ea 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -71,7 +71,7 @@ struct Material; struct Object; struct rcti; -intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, char mode); +intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode); int mesh_mirrtopo_table(struct Object *ob, char mode); /* editmesh_utils.c */ @@ -139,7 +139,7 @@ struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace * void EDBM_uv_vert_map_free(struct UvVertMap *vmap); struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v); -struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, float *limit); +struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2]); void EDBM_data_layer_add(struct BMEditMesh *em, struct CustomData *data, int type, const char *name); void EDBM_data_layer_free(struct BMEditMesh *em, struct CustomData *data, int type); @@ -158,7 +158,7 @@ extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs; int mouse_mesh(struct bContext *C, const int mval[2], short extend); -struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, float *co, int index); +struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index); int mesh_get_x_mirror_vert(struct Object *ob, int index); int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em); @@ -188,7 +188,7 @@ int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend); void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags); void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode); -int paintface_minmax(struct Object *ob, float *min, float *max); +int paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]); void paintface_hide(struct Object *ob, const int unselected); void paintface_reveal(struct Object *ob); diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 3569c0e8243..2427ed1a333 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -51,7 +51,7 @@ void ED_operatortypes_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); void ED_uvedit_assign_image(struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma); -int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max); +int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float min[2], float max[2]); int ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **ima, struct ImageUser **iuser, struct bNode **node); void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, struct Image *ima); @@ -71,7 +71,8 @@ void uvedit_edge_select_disable(struct BMEditMesh *em, struct Scene *scene, stru void uvedit_uv_select_enable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const short do_history); void uvedit_uv_select_disable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l); -int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float uv[2]); +int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, + const float co[2], float r_uv[2]); /* uvedit_unwrap_ops.c */ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 294a39eddf8..cfc9e11879e 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -400,14 +400,14 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags) } } -int paintface_minmax(Object *ob, float *min, float *max) +int paintface_minmax(Object *ob, float r_min[3], float r_max[3]) { Mesh *me; MPoly *mp; MTexPoly *tf; MLoop *ml; MVert *mvert; - int a, b, ok = 0; + int a, b, ok = FALSE; float vec[3], bmat[3][3]; me = get_mesh(ob); @@ -427,10 +427,10 @@ int paintface_minmax(Object *ob, float *min, float *max) copy_v3_v3(vec, (mvert[ml->v].co)); mul_m3_v3(bmat, vec); add_v3_v3v3(vec, vec, ob->obmat[3]); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, r_min, r_max); } - ok = 1; + ok = TRUE; } return ok; diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c index 6155ad1be1c..6d740812f27 100644 --- a/source/blender/editors/mesh/editmesh_bvh.c +++ b/source/blender/editors/mesh/editmesh_bvh.c @@ -239,7 +239,8 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre } } -BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit) +BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]) { BVHTreeRayHit hit; @@ -250,10 +251,9 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo BLI_bvhtree_ray_cast(tree->tree, co, dir, 0.0f, &hit, raycallback, tree); if (hit.dist != FLT_MAX && hit.index != -1) { - if (hitout) { + if (r_hitout) { if (tree->flag & BMBVH_RETURN_ORIG) { BMVert *v1, *v2, *v3; - float co[3]; int i; v1 = tree->em->looptris[hit.index][0]->v; @@ -261,17 +261,17 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo v3 = tree->em->looptris[hit.index][2]->v; for (i = 0; i < 3; i++) { - co[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) + - ((v3->co[i] - v1->co[i]) * tree->uv[1]); + r_hitout[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) + + ((v3->co[i] - v1->co[i]) * tree->uv[1]); } - copy_v3_v3(hitout, co); } else { - copy_v3_v3(hitout, hit.co); + copy_v3_v3(r_hitout, hit.co); } - if (cagehit) - copy_v3_v3(cagehit, hit.co); + if (r_cagehit) { + copy_v3_v3(r_cagehit, hit.co); + } } return tree->em->looptris[hit.index][0]->f; diff --git a/source/blender/editors/mesh/editmesh_bvh.h b/source/blender/editors/mesh/editmesh_bvh.h index e2b45062e41..6512f054c1b 100644 --- a/source/blender/editors/mesh/editmesh_bvh.h +++ b/source/blender/editors/mesh/editmesh_bvh.h @@ -50,13 +50,12 @@ struct BMBVHTree *BMBVH_NewBVH(struct BMEditMesh *em, int flag, struct Scene *sc void BMBVH_FreeBVH(struct BMBVHTree *tree); struct BVHTree *BMBVH_BVHTree(struct BMBVHTree *tree); -struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit); +struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]); int BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, struct ARegion *ar, struct View3D *v3d, struct Object *obedit); -#define BM_SEARCH_MAXDIST 0.4f - /*find a vert closest to co in a sphere of radius maxdist*/ struct BMVert *BMBVH_FindClosestVert(struct BMBVHTree *tree, float *co, float maxdist); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index b3bc0a1ffa9..6f33fcd05b7 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -277,7 +277,7 @@ static void knife_add_to_vert_edges(KnifeTool_OpData *kcd, KnifeEdge *kfe) knife_append_list(kcd, &kfe->v2->edges, kfe); } -static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, float *co, float *cageco) +static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, const float co[3], float *cageco) { KnifeVert *kfv = BLI_mempool_calloc(kcd->kverts); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index e755df1f076..b5f486947b4 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -56,7 +56,8 @@ #include "mesh_intern.h" /* helper to find edge for edge_rip */ -static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const float mvalf[2]) +static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], + const float co1[3], const float co2[2], const float mvalf[2]) { float vec1[3], vec2[3]; diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 4ec3c22d1df..2ebeb9ca224 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -567,7 +567,7 @@ void undo_push_mesh(bContext *C, const char *name) } /* write comment here */ -UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit) +UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2]) { BMVert *ev; BMFace *efa; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 0a6368daf74..b3ac3069cd9 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -641,7 +641,7 @@ typedef struct MocNode { intptr_t index[MOC_NODE_RES]; } MocNode; -static int mesh_octree_get_base_offs(float *co, float *offs, float *div) +static int mesh_octree_get_base_offs(const float co[3], const float offs[3], const float div[3]) { int vx, vy, vz; @@ -736,7 +736,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f } -static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co) +static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, const float co[3]) { float *vec; int a; @@ -773,7 +773,7 @@ static struct { /* mode is 's' start, or 'e' end, or 'u' use */ /* if end, ob can be NULL */ -intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode) +intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char mode) { MocNode **bt; @@ -920,7 +920,7 @@ int mesh_get_x_mirror_vert(Object *ob, int index) return 0; } -static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, float *co) +static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, const float co[3]) { float vec[3]; intptr_t poinval; @@ -972,7 +972,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e return NULL; } -BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index) +BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index) { if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 507fbe0f4b8..8d2dfc8dbfa 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -766,7 +766,7 @@ static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v) } /* Handles clipping against a mirror modifier and SCULPT_LOCK axis flags */ -static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float val[3]) +static void sculpt_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3]) { int i; diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index 04d20b3ba09..d258d271833 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -55,8 +55,8 @@ int uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa); /* geometric utilities */ float uv_poly_area(float uv[][2], int len); -void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len); -void uv_poly_center(struct BMEditMesh *em, struct BMFace *f, float cent[2]); +void uv_poly_copy_aspect(float uv_orig [][2], float uv[][2], float aspx, float aspy, int len); +void uv_poly_center(struct BMEditMesh *em, struct BMFace *f, float r_cent[2]); /* find nearest */ @@ -69,8 +69,10 @@ typedef struct NearestHit { int vert1, vert2; //index in mesh of edge vertices } NearestHit; -void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], float penalty[2], struct NearestHit *hit); -void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], struct NearestHit *hit); +void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, + const float co[2], const float penalty[2], struct NearestHit *hit); +void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, + const float co[2], struct NearestHit *hit); /* utility tool functions */ @@ -115,4 +117,3 @@ void UV_OT_unwrap(struct wmOperatorType *ot); void UV_OT_stitch(struct wmOperatorType *ot); #endif /* __UVEDIT_INTERN_H__ */ - diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 4a115465932..7883fac3ec2 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -523,20 +523,20 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit) } /*********************** geometric utilities ***********************/ -void uv_poly_center(BMEditMesh *em, BMFace *f, float cent[2]) +void uv_poly_center(BMEditMesh *em, BMFace *f, float r_cent[2]) { BMLoop *l; MLoopUV *luv; BMIter liter; - zero_v2(cent); + zero_v2(r_cent); BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - add_v2_v2(cent, luv->uv); + add_v2_v2(r_cent, luv->uv); } - mul_v2_fl(cent, 1.0f / (float)f->len); + mul_v2_fl(r_cent, 1.0f / (float)f->len); } float uv_poly_area(float uv[][2], int len) @@ -561,7 +561,7 @@ void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float as } } -int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float *max) +int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2], float r_max[2]) { BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; @@ -571,7 +571,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float MLoopUV *luv; int sel; - INIT_MINMAX2(min, max); + INIT_MINMAX2(r_min, r_max); sel = 0; BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { @@ -582,7 +582,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if (uvedit_uv_select_test(em, scene, l)) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - DO_MINMAX2(luv->uv, min, max); + DO_MINMAX2(luv->uv, r_min, r_max); sel = 1; } } @@ -643,7 +643,7 @@ static int uvedit_center(Scene *scene, Image *ima, Object *obedit, float cent[2] /************************** find nearest ****************************/ -void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit) +void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit) { MTexPoly *tf; BMFace *efa; @@ -690,13 +690,11 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2], } } -static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit) +static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit) { MTexPoly *tf; BMFace *efa; - BMLoop *l; - BMIter iter, liter; - MLoopUV *luv; + BMIter iter; float mindist, dist, cent[2]; mindist = 1e10f; @@ -711,16 +709,9 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); if (!uvedit_face_visible_test(scene, ima, efa, tf)) continue; - - cent[0] = cent[1] = 0.0f; - BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - add_v2_v2(cent, luv->uv); - } + uv_poly_center(em, efa, cent); - cent[0] /= efa->len; - cent[1] /= efa->len; dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]); if (dist < mindist) { @@ -732,7 +723,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float } static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), int id, - float co[2], float uv[2]) + const float co[2], const float uv[2]) { BMLoop *l; MLoopUV *luv; @@ -778,7 +769,7 @@ static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), i } void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em, - float co[2], float penalty[2], NearestHit *hit) + float const co[2], const float penalty[2], NearestHit *hit) { BMFace *efa; BMLoop *l; @@ -836,7 +827,7 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em, } } -int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2]) +int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float co[2], float r_uv[2]) { BMEditMesh *em = BMEdit_FromObject(obedit); BMFace *efa; @@ -845,11 +836,10 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], MTexPoly *tf; MLoopUV *luv; float mindist, dist; - int found = 0; + int found = FALSE; mindist = 1e10f; - uv[0] = co[0]; - uv[1] = co[1]; + copy_v2_v2(r_uv, co); BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); @@ -863,9 +853,8 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], if (dist <= mindist) { mindist = dist; - uv[0] = luv->uv[0]; - uv[1] = luv->uv[1]; - found = 1; + copy_v2_v2(r_uv, luv->uv); + found = TRUE; } } } @@ -1085,7 +1074,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit /*********************** linked select ***********************/ -static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[2], NearestHit *hit, int extend) +static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, int extend) { BMFace *efa; BMLoop *l; @@ -1696,7 +1685,7 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa return 0; } -static int mouse_select(bContext *C, float co[2], int extend, int loop) +static int mouse_select(bContext *C, const float co[2], int extend, int loop) { SpaceImage *sima = CTX_wm_space_image(C); Scene *scene = CTX_data_scene(C); @@ -2768,7 +2757,7 @@ void UV_OT_select_lasso(wmOperatorType *ot) /* ******************** snap cursor operator **************** */ -static void snap_uv_to_pixel(float *uvco, float w, float h) +static void snap_uv_to_pixel(float uvco[2], float w, float h) { uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w; uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index d8fbb6f468f..b115e5bb244 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -128,7 +128,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } -static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac) +static float hook_falloff(const float co_1[3], const float co_2[3], const float falloff_squared, float fac) { if (falloff_squared) { float len_squared = len_squared_v3v3(co_1, co_2); -- cgit v1.2.3