Commit Graph

160 Commits

Author SHA1 Message Date
9fd569a654 PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
2015-01-06 19:09:11 +11:00
3e7e97f127 BMesh: ensure iterator macros assign to valid types
note, this is for C++ code which expects a cast, (will be added later)
also add a macro for nop-expressions (EXPR_NOP),
when we never want an expression to be evaluated, but it should still be valid.
2014-12-08 10:54:56 +01:00
08fd38cf52 BLI_utildefines: add UNUSED_VARS() macro 2014-11-24 12:03:25 +01:00
5efd2b7f36 correct another problem with BLI_assert
need to use extern C for C++
2014-11-18 10:56:31 +01:00
94f0d18470 BLI_assert: print a backtrace with the error
Add BLI_system_backtrace()
2014-11-18 00:20:56 +01:00
832a97f002 Macros: ELEM() can now take 2 args
Handy when used indirectly.
2014-11-16 14:29:17 +01:00
988b3d7188 Add utility macros to clamp all elements of 2,3,4 component vectors 2014-11-04 16:31:42 +05:00
a4258d40a1 BLI_utildefines: add SQUARE macro
also minor cleanup
2014-10-13 15:36:13 +02:00
21462410ee Move typecheck macros into own header 2014-09-25 13:07:17 +10:00
bdd515fee2 Macro VA_NARGS, increase max to 64 2014-09-23 20:29:18 +10:00
6b6ea0485f Macros: replace UNPACK#OP -> UNPACK#_EX, allow suffix 2014-08-05 08:06:19 +10:00
a90e49e40a Tweaks to macros 2014-08-04 11:43:10 +10:00
a039f2bfc4 Macros: prevent instantiation of args for type checks
also make CHECK_TYPE_INLINE more strict
2014-08-04 11:18:33 +10:00
88a0d5ebe8 Make CHECK_TYPE_NONCONST macro portable
also replace __typeof -> typeof
2014-08-02 18:08:44 +10:00
7f32cf4605 Prevent macros hiding casts from const pointers 2014-08-01 22:03:03 +10:00
00b29156e0 Defines: replace ELEM3-16 with ELEM(...), that can take varargs 2014-07-20 01:33:40 +10:00
8ad607bbe0 Cleanup: Use more logically constructed ELEM macros
- name primary comparison var 'v'
- names remain same when expanded
- no odd mixing of macros, use prev ELEM + extra arg
- use 16, even if not used yet, saves adding more in future
2014-07-19 15:00:09 +10:00
c5ccbacdaa move STACK_* macros into BLI_stackdefines.h 2014-06-25 00:01:33 +10:00
d19d1b5497 Add MEMCPY_STRUCT_OFS macro for copying values after a struct member
use for DM_to_mesh to avoid clobbering the ListBase
2014-06-24 23:50:12 +10:00
77616cbe11 add STACK_REMOVE macro 2014-06-24 22:14:22 +10:00
a82d3f85c6 Correct casts for IS_EQ and other macro tweaks
- ensure GET_INT_FROM_POINTER us only used to get values
- rename STACK_POP_ELSE -> STACK_POP_DEFAULT
2014-06-18 14:02:41 +10:00
ecb7905127 Resolve MSVC error 2014-06-14 04:46:37 +10:00
1962e21703 Code cleanup: remove redundant arg from ARRAY_LAST_ITEM 2014-06-14 00:47:11 +10:00
f8278e5479 Correct ARRAY_SIZE macro and make doxy comments consistent 2014-05-19 18:00:20 +10:00
2a49bf35f0 Add ARRAY_SIZE macro to check fixed size arrays 2014-05-18 23:51:59 +10:00
c88e65da61 Code cleanup: comment typos 2014-05-11 16:22:05 +10:00
95b93b5d46 Add BLI_compiler_compat.h to help with portability 2014-05-02 01:14:15 +10:00
2025e4cbb9 Code cleanup: quiet warnings & style 2014-04-13 11:26:31 +10:00
0319db1063 Correct own recent changes broke release builds 2014-03-30 20:35:59 +11:00
c16bd951cd Enable GCC pedantic warnings with strict flags,
also modify MIN/MAX macros to prevent shadowing.
2014-03-30 15:04:20 +11:00
ac07046e55 BMesh: optimize quad_coord, avoid duplicate sqrt calls 2014-03-28 15:25:02 +11:00
3a99fa5d7f Revert own changes to CLAMP and CLAMPIS, caused T38875 2014-02-28 11:47:02 +11:00
c005fb407b Util-defines: avoid multiple calculation/access for MIN/MAX macros 2013-12-08 17:29:22 +11:00
f64b3732be Util Macros: reduce multiple access & conversion for CLAMP/CLAMPIS/ABS 2013-12-07 14:29:27 +11:00
69065b5b2c Compiler warnings: quiet warnings for gcc4.7x
patch from Sergey
2013-12-07 13:21:59 +11:00
5910531318 Math Library: add functions cross_poly_v2, cross_tri_v2
also added utility macro for removing elements in the middle of an array
2013-11-30 15:57:16 +11:00
918ad1719f Transform: improve normal orientation
- when 3 verts are selected ensure the normal is flipped on the side of existing vert normals.
  also use the most distant 2 verts to define the tangent.

- when 2 vertices are selected, the normal wasn't aligned with the vert normal.
2013-11-28 20:40:14 +11:00
aaa99106fe make IS_EQ and IS_EQF typecheck args 2013-11-10 14:13:26 +00:00
35b61a7512 Move GCC attributes into a centraized defines
Instead of having ifdef __GNUC__ all over the headers
to use special compiler's hints use a special file where
all things like this are concentrated.

Makes code easier to follow and allows to manage special
attributes in more efficient way.

Thanks Campbell for review!
2013-09-01 15:01:15 +00:00
9d4bf6b37b change CHECK_TYPE_INLINE macro not to add the pointer in the macro. 2013-08-17 04:48:34 +00:00
ea95a78b0b skip BLI_STATIC_ASSERT for Coverity builds (caused parse error) 2013-08-03 13:08:51 +00:00
60acf217f8 fix for editmesh transform connected,
the distance checks could get into a feedback loop so that the result depended on the order of verts/edges.

now you can randomize vert/edge/faces and get exactly the same results.

also made some internal improvements,
- used fixed sized arrays (no need to realloc).
- use vertex tag flags rather then a visit-hash.
- remove 'tots' array that did nothing (not sure why it was added).
2013-06-17 16:55:05 +00:00
1fe21f29ec utility function for calculating smooth groups from sharp edges: BKE_mesh_calc_smoothgroups 2013-06-14 08:28:27 +00:00
b5cb9e8810 add BLI_sys_types.h 2013-05-28 19:42:19 +00:00
a70fa65592 optimize mirror merging, remove array reallocation, replace with fixed size arrays. 2013-05-27 20:11:12 +00:00
1014dbaea1 bmesh: replace BLI_array reallocs with alloca, also don't check all faces for connecting verts. 2013-05-25 23:34:25 +00:00
40535f5ef3 bmesh recalculate normals - remove BLI_array reallocation, the max size of the array is known.
replace with STACK_* macros (moved to BLI_utildefines.h).
2013-05-12 12:23:44 +00:00
7fac200080 remove unused define CLAMPTEST, move INPR to
collision_compute_barycentric(), only place its used.
2013-05-08 12:56:02 +00:00
3bbf11761a make rna layer access less cryptic by using ARRAY_HAS_ITEM(), modified this to use unsigned offset. 2013-05-01 22:39:34 +00:00
d119b5b197 remove negated string macros from BLI_utildefines.h, were unused and can just use !STREQ(...) 2013-04-23 16:27:45 +00:00