diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-19 05:05:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-19 05:12:21 +0300 |
commit | bb3ec3ebafbc2c0e5d8530148a433242e0adad30 (patch) | |
tree | d30aaa3df2d03f90f6e7749bdc075445a5642045 /source/blender/editors | |
parent | 4c918efd44be11d47afc1efed684a15ad5579722 (diff) |
BLI_utildefines: rename pointer conversion macros
Terms get/set don't make much sense when casting values.
Name macros so the conversion is obvious,
use common prefix for easier completion.
- GET_INT_FROM_POINTER -> POINTER_AS_INT
- SET_INT_IN_POINTER -> POINTER_FROM_INT
- GET_UINT_FROM_POINTER -> POINTER_AS_UINT
- SET_UINT_IN_POINTER -> POINTER_FROM_UINT
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/fmodifier_ui.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_sketch.c | 10 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_select.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 24 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_templates.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_select.c | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 2 |
15 files changed, 59 insertions, 59 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 1ea4c7ead77..8ad6b96bc33 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -4009,7 +4009,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... */ @@ -4339,7 +4339,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 */ diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 951dcc2dddf..f1d8f9a1ebf 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -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); } } diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 691da4cbd2b..dd800613382 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -157,7 +157,7 @@ void BIF_makeListTemplates(const bContext *C) if (ob != obedit && ob->type == OB_ARMATURE) { index++; - BLI_ghash_insert(TEMPLATES_HASH, SET_INT_IN_POINTER(index), ob); + BLI_ghash_insert(TEMPLATES_HASH, POINTER_FROM_INT(index), ob); if (ob == ts->skgen_template) { TEMPLATES_CURRENT = index; @@ -187,7 +187,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C)) while (!BLI_ghashIterator_done(&ghi)) { Object *ob = BLI_ghashIterator_getValue(&ghi); - int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi)); + int key = POINTER_AS_INT(BLI_ghashIterator_getKey(&ghi)); p += sprintf(p, "|%s %%x%i", ob->id.name + 2, key); @@ -208,7 +208,7 @@ int BIF_currentTemplate(const bContext *C) while (!BLI_ghashIterator_done(&ghi)) { Object *ob = BLI_ghashIterator_getValue(&ghi); - int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi)); + int key = POINTER_AS_INT(BLI_ghashIterator_getKey(&ghi)); if (ob == ts->skgen_template) { TEMPLATES_CURRENT = key; @@ -302,7 +302,7 @@ void BIF_setTemplate(bContext *C, int index) { ToolSettings *ts = CTX_data_tool_settings(C); if (index > 0) { - ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index)); + ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, POINTER_FROM_INT(index)); } else { ts->skgen_template = NULL; @@ -2051,7 +2051,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch, for (p = sketch->depth_peels.first; p; p = p->next) { - int index = GET_INT_FROM_POINTER(p->ob); + int index = POINTER_AS_INT(p->ob); index = (index >> 5) & 7; glColor3fv(colors[index]); diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index d91d3809a42..f04106dac3a 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -1124,7 +1124,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; @@ -1147,7 +1147,7 @@ static int pose_reveal_exec(bContext *C, wmOperator *op) bArmature *arm = ob->data; const bool select = RNA_boolean_get(op->ptr, "select"); - bone_looper(ob, arm->bonebase.first, SET_INT_IN_POINTER(select), show_pose_bone_cb); + bone_looper(ob, arm->bonebase.first, POINTER_FROM_INT(select), show_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index ecfaa41b0b5..c4a7ecd25c7 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -63,8 +63,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 ********************* */ diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index c28fea0fc41..1bdeeefe223 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -670,13 +670,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 */ for (bGPDframe *gpf = gpl_next->frames.first; gpf; gpf = gpf->next) { /* try to find frame in active 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) { /* nothing found, create new */ frame = BKE_gpencil_frame_addnew(gpl_current, gpf->framenum); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 2e4cab5ec24..0b611a8e4c8 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -4484,7 +4484,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), 0)) + if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), 0)) break; } } @@ -4502,7 +4502,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! diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index edd568e4fea..81810baf2cf 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -370,7 +370,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); @@ -463,7 +463,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; @@ -481,7 +481,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); @@ -567,7 +567,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)) { @@ -645,7 +645,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) @@ -1741,7 +1741,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s /* add search items from temporary list */ for (cis = items_list->first; cis; cis = cis->next) { - if (false == UI_search_item_add(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) { + if (false == UI_search_item_add(items, cis->name, POINTER_FROM_INT(cis->index), cis->iconid)) { break; } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index be489072439..2bafc3b641b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -349,7 +349,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: @@ -535,7 +535,7 @@ static void template_ID( but = uiDefButR( block, UI_BTYPE_TEXT, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, &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) { @@ -553,7 +553,7 @@ static void template_ID( UI_but_flag_enable(but, UI_BUT_DISABLED); } - 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)); } if (id->us > 1) { @@ -568,7 +568,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) || @@ -626,13 +626,13 @@ static void template_ID( but = uiDefIconTextButO( block, UI_BTYPE_BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 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_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, UI_BTYPE_BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 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_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) @@ -658,13 +658,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) @@ -688,7 +688,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); @@ -2598,7 +2598,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; @@ -2682,7 +2682,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; } } @@ -2753,7 +2753,7 @@ void uiTemplateGameStates( but = uiDefIconButR_prop( block, UI_BTYPE_ICON_TOGGLE, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop, state, 0, 0, -1, -1, sca_state_name_get(ob, state)); - UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state)); + UI_but_func_set(but, handle_layer_buttons, but, POINTER_FROM_INT(state)); but->type = UI_BTYPE_TOGGLE; } } diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 8eb3ad84919..f83bc7d7d34 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -502,7 +502,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 */ @@ -510,7 +510,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; } diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 6b13decd41b..889c1f31362 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -183,7 +183,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 @@ -593,7 +593,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->dm_mlooptri[tri_index]; const float *vtri_ss[3] = { ps->screenCoords[ps->dm_mloop[lt->tri[0]].v], @@ -807,7 +807,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->dm_mlooptri[tri_index]; @@ -1028,7 +1028,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->dm_mlooptri[tri_index]; @@ -2937,7 +2937,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, (ima->tpageflag & IMA_CLAMP_U) != 0, (ima->tpageflag & IMA_CLAMP_V) != 0); } @@ -2946,7 +2946,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); @@ -3057,7 +3057,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 ); @@ -3415,7 +3415,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); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 09e2660a762..de73d9d8c13 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -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; diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index ef9ead3407c..c45a5c650ee 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -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); @@ -581,11 +581,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")); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 88ad2cad3e9..4ffa5fe948e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -1150,7 +1150,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; @@ -1175,7 +1175,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; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 8bc53127b4c..b06f22f50cc 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -611,7 +611,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))); } } } |