Merge branch 'master' into blender2.8
This commit is contained in:
commit
f35e9f047a
@ -78,7 +78,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) {
|
||||
@ -86,7 +86,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;
|
||||
}
|
||||
@ -104,9 +104,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;
|
||||
@ -122,7 +122,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;
|
||||
}
|
||||
|
@ -584,7 +584,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);
|
||||
}
|
||||
|
||||
@ -593,12 +593,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,12 +607,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -621,18 +621,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);
|
||||
}
|
||||
|
||||
@ -641,12 +641,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,7 +654,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.
|
||||
*/
|
||||
@ -665,7 +665,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);
|
||||
}
|
||||
|
||||
@ -674,12 +674,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -687,7 +687,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);
|
||||
}
|
||||
|
||||
@ -696,12 +696,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1070,7 +1070,7 @@ void armature_deform_verts(Object *armOb, Object *target, const Mesh * mesh, flo
|
||||
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);
|
||||
@ -1080,7 +1080,7 @@ void armature_deform_verts(Object *armOb, Object *target, const Mesh * mesh, flo
|
||||
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]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1274,7 +1274,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");
|
||||
@ -1608,13 +1608,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++;
|
||||
}
|
||||
}
|
||||
@ -1776,7 +1776,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);
|
||||
@ -1785,7 +1785,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;
|
||||
@ -1828,7 +1828,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);
|
||||
@ -1837,7 +1837,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;
|
||||
@ -2032,7 +2032,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2061,7 +2061,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;
|
||||
@ -2072,7 +2072,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);
|
||||
|
||||
@ -2089,7 +2089,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,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");
|
||||
|
@ -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,
|
||||
|
@ -157,7 +157,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 */
|
||||
@ -211,7 +211,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);
|
||||
}
|
||||
@ -522,7 +522,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! */
|
||||
@ -557,7 +557,7 @@ static Icon *icon_create(int icon_id, int obj_type, void *obj)
|
||||
new_icon->drawinfo = NULL;
|
||||
new_icon->drawinfo_free = NULL;
|
||||
|
||||
BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(icon_id), new_icon);
|
||||
BLI_ghash_insert(gIcons, POINTER_FROM_INT(icon_id), new_icon);
|
||||
|
||||
return new_icon;
|
||||
}
|
||||
@ -687,7 +687,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);
|
||||
@ -703,7 +703,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;
|
||||
}
|
||||
@ -732,7 +732,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -745,7 +745,7 @@ bool BKE_icon_delete(const int icon_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
Icon *icon = BLI_ghash_popkey(gIcons, SET_INT_IN_POINTER(icon_id), NULL);
|
||||
Icon *icon = BLI_ghash_popkey(gIcons, POINTER_FROM_INT(icon_id), NULL);
|
||||
if (icon) {
|
||||
icon_free_data(icon_id, icon);
|
||||
icon_free(icon);
|
||||
@ -763,10 +763,10 @@ bool BKE_icon_delete_unmanaged(const int icon_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
Icon *icon = BLI_ghash_popkey(gIcons, SET_INT_IN_POINTER(icon_id), NULL);
|
||||
Icon *icon = BLI_ghash_popkey(gIcons, POINTER_FROM_INT(icon_id), NULL);
|
||||
if (icon) {
|
||||
if (UNLIKELY(icon->flag & ICON_FLAG_MANAGED)) {
|
||||
BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(icon_id), icon);
|
||||
BLI_ghash_insert(gIcons, POINTER_FROM_INT(icon_id), icon);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
@ -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;
|
||||
|
@ -827,7 +827,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) */
|
||||
@ -857,7 +857,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1654,7 +1654,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;
|
||||
@ -1662,7 +1662,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;
|
||||
@ -1723,7 +1723,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));
|
||||
@ -1738,13 +1738,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;
|
||||
|
@ -182,7 +182,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;
|
||||
@ -198,7 +198,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;
|
||||
}
|
||||
}
|
||||
|
@ -598,7 +598,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);
|
||||
@ -1687,7 +1687,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];
|
||||
@ -1718,7 +1718,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];
|
||||
@ -1760,7 +1760,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];
|
||||
|
||||
@ -1774,7 +1774,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];
|
||||
|
||||
@ -3225,7 +3225,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;
|
||||
@ -3247,7 +3247,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
|
||||
|
||||
|
@ -342,13 +342,13 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, const int *vtargetmap, const int tot_vtar
|
||||
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++;
|
||||
}
|
||||
}
|
||||
@ -507,7 +507,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, const int *vtargetmap, const int tot_vtar
|
||||
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);
|
||||
@ -516,7 +516,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, const int *vtargetmap, const int tot_vtar
|
||||
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;
|
||||
@ -559,7 +559,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, const int *vtargetmap, const int tot_vtar
|
||||
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);
|
||||
@ -568,7 +568,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, const int *vtargetmap, const int tot_vtar
|
||||
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;
|
||||
|
@ -966,7 +966,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... */
|
||||
@ -1082,12 +1082,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1666,7 +1666,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(
|
||||
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) {
|
||||
@ -1689,7 +1689,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(
|
||||
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,
|
||||
@ -1701,7 +1701,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(
|
||||
/* 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) {
|
||||
@ -1774,7 +1774,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(
|
||||
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,
|
||||
@ -1786,7 +1786,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(
|
||||
/* 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);
|
||||
|
@ -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);
|
||||
@ -1351,7 +1351,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;
|
||||
@ -1363,7 +1363,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++;
|
||||
}
|
||||
@ -1472,7 +1472,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);
|
||||
|
||||
@ -1485,7 +1485,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;
|
||||
}
|
||||
|
@ -2010,7 +2010,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);
|
||||
@ -2993,7 +2993,7 @@ Mesh *BKE_object_get_original_mesh(Object *object)
|
||||
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;
|
||||
}
|
||||
@ -3006,14 +3006,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;
|
||||
@ -3028,7 +3028,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++;
|
||||
|
@ -633,7 +633,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -520,7 +520,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;
|
||||
|
@ -1399,7 +1399,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 :/ -
|
||||
|
@ -369,7 +369,7 @@ void psys_calc_dmcache(Object *ob, Mesh *mesh_final, Mesh *mesh_original, Partic
|
||||
|
||||
for (i=0, node=nodedmelem; i<totdmelem; i++, node++) {
|
||||
int origindex_final;
|
||||
node->link = SET_INT_IN_POINTER(i);
|
||||
node->link = POINTER_FROM_INT(i);
|
||||
|
||||
/* may be vertex or face origindex */
|
||||
if (use_modifier_stack) {
|
||||
@ -412,7 +412,7 @@ void psys_calc_dmcache(Object *ob, Mesh *mesh_final, Mesh *mesh_original, Partic
|
||||
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;
|
||||
}
|
||||
@ -1550,7 +1550,7 @@ static EdgeHash *sph_springhash_build(ParticleSystem *psys)
|
||||
springhash = BLI_edgehash_new_ex(__func__, psys->tot_fluidsprings);
|
||||
|
||||
for (i=0, spring=psys->fluid_springs; i<psys->tot_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;
|
||||
}
|
||||
@ -1752,7 +1752,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;
|
||||
|
@ -247,7 +247,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) {
|
||||
@ -259,11 +259,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,13 +304,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;
|
||||
@ -1220,7 +1220,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)
|
||||
@ -2087,7 +2087,7 @@ void BKE_pbvh_draw_cb(
|
||||
PBVHNode **nodes;
|
||||
int totnode;
|
||||
|
||||
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);
|
||||
|
@ -284,7 +284,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,7 +331,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);
|
||||
|
||||
@ -347,7 +347,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;
|
||||
|
||||
@ -361,12 +361,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);
|
||||
@ -391,7 +391,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
|
||||
@ -436,7 +436,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 */
|
||||
@ -522,7 +522,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 */
|
||||
@ -698,10 +698,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;
|
||||
@ -716,8 +716,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;
|
||||
}
|
||||
@ -736,14 +736,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;
|
||||
@ -1398,7 +1398,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;
|
||||
@ -1502,19 +1502,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++;
|
||||
}
|
||||
}
|
||||
@ -1536,7 +1536,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);
|
||||
@ -1623,7 +1623,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);
|
||||
@ -1631,7 +1631,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);
|
||||
@ -1639,7 +1639,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;
|
||||
@ -2472,7 +2472,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);
|
||||
@ -2483,7 +2483,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);
|
||||
@ -2494,7 +2494,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2568,7 +2568,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;
|
||||
@ -2602,7 +2602,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?*/
|
||||
@ -2715,13 +2715,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;
|
||||
@ -2775,7 +2775,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;
|
||||
|
||||
@ -3060,7 +3060,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;
|
||||
|
@ -512,11 +512,11 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
|
||||
|
||||
/* Warning-free macros for storing ints in pointers. Use these _only_
|
||||
* for storing an int in a pointer, not a pointer in an int (64bit)! */
|
||||
#define SET_INT_IN_POINTER(i) ((void *)(intptr_t)(i))
|
||||
#define GET_INT_FROM_POINTER(i) ((void)0, ((int)(intptr_t)(i)))
|
||||
#define POINTER_FROM_INT(i) ((void *)(intptr_t)(i))
|
||||
#define POINTER_AS_INT(i) ((void)0, ((int)(intptr_t)(i)))
|
||||
|
||||
#define SET_UINT_IN_POINTER(i) ((void *)(uintptr_t)(i))
|
||||
#define GET_UINT_FROM_POINTER(i) ((void)0, ((unsigned int)(uintptr_t)(i)))
|
||||
#define POINTER_FROM_UINT(i) ((void *)(uintptr_t)(i))
|
||||
#define POINTER_AS_UINT(i) ((void)0, ((unsigned int)(uintptr_t)(i)))
|
||||
|
||||
/* Set flag from a single test */
|
||||
#define SET_FLAG_FROM_TEST(value, test, flag) \
|
||||
|
@ -126,7 +126,7 @@ uint BLI_ghashutil_inthash_p_murmur(const void *ptr)
|
||||
|
||||
uint BLI_ghashutil_inthash_p_simple(const void *ptr)
|
||||
{
|
||||
return GET_UINT_FROM_POINTER(ptr);
|
||||
return POINTER_AS_UINT(ptr);
|
||||
}
|
||||
|
||||
bool BLI_ghashutil_intcmp(const void *a, const void *b)
|
||||
|
@ -1760,7 +1760,7 @@ bool BLI_array_store_is_valid(
|
||||
}
|
||||
GHASH_ITER (gh_iter, chunk_list_map) {
|
||||
const struct BChunkList *chunk_list = BLI_ghashIterator_getKey(&gh_iter);
|
||||
const int users = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
const int users = POINTER_AS_INT(BLI_ghashIterator_getValue(&gh_iter));
|
||||
if (!(chunk_list->users == users)) {
|
||||
ok = false;
|
||||
goto user_finally;
|
||||
@ -1790,7 +1790,7 @@ bool BLI_array_store_is_valid(
|
||||
|
||||
GHASH_ITER (gh_iter, chunk_map) {
|
||||
const struct BChunk *chunk = BLI_ghashIterator_getKey(&gh_iter);
|
||||
const int users = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
const int users = POINTER_AS_INT(BLI_ghashIterator_getValue(&gh_iter));
|
||||
if (!(chunk->users == users)) {
|
||||
ok = false;
|
||||
goto user_finally;
|
||||
|
@ -228,10 +228,10 @@ bool BLI_astar_graph_solve(
|
||||
todo_nodes = BLI_heap_new();
|
||||
BLI_heap_insert(todo_nodes,
|
||||
f_cost_cb(as_graph, r_solution, NULL, -1, node_index_src, node_index_dst),
|
||||
SET_INT_IN_POINTER(node_index_src));
|
||||
POINTER_FROM_INT(node_index_src));
|
||||
|
||||
while (!BLI_heap_is_empty(todo_nodes)) {
|
||||
const int node_curr_idx = GET_INT_FROM_POINTER(BLI_heap_pop_min(todo_nodes));
|
||||
const int node_curr_idx = POINTER_AS_INT(BLI_heap_pop_min(todo_nodes));
|
||||
BLI_AStarGNode *node_curr = &as_graph->nodes[node_curr_idx];
|
||||
LinkData *ld;
|
||||
|
||||
@ -271,7 +271,7 @@ bool BLI_astar_graph_solve(
|
||||
* no problem. */
|
||||
BLI_heap_insert(todo_nodes,
|
||||
f_cost_cb(as_graph, r_solution, link, node_curr_idx, node_next_idx, node_index_dst),
|
||||
SET_INT_IN_POINTER(node_next_idx));
|
||||
POINTER_FROM_INT(node_next_idx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ static VChar *freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *
|
||||
che->index = charcode;
|
||||
che->width = glyph->advance.x * scale;
|
||||
|
||||
BLI_ghash_insert(vfd->characters, SET_UINT_IN_POINTER(che->index), che);
|
||||
BLI_ghash_insert(vfd->characters, POINTER_FROM_UINT(che->index), che);
|
||||
|
||||
/* Start converting the FT data */
|
||||
onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int), "onpoints");
|
||||
|
@ -396,7 +396,7 @@ static void do_versions_nodetree_image_layer_2_64_5(bNodeTree *ntree)
|
||||
NodeImageLayer *output = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
|
||||
|
||||
/* take pass index both from current storage ptr (actually an int) */
|
||||
output->pass_index = GET_INT_FROM_POINTER(sock->storage);
|
||||
output->pass_index = POINTER_AS_INT(sock->storage);
|
||||
|
||||
/* replace socket data pointer */
|
||||
sock->storage = output;
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
bool BM_elem_cb_check_hflag_ex(BMElem *ele, void *user_data)
|
||||
{
|
||||
const uint hflag_pair = GET_INT_FROM_POINTER(user_data);
|
||||
const uint hflag_pair = POINTER_AS_INT(user_data);
|
||||
const char hflag_p = (hflag_pair & 0xff);
|
||||
const char hflag_n = (hflag_pair >> 8);
|
||||
|
||||
@ -42,14 +42,14 @@ bool BM_elem_cb_check_hflag_ex(BMElem *ele, void *user_data)
|
||||
|
||||
bool BM_elem_cb_check_hflag_enabled(BMElem *ele, void *user_data)
|
||||
{
|
||||
const char hflag = GET_INT_FROM_POINTER(user_data);
|
||||
const char hflag = POINTER_AS_INT(user_data);
|
||||
|
||||
return (BM_elem_flag_test(ele, hflag) != 0);
|
||||
}
|
||||
|
||||
bool BM_elem_cb_check_hflag_disabled(BMElem *ele, void *user_data)
|
||||
{
|
||||
const char hflag = GET_INT_FROM_POINTER(user_data);
|
||||
const char hflag = POINTER_AS_INT(user_data);
|
||||
|
||||
return (BM_elem_flag_test(ele, hflag) == 0);
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ bool BM_elem_cb_check_elem_not_equal(BMElem *ele, void *user_data);
|
||||
|
||||
#define BM_elem_cb_check_hflag_ex_simple(type, hflag_p, hflag_n) \
|
||||
(bool (*)(type, void *))BM_elem_cb_check_hflag_ex, \
|
||||
SET_UINT_IN_POINTER(((hflag_p) | (hflag_n << 8)))
|
||||
POINTER_FROM_UINT(((hflag_p) | (hflag_n << 8)))
|
||||
|
||||
#define BM_elem_cb_check_hflag_enabled_simple(type, hflag_p) \
|
||||
(bool (*)(type, void *))BM_elem_cb_check_hflag_enabled, \
|
||||
SET_UINT_IN_POINTER((hflag_p))
|
||||
POINTER_FROM_UINT((hflag_p))
|
||||
|
||||
#define BM_elem_cb_check_hflag_disabled_simple(type, hflag_n) \
|
||||
(bool (*)(type, void *))BM_elem_cb_check_hflag_disabled, \
|
||||
SET_UINT_IN_POINTER(hflag_n)
|
||||
POINTER_FROM_UINT(hflag_n)
|
||||
|
||||
#endif /* __BMESH_CALLBACK_GENERIC_H__ */
|
||||
|
@ -134,13 +134,13 @@ typedef struct {
|
||||
static uint bm_log_vert_id_get(BMLog *log, BMVert *v)
|
||||
{
|
||||
BLI_assert(BLI_ghash_haskey(log->elem_to_id, v));
|
||||
return GET_UINT_FROM_POINTER(BLI_ghash_lookup(log->elem_to_id, v));
|
||||
return POINTER_AS_UINT(BLI_ghash_lookup(log->elem_to_id, v));
|
||||
}
|
||||
|
||||
/* Set the vertex's unique ID in the log */
|
||||
static void bm_log_vert_id_set(BMLog *log, BMVert *v, uint id)
|
||||
{
|
||||
void *vid = SET_UINT_IN_POINTER(id);
|
||||
void *vid = POINTER_FROM_UINT(id);
|
||||
|
||||
BLI_ghash_reinsert(log->id_to_elem, vid, v, NULL, NULL);
|
||||
BLI_ghash_reinsert(log->elem_to_id, v, vid, NULL, NULL);
|
||||
@ -149,7 +149,7 @@ static void bm_log_vert_id_set(BMLog *log, BMVert *v, uint id)
|
||||
/* Get a vertex from its unique ID */
|
||||
static BMVert *bm_log_vert_from_id(BMLog *log, uint id)
|
||||
{
|
||||
void *key = SET_UINT_IN_POINTER(id);
|
||||
void *key = POINTER_FROM_UINT(id);
|
||||
BLI_assert(BLI_ghash_haskey(log->id_to_elem, key));
|
||||
return BLI_ghash_lookup(log->id_to_elem, key);
|
||||
}
|
||||
@ -158,13 +158,13 @@ static BMVert *bm_log_vert_from_id(BMLog *log, uint id)
|
||||
static uint bm_log_face_id_get(BMLog *log, BMFace *f)
|
||||
{
|
||||
BLI_assert(BLI_ghash_haskey(log->elem_to_id, f));
|
||||
return GET_UINT_FROM_POINTER(BLI_ghash_lookup(log->elem_to_id, f));
|
||||
return POINTER_AS_UINT(BLI_ghash_lookup(log->elem_to_id, f));
|
||||
}
|
||||
|
||||
/* Set the face's unique ID in the log */
|
||||
static void bm_log_face_id_set(BMLog *log, BMFace *f, uint id)
|
||||
{
|
||||
void *fid = SET_UINT_IN_POINTER(id);
|
||||
void *fid = POINTER_FROM_UINT(id);
|
||||
|
||||
BLI_ghash_reinsert(log->id_to_elem, fid, f, NULL, NULL);
|
||||
BLI_ghash_reinsert(log->elem_to_id, f, fid, NULL, NULL);
|
||||
@ -173,7 +173,7 @@ static void bm_log_face_id_set(BMLog *log, BMFace *f, uint id)
|
||||
/* Get a face from its unique ID */
|
||||
static BMFace *bm_log_face_from_id(BMLog *log, uint id)
|
||||
{
|
||||
void *key = SET_UINT_IN_POINTER(id);
|
||||
void *key = POINTER_FROM_UINT(id);
|
||||
BLI_assert(BLI_ghash_haskey(log->id_to_elem, key));
|
||||
return BLI_ghash_lookup(log->id_to_elem, key);
|
||||
}
|
||||
@ -255,7 +255,7 @@ static void bm_log_verts_unmake(BMesh *bm, BMLog *log, GHash *verts)
|
||||
GHASH_ITER (gh_iter, verts) {
|
||||
void *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
BMLogVert *lv = BLI_ghashIterator_getValue(&gh_iter);
|
||||
uint id = GET_UINT_FROM_POINTER(key);
|
||||
uint id = POINTER_AS_UINT(key);
|
||||
BMVert *v = bm_log_vert_from_id(log, id);
|
||||
|
||||
/* Ensure the log has the final values of the vertex before
|
||||
@ -271,7 +271,7 @@ static void bm_log_faces_unmake(BMesh *bm, BMLog *log, GHash *faces)
|
||||
GHashIterator gh_iter;
|
||||
GHASH_ITER (gh_iter, faces) {
|
||||
void *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
uint id = GET_UINT_FROM_POINTER(key);
|
||||
uint id = POINTER_AS_UINT(key);
|
||||
BMFace *f = bm_log_face_from_id(log, id);
|
||||
BMEdge *e_tri[3];
|
||||
BMLoop *l_iter;
|
||||
@ -304,7 +304,7 @@ static void bm_log_verts_restore(BMesh *bm, BMLog *log, GHash *verts)
|
||||
vert_mask_set(v, lv->mask, cd_vert_mask_offset);
|
||||
v->head.hflag = lv->hflag;
|
||||
normal_short_to_float_v3(v->no, lv->no);
|
||||
bm_log_vert_id_set(log, v, GET_UINT_FROM_POINTER(key));
|
||||
bm_log_vert_id_set(log, v, POINTER_AS_UINT(key));
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ static void bm_log_faces_restore(BMesh *bm, BMLog *log, GHash *faces)
|
||||
|
||||
f = BM_face_create_verts(bm, v, 3, NULL, BM_CREATE_NOP, true);
|
||||
f->head.hflag = lf->hflag;
|
||||
bm_log_face_id_set(log, f, GET_UINT_FROM_POINTER(key));
|
||||
bm_log_face_id_set(log, f, POINTER_AS_UINT(key));
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ static void bm_log_vert_values_swap(BMesh *bm, BMLog *log, GHash *verts)
|
||||
GHASH_ITER (gh_iter, verts) {
|
||||
void *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
BMLogVert *lv = BLI_ghashIterator_getValue(&gh_iter);
|
||||
uint id = GET_UINT_FROM_POINTER(key);
|
||||
uint id = POINTER_AS_UINT(key);
|
||||
BMVert *v = bm_log_vert_from_id(log, id);
|
||||
float mask;
|
||||
short normal[3];
|
||||
@ -355,7 +355,7 @@ static void bm_log_face_values_swap(BMLog *log, GHash *faces)
|
||||
GHASH_ITER (gh_iter, faces) {
|
||||
void *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
BMLogFace *lf = BLI_ghashIterator_getValue(&gh_iter);
|
||||
uint id = GET_UINT_FROM_POINTER(key);
|
||||
uint id = POINTER_AS_UINT(key);
|
||||
BMFace *f = bm_log_face_from_id(log, id);
|
||||
|
||||
SWAP(char, f->head.hflag, lf->hflag);
|
||||
@ -425,7 +425,7 @@ static void bm_log_id_ghash_retake(RangeTreeUInt *unused_ids, GHash *id_ghash)
|
||||
|
||||
GHASH_ITER (gh_iter, id_ghash) {
|
||||
void *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
uint id = GET_UINT_FROM_POINTER(key);
|
||||
uint id = POINTER_AS_UINT(key);
|
||||
|
||||
range_tree_uint_retake(unused_ids, id);
|
||||
}
|
||||
@ -454,8 +454,8 @@ static GHash *bm_log_compress_ids_to_indices(uint *ids, uint totid)
|
||||
qsort(ids, totid, sizeof(*ids), uint_compare);
|
||||
|
||||
for (i = 0; i < totid; i++) {
|
||||
void *key = SET_UINT_IN_POINTER(ids[i]);
|
||||
void *val = SET_UINT_IN_POINTER(i);
|
||||
void *key = POINTER_FROM_UINT(ids[i]);
|
||||
void *val = POINTER_FROM_UINT(i);
|
||||
BLI_ghash_insert(map, key, val);
|
||||
}
|
||||
|
||||
@ -469,7 +469,7 @@ static void bm_log_id_ghash_release(BMLog *log, GHash *id_ghash)
|
||||
|
||||
GHASH_ITER (gh_iter, id_ghash) {
|
||||
void *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
uint id = GET_UINT_FROM_POINTER(key);
|
||||
uint id = POINTER_AS_UINT(key);
|
||||
range_tree_uint_release(log->unused_ids, id);
|
||||
}
|
||||
}
|
||||
@ -620,9 +620,9 @@ void BM_log_mesh_elems_reorder(BMesh *bm, BMLog *log)
|
||||
id_to_idx = bm_log_compress_ids_to_indices(varr, (uint)bm->totvert);
|
||||
BM_ITER_MESH_INDEX (v, &bm_iter, bm, BM_VERTS_OF_MESH, i) {
|
||||
const unsigned id = bm_log_vert_id_get(log, v);
|
||||
const void *key = SET_UINT_IN_POINTER(id);
|
||||
const void *key = POINTER_FROM_UINT(id);
|
||||
const void *val = BLI_ghash_lookup(id_to_idx, key);
|
||||
varr[i] = GET_UINT_FROM_POINTER(val);
|
||||
varr[i] = POINTER_AS_UINT(val);
|
||||
}
|
||||
BLI_ghash_free(id_to_idx, NULL, NULL);
|
||||
|
||||
@ -630,9 +630,9 @@ void BM_log_mesh_elems_reorder(BMesh *bm, BMLog *log)
|
||||
id_to_idx = bm_log_compress_ids_to_indices(farr, (uint)bm->totface);
|
||||
BM_ITER_MESH_INDEX (f, &bm_iter, bm, BM_FACES_OF_MESH, i) {
|
||||
const unsigned id = bm_log_face_id_get(log, f);
|
||||
const void *key = SET_UINT_IN_POINTER(id);
|
||||
const void *key = POINTER_FROM_UINT(id);
|
||||
const void *val = BLI_ghash_lookup(id_to_idx, key);
|
||||
farr[i] = GET_UINT_FROM_POINTER(val);
|
||||
farr[i] = POINTER_AS_UINT(val);
|
||||
}
|
||||
BLI_ghash_free(id_to_idx, NULL, NULL);
|
||||
|
||||
@ -840,7 +840,7 @@ void BM_log_vert_before_modified(BMLog *log, BMVert *v, const int cd_vert_mask_o
|
||||
BMLogEntry *entry = log->current_entry;
|
||||
BMLogVert *lv;
|
||||
uint v_id = bm_log_vert_id_get(log, v);
|
||||
void *key = SET_UINT_IN_POINTER(v_id);
|
||||
void *key = POINTER_FROM_UINT(v_id);
|
||||
void **val_p;
|
||||
|
||||
/* Find or create the BMLogVert entry */
|
||||
@ -864,7 +864,7 @@ void BM_log_vert_added(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
|
||||
{
|
||||
BMLogVert *lv;
|
||||
uint v_id = range_tree_uint_take_any(log->unused_ids);
|
||||
void *key = SET_UINT_IN_POINTER(v_id);
|
||||
void *key = POINTER_FROM_UINT(v_id);
|
||||
|
||||
bm_log_vert_id_set(log, v, v_id);
|
||||
lv = bm_log_vert_alloc(log, v, cd_vert_mask_offset);
|
||||
@ -881,7 +881,7 @@ void BM_log_face_modified(BMLog *log, BMFace *f)
|
||||
{
|
||||
BMLogFace *lf;
|
||||
uint f_id = bm_log_face_id_get(log, f);
|
||||
void *key = SET_UINT_IN_POINTER(f_id);
|
||||
void *key = POINTER_FROM_UINT(f_id);
|
||||
|
||||
lf = bm_log_face_alloc(log, f);
|
||||
BLI_ghash_insert(log->current_entry->modified_faces, key, lf);
|
||||
@ -897,7 +897,7 @@ void BM_log_face_added(BMLog *log, BMFace *f)
|
||||
{
|
||||
BMLogFace *lf;
|
||||
uint f_id = range_tree_uint_take_any(log->unused_ids);
|
||||
void *key = SET_UINT_IN_POINTER(f_id);
|
||||
void *key = POINTER_FROM_UINT(f_id);
|
||||
|
||||
/* Only triangles are supported for now */
|
||||
BLI_assert(f->len == 3);
|
||||
@ -927,7 +927,7 @@ void BM_log_vert_removed(BMLog *log, BMVert *v, const int cd_vert_mask_offset)
|
||||
{
|
||||
BMLogEntry *entry = log->current_entry;
|
||||
uint v_id = bm_log_vert_id_get(log, v);
|
||||
void *key = SET_UINT_IN_POINTER(v_id);
|
||||
void *key = POINTER_FROM_UINT(v_id);
|
||||
|
||||
/* if it has a key, it shouldn't be NULL */
|
||||
BLI_assert(!!BLI_ghash_lookup(entry->added_verts, key) ==
|
||||
@ -968,7 +968,7 @@ void BM_log_face_removed(BMLog *log, BMFace *f)
|
||||
{
|
||||
BMLogEntry *entry = log->current_entry;
|
||||
uint f_id = bm_log_face_id_get(log, f);
|
||||
void *key = SET_UINT_IN_POINTER(f_id);
|
||||
void *key = POINTER_FROM_UINT(f_id);
|
||||
|
||||
/* if it has a key, it shouldn't be NULL */
|
||||
BLI_assert(!!BLI_ghash_lookup(entry->added_faces, key) ==
|
||||
@ -1040,7 +1040,7 @@ const float *BM_log_original_vert_co(BMLog *log, BMVert *v)
|
||||
BMLogEntry *entry = log->current_entry;
|
||||
const BMLogVert *lv;
|
||||
unsigned v_id = bm_log_vert_id_get(log, v);
|
||||
void *key = SET_UINT_IN_POINTER(v_id);
|
||||
void *key = POINTER_FROM_UINT(v_id);
|
||||
|
||||
BLI_assert(entry);
|
||||
|
||||
@ -1058,7 +1058,7 @@ const short *BM_log_original_vert_no(BMLog *log, BMVert *v)
|
||||
BMLogEntry *entry = log->current_entry;
|
||||
const BMLogVert *lv;
|
||||
unsigned v_id = bm_log_vert_id_get(log, v);
|
||||
void *key = SET_UINT_IN_POINTER(v_id);
|
||||
void *key = POINTER_FROM_UINT(v_id);
|
||||
|
||||
BLI_assert(entry);
|
||||
|
||||
@ -1076,7 +1076,7 @@ float BM_log_original_mask(BMLog *log, BMVert *v)
|
||||
BMLogEntry *entry = log->current_entry;
|
||||
const BMLogVert *lv;
|
||||
unsigned v_id = bm_log_vert_id_get(log, v);
|
||||
void *key = SET_UINT_IN_POINTER(v_id);
|
||||
void *key = POINTER_FROM_UINT(v_id);
|
||||
|
||||
BLI_assert(entry);
|
||||
|
||||
@ -1093,7 +1093,7 @@ void BM_log_original_vert_data(
|
||||
BMLogEntry *entry = log->current_entry;
|
||||
const BMLogVert *lv;
|
||||
unsigned v_id = bm_log_vert_id_get(log, v);
|
||||
void *key = SET_UINT_IN_POINTER(v_id);
|
||||
void *key = POINTER_FROM_UINT(v_id);
|
||||
|
||||
BLI_assert(entry);
|
||||
|
||||
|
@ -505,7 +505,7 @@ static LoopPairStore *bm_edgering_pair_store_create(
|
||||
for (v_iter = lb->first, i = 0; v_iter; v_iter = v_iter->next, i++) {
|
||||
BMVert *v = v_iter->data;
|
||||
bm_vert_calc_surface_tangent(bm, v, nor[i]);
|
||||
BLI_ghash_insert(nors_gh_iter, v, SET_UINT_IN_POINTER(i));
|
||||
BLI_ghash_insert(nors_gh_iter, v, POINTER_FROM_UINT(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -768,8 +768,8 @@ static void bm_edgering_pair_interpolate(
|
||||
bm_vert_calc_surface_tangent(bm, v_b, no_b);
|
||||
#else
|
||||
{
|
||||
const uint index_a = GET_UINT_FROM_POINTER(BLI_ghash_lookup(lpair->nors_gh_a, v_a));
|
||||
const uint index_b = GET_UINT_FROM_POINTER(BLI_ghash_lookup(lpair->nors_gh_b, v_b));
|
||||
const uint index_a = POINTER_AS_UINT(BLI_ghash_lookup(lpair->nors_gh_a, v_a));
|
||||
const uint index_b = POINTER_AS_UINT(BLI_ghash_lookup(lpair->nors_gh_b, v_b));
|
||||
|
||||
BLI_assert(BLI_ghash_haskey(lpair->nors_gh_a, v_a));
|
||||
BLI_assert(BLI_ghash_haskey(lpair->nors_gh_b, v_b));
|
||||
|
@ -1698,21 +1698,21 @@ static void bevel_harden_normals_mode(BevelParams *bp, BevVert *bv, BMOperator *
|
||||
BMFace *f_a, *f_b;
|
||||
BM_edge_face_pair(e, &f_a, &f_b);
|
||||
|
||||
if (f_a && !BLI_ghash_haskey(tempfaceHash, SET_UINT_IN_POINTER(BM_elem_index_get(f_a)))) {
|
||||
if (f_a && !BLI_ghash_haskey(tempfaceHash, POINTER_FROM_UINT(BM_elem_index_get(f_a)))) {
|
||||
int f_area = BM_face_calc_area(f_a);
|
||||
float f_no[3];
|
||||
copy_v3_v3(f_no, f_a->no);
|
||||
mul_v3_fl(f_no, f_area);
|
||||
add_v3_v3(n_final, f_no);
|
||||
BLI_ghash_insert(tempfaceHash, SET_UINT_IN_POINTER(BM_elem_index_get(f_a)), NULL);
|
||||
BLI_ghash_insert(tempfaceHash, POINTER_FROM_UINT(BM_elem_index_get(f_a)), NULL);
|
||||
}
|
||||
if (f_b && !BLI_ghash_haskey(tempfaceHash, SET_UINT_IN_POINTER(BM_elem_index_get(f_b)))) {
|
||||
if (f_b && !BLI_ghash_haskey(tempfaceHash, POINTER_FROM_UINT(BM_elem_index_get(f_b)))) {
|
||||
int f_area = BM_face_calc_area(f_b);
|
||||
float f_no[3];
|
||||
copy_v3_v3(f_no, f_b->no);
|
||||
mul_v3_fl(f_no, f_area);
|
||||
add_v3_v3(n_final, f_no);
|
||||
BLI_ghash_insert(tempfaceHash, SET_UINT_IN_POINTER(BM_elem_index_get(f_b)), NULL);
|
||||
BLI_ghash_insert(tempfaceHash, POINTER_FROM_UINT(BM_elem_index_get(f_b)), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ static void face_edges_add(
|
||||
BMEdge *e,
|
||||
const bool use_test)
|
||||
{
|
||||
void *f_index_key = SET_INT_IN_POINTER(f_index);
|
||||
void *f_index_key = POINTER_FROM_INT(f_index);
|
||||
BLI_assert(e->head.htype == BM_EDGE);
|
||||
BLI_assert(BM_edge_in_face(e, s->bm->ftable[f_index]) == false);
|
||||
BLI_assert(BM_elem_index_get(s->bm->ftable[f_index]) == f_index);
|
||||
@ -1478,7 +1478,7 @@ bool BM_mesh_intersect(
|
||||
faces = bm->ftable;
|
||||
|
||||
GHASH_ITER (gh_iter, s.face_edges) {
|
||||
const int f_index = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int f_index = POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter));
|
||||
BMFace *f;
|
||||
struct LinkBase *e_ls_base = BLI_ghashIterator_getValue(&gh_iter);
|
||||
|
||||
|
@ -62,7 +62,7 @@ void ScreenLensDistortionOperation::initExecution()
|
||||
this->initMutex();
|
||||
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
rng_seed ^= (uint)GET_INT_FROM_POINTER(m_inputProgram);
|
||||
rng_seed ^= (uint)POINTER_AS_INT(m_inputProgram);
|
||||
this->m_rng = BLI_rng_new(rng_seed);
|
||||
|
||||
this->m_cx = 0.5f * (float)getWidth();
|
||||
|
@ -616,7 +616,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
|
||||
material_template.ima = ima;
|
||||
uint hash = workbench_material_get_hash(&material_template, is_ghost);
|
||||
|
||||
material = BLI_ghash_lookup(wpd->material_hash, SET_UINT_IN_POINTER(hash));
|
||||
material = BLI_ghash_lookup(wpd->material_hash, POINTER_FROM_UINT(hash));
|
||||
if (material == NULL) {
|
||||
material = MEM_mallocN(sizeof(WORKBENCH_MaterialData), __func__);
|
||||
material->shgrp = DRW_shgroup_create(
|
||||
@ -627,7 +627,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
|
||||
DRW_shgroup_uniform_int(material->shgrp, "object_id", &material->object_id, 1);
|
||||
workbench_material_shgroup_uniform(wpd, material->shgrp, material, ob);
|
||||
|
||||
BLI_ghash_insert(wpd->material_hash, SET_UINT_IN_POINTER(hash), material);
|
||||
BLI_ghash_insert(wpd->material_hash, POINTER_FROM_UINT(hash), material);
|
||||
}
|
||||
return material;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
|
||||
material_template.ima = ima;
|
||||
uint hash = workbench_material_get_hash(&material_template, false);
|
||||
|
||||
material = BLI_ghash_lookup(wpd->material_hash, SET_UINT_IN_POINTER(hash));
|
||||
material = BLI_ghash_lookup(wpd->material_hash, POINTER_FROM_UINT(hash));
|
||||
if (material == NULL) {
|
||||
material = MEM_mallocN(sizeof(WORKBENCH_MaterialData), __func__);
|
||||
|
||||
@ -192,7 +192,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
|
||||
}
|
||||
material->object_id = engine_object_data->object_id;
|
||||
DRW_shgroup_uniform_int(material->shgrp_object_outline, "object_id", &material->object_id, 1);
|
||||
BLI_ghash_insert(wpd->material_hash, SET_UINT_IN_POINTER(hash), material);
|
||||
BLI_ghash_insert(wpd->material_hash, POINTER_FROM_UINT(hash), material);
|
||||
}
|
||||
return material;
|
||||
}
|
||||
|
@ -3296,16 +3296,16 @@ static GPUIndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
|
||||
bool inv_indices = (v1 > v2);
|
||||
void **pval;
|
||||
bool value_is_init = BLI_edgehash_ensure_p(eh, v1, v2, &pval);
|
||||
int v_data = GET_INT_FROM_POINTER(*pval);
|
||||
int v_data = POINTER_AS_INT(*pval);
|
||||
if (!value_is_init || v_data == NO_EDGE) {
|
||||
/* Save the winding order inside the sign bit. Because the
|
||||
* edgehash sort the keys and we need to compare winding later. */
|
||||
int value = (int)v0 + 1; /* Int 0 cannot be signed */
|
||||
*pval = SET_INT_IN_POINTER((inv_indices) ? -value : value);
|
||||
*pval = POINTER_FROM_INT((inv_indices) ? -value : value);
|
||||
}
|
||||
else {
|
||||
/* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */
|
||||
*pval = SET_INT_IN_POINTER(NO_EDGE);
|
||||
*pval = POINTER_FROM_INT(NO_EDGE);
|
||||
bool inv_opposite = (v_data < 0);
|
||||
uint v_opposite = (uint)abs(v_data) - 1;
|
||||
|
||||
@ -3328,7 +3328,7 @@ static GPUIndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
|
||||
BLI_edgehashIterator_step(ehi))
|
||||
{
|
||||
uint v1, v2;
|
||||
int v_data = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
|
||||
int v_data = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi));
|
||||
if (v_data == NO_EDGE) {
|
||||
continue;
|
||||
}
|
||||
|
@ -4040,7 +4040,7 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
|
||||
bAnimContext ac;
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
int filter;
|
||||
int setting = GET_INT_FROM_POINTER(setting_wrap);
|
||||
int setting = POINTER_AS_INT(setting_wrap);
|
||||
short on = 0;
|
||||
|
||||
/* send notifiers before doing anything else... */
|
||||
@ -4390,7 +4390,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
|
||||
case ACHANNEL_SETTING_PINNED: /* NLA Actions - 'map/nomap' */
|
||||
case ACHANNEL_SETTING_MOD_OFF:
|
||||
case ACHANNEL_SETTING_ALWAYS_VISIBLE:
|
||||
UI_but_funcN_set(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), SET_INT_IN_POINTER(setting));
|
||||
UI_but_funcN_set(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), POINTER_FROM_INT(setting));
|
||||
break;
|
||||
|
||||
/* settings needing special attention */
|
||||
|
@ -387,7 +387,7 @@ static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void
|
||||
{
|
||||
FMod_Envelope *env = (FMod_Envelope *)fcm_dv;
|
||||
FCM_EnvelopeData *fedn;
|
||||
int index = GET_INT_FROM_POINTER(ind_v);
|
||||
int index = POINTER_AS_INT(ind_v);
|
||||
|
||||
/* check that no data exists for the current frame... */
|
||||
if (env->totvert > 1) {
|
||||
@ -465,7 +465,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
|
||||
|
||||
but = uiDefIconBut(block, UI_BTYPE_BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 0.9 * UI_UNIT_X, UI_UNIT_Y,
|
||||
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point"));
|
||||
UI_but_func_set(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i));
|
||||
UI_but_func_set(but, fmod_envelope_deletepoint_cb, env, POINTER_FROM_INT(i));
|
||||
UI_block_align_begin(block);
|
||||
}
|
||||
}
|
||||
|
@ -1169,7 +1169,7 @@ void ARMATURE_OT_bone_layers(wmOperatorType *ot)
|
||||
static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
|
||||
{
|
||||
bArmature *arm = ob->data;
|
||||
const bool hide_select = (bool)GET_INT_FROM_POINTER(ptr);
|
||||
const bool hide_select = (bool)POINTER_AS_INT(ptr);
|
||||
int count = 0;
|
||||
if (arm->layer & bone->layer) {
|
||||
if (((bone->flag & BONE_SELECTED) != 0) == hide_select) {
|
||||
@ -1194,7 +1194,7 @@ static int pose_hide_exec(bContext *C, wmOperator *op)
|
||||
bool changed_multi = false;
|
||||
|
||||
const int hide_select = !RNA_boolean_get(op->ptr, "unselected");
|
||||
void *hide_select_p = SET_INT_IN_POINTER(hide_select);
|
||||
void *hide_select_p = POINTER_FROM_INT(hide_select);
|
||||
|
||||
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||
Object *ob_iter = objects[ob_index];
|
||||
@ -1236,7 +1236,7 @@ void POSE_OT_hide(wmOperatorType *ot)
|
||||
|
||||
static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
|
||||
{
|
||||
const bool select = GET_INT_FROM_POINTER(data);
|
||||
const bool select = POINTER_AS_INT(data);
|
||||
|
||||
bArmature *arm = ob->data;
|
||||
int count = 0;
|
||||
@ -1261,7 +1261,7 @@ static int pose_reveal_exec(bContext *C, wmOperator *op)
|
||||
Object **objects = BKE_object_pose_array_get_unique(view_layer, &objects_len);
|
||||
bool changed_multi = false;
|
||||
const bool select = RNA_boolean_get(op->ptr, "select");
|
||||
void *select_p = SET_INT_IN_POINTER(select);
|
||||
void *select_p = POINTER_FROM_INT(select);
|
||||
|
||||
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||
Object *ob_iter = objects[ob_index];
|
||||
|
@ -66,8 +66,8 @@
|
||||
#include "armature_intern.h"
|
||||
|
||||
/* utility macros for storing a temp int in the bone (selection flag) */
|
||||
#define PBONE_PREV_FLAG_GET(pchan) ((void)0, (GET_INT_FROM_POINTER((pchan)->temp)))
|
||||
#define PBONE_PREV_FLAG_SET(pchan, val) ((pchan)->temp = SET_INT_IN_POINTER(val))
|
||||
#define PBONE_PREV_FLAG_GET(pchan) ((void)0, (POINTER_AS_INT((pchan)->temp)))
|
||||
#define PBONE_PREV_FLAG_SET(pchan, val) ((pchan)->temp = POINTER_FROM_INT(val))
|
||||
|
||||
|
||||
/* ***************** Pose Select Utilities ********************* */
|
||||
|
@ -1220,7 +1220,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
|
||||
|
||||
/* Random generator, only init once. */
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
rng_seed ^= GET_UINT_FROM_POINTER(gso);
|
||||
rng_seed ^= POINTER_AS_UINT(gso);
|
||||
gso->rng = BLI_rng_new(rng_seed);
|
||||
|
||||
gso->is_painting = false;
|
||||
|
@ -1094,13 +1094,13 @@ static int gp_merge_layer_exec(bContext *C, wmOperator *op)
|
||||
/* Collect frames of gpl_current in hash table to avoid O(n^2) lookups */
|
||||
GHash *gh_frames_cur = BLI_ghash_int_new_ex(__func__, 64);
|
||||
for (bGPDframe *gpf = gpl_current->frames.first; gpf; gpf = gpf->next) {
|
||||
BLI_ghash_insert(gh_frames_cur, SET_INT_IN_POINTER(gpf->framenum), gpf);
|
||||
BLI_ghash_insert(gh_frames_cur, POINTER_FROM_INT(gpf->framenum), gpf);
|
||||
}
|
||||
|
||||
/* read all frames from next layer and add any missing in current layer */
|
||||
for (bGPDframe *gpf = gpl_next->frames.first; gpf; gpf = gpf->next) {
|
||||
/* try to find frame in current layer */
|
||||
bGPDframe *frame = BLI_ghash_lookup(gh_frames_cur, SET_INT_IN_POINTER(gpf->framenum));
|
||||
bGPDframe *frame = BLI_ghash_lookup(gh_frames_cur, POINTER_FROM_INT(gpf->framenum));
|
||||
if (!frame) {
|
||||
bGPDframe *actframe = BKE_gpencil_layer_getframe(gpl_current, gpf->framenum, GP_GETFRAME_USE_PREV);
|
||||
frame = BKE_gpencil_frame_addnew(gpl_current, gpf->framenum);
|
||||
|
@ -1978,7 +1978,7 @@ static tGPsdata *gp_session_initpaint(bContext *C, wmOperator *op)
|
||||
|
||||
/* Random generator, only init once. */
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
rng_seed ^= GET_UINT_FROM_POINTER(p);
|
||||
rng_seed ^= POINTER_AS_UINT(p);
|
||||
p->rng = BLI_rng_new(rng_seed);
|
||||
|
||||
/* return context data for running paint operator */
|
||||
|
@ -4560,7 +4560,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c
|
||||
for (item = item_array; item->identifier; item++) {
|
||||
/* note: need to give the index rather than the identifier because the enum can be freed */
|
||||
if (BLI_strcasestr(item->name, str)) {
|
||||
if (false == UI_search_item_add(items, item->name, SET_INT_IN_POINTER(item->value), item->icon))
|
||||
if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), item->icon))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4578,7 +4578,7 @@ static void operator_enum_call_cb(struct bContext *UNUSED(C), void *but, void *a
|
||||
|
||||
if (ot) {
|
||||
if (ot->prop) {
|
||||
RNA_property_enum_set(opptr, ot->prop, GET_INT_FROM_POINTER(arg2));
|
||||
RNA_property_enum_set(opptr, ot->prop, POINTER_AS_INT(arg2));
|
||||
/* We do not call op from here, will be called by button code.
|
||||
* ui_apply_but_funcs_after() (in interface_handlers.c) called this func before checking operators,
|
||||
* because one of its parameters is the button itself!
|
||||
|
@ -413,7 +413,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
|
||||
uiBut *but = arg_but, *cbut;
|
||||
PointerRNA *ptr = &but->rnapoin;
|
||||
PropertyRNA *prop = but->rnaprop;
|
||||
int i, index = GET_INT_FROM_POINTER(arg_index);
|
||||
int i, index = POINTER_AS_INT(arg_index);
|
||||
int shift = win->eventstate->shift;
|
||||
int len = RNA_property_array_length(ptr, prop);
|
||||
|
||||
@ -507,7 +507,7 @@ static void ui_item_array(
|
||||
|
||||
but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y + buth, butw, buth);
|
||||
if (subtype == PROP_LAYER_MEMBER)
|
||||
UI_but_func_set(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num));
|
||||
UI_but_func_set(but, ui_layer_but_cb, but, POINTER_FROM_INT(layer_num));
|
||||
}
|
||||
for (a = 0; a < colbuts; a++) {
|
||||
const int layer_num = a + len / 2 + b * colbuts;
|
||||
@ -525,7 +525,7 @@ static void ui_item_array(
|
||||
|
||||
but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y, butw, buth);
|
||||
if (subtype == PROP_LAYER_MEMBER)
|
||||
UI_but_func_set(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num));
|
||||
UI_but_func_set(but, ui_layer_but_cb, but, POINTER_FROM_INT(layer_num));
|
||||
}
|
||||
UI_block_align_end(block);
|
||||
|
||||
@ -623,7 +623,7 @@ static void ui_item_enum_expand_handle(bContext *C, void *arg1, void *arg2)
|
||||
|
||||
if (!win->eventstate->shift) {
|
||||
uiBut *but = (uiBut *)arg1;
|
||||
int enum_value = GET_INT_FROM_POINTER(arg2);
|
||||
int enum_value = POINTER_AS_INT(arg2);
|
||||
|
||||
int current_value = RNA_property_enum_get(&but->rnapoin, but->rnaprop);
|
||||
if (!(current_value & enum_value)) {
|
||||
@ -707,7 +707,7 @@ static void ui_item_enum_expand(
|
||||
but = uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
|
||||
|
||||
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
|
||||
UI_but_func_set(but, ui_item_enum_expand_handle, but, SET_INT_IN_POINTER(value));
|
||||
UI_but_func_set(but, ui_item_enum_expand_handle, but, POINTER_FROM_INT(value));
|
||||
}
|
||||
|
||||
if (ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
|
||||
|
@ -428,7 +428,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
|
||||
TemplateID *template_ui = (TemplateID *)arg_litem;
|
||||
PointerRNA idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop);
|
||||
ID *id = idptr.data;
|
||||
int event = GET_INT_FROM_POINTER(arg_event);
|
||||
int event = POINTER_AS_INT(arg_event);
|
||||
|
||||
switch (event) {
|
||||
case UI_ID_BROWSE:
|
||||
@ -625,13 +625,13 @@ static uiBut *template_id_def_new_but(
|
||||
but = uiDefIconTextButO(
|
||||
block, but_type, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
|
||||
(id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, but_height, NULL);
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ADD_NEW));
|
||||
}
|
||||
else {
|
||||
but = uiDefIconTextBut(
|
||||
block, but_type, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"),
|
||||
0, 0, w, but_height, NULL, 0, 0, 0, 0, NULL);
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ADD_NEW));
|
||||
}
|
||||
|
||||
if ((idfrom && idfrom->lib) || !editable) {
|
||||
@ -686,7 +686,7 @@ static void template_ID(
|
||||
but = uiDefButR(
|
||||
block, UI_BTYPE_TEXT, 0, name, 0, 0, TEMPLATE_SEARCH_TEXTBUT_WIDTH, TEMPLATE_SEARCH_TEXTBUT_HEIGHT,
|
||||
&idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_RENAME));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_RENAME));
|
||||
if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT);
|
||||
|
||||
if (id->lib) {
|
||||
@ -709,7 +709,7 @@ static void template_ID(
|
||||
UI_but_flag_enable(but, UI_BUT_DISABLED);
|
||||
}
|
||||
else {
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_LOCAL));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_LOCAL));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -718,7 +718,7 @@ static void template_ID(
|
||||
block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_OVERRIDE, 0, 0, UI_UNIT_X, UI_UNIT_Y,
|
||||
NULL, 0, 0, 0, 0,
|
||||
TIP_("Static override of linked library data-block, click to make fully local"));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OVERRIDE));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_OVERRIDE));
|
||||
}
|
||||
|
||||
if (id->us > 1) {
|
||||
@ -733,7 +733,7 @@ static void template_ID(
|
||||
TIP_("Display number of users of this data (click to make a single-user copy)"));
|
||||
but->flag |= UI_BUT_UNDO;
|
||||
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ALONE));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_ALONE));
|
||||
if (/* test only */
|
||||
(id_copy(CTX_data_main(C), id, NULL, true) == false) ||
|
||||
(idfrom && idfrom->lib) ||
|
||||
@ -775,13 +775,13 @@ static void template_ID(
|
||||
but = uiDefIconTextButO(
|
||||
block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
|
||||
0, 0, w, UI_UNIT_Y, NULL);
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_OPEN));
|
||||
}
|
||||
else {
|
||||
but = uiDefIconTextBut(
|
||||
block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
|
||||
NULL, 0, 0, 0, 0, NULL);
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_OPEN));
|
||||
}
|
||||
|
||||
if ((idfrom && idfrom->lib) || !editable)
|
||||
@ -805,7 +805,7 @@ static void template_ID(
|
||||
block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
|
||||
TIP_("Unlink data-block "
|
||||
"(Shift + Click to set users to zero, data will then not be saved)"));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_DELETE));
|
||||
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_DELETE));
|
||||
|
||||
if (RNA_property_flag(template_ui->prop) & PROP_NEVER_NULL) {
|
||||
UI_but_flag_enable(but, UI_BUT_DISABLED);
|
||||
@ -3356,7 +3356,7 @@ void uiTemplateCryptoPicker(uiLayout *layout, PointerRNA *ptr, const char *propn
|
||||
static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
|
||||
{
|
||||
uiBut *but = arg1;
|
||||
int cur = GET_INT_FROM_POINTER(arg2);
|
||||
int cur = POINTER_AS_INT(arg2);
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
int i, tot, shift = win->eventstate->shift;
|
||||
|
||||
@ -3440,7 +3440,7 @@ void uiTemplateLayers(
|
||||
icon = ICON_LAYER_USED;
|
||||
|
||||
but = uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2);
|
||||
UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer));
|
||||
UI_but_func_set(but, handle_layer_buttons, but, POINTER_FROM_INT(layer));
|
||||
but->type = UI_BTYPE_TOGGLE;
|
||||
}
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ static void set_lowest_face_tri(KnifeTool_OpData *kcd, BMFace *f, int index)
|
||||
if (i == -1)
|
||||
i++;
|
||||
|
||||
BLI_ghash_insert(kcd->facetrimap, f, SET_INT_IN_POINTER(i + 1));
|
||||
BLI_ghash_insert(kcd->facetrimap, f, POINTER_FROM_INT(i + 1));
|
||||
}
|
||||
|
||||
/* This should only be called for faces that have had a lowest face tri set by previous function */
|
||||
@ -513,7 +513,7 @@ static int get_lowest_face_tri(KnifeTool_OpData *kcd, BMFace *f)
|
||||
{
|
||||
int ans;
|
||||
|
||||
ans = GET_INT_FROM_POINTER(BLI_ghash_lookup(kcd->facetrimap, f));
|
||||
ans = POINTER_AS_INT(BLI_ghash_lookup(kcd->facetrimap, f));
|
||||
BLI_assert(ans != 0);
|
||||
return ans - 1;
|
||||
}
|
||||
|
@ -491,8 +491,8 @@ static void PE_free_shape_tree(PEData *data)
|
||||
static void PE_create_random_generator(PEData *data)
|
||||
{
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
rng_seed ^= GET_UINT_FROM_POINTER(data->ob);
|
||||
rng_seed ^= GET_UINT_FROM_POINTER(data->edit);
|
||||
rng_seed ^= POINTER_AS_UINT(data->ob);
|
||||
rng_seed ^= POINTER_AS_UINT(data->edit);
|
||||
data->rng = BLI_rng_new(rng_seed);
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ BLI_INLINE unsigned char f_to_char(const float val)
|
||||
#define PROJ_VERT_CULL 1
|
||||
|
||||
/* to avoid locking in tile initialization */
|
||||
#define TILE_PENDING SET_INT_IN_POINTER(-1)
|
||||
#define TILE_PENDING POINTER_FROM_INT(-1)
|
||||
|
||||
/* This is mainly a convenience struct used so we can keep an array of images we use -
|
||||
* their imbufs, etc, in 1 array, When using threads this array is copied for each thread
|
||||
@ -598,7 +598,7 @@ static int project_paint_PickFace(
|
||||
* that the point its testing is only every originated from an existing face */
|
||||
|
||||
for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
|
||||
const int tri_index = GET_INT_FROM_POINTER(node->link);
|
||||
const int tri_index = POINTER_AS_INT(node->link);
|
||||
const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
|
||||
const float *vtri_ss[3] = {
|
||||
ps->screenCoords[ps->mloop_eval[lt->tri[0]].v],
|
||||
@ -812,7 +812,7 @@ static bool project_bucket_point_occluded(
|
||||
* that the point its testing is only every originated from an existing face */
|
||||
|
||||
for (; bucketFace; bucketFace = bucketFace->next) {
|
||||
const int tri_index = GET_INT_FROM_POINTER(bucketFace->link);
|
||||
const int tri_index = POINTER_AS_INT(bucketFace->link);
|
||||
|
||||
if (orig_face != tri_index) {
|
||||
const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
|
||||
@ -1033,7 +1033,7 @@ static bool check_seam(
|
||||
int i1_fidx = -1, i2_fidx = -1; /* index in face */
|
||||
|
||||
for (node = ps->vertFaces[i1]; node; node = node->next) {
|
||||
const int tri_index = GET_INT_FROM_POINTER(node->link);
|
||||
const int tri_index = POINTER_AS_INT(node->link);
|
||||
|
||||
if (tri_index != orig_face) {
|
||||
const MLoopTri *lt = &ps->mlooptri_eval[tri_index];
|
||||
@ -2928,7 +2928,7 @@ static void project_bucket_init(
|
||||
|
||||
for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
|
||||
project_paint_face_init(
|
||||
ps, thread_index, bucket_index, GET_INT_FROM_POINTER(node->link), 0,
|
||||
ps, thread_index, bucket_index, POINTER_AS_INT(node->link), 0,
|
||||
clip_rect, bucket_bounds, ibuf, &tmpibuf);
|
||||
}
|
||||
}
|
||||
@ -2936,7 +2936,7 @@ static void project_bucket_init(
|
||||
|
||||
/* More complicated loop, switch between images */
|
||||
for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
|
||||
tri_index = GET_INT_FROM_POINTER(node->link);
|
||||
tri_index = POINTER_AS_INT(node->link);
|
||||
|
||||
/* Image context switching */
|
||||
tpage = project_paint_face_paint_image(ps, tri_index);
|
||||
@ -3045,7 +3045,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MLoopTri *
|
||||
int bucket_index = bucket_x + (bucket_y * ps->buckets_x);
|
||||
BLI_linklist_prepend_arena(
|
||||
&ps->bucketFaces[bucket_index],
|
||||
SET_INT_IN_POINTER(tri_index), /* cast to a pointer to shut up the compiler */
|
||||
POINTER_FROM_INT(tri_index), /* cast to a pointer to shut up the compiler */
|
||||
arena
|
||||
);
|
||||
|
||||
@ -3385,7 +3385,7 @@ static void project_paint_bleed_add_face_user(
|
||||
/* annoying but we need to add all faces even ones we never use elsewhere */
|
||||
if (ps->seam_bleed_px > 0.0f) {
|
||||
const int lt_vtri[3] = { PS_LOOPTRI_AS_VERT_INDEX_3(ps, lt) };
|
||||
void *tri_index_p = SET_INT_IN_POINTER(tri_index);
|
||||
void *tri_index_p = POINTER_FROM_INT(tri_index);
|
||||
BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[0]], tri_index_p, arena);
|
||||
BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[1]], tri_index_p, arena);
|
||||
BLI_linklist_prepend_arena(&ps->vertFaces[lt_vtri[2]], tri_index_p, arena);
|
||||
|
@ -414,7 +414,7 @@ static bool paint_brush_update(
|
||||
if ((do_random || do_random_mask) && stroke->rng == NULL) {
|
||||
/* Lazy initialization. */
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
rng_seed ^= (uint)GET_INT_FROM_POINTER(brush);
|
||||
rng_seed ^= (uint)POINTER_AS_INT(brush);
|
||||
stroke->rng = BLI_rng_new(rng_seed);
|
||||
}
|
||||
|
||||
|
@ -1516,7 +1516,7 @@ static FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index
|
||||
return cache->block_entries[idx];
|
||||
}
|
||||
|
||||
if ((ret = BLI_ghash_lookup(cache->misc_entries, SET_INT_IN_POINTER(index)))) {
|
||||
if ((ret = BLI_ghash_lookup(cache->misc_entries, POINTER_FROM_INT(index)))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1529,11 +1529,11 @@ static FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index
|
||||
/* Else, we have to add new entry to 'misc' cache - and possibly make room for it first! */
|
||||
ret = filelist_file_create_entry(filelist, index);
|
||||
old_index = cache->misc_entries_indices[cache->misc_cursor];
|
||||
if ((old = BLI_ghash_popkey(cache->misc_entries, SET_INT_IN_POINTER(old_index), NULL))) {
|
||||
if ((old = BLI_ghash_popkey(cache->misc_entries, POINTER_FROM_INT(old_index), NULL))) {
|
||||
BLI_ghash_remove(cache->uuids, old->uuid, NULL, NULL);
|
||||
filelist_file_release_entry(filelist, old);
|
||||
}
|
||||
BLI_ghash_insert(cache->misc_entries, SET_INT_IN_POINTER(index), ret);
|
||||
BLI_ghash_insert(cache->misc_entries, POINTER_FROM_INT(index), ret);
|
||||
BLI_ghash_insert(cache->uuids, ret->uuid, ret);
|
||||
|
||||
cache->misc_entries_indices[cache->misc_cursor] = index;
|
||||
@ -1628,7 +1628,7 @@ static bool filelist_file_cache_block_create(FileList *filelist, const int start
|
||||
FileDirEntry *entry;
|
||||
|
||||
/* That entry might have already been requested and stored in misc cache... */
|
||||
if ((entry = BLI_ghash_popkey(cache->misc_entries, SET_INT_IN_POINTER(idx), NULL)) == NULL) {
|
||||
if ((entry = BLI_ghash_popkey(cache->misc_entries, POINTER_FROM_INT(idx), NULL)) == NULL) {
|
||||
entry = filelist_file_create_entry(filelist, idx);
|
||||
BLI_ghash_insert(cache->uuids, entry->uuid, entry);
|
||||
}
|
||||
@ -2064,7 +2064,7 @@ unsigned int filelist_entry_select_set(
|
||||
{
|
||||
/* Default NULL pointer if not found is fine here! */
|
||||
void **es_p = BLI_ghash_lookup_p(filelist->selection_state, entry->uuid);
|
||||
unsigned int entry_flag = es_p ? GET_UINT_FROM_POINTER(*es_p) : 0;
|
||||
unsigned int entry_flag = es_p ? POINTER_AS_UINT(*es_p) : 0;
|
||||
const unsigned int org_entry_flag = entry_flag;
|
||||
|
||||
BLI_assert(entry);
|
||||
@ -2090,7 +2090,7 @@ unsigned int filelist_entry_select_set(
|
||||
if (entry_flag != org_entry_flag) {
|
||||
if (es_p) {
|
||||
if (entry_flag) {
|
||||
*es_p = SET_UINT_IN_POINTER(entry_flag);
|
||||
*es_p = POINTER_FROM_UINT(entry_flag);
|
||||
}
|
||||
else {
|
||||
BLI_ghash_remove(filelist->selection_state, entry->uuid, MEM_freeN, NULL);
|
||||
@ -2099,7 +2099,7 @@ unsigned int filelist_entry_select_set(
|
||||
else if (entry_flag) {
|
||||
void *key = MEM_mallocN(sizeof(entry->uuid), __func__);
|
||||
memcpy(key, entry->uuid, sizeof(entry->uuid));
|
||||
BLI_ghash_insert(filelist->selection_state, key, SET_UINT_IN_POINTER(entry_flag));
|
||||
BLI_ghash_insert(filelist->selection_state, key, POINTER_FROM_UINT(entry_flag));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2139,7 +2139,7 @@ unsigned int filelist_entry_select_get(FileList *filelist, FileDirEntry *entry,
|
||||
((check == CHECK_FILES) && !(entry->typeflag & FILE_TYPE_DIR)))
|
||||
{
|
||||
/* Default NULL pointer if not found is fine here! */
|
||||
return GET_UINT_FROM_POINTER(BLI_ghash_lookup(filelist->selection_state, entry->uuid));
|
||||
return POINTER_AS_UINT(BLI_ghash_lookup(filelist->selection_state, entry->uuid));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -375,7 +375,7 @@ static void ui_node_link(bContext *C, void *arg_p, void *event_p)
|
||||
bNode *node_to = arg->node;
|
||||
bNodeSocket *sock_to = arg->sock;
|
||||
bNodeTree *ntree = arg->ntree;
|
||||
int event = GET_INT_FROM_POINTER(event_p);
|
||||
int event = POINTER_AS_INT(event_p);
|
||||
|
||||
if (event == UI_NODE_LINK_DISCONNECT)
|
||||
node_socket_disconnect(bmain, ntree, node_to, sock_to);
|
||||
@ -573,11 +573,11 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
|
||||
|
||||
but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
|
||||
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input"));
|
||||
UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_REMOVE));
|
||||
UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), POINTER_FROM_INT(UI_NODE_LINK_REMOVE));
|
||||
|
||||
but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
|
||||
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input"));
|
||||
UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT));
|
||||
UI_but_funcN_set(but, ui_node_link, MEM_dupallocN(arg), POINTER_FROM_INT(UI_NODE_LINK_DISCONNECT));
|
||||
}
|
||||
|
||||
ui_node_menu_column(arg, NODE_CLASS_GROUP, N_("Group"));
|
||||
|
@ -1151,7 +1151,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int
|
||||
}
|
||||
SEQ_END;
|
||||
|
||||
actseq->tmp = SET_INT_IN_POINTER(true);
|
||||
actseq->tmp = POINTER_FROM_INT(true);
|
||||
|
||||
for (BKE_sequence_iterator_begin(ed, &iter, true); iter.valid; BKE_sequence_iterator_next(&iter)) {
|
||||
seq = iter.seq;
|
||||
@ -1176,7 +1176,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int
|
||||
if (enddisp < seq->enddisp) enddisp = seq->enddisp;
|
||||
if (machine < seq->machine) machine = seq->machine;
|
||||
|
||||
seq->tmp = SET_INT_IN_POINTER(true);
|
||||
seq->tmp = POINTER_FROM_INT(true);
|
||||
|
||||
seq->flag |= SELECT;
|
||||
changed = true;
|
||||
|
@ -594,7 +594,7 @@ static void initSnappingMode(TransInfo *t)
|
||||
(bool (*)(BMVert *, void *))BM_elem_cb_check_hflag_disabled,
|
||||
bm_edge_is_snap_target,
|
||||
bm_face_is_snap_target,
|
||||
SET_UINT_IN_POINTER((BM_ELEM_SELECT | BM_ELEM_HIDDEN)));
|
||||
POINTER_FROM_UINT((BM_ELEM_SELECT | BM_ELEM_HIDDEN)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include <cstring> // for memset
|
||||
#include <float.h>
|
||||
#include <stdint.h> // For SET_UINT_IN_POINTER, i.e. uintptr_t.
|
||||
#include <stdint.h> // For POINTER_FROM_UINT, i.e. uintptr_t.
|
||||
#include <vector>
|
||||
|
||||
#include "Geom.h"
|
||||
@ -338,8 +338,8 @@ protected:
|
||||
visitor.discoverCell(current_cell);
|
||||
OccludersSet& occluders = current_cell->getOccluders(); // FIXME: I had forgotten the ref &
|
||||
for (OccludersSet::iterator it = occluders.begin(); it != occluders.end(); it++) {
|
||||
if (GET_UINT_FROM_POINTER((*it)->userdata2) != _timestamp) {
|
||||
(*it)->userdata2 = SET_UINT_IN_POINTER(_timestamp);
|
||||
if (POINTER_AS_UINT((*it)->userdata2) != _timestamp) {
|
||||
(*it)->userdata2 = POINTER_FROM_UINT(_timestamp);
|
||||
visitor.examineOccluder(*it);
|
||||
}
|
||||
}
|
||||
|
@ -1102,17 +1102,17 @@ int save(ostream& out, ViewMap *vm, ProgressBar *pb)
|
||||
|
||||
// For every object, initialize its userdata member to its index in the ViewMap list
|
||||
for (unsigned int i0 = 0; i0 < vm->ViewShapes().size(); i0++) {
|
||||
vm->ViewShapes()[i0]->userdata = SET_UINT_IN_POINTER(i0);
|
||||
vm->ViewShapes()[i0]->sshape()->userdata = SET_UINT_IN_POINTER(i0);
|
||||
vm->ViewShapes()[i0]->userdata = POINTER_FROM_UINT(i0);
|
||||
vm->ViewShapes()[i0]->sshape()->userdata = POINTER_FROM_UINT(i0);
|
||||
}
|
||||
for (unsigned int i1 = 0; i1 < vm->FEdges().size(); i1++)
|
||||
vm->FEdges()[i1]->userdata = SET_UINT_IN_POINTER(i1);
|
||||
vm->FEdges()[i1]->userdata = POINTER_FROM_UINT(i1);
|
||||
for (unsigned int i2 = 0; i2 < vm->SVertices().size(); i2++)
|
||||
vm->SVertices()[i2]->userdata = SET_UINT_IN_POINTER(i2);
|
||||
vm->SVertices()[i2]->userdata = POINTER_FROM_UINT(i2);
|
||||
for (unsigned int i3 = 0; i3 < vm->ViewEdges().size(); i3++)
|
||||
vm->ViewEdges()[i3]->userdata = SET_UINT_IN_POINTER(i3);
|
||||
vm->ViewEdges()[i3]->userdata = POINTER_FROM_UINT(i3);
|
||||
for (unsigned int i4 = 0; i4 < vm->ViewVertices().size(); i4++)
|
||||
vm->ViewVertices()[i4]->userdata = SET_UINT_IN_POINTER(i4);
|
||||
vm->ViewVertices()[i4]->userdata = POINTER_FROM_UINT(i4);
|
||||
|
||||
// Write the current options
|
||||
unsigned char flags = Options::getFlags();
|
||||
|
@ -115,7 +115,7 @@ static void deformStroke(
|
||||
/* Random generator, only init once. */
|
||||
if (mmd->rng == NULL) {
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
rng_seed ^= GET_UINT_FROM_POINTER(mmd);
|
||||
rng_seed ^= POINTER_AS_UINT(mmd);
|
||||
mmd->rng = BLI_rng_new(rng_seed);
|
||||
}
|
||||
|
||||
|
@ -516,14 +516,14 @@ static void codegen_set_texid(GHash *bindhash, GPUInput *input, int *texid, void
|
||||
{
|
||||
if (BLI_ghash_haskey(bindhash, key)) {
|
||||
/* Reuse existing texid */
|
||||
input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, key));
|
||||
input->texid = POINTER_AS_INT(BLI_ghash_lookup(bindhash, key));
|
||||
}
|
||||
else {
|
||||
/* Allocate new texid */
|
||||
input->texid = *texid;
|
||||
(*texid)++;
|
||||
input->bindtex = true;
|
||||
BLI_ghash_insert(bindhash, key, SET_INT_IN_POINTER(input->texid));
|
||||
BLI_ghash_insert(bindhash, key, POINTER_FROM_INT(input->texid));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,7 @@ static void processor_apply_scanline_func(TaskPool * __restrict pool,
|
||||
int UNUSED(threadid))
|
||||
{
|
||||
ScanlineGlobalData *data = BLI_task_pool_userdata(pool);
|
||||
int start_scanline = GET_INT_FROM_POINTER(taskdata);
|
||||
int start_scanline = POINTER_AS_INT(taskdata);
|
||||
int num_scanlines = min_ii(data->scanlines_per_task,
|
||||
data->total_scanlines - start_scanline);
|
||||
data->do_thread(data->custom_data,
|
||||
@ -415,7 +415,7 @@ void IMB_processor_apply_threaded_scanlines(int total_scanlines,
|
||||
for (int i = 0, start_line = 0; i < total_tasks; i++) {
|
||||
BLI_task_pool_push(task_pool,
|
||||
processor_apply_scanline_func,
|
||||
SET_INT_IN_POINTER(start_line),
|
||||
POINTER_FROM_INT(start_line),
|
||||
false,
|
||||
TASK_PRIORITY_LOW);
|
||||
start_line += scanlines_per_task;
|
||||
|
@ -271,7 +271,7 @@ int DNA_struct_find_nr_ex(const SDNA *sdna, const char *str, unsigned int *index
|
||||
index_p = BLI_ghash_lookup_p(sdna->structs_map, str);
|
||||
|
||||
if (index_p) {
|
||||
a = GET_INT_FROM_POINTER(*index_p);
|
||||
a = POINTER_AS_INT(*index_p);
|
||||
*index_last = a;
|
||||
}
|
||||
else {
|
||||
@ -583,7 +583,7 @@ static bool init_structDNA(
|
||||
|
||||
for (intptr_t nr = 0; nr < sdna->nr_structs; nr++) {
|
||||
sp = sdna->structs[nr];
|
||||
BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], SET_INT_IN_POINTER(nr));
|
||||
BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], POINTER_FROM_INT(nr));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -133,7 +133,7 @@ static Mesh *applyModifier(
|
||||
|
||||
for (j = 0; j < mp->totloop; j++, ml++) {
|
||||
void **val_p;
|
||||
if (!BLI_ghash_ensure_p(vertHash, SET_INT_IN_POINTER(ml->v), &val_p)) {
|
||||
if (!BLI_ghash_ensure_p(vertHash, POINTER_FROM_INT(ml->v), &val_p)) {
|
||||
*val_p = (void *)hash_num;
|
||||
hash_num++;
|
||||
}
|
||||
@ -151,8 +151,8 @@ static Mesh *applyModifier(
|
||||
for (i = 0; i < numEdge_src; i++, hash_num_alt++) {
|
||||
MEdge *me = medge_src + i;
|
||||
|
||||
if (BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1)) &&
|
||||
BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2)))
|
||||
if (BLI_ghash_haskey(vertHash, POINTER_FROM_INT(me->v1)) &&
|
||||
BLI_ghash_haskey(vertHash, POINTER_FROM_INT(me->v2)))
|
||||
{
|
||||
BLI_ghash_insert(edgeHash, (void *)hash_num, (void *)hash_num_alt);
|
||||
BLI_ghash_insert(edgeHash2, (void *)hash_num_alt, (void *)hash_num);
|
||||
@ -179,11 +179,11 @@ static Mesh *applyModifier(
|
||||
void **val_p;
|
||||
me = medge + edgeMap[i];
|
||||
|
||||
if (!BLI_ghash_ensure_p(vertHash, SET_INT_IN_POINTER(me->v1), &val_p)) {
|
||||
if (!BLI_ghash_ensure_p(vertHash, POINTER_FROM_INT(me->v1), &val_p)) {
|
||||
*val_p = (void *)hash_num;
|
||||
hash_num++;
|
||||
}
|
||||
if (!BLI_ghash_ensure_p(vertHash, SET_INT_IN_POINTER(me->v2), &val_p)) {
|
||||
if (!BLI_ghash_ensure_p(vertHash, POINTER_FROM_INT(me->v2), &val_p)) {
|
||||
*val_p = (void *)hash_num;
|
||||
hash_num++;
|
||||
}
|
||||
@ -194,10 +194,10 @@ static Mesh *applyModifier(
|
||||
for (i = 0; i < numEdges_dst; i++) {
|
||||
j = BLI_ghash_len(edgeHash);
|
||||
|
||||
BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(j),
|
||||
SET_INT_IN_POINTER(edgeMap[i]));
|
||||
BLI_ghash_insert(edgeHash2, SET_INT_IN_POINTER(edgeMap[i]),
|
||||
SET_INT_IN_POINTER(j));
|
||||
BLI_ghash_insert(edgeHash, POINTER_FROM_INT(j),
|
||||
POINTER_FROM_INT(edgeMap[i]));
|
||||
BLI_ghash_insert(edgeHash2, POINTER_FROM_INT(edgeMap[i]),
|
||||
POINTER_FROM_INT(j));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -212,7 +212,7 @@ static Mesh *applyModifier(
|
||||
* mapped to the new indices
|
||||
*/
|
||||
for (i = 0; i < numVerts; i++) {
|
||||
BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(vertMap[i]), SET_INT_IN_POINTER(i));
|
||||
BLI_ghash_insert(vertHash, POINTER_FROM_INT(vertMap[i]), POINTER_FROM_INT(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,8 +225,8 @@ static Mesh *applyModifier(
|
||||
GHASH_ITER (gh_iter, vertHash) {
|
||||
MVert source;
|
||||
MVert *dest;
|
||||
int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
int oldIndex = POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter));
|
||||
int newIndex = POINTER_AS_INT(BLI_ghashIterator_getValue(&gh_iter));
|
||||
|
||||
source = mvert_src[oldIndex];
|
||||
dest = &result->mvert[newIndex];
|
||||
@ -239,13 +239,13 @@ static Mesh *applyModifier(
|
||||
for (i = 0; i < BLI_ghash_len(edgeHash); i++) {
|
||||
MEdge source;
|
||||
MEdge *dest;
|
||||
int oldIndex = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_INT_IN_POINTER(i)));
|
||||
int oldIndex = POINTER_AS_INT(BLI_ghash_lookup(edgeHash, POINTER_FROM_INT(i)));
|
||||
|
||||
source = medge_src[oldIndex];
|
||||
dest = &result->medge[i];
|
||||
|
||||
source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1)));
|
||||
source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2)));
|
||||
source.v1 = POINTER_AS_INT(BLI_ghash_lookup(vertHash, POINTER_FROM_INT(source.v1)));
|
||||
source.v2 = POINTER_AS_INT(BLI_ghash_lookup(vertHash, POINTER_FROM_INT(source.v2)));
|
||||
|
||||
CustomData_copy_data(&mesh->edata, &result->edata, oldIndex, i, 1);
|
||||
*dest = source;
|
||||
@ -270,8 +270,8 @@ static Mesh *applyModifier(
|
||||
|
||||
ml_src = mloop_src + source->loopstart;
|
||||
for (j = 0; j < source->totloop; j++, k++, ml_src++, ml_dst++) {
|
||||
ml_dst->v = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(ml_src->v)));
|
||||
ml_dst->e = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash2, SET_INT_IN_POINTER(ml_src->e)));
|
||||
ml_dst->v = POINTER_AS_INT(BLI_ghash_lookup(vertHash, POINTER_FROM_INT(ml_src->v)));
|
||||
ml_dst->e = POINTER_AS_INT(BLI_ghash_lookup(edgeHash2, POINTER_FROM_INT(ml_src->e)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ static void createFacepa(
|
||||
|
||||
static int edgecut_get(EdgeHash *edgehash, unsigned int v1, unsigned int v2)
|
||||
{
|
||||
return GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, v1, v2));
|
||||
return POINTER_AS_INT(BLI_edgehash_lookup(edgehash, v1, v2));
|
||||
}
|
||||
|
||||
|
||||
@ -628,7 +628,7 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
|
||||
ehi = BLI_edgehashIterator_new(edgehash);
|
||||
totesplit = totvert;
|
||||
for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
|
||||
BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totesplit));
|
||||
BLI_edgehashIterator_setValue(ehi, POINTER_FROM_INT(totesplit));
|
||||
totesplit++;
|
||||
}
|
||||
BLI_edgehashIterator_free(ehi);
|
||||
@ -667,7 +667,7 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
|
||||
ehi = BLI_edgehashIterator_new(edgehash);
|
||||
for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
|
||||
BLI_edgehashIterator_getKey(ehi, &ed_v1, &ed_v2);
|
||||
esplit = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
|
||||
esplit = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi));
|
||||
mv = CDDM_get_vert(splitdm, ed_v2);
|
||||
dupve = CDDM_get_vert(splitdm, esplit);
|
||||
|
||||
@ -862,7 +862,7 @@ static DerivedMesh *explodeMesh(
|
||||
/* make new vertice indexes & count total vertices after duplication */
|
||||
ehi = BLI_edgehashIterator_new(vertpahash);
|
||||
for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
|
||||
BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totdup));
|
||||
BLI_edgehashIterator_setValue(ehi, POINTER_FROM_INT(totdup));
|
||||
totdup++;
|
||||
}
|
||||
BLI_edgehashIterator_free(ehi);
|
||||
@ -886,7 +886,7 @@ static DerivedMesh *explodeMesh(
|
||||
/* get particle + vertex from hash */
|
||||
BLI_edgehashIterator_getKey(ehi, &ed_v1, &ed_v2);
|
||||
ed_v2 -= totvert;
|
||||
v = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
|
||||
v = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi));
|
||||
|
||||
dm->getVert(dm, ed_v1, &source);
|
||||
dest = CDDM_get_vert(explode, v);
|
||||
|
@ -196,7 +196,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
}
|
||||
|
||||
/* add to ghash for verts (numVerts acts as counter for mapping) */
|
||||
BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numVerts));
|
||||
BLI_ghash_insert(vertHash, POINTER_FROM_INT(i), POINTER_FROM_INT(numVerts));
|
||||
numVerts++;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
}
|
||||
|
||||
/* add to ghash for verts (numVerts acts as counter for mapping) */
|
||||
BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numVerts));
|
||||
BLI_ghash_insert(vertHash, POINTER_FROM_INT(i), POINTER_FROM_INT(numVerts));
|
||||
numVerts++;
|
||||
}
|
||||
}
|
||||
@ -246,10 +246,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
const MEdge *me = &medge_src[i];
|
||||
|
||||
/* only add if both verts will be in new mesh */
|
||||
if (BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1)) &&
|
||||
BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2)))
|
||||
if (BLI_ghash_haskey(vertHash, POINTER_FROM_INT(me->v1)) &&
|
||||
BLI_ghash_haskey(vertHash, POINTER_FROM_INT(me->v2)))
|
||||
{
|
||||
BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numEdges));
|
||||
BLI_ghash_insert(edgeHash, POINTER_FROM_INT(i), POINTER_FROM_INT(numEdges));
|
||||
numEdges++;
|
||||
}
|
||||
}
|
||||
@ -260,7 +260,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
int j;
|
||||
|
||||
for (j = 0; j < mp_src->totloop; j++, ml_src++) {
|
||||
if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(ml_src->v))) {
|
||||
if (!BLI_ghash_haskey(vertHash, POINTER_FROM_INT(ml_src->v))) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -268,7 +268,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
|
||||
/* all verts must be available */
|
||||
if (ok) {
|
||||
BLI_ghash_insert(polyHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numPolys));
|
||||
BLI_ghash_insert(polyHash, POINTER_FROM_INT(i), POINTER_FROM_INT(numPolys));
|
||||
loop_mapping[numPolys] = numLoops;
|
||||
numPolys++;
|
||||
numLoops += mp_src->totloop;
|
||||
@ -291,8 +291,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
GHASH_ITER (gh_iter, vertHash) {
|
||||
const MVert *v_src;
|
||||
MVert *v_dst;
|
||||
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
const int i_src = POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = POINTER_AS_INT(BLI_ghashIterator_getValue(&gh_iter));
|
||||
|
||||
v_src = &mvert_src[i_src];
|
||||
v_dst = &mvert_dst[i_dst];
|
||||
@ -305,22 +305,22 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
GHASH_ITER (gh_iter, edgeHash) {
|
||||
const MEdge *e_src;
|
||||
MEdge *e_dst;
|
||||
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
const int i_src = POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = POINTER_AS_INT(BLI_ghashIterator_getValue(&gh_iter));
|
||||
|
||||
e_src = &medge_src[i_src];
|
||||
e_dst = &medge_dst[i_dst];
|
||||
|
||||
CustomData_copy_data(&mesh->edata, &result->edata, i_src, i_dst, 1);
|
||||
*e_dst = *e_src;
|
||||
e_dst->v1 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v1)));
|
||||
e_dst->v2 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v2)));
|
||||
e_dst->v1 = POINTER_AS_UINT(BLI_ghash_lookup(vertHash, POINTER_FROM_UINT(e_src->v1)));
|
||||
e_dst->v2 = POINTER_AS_UINT(BLI_ghash_lookup(vertHash, POINTER_FROM_UINT(e_src->v2)));
|
||||
}
|
||||
|
||||
/* faces */
|
||||
GHASH_ITER (gh_iter, polyHash) {
|
||||
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
const int i_src = POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = POINTER_AS_INT(BLI_ghashIterator_getValue(&gh_iter));
|
||||
const MPoly *mp_src = &mpoly_src[i_src];
|
||||
MPoly *mp_dst = &mpoly_dst[i_dst];
|
||||
const int i_ml_src = mp_src->loopstart;
|
||||
@ -334,8 +334,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
*mp_dst = *mp_src;
|
||||
mp_dst->loopstart = i_ml_dst;
|
||||
for (i = 0; i < mp_src->totloop; i++) {
|
||||
ml_dst[i].v = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(ml_src[i].v)));
|
||||
ml_dst[i].e = GET_UINT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_UINT_IN_POINTER(ml_src[i].e)));
|
||||
ml_dst[i].v = POINTER_AS_UINT(BLI_ghash_lookup(vertHash, POINTER_FROM_UINT(ml_src[i].v)));
|
||||
ml_dst[i].e = POINTER_AS_UINT(BLI_ghash_lookup(edgeHash, POINTER_FROM_UINT(ml_src[i].e)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, Weight
|
||||
|
||||
if (!(lnor_space->flags & MLNOR_SPACE_IS_SINGLE)) {
|
||||
for (LinkNode *lnode = lnor_space->loops; lnode; lnode = lnode->next) {
|
||||
const int ml_fan_index = GET_INT_FROM_POINTER(lnode->link);
|
||||
const int ml_fan_index = POINTER_AS_INT(lnode->link);
|
||||
BLI_BITMAP_ENABLE(done_loops, ml_fan_index);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ PyDoc_STRVAR(bpy_bm_elem_seam_doc, "Seam for UV unwrapping.\n\n:type: boolean
|
||||
|
||||
static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
|
||||
{
|
||||
const char hflag = (char)GET_INT_FROM_POINTER(flag);
|
||||
const char hflag = (char)POINTER_AS_INT(flag);
|
||||
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
|
||||
@ -122,7 +122,7 @@ static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
|
||||
|
||||
static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag)
|
||||
{
|
||||
const char hflag = (char)GET_INT_FROM_POINTER(flag);
|
||||
const char hflag = (char)POINTER_AS_INT(flag);
|
||||
int param;
|
||||
|
||||
BPY_BM_CHECK_INT(self);
|
||||
@ -266,7 +266,7 @@ PyDoc_STRVAR(bpy_bmloops_link_loops_doc,
|
||||
static PyObject *bpy_bmelemseq_elem_get(BPy_BMElem *self, void *itype)
|
||||
{
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
return BPy_BMElemSeq_CreatePyObject(self->bm, self, GET_INT_FROM_POINTER(itype));
|
||||
return BPy_BMElemSeq_CreatePyObject(self->bm, self, POINTER_AS_INT(itype));
|
||||
}
|
||||
|
||||
|
||||
@ -614,7 +614,7 @@ static PyObject *bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
|
||||
{
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
|
||||
return BPy_BMLayerAccess_CreatePyObject(self->bm, GET_INT_FROM_POINTER(htype));
|
||||
return BPy_BMLayerAccess_CreatePyObject(self->bm, POINTER_AS_INT(htype));
|
||||
}
|
||||
|
||||
/* FaceSeq
|
||||
|
@ -131,7 +131,7 @@ PyDoc_STRVAR(bpy_bmlayeraccess_collection__freestyle_face_doc,
|
||||
|
||||
static PyObject *bpy_bmlayeraccess_collection_get(BPy_BMLayerAccess *self, void *flag)
|
||||
{
|
||||
const int type = (int)GET_INT_FROM_POINTER(flag);
|
||||
const int type = (int)POINTER_AS_INT(flag);
|
||||
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
|
||||
|
@ -92,13 +92,13 @@ PyDoc_STRVAR(bpy_bmloopuv_flag__select_edge_doc,
|
||||
|
||||
static PyObject *bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p)
|
||||
{
|
||||
const int flag = GET_INT_FROM_POINTER(flag_p);
|
||||
const int flag = POINTER_AS_INT(flag_p);
|
||||
return PyBool_FromLong(self->data->flag & flag);
|
||||
}
|
||||
|
||||
static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag_p)
|
||||
{
|
||||
const int flag = GET_INT_FROM_POINTER(flag_p);
|
||||
const int flag = POINTER_AS_INT(flag_p);
|
||||
|
||||
switch (PyC_Long_AsBool(value)) {
|
||||
case true:
|
||||
@ -200,13 +200,13 @@ PyDoc_STRVAR(bpy_bmvertskin_flag__use_loose_doc,
|
||||
|
||||
static PyObject *bpy_bmvertskin_flag_get(BPy_BMVertSkin *self, void *flag_p)
|
||||
{
|
||||
const int flag = GET_INT_FROM_POINTER(flag_p);
|
||||
const int flag = POINTER_AS_INT(flag_p);
|
||||
return PyBool_FromLong(self->data->flag & flag);
|
||||
}
|
||||
|
||||
static int bpy_bmvertskin_flag_set(BPy_BMVertSkin *self, PyObject *value, void *flag_p)
|
||||
{
|
||||
const int flag = GET_INT_FROM_POINTER(flag_p);
|
||||
const int flag = POINTER_AS_INT(flag_p);
|
||||
|
||||
switch (PyC_Long_AsBool(value)) {
|
||||
case true:
|
||||
|
@ -240,13 +240,13 @@ PyDoc_STRVAR(bpy_app_debug_doc,
|
||||
);
|
||||
static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *closure)
|
||||
{
|
||||
const int flag = GET_INT_FROM_POINTER(closure);
|
||||
const int flag = POINTER_AS_INT(closure);
|
||||
return PyBool_FromLong(G.debug & flag);
|
||||
}
|
||||
|
||||
static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *closure)
|
||||
{
|
||||
const int flag = GET_INT_FROM_POINTER(closure);
|
||||
const int flag = POINTER_AS_INT(closure);
|
||||
const int param = PyObject_IsTrue(value);
|
||||
|
||||
if (param == -1) {
|
||||
@ -317,7 +317,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
|
||||
|
||||
static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure)
|
||||
{
|
||||
const int flag = GET_INT_FROM_POINTER(closure);
|
||||
const int flag = POINTER_AS_INT(closure);
|
||||
return PyBool_FromLong(G.f & flag);
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ PyDoc_STRVAR(bpy_app_preview_render_size_doc,
|
||||
);
|
||||
static PyObject *bpy_app_preview_render_size_get(PyObject *UNUSED(self), void *closure)
|
||||
{
|
||||
return PyLong_FromLong((long)UI_preview_render_size(GET_INT_FROM_POINTER(closure)));
|
||||
return PyLong_FromLong((long)UI_preview_render_size(POINTER_AS_INT(closure)));
|
||||
}
|
||||
|
||||
static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
||||
|
@ -233,7 +233,7 @@ PyObject *BPY_app_handlers_struct(void)
|
||||
funcstore = &funcstore_array[pos];
|
||||
funcstore->func = bpy_app_generic_callback;
|
||||
funcstore->alloc = 0;
|
||||
funcstore->arg = SET_INT_IN_POINTER(pos);
|
||||
funcstore->arg = POINTER_FROM_INT(pos);
|
||||
BLI_callback_add(funcstore, pos);
|
||||
}
|
||||
}
|
||||
@ -292,7 +292,7 @@ void BPY_app_handlers_reset(const short do_all)
|
||||
/* the actual callback - not necessarily called from py */
|
||||
void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
|
||||
{
|
||||
PyObject *cb_list = py_cb_array[GET_INT_FROM_POINTER(arg)];
|
||||
PyObject *cb_list = py_cb_array[POINTER_AS_INT(arg)];
|
||||
if (PyList_GET_SIZE(cb_list) > 0) {
|
||||
PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
|
||||
|
@ -706,12 +706,12 @@ PyDoc_STRVAR(Color_channel_b_doc, "Blue color channel.\n\n:type: float");
|
||||
|
||||
static PyObject *Color_channel_get(ColorObject *self, void *type)
|
||||
{
|
||||
return Color_item(self, GET_INT_FROM_POINTER(type));
|
||||
return Color_item(self, POINTER_AS_INT(type));
|
||||
}
|
||||
|
||||
static int Color_channel_set(ColorObject *self, PyObject *value, void *type)
|
||||
{
|
||||
return Color_ass_item(self, GET_INT_FROM_POINTER(type), value);
|
||||
return Color_ass_item(self, POINTER_AS_INT(type), value);
|
||||
}
|
||||
|
||||
/* color channel (HSV), color.h/s/v */
|
||||
@ -722,7 +722,7 @@ PyDoc_STRVAR(Color_channel_hsv_v_doc, "HSV Value component in [0, 1].\n\n:type:
|
||||
static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
|
||||
{
|
||||
float hsv[3];
|
||||
int i = GET_INT_FROM_POINTER(type);
|
||||
int i = POINTER_AS_INT(type);
|
||||
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
@ -735,7 +735,7 @@ static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
|
||||
static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void *type)
|
||||
{
|
||||
float hsv[3];
|
||||
int i = GET_INT_FROM_POINTER(type);
|
||||
int i = POINTER_AS_INT(type);
|
||||
float f = PyFloat_AsDouble(value);
|
||||
|
||||
if (f == -1 && PyErr_Occurred()) {
|
||||
|
@ -612,12 +612,12 @@ PyDoc_STRVAR(Euler_axis_doc,
|
||||
);
|
||||
static PyObject *Euler_axis_get(EulerObject *self, void *type)
|
||||
{
|
||||
return Euler_item(self, GET_INT_FROM_POINTER(type));
|
||||
return Euler_item(self, POINTER_AS_INT(type));
|
||||
}
|
||||
|
||||
static int Euler_axis_set(EulerObject *self, PyObject *value, void *type)
|
||||
{
|
||||
return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value);
|
||||
return Euler_ass_item(self, POINTER_AS_INT(type), value);
|
||||
}
|
||||
|
||||
/* rotation order */
|
||||
|
@ -1083,12 +1083,12 @@ PyDoc_STRVAR(Quaternion_axis_doc,
|
||||
);
|
||||
static PyObject *Quaternion_axis_get(QuaternionObject *self, void *type)
|
||||
{
|
||||
return Quaternion_item(self, GET_INT_FROM_POINTER(type));
|
||||
return Quaternion_item(self, POINTER_AS_INT(type));
|
||||
}
|
||||
|
||||
static int Quaternion_axis_set(QuaternionObject *self, PyObject *value, void *type)
|
||||
{
|
||||
return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value);
|
||||
return Quaternion_ass_item(self, POINTER_AS_INT(type), value);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_magnitude_doc,
|
||||
|
@ -2224,12 +2224,12 @@ PyDoc_STRVAR(Vector_axis_w_doc, "Vector W axis (4D Vectors only).\n\n:type: floa
|
||||
|
||||
static PyObject *Vector_axis_get(VectorObject *self, void *type)
|
||||
{
|
||||
return vector_item_internal(self, GET_INT_FROM_POINTER(type), true);
|
||||
return vector_item_internal(self, POINTER_AS_INT(type), true);
|
||||
}
|
||||
|
||||
static int Vector_axis_set(VectorObject *self, PyObject *value, void *type)
|
||||
{
|
||||
return vector_ass_item_internal(self, GET_INT_FROM_POINTER(type), value, true);
|
||||
return vector_ass_item_internal(self, POINTER_AS_INT(type), value, true);
|
||||
}
|
||||
|
||||
/* vector.length */
|
||||
@ -2372,7 +2372,7 @@ static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
|
||||
|
||||
/* Unpack the axes from the closure into an array. */
|
||||
axis_to = 0;
|
||||
swizzleClosure = GET_INT_FROM_POINTER(closure);
|
||||
swizzleClosure = POINTER_AS_INT(closure);
|
||||
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
|
||||
axis_from = swizzleClosure & SWIZZLE_AXIS;
|
||||
if (axis_from >= self->size) {
|
||||
@ -2419,7 +2419,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
|
||||
/* Check that the closure can be used with this vector: even 2D vectors have
|
||||
* swizzles defined for axes z and w, but they would be invalid. */
|
||||
swizzleClosure = GET_INT_FROM_POINTER(closure);
|
||||
swizzleClosure = POINTER_AS_INT(closure);
|
||||
axis_from = 0;
|
||||
|
||||
while (swizzleClosure & SWIZZLE_VALID_AXIS) {
|
||||
@ -2458,7 +2458,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
|
||||
/* Copy vector contents onto swizzled axes. */
|
||||
axis_from = 0;
|
||||
swizzleClosure = GET_INT_FROM_POINTER(closure);
|
||||
swizzleClosure = POINTER_AS_INT(closure);
|
||||
|
||||
/* We must first copy current vec into tvec, else some org values may be lost.
|
||||
* See [#31760].
|
||||
@ -2488,9 +2488,9 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
|
||||
#define _SWIZZLE3(a, b, c) (_SWIZZLE2(a, b) | (((c) | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)))
|
||||
#define _SWIZZLE4(a, b, c, d) (_SWIZZLE3(a, b, c) | (((d) | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))
|
||||
|
||||
#define SWIZZLE2(a, b) SET_INT_IN_POINTER(_SWIZZLE2(a, b))
|
||||
#define SWIZZLE3(a, b, c) SET_INT_IN_POINTER(_SWIZZLE3(a, b, c))
|
||||
#define SWIZZLE4(a, b, c, d) SET_INT_IN_POINTER(_SWIZZLE4(a, b, c, d))
|
||||
#define SWIZZLE2(a, b) POINTER_FROM_INT(_SWIZZLE2(a, b))
|
||||
#define SWIZZLE3(a, b, c) POINTER_FROM_INT(_SWIZZLE3(a, b, c))
|
||||
#define SWIZZLE4(a, b, c, d) POINTER_FROM_INT(_SWIZZLE4(a, b, c, d))
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python attributes get/set structure: */
|
||||
|
@ -404,7 +404,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if (!BLI_ghash_haskey(libraries, libname)) {
|
||||
BLI_ghash_insert(libraries, BLI_strdup(libname), SET_INT_IN_POINTER(lib_idx));
|
||||
BLI_ghash_insert(libraries, BLI_strdup(libname), POINTER_FROM_INT(lib_idx));
|
||||
lib_idx++;
|
||||
wm_link_append_data_library_add(lapp_data, libname);
|
||||
}
|
||||
@ -425,7 +425,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
lib_idx = GET_INT_FROM_POINTER(BLI_ghash_lookup(libraries, libname));
|
||||
lib_idx = POINTER_AS_INT(BLI_ghash_lookup(libraries, libname));
|
||||
|
||||
item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL);
|
||||
BLI_BITMAP_ENABLE(item->libraries, lib_idx);
|
||||
|
@ -1595,7 +1595,7 @@ static int wm_window_timer(const bContext *C)
|
||||
else if (wt->event_type == TIMERAUTOSAVE)
|
||||
wm_autosave_timer(C, wm, wt);
|
||||
else if (wt->event_type == TIMERNOTIFIER)
|
||||
WM_main_add_notifier(GET_UINT_FROM_POINTER(wt->customdata), NULL);
|
||||
WM_main_add_notifier(POINTER_AS_UINT(wt->customdata), NULL);
|
||||
else if (win) {
|
||||
wmEvent event;
|
||||
wm_event_init_from_window(win, &event);
|
||||
@ -1734,7 +1734,7 @@ wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigne
|
||||
wt->stime = wt->ltime;
|
||||
wt->timestep = timestep;
|
||||
wt->win = win;
|
||||
wt->customdata = SET_UINT_IN_POINTER(type);
|
||||
wt->customdata = POINTER_FROM_UINT(type);
|
||||
wt->flags |= WM_TIMER_NO_FREE_CUSTOM_DATA;
|
||||
|
||||
BLI_addtail(&wm->timers, wt);
|
||||
|
@ -883,7 +883,7 @@ static const char arg_handle_debug_mode_generic_set_doc_gpumem[] =
|
||||
|
||||
static int arg_handle_debug_mode_generic_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
|
||||
{
|
||||
G.debug |= GET_INT_FROM_POINTER(data);
|
||||
G.debug |= POINTER_AS_INT(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -83,16 +83,16 @@ static void str_ghash_tests(GHash *ghash, const char *id)
|
||||
BLI_ghash_reserve(ghash, strlen(data) / 32); /* rough estimation... */
|
||||
#endif
|
||||
|
||||
BLI_ghash_insert(ghash, data, SET_INT_IN_POINTER(data[0]));
|
||||
BLI_ghash_insert(ghash, data, POINTER_FROM_INT(data[0]));
|
||||
|
||||
for (p = c_p = data_p, w = c_w = data_w; *c_w; c_w++, c_p++) {
|
||||
if (*c_p == '.') {
|
||||
*c_p = *c_w = '\0';
|
||||
if (!BLI_ghash_haskey(ghash, p)) {
|
||||
BLI_ghash_insert(ghash, p, SET_INT_IN_POINTER(p[0]));
|
||||
BLI_ghash_insert(ghash, p, POINTER_FROM_INT(p[0]));
|
||||
}
|
||||
if (!BLI_ghash_haskey(ghash, w)) {
|
||||
BLI_ghash_insert(ghash, w, SET_INT_IN_POINTER(w[0]));
|
||||
BLI_ghash_insert(ghash, w, POINTER_FROM_INT(w[0]));
|
||||
}
|
||||
p = c_p + 1;
|
||||
w = c_w + 1;
|
||||
@ -100,7 +100,7 @@ static void str_ghash_tests(GHash *ghash, const char *id)
|
||||
else if (*c_w == ' ') {
|
||||
*c_w = '\0';
|
||||
if (!BLI_ghash_haskey(ghash, w)) {
|
||||
BLI_ghash_insert(ghash, w, SET_INT_IN_POINTER(w[0]));
|
||||
BLI_ghash_insert(ghash, w, POINTER_FROM_INT(w[0]));
|
||||
}
|
||||
w = c_w + 1;
|
||||
}
|
||||
@ -118,21 +118,21 @@ static void str_ghash_tests(GHash *ghash, const char *id)
|
||||
TIMEIT_START(string_lookup);
|
||||
|
||||
v = BLI_ghash_lookup(ghash, data_bis);
|
||||
EXPECT_EQ(GET_INT_FROM_POINTER(v), data_bis[0]);
|
||||
EXPECT_EQ(POINTER_AS_INT(v), data_bis[0]);
|
||||
|
||||
for (p = w = c = data_bis; *c; c++) {
|
||||
if (*c == '.') {
|
||||
*c = '\0';
|
||||
v = BLI_ghash_lookup(ghash, w);
|
||||
EXPECT_EQ(GET_INT_FROM_POINTER(v), w[0]);
|
||||
EXPECT_EQ(POINTER_AS_INT(v), w[0]);
|
||||
v = BLI_ghash_lookup(ghash, p);
|
||||
EXPECT_EQ(GET_INT_FROM_POINTER(v), p[0]);
|
||||
EXPECT_EQ(POINTER_AS_INT(v), p[0]);
|
||||
p = w = c + 1;
|
||||
}
|
||||
else if (*c == ' ') {
|
||||
*c = '\0';
|
||||
v = BLI_ghash_lookup(ghash, w);
|
||||
EXPECT_EQ(GET_INT_FROM_POINTER(v), w[0]);
|
||||
EXPECT_EQ(POINTER_AS_INT(v), w[0]);
|
||||
w = c + 1;
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr
|
||||
#endif
|
||||
|
||||
while (i--) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(i), SET_UINT_IN_POINTER(i));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(i), POINTER_FROM_UINT(i));
|
||||
}
|
||||
|
||||
TIMEIT_END(int_insert);
|
||||
@ -194,8 +194,8 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr
|
||||
TIMEIT_START(int_lookup);
|
||||
|
||||
while (i--) {
|
||||
void *v = BLI_ghash_lookup(ghash, SET_UINT_IN_POINTER(i));
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), i);
|
||||
void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(i));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), i);
|
||||
}
|
||||
|
||||
TIMEIT_END(int_lookup);
|
||||
@ -279,7 +279,7 @@ static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int
|
||||
#endif
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*dt), SET_UINT_IN_POINTER(*dt));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*dt), POINTER_FROM_UINT(*dt));
|
||||
}
|
||||
|
||||
TIMEIT_END(int_insert);
|
||||
@ -291,8 +291,8 @@ static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int
|
||||
TIMEIT_START(int_lookup);
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
void *v = BLI_ghash_lookup(ghash, SET_UINT_IN_POINTER(*dt));
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *dt);
|
||||
void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(*dt));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *dt);
|
||||
}
|
||||
|
||||
TIMEIT_END(int_lookup);
|
||||
@ -337,7 +337,7 @@ TEST(ghash, IntRandMurmur2a50000000)
|
||||
|
||||
static unsigned int ghashutil_tests_nohash_p(const void *p)
|
||||
{
|
||||
return GET_UINT_FROM_POINTER(p);
|
||||
return POINTER_AS_UINT(p);
|
||||
}
|
||||
|
||||
static bool ghashutil_tests_cmp_p(const void *a, const void *b)
|
||||
@ -390,7 +390,7 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb
|
||||
#endif
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
BLI_ghash_insert(ghash, *dt, SET_UINT_IN_POINTER(i));
|
||||
BLI_ghash_insert(ghash, *dt, POINTER_FROM_UINT(i));
|
||||
}
|
||||
|
||||
TIMEIT_END(int_v4_insert);
|
||||
@ -403,7 +403,7 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
void *v = BLI_ghash_lookup(ghash, (void *)(*dt));
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), i);
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), i);
|
||||
}
|
||||
|
||||
TIMEIT_END(int_v4_lookup);
|
||||
@ -464,12 +464,12 @@ static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned i
|
||||
#endif
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*dt), SET_UINT_IN_POINTER(*dt));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*dt), POINTER_FROM_UINT(*dt));
|
||||
}
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
void *v = BLI_ghash_lookup(ghash, SET_UINT_IN_POINTER(*dt));
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *dt);
|
||||
void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(*dt));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *dt);
|
||||
}
|
||||
|
||||
BLI_ghash_clear(ghash, NULL, NULL);
|
||||
|
@ -59,14 +59,14 @@ TEST(ghash, InsertLookup)
|
||||
init_keys(keys, 0);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*k), POINTER_FROM_UINT(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_lookup(ghash, SET_UINT_IN_POINTER(*k));
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *k);
|
||||
void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(*k));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *k);
|
||||
}
|
||||
|
||||
BLI_ghash_free(ghash, NULL, NULL);
|
||||
@ -82,15 +82,15 @@ TEST(ghash, InsertRemove)
|
||||
init_keys(keys, 10);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*k), POINTER_FROM_UINT(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
bkt_size = BLI_ghash_buckets_len(ghash);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_popkey(ghash, SET_UINT_IN_POINTER(*k), NULL);
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *k);
|
||||
void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), NULL);
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *k);
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), 0);
|
||||
@ -110,15 +110,15 @@ TEST(ghash, InsertRemoveShrink)
|
||||
init_keys(keys, 20);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*k), POINTER_FROM_UINT(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
bkt_size = BLI_ghash_buckets_len(ghash);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_popkey(ghash, SET_UINT_IN_POINTER(*k), NULL);
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *k);
|
||||
void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), NULL);
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *k);
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), 0);
|
||||
@ -138,7 +138,7 @@ TEST(ghash, Copy)
|
||||
init_keys(keys, 30);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*k), POINTER_FROM_UINT(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
@ -149,8 +149,8 @@ TEST(ghash, Copy)
|
||||
EXPECT_EQ(BLI_ghash_buckets_len(ghash_copy), BLI_ghash_buckets_len(ghash));
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
void *v = BLI_ghash_lookup(ghash_copy, SET_UINT_IN_POINTER(*k));
|
||||
EXPECT_EQ(GET_UINT_FROM_POINTER(v), *k);
|
||||
void *v = BLI_ghash_lookup(ghash_copy, POINTER_FROM_UINT(*k));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *k);
|
||||
}
|
||||
|
||||
BLI_ghash_free(ghash, NULL, NULL);
|
||||
@ -168,7 +168,7 @@ TEST(ghash, Pop)
|
||||
init_keys(keys, 30);
|
||||
|
||||
for (i = TESTCASE_SIZE, k = keys; i--; k++) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(*k), SET_UINT_IN_POINTER(*k));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*k), POINTER_FROM_UINT(*k));
|
||||
}
|
||||
|
||||
EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE);
|
||||
@ -182,7 +182,7 @@ TEST(ghash, Pop)
|
||||
EXPECT_TRUE(success);
|
||||
|
||||
if (i % 2) {
|
||||
BLI_ghash_insert(ghash, SET_UINT_IN_POINTER(i * 4), SET_UINT_IN_POINTER(i * 4));
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(i * 4), POINTER_FROM_UINT(i * 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,10 @@ TEST(heap, Range)
|
||||
const int items_total = SIZE;
|
||||
Heap *heap = BLI_heap_new();
|
||||
for (int in = 0; in < items_total; in++) {
|
||||
BLI_heap_insert(heap, (float)in, SET_INT_IN_POINTER(in));
|
||||
BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
|
||||
}
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
|
||||
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
@ -70,10 +70,10 @@ TEST(heap, RangeReverse)
|
||||
const int items_total = SIZE;
|
||||
Heap *heap = BLI_heap_new();
|
||||
for (int in = 0; in < items_total; in++) {
|
||||
BLI_heap_insert(heap, (float)-in, SET_INT_IN_POINTER(-in));
|
||||
BLI_heap_insert(heap, (float)-in, POINTER_FROM_INT(-in));
|
||||
}
|
||||
for (int out_test = items_total - 1; out_test >= 0; out_test--) {
|
||||
EXPECT_EQ(-out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
EXPECT_EQ(-out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
@ -85,14 +85,14 @@ TEST(heap, RangeRemove)
|
||||
Heap *heap = BLI_heap_new();
|
||||
HeapNode **nodes = (HeapNode **)MEM_mallocN(sizeof(HeapNode *) * items_total, __func__);
|
||||
for (int in = 0; in < items_total; in++) {
|
||||
nodes[in] = BLI_heap_insert(heap, (float)in, SET_INT_IN_POINTER(in));
|
||||
nodes[in] = BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
|
||||
}
|
||||
for (int i = 0; i < items_total; i += 2) {
|
||||
BLI_heap_remove(heap, nodes[i]);
|
||||
nodes[i] = NULL;
|
||||
}
|
||||
for (int out_test = 1; out_test < items_total; out_test += 2) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
@ -107,7 +107,7 @@ TEST(heap, Duplicates)
|
||||
BLI_heap_insert(heap, 1.0f, 0);
|
||||
}
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(0, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
EXPECT_EQ(0, POINTER_AS_INT(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
@ -122,10 +122,10 @@ static void random_heap_helper(
|
||||
range_fl(values, items_total);
|
||||
BLI_array_randomize(values, sizeof(float), items_total, random_seed);
|
||||
for (int i = 0; i < items_total; i++) {
|
||||
BLI_heap_insert(heap, values[i], SET_INT_IN_POINTER((int)values[i]));
|
||||
BLI_heap_insert(heap, values[i], POINTER_FROM_INT((int)values[i]));
|
||||
}
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
BLI_heap_free(heap, NULL);
|
||||
@ -143,14 +143,14 @@ TEST(heap, ReInsertSimple)
|
||||
Heap *heap = BLI_heap_new();
|
||||
HeapNode **nodes = (HeapNode **)MEM_mallocN(sizeof(HeapNode *) * items_total, __func__);
|
||||
for (int in = 0; in < items_total; in++) {
|
||||
nodes[in] = BLI_heap_insert(heap, (float)in, SET_INT_IN_POINTER(in));
|
||||
nodes[in] = BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
|
||||
}
|
||||
for (int i = 0; i < items_total; i++) {
|
||||
BLI_heap_node_value_update(heap, nodes[i], (float)(items_total + i));
|
||||
}
|
||||
|
||||
for (int out_test = 0; out_test < items_total; out_test++) {
|
||||
EXPECT_EQ(out_test, GET_INT_FROM_POINTER(BLI_heap_pop_min(heap)));
|
||||
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(BLI_heap_is_empty(heap));
|
||||
@ -165,7 +165,7 @@ static void random_heap_reinsert_helper(
|
||||
Heap *heap = BLI_heap_new();
|
||||
HeapNode **nodes = (HeapNode **)MEM_mallocN(sizeof(HeapNode *) * items_total, __func__);
|
||||
for (int in = 0; in < items_total; in++) {
|
||||
nodes[in] = BLI_heap_insert(heap, (float)in, SET_INT_IN_POINTER(in));
|
||||
nodes[in] = BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
|
||||
}
|
||||
BLI_array_randomize(nodes, sizeof(HeapNode *), items_total, random_seed);
|
||||
for (int i = 0; i < items_total; i++) {
|
||||
|
@ -74,7 +74,7 @@ void concurrent_insert(TaskPool *__restrict pool,
|
||||
CHECK_NOTNULL(list);
|
||||
IndexedNode *node = (IndexedNode *)MEM_mallocN(sizeof(IndexedNode),
|
||||
"test node");
|
||||
node->index = GET_INT_FROM_POINTER(taskdata);
|
||||
node->index = POINTER_AS_INT(taskdata);
|
||||
BLI_linklist_lockfree_insert(list, (LockfreeLinkNode *)node);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ TEST(LockfreeLinkList, InsertMultipleConcurrent)
|
||||
for (int i = 0; i < num_nodes; ++i) {
|
||||
BLI_task_pool_push(pool,
|
||||
concurrent_insert,
|
||||
SET_INT_IN_POINTER(i),
|
||||
POINTER_FROM_INT(i),
|
||||
false,
|
||||
TASK_PRIORITY_HIGH);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user