From bb3ec3ebafbc2c0e5d8530148a433242e0adad30 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Sep 2018 12:05:58 +1000 Subject: BLI_utildefines: rename pointer conversion macros Terms get/set don't make much sense when casting values. Name macros so the conversion is obvious, use common prefix for easier completion. - GET_INT_FROM_POINTER -> POINTER_AS_INT - SET_INT_IN_POINTER -> POINTER_FROM_INT - GET_UINT_FROM_POINTER -> POINTER_AS_UINT - SET_UINT_IN_POINTER -> POINTER_FROM_UINT --- .../blenkernel/intern/CCGSubSurf_opensubdiv.c | 12 +-- .../intern/CCGSubSurf_opensubdiv_converter.c | 36 ++++----- source/blender/blenkernel/intern/armature.c | 4 +- source/blender/blenkernel/intern/cdderivedmesh.c | 22 +++--- source/blender/blenkernel/intern/editderivedmesh.c | 2 +- source/blender/blenkernel/intern/font.c | 2 +- source/blender/blenkernel/intern/icons.c | 18 ++--- source/blender/blenkernel/intern/mask_rasterize.c | 4 +- source/blender/blenkernel/intern/material.c | 4 +- source/blender/blenkernel/intern/mesh.c | 10 +-- source/blender/blenkernel/intern/mesh_convert.c | 4 +- source/blender/blenkernel/intern/mesh_evaluate.c | 14 ++-- source/blender/blenkernel/intern/mesh_remap.c | 18 ++--- source/blender/blenkernel/intern/mesh_validate.c | 16 ++-- source/blender/blenkernel/intern/object.c | 10 +-- source/blender/blenkernel/intern/object_deform.c | 2 +- source/blender/blenkernel/intern/object_dupli.c | 2 +- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/particle_system.c | 8 +- source/blender/blenkernel/intern/pbvh.c | 16 ++-- source/blender/blenkernel/intern/subsurf_ccg.c | 88 +++++++++++----------- 21 files changed, 147 insertions(+), 147 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c index f568bb94ac5..65c6518cee4 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c @@ -75,7 +75,7 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm) ccgFaceIterator_next(&ccg_face_iter)) { /*const*/ CCGFace *ccg_face = ccgFaceIterator_getCurrent(&ccg_face_iter); - const int poly_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ccg_face)); + const int poly_index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(ccg_face)); const MPoly *mp = &mpoly[poly_index]; int corner; if (ccg_face->numVerts != mp->totloop) { @@ -83,7 +83,7 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm) } for (corner = 0; corner < ccg_face->numVerts; corner++) { /*const*/ CCGVert *ccg_vert = FACE_getVerts(ccg_face)[corner]; - const int vert_index = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert)); + const int vert_index = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert)); if (vert_index != mloop[mp->loopstart + corner].v) { return false; } @@ -101,9 +101,9 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm) /* const */ CCGEdge *ccg_edge = ccgEdgeIterator_getCurrent(&ccg_edge_iter); /* const */ CCGVert *ccg_vert1 = ccg_edge->v0; /* const */ CCGVert *ccg_vert2 = ccg_edge->v1; - const int ccg_vert1_index = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert1)); - const int ccg_vert2_index = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert2)); - const int edge_index = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); + const int ccg_vert1_index = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert1)); + const int ccg_vert2_index = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert2)); + const int edge_index = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); const MEdge *me = &medge[edge_index]; if (me->v1 != ccg_vert1_index || me->v2 != ccg_vert2_index) { return false; @@ -119,7 +119,7 @@ static bool compare_ccg_derivedmesh_topology(CCGSubSurf *ss, DerivedMesh *dm) ccgEdgeIterator_next(&ccg_edge_iter)) { /* const */ CCGEdge *ccg_edge = ccgEdgeIterator_getCurrent(&ccg_edge_iter); - const int edge_index = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); + const int edge_index = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); if (ccg_edge->crease != medge[edge_index].crease) { return false; } diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c index 8c1ba0c3782..d6b15148ed1 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c @@ -562,7 +562,7 @@ static int conv_ccg_get_num_face_verts(const OpenSubdiv_Converter *converter, int face) { CCGSubSurf *ss = converter->user_data; - CCGFace *ccg_face = ccgSubSurf_getFace(ss, SET_INT_IN_POINTER(face)); + CCGFace *ccg_face = ccgSubSurf_getFace(ss, POINTER_FROM_INT(face)); return ccgSubSurf_getFaceNumVerts(ccg_face); } @@ -571,12 +571,12 @@ static void conv_ccg_get_face_verts(const OpenSubdiv_Converter *converter, int *face_verts) { CCGSubSurf *ss = converter->user_data; - CCGFace *ccg_face = ccgSubSurf_getFace(ss, SET_INT_IN_POINTER(face)); + CCGFace *ccg_face = ccgSubSurf_getFace(ss, POINTER_FROM_INT(face)); int num_face_verts = ccgSubSurf_getFaceNumVerts(ccg_face); int loop; for (loop = 0; loop < num_face_verts; loop++) { CCGVert *ccg_vert = ccgSubSurf_getFaceVert(ccg_face, loop); - face_verts[loop] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert)); + face_verts[loop] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert)); } } @@ -585,12 +585,12 @@ static void conv_ccg_get_face_edges(const OpenSubdiv_Converter *converter, int *face_edges) { CCGSubSurf *ss = converter->user_data; - CCGFace *ccg_face = ccgSubSurf_getFace(ss, SET_INT_IN_POINTER(face)); + CCGFace *ccg_face = ccgSubSurf_getFace(ss, POINTER_FROM_INT(face)); int num_face_verts = ccgSubSurf_getFaceNumVerts(ccg_face); int loop; for (loop = 0; loop < num_face_verts; loop++) { CCGEdge *ccg_edge = ccgSubSurf_getFaceEdge(ccg_face, loop); - face_edges[loop] = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); + face_edges[loop] = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); } } @@ -599,18 +599,18 @@ static void conv_ccg_get_edge_verts(const OpenSubdiv_Converter *converter, int *edge_verts) { CCGSubSurf *ss = converter->user_data; - CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge)); + CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge)); CCGVert *ccg_vert0 = ccgSubSurf_getEdgeVert0(ccg_edge); CCGVert *ccg_vert1 = ccgSubSurf_getEdgeVert1(ccg_edge); - edge_verts[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert0)); - edge_verts[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ccg_vert1)); + edge_verts[0] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert0)); + edge_verts[1] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(ccg_vert1)); } static int conv_ccg_get_num_edge_faces(const OpenSubdiv_Converter *converter, int edge) { CCGSubSurf *ss = converter->user_data; - CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge)); + CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge)); return ccgSubSurf_getEdgeNumFaces(ccg_edge); } @@ -619,12 +619,12 @@ static void conv_ccg_get_edge_faces(const OpenSubdiv_Converter *converter, int *edge_faces) { CCGSubSurf *ss = converter->user_data; - CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge)); + CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge)); int num_edge_faces = ccgSubSurf_getEdgeNumFaces(ccg_edge); int face; for (face = 0; face < num_edge_faces; face++) { CCGFace *ccg_face = ccgSubSurf_getEdgeFace(ccg_edge, face); - edge_faces[face] = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ccg_face)); + edge_faces[face] = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(ccg_face)); } } @@ -632,7 +632,7 @@ static float conv_ccg_get_edge_sharpness(const OpenSubdiv_Converter *converter, int edge) { CCGSubSurf *ss = converter->user_data; - CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, SET_INT_IN_POINTER(edge)); + CCGEdge *ccg_edge = ccgSubSurf_getEdge(ss, POINTER_FROM_INT(edge)); /* TODO(sergey): Multiply by subdivision level once CPU evaluator * is switched to uniform subdivision type. */ @@ -643,7 +643,7 @@ static int conv_ccg_get_num_vert_edges(const OpenSubdiv_Converter *converter, int vert) { CCGSubSurf *ss = converter->user_data; - CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert)); + CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert)); return ccgSubSurf_getVertNumEdges(ccg_vert); } @@ -652,12 +652,12 @@ static void conv_ccg_get_vert_edges(const OpenSubdiv_Converter *converter, int *vert_edges) { CCGSubSurf *ss = converter->user_data; - CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert)); + CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert)); int num_vert_edges = ccgSubSurf_getVertNumEdges(ccg_vert); int edge; for (edge = 0; edge < num_vert_edges; edge++) { CCGEdge *ccg_edge = ccgSubSurf_getVertEdge(ccg_vert, edge); - vert_edges[edge] = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); + vert_edges[edge] = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(ccg_edge)); } } @@ -665,7 +665,7 @@ static int conv_ccg_get_num_vert_faces(const OpenSubdiv_Converter *converter, int vert) { CCGSubSurf *ss = converter->user_data; - CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert)); + CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert)); return ccgSubSurf_getVertNumFaces(ccg_vert); } @@ -674,12 +674,12 @@ static void conv_ccg_get_vert_faces(const OpenSubdiv_Converter *converter, int *vert_faces) { CCGSubSurf *ss = converter->user_data; - CCGVert *ccg_vert = ccgSubSurf_getVert(ss, SET_INT_IN_POINTER(vert)); + CCGVert *ccg_vert = ccgSubSurf_getVert(ss, POINTER_FROM_INT(vert)); int num_vert_faces = ccgSubSurf_getVertNumFaces(ccg_vert); int face; for (face = 0; face < num_vert_faces; face++) { CCGFace *ccg_face = ccgSubSurf_getVertFace(ccg_vert, face); - vert_faces[face] = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ccg_face)); + vert_faces[face] = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(ccg_face)); } } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index b7a811b7574..2eded2ee8f1 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1068,7 +1068,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float GHash *idx_hash = BLI_ghash_ptr_new("pose channel index by name"); int pchan_index = 0; for (pchan = armOb->pose->chanbase.first; pchan != NULL; pchan = pchan->next, ++pchan_index) { - BLI_ghash_insert(idx_hash, pchan, SET_INT_IN_POINTER(pchan_index)); + BLI_ghash_insert(idx_hash, pchan, POINTER_FROM_INT(pchan_index)); } for (i = 0, dg = target->defbase.first; dg; i++, dg = dg->next) { defnrToPC[i] = BKE_pose_channel_find_name(armOb->pose, dg->name); @@ -1078,7 +1078,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float defnrToPC[i] = NULL; } else { - defnrToPCIndex[i] = GET_INT_FROM_POINTER(BLI_ghash_lookup(idx_hash, defnrToPC[i])); + defnrToPCIndex[i] = POINTER_AS_INT(BLI_ghash_lookup(idx_hash, defnrToPC[i])); } } } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 1c5b1ca242c..ed2b8cddc14 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -2735,7 +2735,7 @@ void CDDM_calc_loop_normals_spacearr( r_lnors_spacearr->lspacearr[i]->ref_beta, r_lnors_spacearr->lspacearr[i]->loops); printf("\t\t(shared with loops"); while (loops) { - printf(" %d", GET_INT_FROM_POINTER(loops->link)); + printf(" %d", POINTER_AS_INT(loops->link)); loops = loops->next; } printf(")\n"); @@ -3067,13 +3067,13 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int void **val_p; if (BLI_edgehash_ensure_p(ehash, v1, v2, &val_p)) { - newe[i] = GET_INT_FROM_POINTER(*val_p); + newe[i] = POINTER_AS_INT(*val_p); } else { STACK_PUSH(olde, i); STACK_PUSH(medge, *med); newe[i] = c; - *val_p = SET_INT_IN_POINTER(c); + *val_p = POINTER_FROM_INT(c); c++; } } @@ -3235,7 +3235,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int uint v2 = mlv; BLI_assert(v1 != v2); if (BLI_edgehash_ensure_p(ehash, v1, v2, &val_p)) { - last_valid_ml->e = GET_INT_FROM_POINTER(*val_p); + last_valid_ml->e = POINTER_AS_INT(*val_p); } else { const int new_eidx = STACK_SIZE(medge); @@ -3244,7 +3244,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int medge[new_eidx].v1 = last_valid_ml->v; medge[new_eidx].v2 = ml->v; /* DO NOT change newe mapping, could break actual values due to some deleted original edges. */ - *val_p = SET_INT_IN_POINTER(new_eidx); + *val_p = POINTER_FROM_INT(new_eidx); created_edges++; last_valid_ml->e = new_eidx; @@ -3287,7 +3287,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int uint v2 = (vtargetmap[first_valid_ml->v] != -1) ? vtargetmap[first_valid_ml->v] : first_valid_ml->v; BLI_assert(v1 != v2); if (BLI_edgehash_ensure_p(ehash, v1, v2, &val_p)) { - last_valid_ml->e = GET_INT_FROM_POINTER(*val_p); + last_valid_ml->e = POINTER_AS_INT(*val_p); } else { const int new_eidx = STACK_SIZE(medge); @@ -3296,7 +3296,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int medge[new_eidx].v1 = last_valid_ml->v; medge[new_eidx].v2 = first_valid_ml->v; /* DO NOT change newe mapping, could break actual values due to some deleted original edges. */ - *val_p = SET_INT_IN_POINTER(new_eidx); + *val_p = POINTER_FROM_INT(new_eidx); created_edges++; last_valid_ml->e = new_eidx; @@ -3491,7 +3491,7 @@ void CDDM_calc_edges(DerivedMesh *dm) eh = BLI_edgehash_new_ex(__func__, eh_reserve); if (med) { for (i = 0; i < numEdges; i++, med++) { - BLI_edgehash_insert(eh, med->v1, med->v2, SET_INT_IN_POINTER(i + 1)); + BLI_edgehash_insert(eh, med->v1, med->v2, POINTER_FROM_INT(i + 1)); } } @@ -3520,7 +3520,7 @@ void CDDM_calc_edges(DerivedMesh *dm) BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) { BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2); - j = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); + j = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi)); if (j == 0 || !eindex) { med->flag = ME_EDGEDRAW | ME_EDGERENDER; @@ -3531,7 +3531,7 @@ void CDDM_calc_edges(DerivedMesh *dm) *index = eindex[j - 1]; } - BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i)); + BLI_edgehashIterator_setValue(ehi, POINTER_FROM_INT(i)); } BLI_edgehashIterator_free(ehi); @@ -3548,7 +3548,7 @@ void CDDM_calc_edges(DerivedMesh *dm) for (j = 0; j < mp->totloop; j++, ml++) { v1 = ml->v; v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v; - ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, v1, v2)); + ml->e = POINTER_AS_INT(BLI_edgehash_lookup(eh, v1, v2)); } } diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index fa4e4372273..db9ce6c9b7d 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -229,7 +229,7 @@ static void emDM_calcLoopNormalsSpaceArray( r_lnors_spacearr->lspacearr[i]->ref_beta, r_lnors_spacearr->lspacearr[i]->loops); printf("\t\t(shared with loops"); while (loops) { - printf(" %d", GET_INT_FROM_POINTER(loops->link)); + printf(" %d", POINTER_AS_INT(loops->link)); loops = loops->next; } printf(")\n"); diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index cf2521509b5..ca73bbce77e 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -360,7 +360,7 @@ VFont *BKE_vfont_builtin_get(void) static VChar *find_vfont_char(VFontData *vfd, unsigned int character) { - return BLI_ghash_lookup(vfd->characters, SET_UINT_IN_POINTER(character)); + return BLI_ghash_lookup(vfd->characters, POINTER_FROM_UINT(character)); } static void build_underline(Curve *cu, ListBase *nubase, const rctf *rect, diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 071c10acaa5..e49f24c8120 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -107,7 +107,7 @@ static int get_next_free_id(void) return gNextIconId++; /* now we try to find the smallest icon id not stored in the gIcons hash */ - while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId >= gFirstIconId) + while (BLI_ghash_lookup(gIcons, POINTER_FROM_INT(startId)) && startId >= gFirstIconId) startId++; /* if we found a suitable one that isn't used yet, return it */ @@ -161,7 +161,7 @@ void BKE_icons_deferred_free(void) node != NULL; node = node->next) { - BLI_ghash_remove(gIcons, SET_INT_IN_POINTER(node->icon_id), NULL, icon_free); + BLI_ghash_remove(gIcons, POINTER_FROM_INT(node->icon_id), NULL, icon_free); } BLI_linklist_lockfree_clear(&g_icon_delete_queue, MEM_freeN); } @@ -471,7 +471,7 @@ void BKE_icon_changed(const int icon_id) if (!icon_id || G.background) return; - icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id)); + icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id)); if (icon) { /* We *only* expect ID-tied icons here, not non-ID icon/preview! */ @@ -507,7 +507,7 @@ static int icon_id_ensure_create_icon(struct ID *id) new_icon->drawinfo = NULL; new_icon->drawinfo_free = NULL; - BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(id->icon_id), new_icon); + BLI_ghash_insert(gIcons, POINTER_FROM_INT(id->icon_id), new_icon); return id->icon_id; } @@ -587,7 +587,7 @@ int BKE_icon_preview_ensure(ID *id, PreviewImage *preview) new_icon->drawinfo = NULL; new_icon->drawinfo_free = NULL; - BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(preview->icon_id), new_icon); + BLI_ghash_insert(gIcons, POINTER_FROM_INT(preview->icon_id), new_icon); return preview->icon_id; } @@ -598,7 +598,7 @@ Icon *BKE_icon_get(const int icon_id) Icon *icon = NULL; - icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id)); + icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id)); if (!icon) { printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); @@ -614,7 +614,7 @@ void BKE_icon_set(const int icon_id, struct Icon *icon) void **val_p; - if (BLI_ghash_ensure_p(gIcons, SET_INT_IN_POINTER(icon_id), &val_p)) { + if (BLI_ghash_ensure_p(gIcons, POINTER_FROM_INT(icon_id), &val_p)) { printf("%s: Internal error, icon already set: %d\n", __func__, icon_id); return; } @@ -643,7 +643,7 @@ void BKE_icon_id_delete(struct ID *id) } BKE_icons_deferred_free(); - BLI_ghash_remove(gIcons, SET_INT_IN_POINTER(icon_id), NULL, icon_free); + BLI_ghash_remove(gIcons, POINTER_FROM_INT(icon_id), NULL, icon_free); } /** @@ -655,7 +655,7 @@ void BKE_icon_delete(const int icon_id) if (!icon_id) return; /* no icon defined for library object */ - icon = BLI_ghash_popkey(gIcons, SET_INT_IN_POINTER(icon_id), NULL); + icon = BLI_ghash_popkey(gIcons, POINTER_FROM_INT(icon_id), NULL); if (icon) { if (icon->id_type != 0) { diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 76d16334630..d4508350d12 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -486,7 +486,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) unsigned int xi_max = (unsigned int) ((xmax - layer->bounds.xmin) * layer->buckets_xy_scalar[0]); unsigned int yi_min = (unsigned int) ((ymin - layer->bounds.ymin) * layer->buckets_xy_scalar[1]); unsigned int yi_max = (unsigned int) ((ymax - layer->bounds.ymin) * layer->buckets_xy_scalar[1]); - void *face_index_void = SET_UINT_IN_POINTER(face_index); + void *face_index_void = POINTER_FROM_UINT(face_index); unsigned int xi, yi; @@ -538,7 +538,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) buckets_face[bucket_index] = bucket; for (bucket_node = bucketstore[bucket_index]; bucket_node; bucket_node = bucket_node->next) { - *bucket = GET_UINT_FROM_POINTER(bucket_node->link); + *bucket = POINTER_AS_UINT(bucket_node->link); bucket++; } *bucket = TRI_TERMINATOR_ID; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 91658a140f0..1caef98ea11 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -844,7 +844,7 @@ void BKE_material_remap_object_calc( for (int i = 0; i < ob_dst->totcol; i++) { Material *ma_src = give_current_material(ob_dst, i + 1); - BLI_ghash_reinsert(gh_mat_map, ma_src, SET_INT_IN_POINTER(i), NULL, NULL); + BLI_ghash_reinsert(gh_mat_map, ma_src, POINTER_FROM_INT(i), NULL, NULL); } /* setup default mapping (when materials don't match) */ @@ -874,7 +874,7 @@ void BKE_material_remap_object_calc( else { void **index_src_p = BLI_ghash_lookup_p(gh_mat_map, ma_src); if (index_src_p) { - remap_src_to_dst[i] = GET_INT_FROM_POINTER(*index_src_p); + remap_src_to_dst[i] = POINTER_AS_INT(*index_src_p); } } } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 6d481472074..e7450b528c8 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1445,7 +1445,7 @@ static int split_faces_prepare_new_verts( if ((*lnor_space)->flags & MLNOR_SPACE_IS_SINGLE) { /* Single loop in this fan... */ - BLI_assert(GET_INT_FROM_POINTER((*lnor_space)->loops) == loop_idx); + BLI_assert(POINTER_AS_INT((*lnor_space)->loops) == loop_idx); BLI_BITMAP_ENABLE(done_loops, loop_idx); if (vert_used) { ml->v = new_vert_idx; @@ -1453,7 +1453,7 @@ static int split_faces_prepare_new_verts( } else { for (LinkNode *lnode = (*lnor_space)->loops; lnode; lnode = lnode->next) { - const int ml_fan_idx = GET_INT_FROM_POINTER(lnode->link); + const int ml_fan_idx = POINTER_AS_INT(lnode->link); BLI_BITMAP_ENABLE(done_loops, ml_fan_idx); if (vert_used) { mloop[ml_fan_idx].v = new_vert_idx; @@ -1514,7 +1514,7 @@ static int split_faces_prepare_new_edges( if (BLI_BITMAP_TEST(edges_used, edge_idx)) { /* Original edge has already been used, we need to define a new one. */ const int new_edge_idx = num_edges++; - *eval = SET_INT_IN_POINTER(new_edge_idx); + *eval = POINTER_FROM_INT(new_edge_idx); ml_prev->e = new_edge_idx; SplitFaceNewEdge *new_edge = BLI_memarena_alloc(memarena, sizeof(*new_edge)); @@ -1529,13 +1529,13 @@ static int split_faces_prepare_new_edges( /* We can re-use original edge. */ medge[edge_idx].v1 = ml_prev->v; medge[edge_idx].v2 = ml->v; - *eval = SET_INT_IN_POINTER(edge_idx); + *eval = POINTER_FROM_INT(edge_idx); BLI_BITMAP_ENABLE(edges_used, edge_idx); } } else { /* Edge already known, just update loop's edge index. */ - ml_prev->e = GET_INT_FROM_POINTER(*eval); + ml_prev->e = POINTER_AS_INT(*eval); } ml_prev = ml; diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index c801c5dcb01..3f870986a0b 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -171,7 +171,7 @@ static void make_edges_mdata_extend( BLI_edgehashIterator_step(ehi), ++medge, e_index++) { BLI_edgehashIterator_getKey(ehi, &medge->v1, &medge->v2); - BLI_edgehashIterator_setValue(ehi, SET_UINT_IN_POINTER(e_index)); + BLI_edgehashIterator_setValue(ehi, POINTER_FROM_UINT(e_index)); medge->crease = medge->bweight = 0; medge->flag = ME_EDGEDRAW | ME_EDGERENDER; @@ -187,7 +187,7 @@ static void make_edges_mdata_extend( int j; for (j = 0; j < mp->totloop; j++, l++) { /* lookup hashed edge index */ - l_prev->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(eh, l_prev->v, l->v)); + l_prev->e = POINTER_AS_UINT(BLI_edgehash_lookup(eh, l_prev->v, l->v)); l_prev = l; } } diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 279ab777529..92619b27ca0 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -569,7 +569,7 @@ void BKE_lnor_space_add_loop( lnors_spacearr->lspacearr[ml_index] = lnor_space; if (bm_loop == NULL) { - bm_loop = SET_INT_IN_POINTER(ml_index); + bm_loop = POINTER_FROM_INT(ml_index); } if (is_single) { BLI_assert(lnor_space->loops == NULL); @@ -1658,7 +1658,7 @@ static void mesh_normals_loop_custom_set( const float *org_nor = NULL; while (loops) { - const int lidx = GET_INT_FROM_POINTER(loops->link); + const int lidx = POINTER_AS_INT(loops->link); MLoop *ml = &mloops[lidx]; const int nidx = lidx; float *nor = r_custom_loopnors[nidx]; @@ -1689,7 +1689,7 @@ static void mesh_normals_loop_custom_set( * See T45984. */ loops = lnors_spacearr.lspacearr[i]->loops; if (loops && org_nor) { - const int lidx = GET_INT_FROM_POINTER(loops->link); + const int lidx = POINTER_AS_INT(loops->link); MLoop *ml = &mloops[lidx]; const int nidx = lidx; float *nor = r_custom_loopnors[nidx]; @@ -1731,7 +1731,7 @@ static void mesh_normals_loop_custom_set( */ LinkNode *loops = lnors_spacearr.lspacearr[i]->loops; if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) { - BLI_assert(GET_INT_FROM_POINTER(loops) == i); + BLI_assert(POINTER_AS_INT(loops) == i); const int nidx = use_vertices ? (int)mloops[i].v : i; float *nor = r_custom_loopnors[nidx]; @@ -1745,7 +1745,7 @@ static void mesh_normals_loop_custom_set( zero_v3(avg_nor); while (loops) { - const int lidx = GET_INT_FROM_POINTER(loops->link); + const int lidx = POINTER_AS_INT(loops->link); const int nidx = use_vertices ? (int)mloops[lidx].v : lidx; float *nor = r_custom_loopnors[nidx]; @@ -3356,7 +3356,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex( /* build edge hash */ me = medge; for (i = 0; i < totedge_i; i++, me++) { - BLI_edgehash_insert(eh, me->v1, me->v2, SET_UINT_IN_POINTER(i)); + BLI_edgehash_insert(eh, me->v1, me->v2, POINTER_FROM_UINT(i)); /* unrelated but avoid having the FGON flag enabled, so we can reuse it later for something else */ me->flag &= ~ME_FGON; @@ -3378,7 +3378,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex( # define ML(v1, v2) { \ ml->v = mf->v1; \ - ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); \ + ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); \ ml++; j++; \ } (void)0 diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index 77aefc04f5f..e9d859cbd4e 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -972,7 +972,7 @@ static void mesh_island_to_astar_graph_edge_process( const int pidx = edge_to_poly_map[edge_idx].indices[i]; MPoly *mp = &polys[pidx]; const int pidx_isld = islands ? poly_island_index_map[pidx] : pidx; - void *custom_data = is_edge_innercut ? SET_INT_IN_POINTER(edge_idx) : SET_INT_IN_POINTER(-1); + void *custom_data = is_edge_innercut ? POINTER_FROM_INT(edge_idx) : POINTER_FROM_INT(-1); if (UNLIKELY(islands && (islands->items_to_islands[mp->loopstart] != island_index))) { /* poly not in current island, happens with border edges... */ @@ -1088,12 +1088,12 @@ static float mesh_remap_calc_loops_astar_f_cost( { float *co_next, *co_dest; - if (link && (GET_INT_FROM_POINTER(link->custom_data) != -1)) { + if (link && (POINTER_AS_INT(link->custom_data) != -1)) { /* An innercut edge... We tag our solution as potentially crossing innercuts. * Note it might not be the case in the end (AStar will explore around optimal path), but helps * trimming off some processing later... */ - if (!GET_INT_FROM_POINTER(as_solution->custom_data)) { - as_solution->custom_data = SET_INT_IN_POINTER(true); + if (!POINTER_AS_INT(as_solution->custom_data)) { + as_solution->custom_data = POINTER_FROM_INT(true); } } @@ -1691,7 +1691,7 @@ void BKE_mesh_remap_calc_loops_from_dm( continue; } - as_solution.custom_data = SET_INT_IN_POINTER(false); + as_solution.custom_data = POINTER_FROM_INT(false); isld_res = &islands_res[best_island_index][plidx_dst]; if (use_from_vert) { @@ -1714,7 +1714,7 @@ void BKE_mesh_remap_calc_loops_from_dm( BLI_astar_graph_solve( as_graph, pidx_isld_src_prev, pidx_isld_src, mesh_remap_calc_loops_astar_f_cost, &as_solution, isld_steps_src); - if (GET_INT_FROM_POINTER(as_solution.custom_data) && (as_solution.steps > 0)) { + if (POINTER_AS_INT(as_solution.custom_data) && (as_solution.steps > 0)) { /* Find first 'cutting edge' on path, and bring back lidx_src on poly just * before that edge. * Note we could try to be much smarter (like e.g. storing a whole poly's indices, @@ -1726,7 +1726,7 @@ void BKE_mesh_remap_calc_loops_from_dm( /* Note we go backward here, from dest to src poly. */ for (i = as_solution.steps - 1; i--;) { BLI_AStarGNLink *as_link = as_solution.prev_links[pidx_isld_src]; - const int eidx = GET_INT_FROM_POINTER(as_link->custom_data); + const int eidx = POINTER_AS_INT(as_link->custom_data); pidx_isld_src = as_solution.prev_nodes[pidx_isld_src]; BLI_assert(pidx_isld_src != -1); if (eidx != -1) { @@ -1799,7 +1799,7 @@ void BKE_mesh_remap_calc_loops_from_dm( BLI_astar_graph_solve( as_graph, pidx_isld_src_prev, pidx_isld_src, mesh_remap_calc_loops_astar_f_cost, &as_solution, isld_steps_src); - if (GET_INT_FROM_POINTER(as_solution.custom_data) && (as_solution.steps > 0)) { + if (POINTER_AS_INT(as_solution.custom_data) && (as_solution.steps > 0)) { /* Find first 'cutting edge' on path, and bring back lidx_src on poly just * before that edge. * Note we could try to be much smarter (like e.g. storing a whole poly's indices, @@ -1811,7 +1811,7 @@ void BKE_mesh_remap_calc_loops_from_dm( /* Note we go backward here, from dest to src poly. */ for (i = as_solution.steps - 1; i--;) { BLI_AStarGNLink *as_link = as_solution.prev_links[pidx_isld_src]; - int eidx = GET_INT_FROM_POINTER(as_link->custom_data); + int eidx = POINTER_AS_INT(as_link->custom_data); pidx_isld_src = as_solution.prev_nodes[pidx_isld_src]; BLI_assert(pidx_isld_src != -1); diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 5c835bbf0fa..bedba57cf85 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -326,13 +326,13 @@ bool BKE_mesh_validate_arrays( if ((me->v1 != me->v2) && BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) { PRINT_ERR("\tEdge %u: is a duplicate of %d\n", i, - GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, me->v1, me->v2))); + POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, me->v1, me->v2))); remove = do_fixes; } if (remove == false) { if (me->v1 != me->v2) { - BLI_edgehash_insert(edge_hash, me->v1, me->v2, SET_INT_IN_POINTER(i)); + BLI_edgehash_insert(edge_hash, me->v1, me->v2, POINTER_FROM_INT(i)); } } else { @@ -566,7 +566,7 @@ bool BKE_mesh_validate_arrays( * We already know from previous text that a valid edge exists, use it (if allowed)! */ if (do_fixes) { int prev_e = ml->e; - ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2)); + ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2)); fix_flag.loops_edge = true; PRINT_ERR("\tLoop %u has invalid edge reference (%d), fixed using edge %u\n", sp->loopstart + j, prev_e, ml->e); @@ -583,7 +583,7 @@ bool BKE_mesh_validate_arrays( * and we already know from previous test that a valid one exists, use it (if allowed)! */ if (do_fixes) { int prev_e = ml->e; - ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2)); + ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2)); fix_flag.loops_edge = true; PRINT_ERR("\tPoly %u has invalid edge reference (%d, is_removed: %d), fixed using edge %u\n", sp->index, prev_e, IS_REMOVED_EDGE(me), ml->e); @@ -1390,7 +1390,7 @@ static void mesh_calc_edges_mdata( /* set edge members of mloops */ hash = BLI_edgehash_new_ex(__func__, totedge_final); for (edge_index = 0, med = medge; edge_index < totedge_final; edge_index++, med++) { - BLI_edgehash_insert(hash, med->v1, med->v2, SET_UINT_IN_POINTER(edge_index)); + BLI_edgehash_insert(hash, med->v1, med->v2, POINTER_FROM_UINT(edge_index)); } mpoly = allpoly; @@ -1402,7 +1402,7 @@ static void mesh_calc_edges_mdata( ml = &ml_next[i - 1]; /* last loop */ while (i-- != 0) { - ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(hash, ml->v, ml_next->v)); + ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(hash, ml->v, ml_next->v)); ml = ml_next; ml_next++; } @@ -1511,7 +1511,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select) } /* store the new edge index in the hash value */ - BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i)); + BLI_edgehashIterator_setValue(ehi, POINTER_FROM_INT(i)); } BLI_edgehashIterator_free(ehi); @@ -1524,7 +1524,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select) int j; for (j = 0; j < mp->totloop; j++, l++) { /* lookup hashed edge index */ - med_index = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, l_prev->v, l->v)); + med_index = POINTER_AS_INT(BLI_edgehash_lookup(eh, l_prev->v, l->v)); l_prev->e = med_index; l_prev = l; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 9f635966ee7..1406991520b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1855,7 +1855,7 @@ static void give_parvert(Object *par, int nr, float vec[3]) if (use_special_ss_case) { /* Special case if the last modifier is SS and no constructive modifier are in front of it. */ CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm; - CCGVert *ccg_vert = ccgSubSurf_getVert(ccgdm->ss, SET_INT_IN_POINTER(nr)); + CCGVert *ccg_vert = ccgSubSurf_getVert(ccgdm->ss, POINTER_FROM_INT(nr)); /* In case we deleted some verts, nr may refer to inexistent one now, see T42557. */ if (ccg_vert) { float *co = ccgSubSurf_getVertData(ccgdm->ss, ccg_vert); @@ -2770,7 +2770,7 @@ int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, static int pc_cmp(const void *a, const void *b) { const LinkData *ad = a, *bd = b; - if (GET_INT_FROM_POINTER(ad->data) > GET_INT_FROM_POINTER(bd->data)) + if (POINTER_AS_INT(ad->data) > POINTER_AS_INT(bd->data)) return 1; else return 0; } @@ -2783,14 +2783,14 @@ int BKE_object_insert_ptcache(Object *ob) BLI_listbase_sort(&ob->pc_ids, pc_cmp); for (link = ob->pc_ids.first, i = 0; link; link = link->next, i++) { - int index = GET_INT_FROM_POINTER(link->data); + int index = POINTER_AS_INT(link->data); if (i < index) break; } link = MEM_callocN(sizeof(LinkData), "PCLink"); - link->data = SET_INT_IN_POINTER(i); + link->data = POINTER_FROM_INT(i); BLI_addtail(&ob->pc_ids, link); return i; @@ -2805,7 +2805,7 @@ static int pc_findindex(ListBase *listbase, int index) link = listbase->first; while (link) { - if (GET_INT_FROM_POINTER(link->data) == index) + if (POINTER_AS_INT(link->data) == index) return number; number++; diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index dc36f2ed202..47f86c28dfc 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -624,7 +624,7 @@ bool *BKE_object_defgroup_validmap_get(Object *ob, const int defbase_tot) val_p = BLI_ghash_lookup_p(gh, chan->name); if (val_p) { - *val_p = SET_INT_IN_POINTER(1); + *val_p = POINTER_FROM_INT(1); } } } diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 589c4468000..a7445d0e920 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -585,7 +585,7 @@ static Object *find_family_object(Main *bmain, const char *family, size_t family { Object **ob_pt; Object *ob; - void *ch_key = SET_UINT_IN_POINTER(ch); + void *ch_key = POINTER_FROM_UINT(ch); if ((ob_pt = (Object **)BLI_ghash_lookup_p(family_gh, ch_key))) { ob = *ob_pt; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index b43c5376af4..40c0e1f8184 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1507,7 +1507,7 @@ int psys_particle_dm_face_lookup( LinkNode *tessface_node = poly_nodes[pindex_orig]; for (; tessface_node; tessface_node = tessface_node->next) { - int findex_dst = GET_INT_FROM_POINTER(tessface_node->link); + int findex_dst = POINTER_AS_INT(tessface_node->link); faceuv = osface_final[findex_dst].uv; /* check that this intersects - Its possible this misses :/ - diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 353c75d63c6..6ae324df136 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -366,7 +366,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform for (i=0, node=nodedmelem; ilink = SET_INT_IN_POINTER(i); + node->link = POINTER_FROM_INT(i); /* may be vertex or face origindex */ if (use_modifier_stack) { @@ -409,7 +409,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform else { if (psys->part->from == PART_FROM_VERT) { if (pa->num < totelem && nodearray[pa->num]) - pa->num_dmcache= GET_INT_FROM_POINTER(nodearray[pa->num]->link); + pa->num_dmcache= POINTER_AS_INT(nodearray[pa->num]->link); else pa->num_dmcache = DMCACHE_NOTFOUND; } @@ -1546,7 +1546,7 @@ static EdgeHash *sph_springhash_build(ParticleSystem *psys) springhash = BLI_edgehash_new_ex(__func__, psys->tot_fluidsprings); for (i=0, spring=psys->fluid_springs; itot_fluidsprings; i++, spring++) - BLI_edgehash_insert(springhash, spring->particle_index[0], spring->particle_index[1], SET_INT_IN_POINTER(i+1)); + BLI_edgehash_insert(springhash, spring->particle_index[0], spring->particle_index[1], POINTER_FROM_INT(i+1)); return springhash; } @@ -1748,7 +1748,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa /* Viscoelastic spring force */ if (pfn->psys == psys[0] && fluid->flag & SPH_VISCOELASTIC_SPRINGS && springhash) { /* BLI_edgehash_lookup appears to be thread-safe. - z0r */ - spring_index = GET_INT_FROM_POINTER(BLI_edgehash_lookup(springhash, index, pfn->index)); + spring_index = POINTER_AS_INT(BLI_edgehash_lookup(springhash, index, pfn->index)); if (spring_index) { spring = psys[0]->fluid_springs + spring_index - 1; diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 772cda7266e..746e8b63a18 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -246,7 +246,7 @@ static int map_insert_vert(PBVH *bvh, GHash *map, { void *key, **value_p; - key = SET_INT_IN_POINTER(vertex); + key = POINTER_FROM_INT(vertex); if (!BLI_ghash_ensure_p(map, key, &value_p)) { int value_i; if (BLI_BITMAP_TEST(bvh->vert_bitmap, vertex) == 0) { @@ -258,11 +258,11 @@ static int map_insert_vert(PBVH *bvh, GHash *map, value_i = ~(*face_verts); (*face_verts)++; } - *value_p = SET_INT_IN_POINTER(value_i); + *value_p = POINTER_FROM_INT(value_i); return value_i; } else { - return GET_INT_FROM_POINTER(*value_p); + return POINTER_AS_INT(*value_p); } } @@ -303,13 +303,13 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) GHashIterator gh_iter; GHASH_ITER (gh_iter, map) { void *value = BLI_ghashIterator_getValue(&gh_iter); - int ndx = GET_INT_FROM_POINTER(value); + int ndx = POINTER_AS_INT(value); if (ndx < 0) ndx = -ndx + node->uniq_verts - 1; vert_indices[ndx] = - GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); + POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter)); } for (int i = 0; i < totface; ++i) { @@ -915,7 +915,7 @@ static void BKE_pbvh_search_callback_occluded(PBVH *bvh, static bool update_search_cb(PBVHNode *node, void *data_v) { - int flag = GET_INT_FROM_POINTER(data_v); + int flag = POINTER_AS_INT(data_v); if (node->flag & PBVH_Leaf) return (node->flag & flag) != 0; @@ -1232,7 +1232,7 @@ void BKE_pbvh_update(PBVH *bvh, int flag, float (*fnors)[3]) PBVHNode **nodes; int totnode; - BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag), + BKE_pbvh_search_gather(bvh, update_search_cb, POINTER_FROM_INT(flag), &nodes, &totnode); if (flag & PBVH_UpdateNormals) @@ -2122,7 +2122,7 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*fnors)[3], pbvh_node_check_mask_changed(bvh, &bvh->nodes[a]); } - BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers), + BKE_pbvh_search_gather(bvh, update_search_cb, POINTER_FROM_INT(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers), &nodes, &totnode); pbvh_update_normals(bvh, nodes, totnode, fnors); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 221c600f502..21c90f318ec 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -289,7 +289,7 @@ static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mpoly, struct ML break; } - fverts[j] = SET_UINT_IN_POINTER(mpoly[nv->poly_index].loopstart + nv->loop_of_poly_index); + fverts[j] = POINTER_FROM_UINT(mpoly[nv->poly_index].loopstart + nv->loop_of_poly_index); } } @@ -336,7 +336,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, if (v->separate) { CCGVert *ssv; int loopid = mpoly[v->poly_index].loopstart + v->loop_of_poly_index; - CCGVertHDL vhdl = SET_INT_IN_POINTER(loopid); + CCGVertHDL vhdl = POINTER_FROM_INT(loopid); copy_v2_v2(uv, mloopuv[loopid].uv); @@ -352,7 +352,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MPoly *mp = &mpoly[i]; int nverts = mp->totloop; int j, j_next; - CCGFace *origf = ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i)); + CCGFace *origf = ccgSubSurf_getFace(origss, POINTER_FROM_INT(i)); /* unsigned int *fv = &mp->v1; */ MLoop *ml = mloop + mp->loopstart; @@ -366,12 +366,12 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, get_face_uv_map_vert(vmap, mpoly, ml, i, fverts); for (j = 0, j_next = nverts - 1; j < nverts; j_next = j++) { - unsigned int v0 = GET_UINT_FROM_POINTER(fverts[j_next]); - unsigned int v1 = GET_UINT_FROM_POINTER(fverts[j]); + unsigned int v0 = POINTER_AS_UINT(fverts[j_next]); + unsigned int v1 = POINTER_AS_UINT(fverts[j]); if (BLI_edgeset_add(eset, v0, v1)) { CCGEdge *e, *orige = ccgSubSurf_getFaceEdge(origf, j_next); - CCGEdgeHDL ehdl = SET_INT_IN_POINTER(mp->loopstart + j_next); + CCGEdgeHDL ehdl = POINTER_FROM_INT(mp->loopstart + j_next); float crease = ccgSubSurf_getEdgeCrease(orige); ccgSubSurf_syncEdge(ss, ehdl, fverts[j_next], fverts[j], crease, &e); @@ -396,7 +396,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, #endif get_face_uv_map_vert(vmap, mpoly, ml, i, fverts); - ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), nverts, fverts, &f); + ccgSubSurf_syncFace(ss, POINTER_FROM_INT(i), nverts, fverts, &f); } #ifndef USE_DYNSIZE @@ -441,7 +441,7 @@ static void UNUSED_FUNCTION(set_subsurf_osd_ccg_uv)(CCGSubSurf *ss, faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv"); for (ccgSubSurf_initFaceIterator(ss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) { CCGFace *f = ccgFaceIterator_getCurrent(&fi); - faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f; + faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f; } /* load coordinates from uvss into tface */ @@ -527,7 +527,7 @@ static void set_subsurf_legacy_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh * faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv"); for (ccgSubSurf_initFaceIterator(uvss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) { CCGFace *f = ccgFaceIterator_getCurrent(&fi); - faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f; + faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f; } /* load coordinates from uvss into tface */ @@ -703,10 +703,10 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss, CCGVert *v; if (vertexCos) { - ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), vertexCos[i], 0, &v); + ccgSubSurf_syncVert(ss, POINTER_FROM_INT(i), vertexCos[i], 0, &v); } else { - ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v); + ccgSubSurf_syncVert(ss, POINTER_FROM_INT(i), mv->co, 0, &v); } ((int *)ccgSubSurf_getVertUserData(ss, v))[1] = (index) ? *index++ : i; @@ -721,8 +721,8 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss, crease = useFlatSubdiv ? creaseFactor : me->crease * creaseFactor / 255.0f; - ccgSubSurf_syncEdge(ss, SET_INT_IN_POINTER(i), SET_UINT_IN_POINTER(me->v1), - SET_UINT_IN_POINTER(me->v2), crease, &e); + ccgSubSurf_syncEdge(ss, POINTER_FROM_INT(i), POINTER_FROM_UINT(me->v1), + POINTER_FROM_UINT(me->v2), crease, &e); ((int *)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index) ? *index++ : i; } @@ -741,14 +741,14 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss, ml = mloop + mp->loopstart; for (j = 0; j < mp->totloop; j++, ml++) { - fVerts[j] = SET_UINT_IN_POINTER(ml->v); + fVerts[j] = POINTER_FROM_UINT(ml->v); } /* this is very bad, means mesh is internally inconsistent. * it is not really possible to continue without modifying * other parts of code significantly to handle missing faces. * since this really shouldn't even be possible we just bail.*/ - if (ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop, + if (ccgSubSurf_syncFace(ss, POINTER_FROM_INT(i), mp->totloop, fVerts, &f) == eCCGError_InvalidValue) { static int hasGivenError = 0; @@ -1403,7 +1403,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) CCGEdge *e = ccgdm->edgeMap[index].edge; short ed_flag = 0; int x; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); + int edgeIdx = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e)); if (!ccgSubSurf_getEdgeNumFaces(e)) { ed_flag |= ME_LOOSEEDGE; @@ -1507,19 +1507,19 @@ static void copyFinalLoopArray_task_cb( edge_size, grid_size); ml->v = v1; - ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2)); + ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v1, v2)); ml++; ml->v = v2; - ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3)); + ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v2, v3)); ml++; ml->v = v3; - ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4)); + ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v3, v4)); ml++; ml->v = v4; - ml->e = GET_UINT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1)); + ml->e = POINTER_AS_UINT(BLI_edgehash_lookup(ccgdm->ehash, v4, v1)); ml++; } } @@ -1541,7 +1541,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop) medge = ccgdm->dm.getEdgeArray((DerivedMesh *)ccgdm); for (int i = 0; i < ccgdm->dm.numEdgeData; i++) { - BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i)); + BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, POINTER_FROM_INT(i)); } atomic_cas_ptr((void **)&ccgdm->ehash, ccgdm->ehash, ehash); @@ -1628,7 +1628,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) { CCGVert *v = ccgVertIterator_getCurrent(&vi); - vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v; + vertMap2[POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v))] = v; } totedge = ccgSubSurf_getNumEdges(ss); @@ -1636,7 +1636,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) for (ccgSubSurf_initEdgeIterator(ss, &ei), i = 0; !ccgEdgeIterator_isStopped(&ei); i++, ccgEdgeIterator_next(&ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(&ei); - edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e; + edgeMap2[POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e))] = e; } totface = ccgSubSurf_getNumFaces(ss); @@ -1644,7 +1644,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) for (ccgSubSurf_initFaceIterator(ss, &fi); !ccgFaceIterator_isStopped(&fi); ccgFaceIterator_next(&fi)) { CCGFace *f = ccgFaceIterator_getCurrent(&fi); - faceMap2[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f; + faceMap2[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))] = f; } i = 0; @@ -1951,7 +1951,7 @@ static void ccgDM_buffer_copy_normal( for (i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); const float (*ln)[3] = NULL; if (faceFlags) { @@ -2067,7 +2067,7 @@ static void ccgDM_buffer_copy_triangles( for (i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); bool is_hidden; int mati; @@ -2300,7 +2300,7 @@ static void ccgDM_buffer_copy_uv_texpaint( for (i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); int matnr; if (faceFlags) { @@ -2431,7 +2431,7 @@ static void ccgDM_buffer_copy_edge( CCGVert *ev2 = ccgSubSurf_getEdgeVert1(e); f = ccgSubSurf_getEdgeFace(e, 0); - fhandle = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + fhandle = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); totvert = ccgSubSurf_getFaceNumVerts(f); /* find the index of vertices in the face */ @@ -2594,7 +2594,7 @@ static GPUDrawObject *ccgDM_GPUObjectNew(DerivedMesh *dm) for (i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; int numVerts = ccgSubSurf_getFaceNumVerts(f); - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); const short new_matnr = ME_MAT_NR_TEST(faceFlags[index].mat_nr, dm_totmat); matinfo[new_matnr].totelements += numVerts * gridFaces * gridFaces * 6; matinfo[new_matnr].totloops += numVerts * gridFaces * gridFaces * 4; @@ -2856,7 +2856,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, CCGFace *f = ccgdm->faceMap[i].face; const float (*ln)[3] = NULL; int S, x, y, drawSmooth; - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); int origIndex = ccgDM_getFaceMapIndex(ss, f); int numVerts = ccgSubSurf_getFaceNumVerts(f); @@ -3079,7 +3079,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, for (a = 0; a < totpoly; a++) { CCGFace *f = ccgdm->faceMap[a].face; - int orig_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int orig_index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); int i; @@ -3297,7 +3297,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, CCGFace *f = ccgdm->faceMap[i].face; const float (*ln)[3] = NULL; int S, x, y, drawSmooth; - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); int origIndex = ccgDM_getFaceMapIndex(ss, f); int new_matnr; @@ -3577,7 +3577,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, CCGFace *f = ccgdm->faceMap[polyindex].face; int numVerts = ccgSubSurf_getFaceNumVerts(f); int index = ccgDM_getFaceMapIndex(ss, f); - int orig_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int orig_index = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); int mat_nr; int facequads = numVerts * gridFaces * gridFaces; int actualFace = ccgdm->faceMap[polyindex].startFace; @@ -3770,7 +3770,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, unsigned char *cp = NULL; const float (*ln)[3] = NULL; - origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + origIndex = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); if (flag & DM_DRAW_ALWAYS_SMOOTH) drawSmooth = 1; else if (faceFlags) drawSmooth = (lnors || (faceFlags[origIndex].flag & ME_SMOOTH)); @@ -4707,7 +4707,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm, { CCGVert *v = ccgVertIterator_getCurrent(&vi); - ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v; + ccgdm->vertMap[POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v))].vert = v; } totedge = ccgSubSurf_getNumEdges(ss); @@ -4718,7 +4718,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm, { CCGEdge *e = ccgEdgeIterator_getCurrent(&ei); - ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e; + ccgdm->edgeMap[POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e; } totface = ccgSubSurf_getNumFaces(ss); @@ -4729,7 +4729,7 @@ static void create_ccgdm_maps(CCGDerivedMesh *ccgdm, { CCGFace *f = ccgFaceIterator_getCurrent(&fi); - ccgdm->faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))].face = f; + ccgdm->faceMap[POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f))].face = f; } } @@ -4803,7 +4803,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, CCGFace *f = ccgdm->faceMap[index].face; int numVerts = ccgSubSurf_getFaceNumVerts(f); int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges); - int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f)); + int origIndex = POINTER_AS_INT(ccgSubSurf_getFaceFaceHandle(f)); int g2_wid = gridCuts + 2; float *w, *w2; int s, x, y; @@ -4837,7 +4837,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, #endif for (s = 0; s < numVerts; s++) { CCGVert *v = ccgSubSurf_getFaceVert(f, s); - vertidx[s] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertidx[s] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v)); } /*I think this is for interpolating the center vert?*/ @@ -4950,13 +4950,13 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, int mapIndex = ccgDM_getEdgeMapIndex(ss, e); int x; int vertIdx[2]; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); + int edgeIdx = POINTER_AS_INT(ccgSubSurf_getEdgeEdgeHandle(e)); CCGVert *v; v = ccgSubSurf_getEdgeVert0(e); - vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertIdx[0] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v)); v = ccgSubSurf_getEdgeVert1(e); - vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertIdx[1] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v)); ccgdm->edgeMap[index].startVert = vertNum; ccgdm->edgeMap[index].startEdge = edgeNum; @@ -5010,7 +5010,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v); int vertIdx; - vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertIdx = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v)); ccgdm->vertMap[index].startVert = vertNum; @@ -5295,7 +5295,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*r_positions)[3]) for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) { CCGVert *v = ccgVertIterator_getCurrent(&vi); - int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + int idx = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v)); int N = ccgSubSurf_getVertNumEdges(v); int numFaces = ccgSubSurf_getVertNumFaces(v); float *co; -- cgit v1.2.3