diff options
-rw-r--r-- | source/blender/blenkernel/BKE_utildefines.h | 45 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 10 | ||||
-rw-r--r-- | source/blender/editors/mesh/editface.c | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_lattice.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 8 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 3 | ||||
-rw-r--r-- | source/blender/freestyle/intern/system/StringUtils.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 41 |
9 files changed, 38 insertions, 77 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h deleted file mode 100644 index 7c1e0e97565..00000000000 --- a/source/blender/blenkernel/BKE_utildefines.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file BKE_utildefines.h - * \ingroup bke - * \brief blender format specific macros - * \note generic defines should go in BLI_utildefines.h - */ - - -#ifndef __BKE_UTILDEFINES_H__ -#define __BKE_UTILDEFINES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define BKE_BIT_TEST_SET(value, test, flag) \ -{ \ - if (test) (value) |= flag; \ - else (value) &= ~flag; \ -} (void)0 - -#ifdef __cplusplus -} -#endif - -#endif /* __BKE_UTILDEFINES_H__ */ diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 74c69c5aeb9..96c653dee23 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -292,7 +292,6 @@ set(SRC BKE_texture.h BKE_tracking.h BKE_unit.h - BKE_utildefines.h BKE_world.h BKE_writeavi.h BKE_writeframeserver.h diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index b13d5e368ec..8f8d7cc3b7f 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -509,6 +509,16 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size); #define SET_UINT_IN_POINTER(i) ((void *)(uintptr_t)(i)) #define GET_UINT_FROM_POINTER(i) ((void)0, ((unsigned int)(uintptr_t)(i))) +/* Set flag from a single test */ +#define SET_FLAG_FROM_TEST(value, test, flag) \ +{ \ + if (test) { \ + (value) |= (flag); \ + } \ + else { \ + (value) &= ~(flag); \ + } \ +} ((void)0) /* Macro to convert a value to string in the preprocessor * STRINGIFY_ARG: gives the argument as a string diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 6c6c106b19a..4336fff45d5 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -42,7 +42,6 @@ #include "BKE_mesh.h" #include "BKE_context.h" #include "BKE_editmesh.h" -#include "BKE_utildefines.h" #include "BIF_gl.h" @@ -231,7 +230,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const unsigned int index, for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) { if (BLI_BITMAP_TEST(poly_tag, a)) { - BKE_BIT_TEST_SET(mp->flag, select, ME_FACE_SEL); + SET_FLAG_FROM_TEST(mp->flag, select, ME_FACE_SEL); } } diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index ac8d438d9e6..57053ddc020 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -57,7 +57,6 @@ #include "BKE_lattice.h" #include "BKE_deform.h" #include "BKE_report.h" -#include "BKE_utildefines.h" #include "ED_lattice.h" #include "ED_object.h" @@ -369,7 +368,7 @@ static int lattice_select_more_less(bContext *C, const bool select) lattice_test_bitmap_uvw(lt, selpoints, u, v, w + 1, select) || lattice_test_bitmap_uvw(lt, selpoints, u, v, w - 1, select)) { - BKE_BIT_TEST_SET(bp->f1, select, SELECT); + SET_FLAG_FROM_TEST(bp->f1, select, SELECT); } } bp++; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 67597729d15..05cf552e5cc 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -70,8 +70,6 @@ #include "BKE_paint.h" #include "BKE_editmesh.h" #include "BKE_tracking.h" -#include "BKE_utildefines.h" - #include "BIF_gl.h" #include "BIF_glutil.h" @@ -726,7 +724,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv, if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co) && BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED)) { - BKE_BIT_TEST_SET(mv->flag, data->select, SELECT); + SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT); } } static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) @@ -1672,7 +1670,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con BoxSelectUserData *data = userData; if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) { - BKE_BIT_TEST_SET(mv->flag, data->select, SELECT); + SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT); } } static int do_paintvert_box_select(ViewContext *vc, rcti *rect, bool select, bool extend) @@ -2498,7 +2496,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv, CircleSelectUserData *data = userData; if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) { - BKE_BIT_TEST_SET(mv->flag, data->select, SELECT); + SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT); } } static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 179b68dd270..277e01d1e2b 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -82,7 +82,6 @@ #include "BKE_editmesh.h" #include "BKE_tracking.h" #include "BKE_mask.h" -#include "BKE_utildefines.h" #include "ED_anim_api.h" #include "ED_armature.h" @@ -1208,7 +1207,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id)) && RNA_property_is_set(op->ptr, prop)) { - BKE_BIT_TEST_SET(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM); + SET_FLAG_FROM_TEST(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM); } } diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h index e11798762e4..10748c45c19 100644 --- a/source/blender/freestyle/intern/system/StringUtils.h +++ b/source/blender/freestyle/intern/system/StringUtils.h @@ -35,7 +35,6 @@ #include <vector> extern "C" { -#include "BKE_utildefines.h" #include "BLI_string.h" #include "BLI_path_util.h" } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 637ace9cd82..e991e901bb1 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -71,7 +71,6 @@ #include "DNA_windowmanager_types.h" #include "BKE_appdir.h" -#include "BKE_utildefines.h" #include "BKE_autoexec.h" #include "BKE_blender.h" #include "BKE_blendfile.h" @@ -327,12 +326,12 @@ static void wm_init_userdef(bContext *C, const bool read_userdef_from_memory) BKE_sound_init(bmain); /* needed so loading a file from the command line respects user-pref [#26156] */ - BKE_BIT_TEST_SET(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI); + SET_FLAG_FROM_TEST(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI); /* set the python auto-execute setting from user prefs */ /* enabled by default, unless explicitly enabled in the command line which overrides */ if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) { - BKE_BIT_TEST_SET(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC); + SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC); } /* avoid re-saving for every small change to our prefs, allow overrides */ @@ -675,7 +674,7 @@ int wm_homefile_read( BLI_assert((use_factory_settings && filepath_startup_override) == 0); if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) { - BKE_BIT_TEST_SET(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC); + SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC); } BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE); @@ -1167,8 +1166,8 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor G.save_over = 1; /* disable untitled.blend convention */ } - BKE_BIT_TEST_SET(G.fileflags, fileflags & G_FILE_COMPRESS, G_FILE_COMPRESS); - BKE_BIT_TEST_SET(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY); + SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_COMPRESS, G_FILE_COMPRESS); + SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY); /* prevent background mode scripts from clobbering history */ if (do_history) { @@ -1555,7 +1554,7 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op) /* This can be used when loading of a start-up file should only change * the scene content but keep the blender UI as it is. */ wm_open_init_load_ui(op, true); - BKE_BIT_TEST_SET(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI); + SET_FLAG_FROM_TEST(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI); if (RNA_property_is_set(op->ptr, prop)) { RNA_property_string_get(op->ptr, prop, filepath_buf); @@ -2038,20 +2037,24 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) fileflags = G.fileflags & ~G_FILE_USERPREFS; /* set compression flag */ - BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "compress"), - G_FILE_COMPRESS); - BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "relative_remap"), - G_FILE_RELATIVE_REMAP); - BKE_BIT_TEST_SET(fileflags, - (RNA_struct_property_is_set(op->ptr, "copy") && - RNA_boolean_get(op->ptr, "copy")), - G_FILE_SAVE_COPY); + SET_FLAG_FROM_TEST( + fileflags, RNA_boolean_get(op->ptr, "compress"), + G_FILE_COMPRESS); + SET_FLAG_FROM_TEST( + fileflags, RNA_boolean_get(op->ptr, "relative_remap"), + G_FILE_RELATIVE_REMAP); + SET_FLAG_FROM_TEST( + fileflags, + (RNA_struct_property_is_set(op->ptr, "copy") && + RNA_boolean_get(op->ptr, "copy")), + G_FILE_SAVE_COPY); #ifdef USE_BMESH_SAVE_AS_COMPAT - BKE_BIT_TEST_SET(fileflags, - (RNA_struct_find_property(op->ptr, "use_mesh_compat") && - RNA_boolean_get(op->ptr, "use_mesh_compat")), - G_FILE_MESH_COMPAT); + SET_FLAG_FROM_TEST( + fileflags, + (RNA_struct_find_property(op->ptr, "use_mesh_compat") && + RNA_boolean_get(op->ptr, "use_mesh_compat")), + G_FILE_MESH_COMPAT); #else # error "don't remove by accident" #endif |