Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_alloca.h7
-rw-r--r--source/blender/blenlib/BLI_allocator.hh5
-rw-r--r--source/blender/blenlib/BLI_args.h5
-rw-r--r--source/blender/blenlib/BLI_array.h5
-rw-r--r--source/blender/blenlib/BLI_array.hh5
-rw-r--r--source/blender/blenlib/BLI_array_store.h5
-rw-r--r--source/blender/blenlib/BLI_array_store_utils.h5
-rw-r--r--source/blender/blenlib/BLI_array_utils.h5
-rw-r--r--source/blender/blenlib/BLI_asan.h5
-rw-r--r--source/blender/blenlib/BLI_assert.h48
-rw-r--r--source/blender/blenlib/BLI_astar.h5
-rw-r--r--source/blender/blenlib/BLI_bitmap.h5
-rw-r--r--source/blender/blenlib/BLI_bitmap_draw_2d.h5
-rw-r--r--source/blender/blenlib/BLI_blenlib.h5
-rw-r--r--source/blender/blenlib/BLI_boxpack_2d.h5
-rw-r--r--source/blender/blenlib/BLI_buffer.h5
-rw-r--r--source/blender/blenlib/BLI_color.hh5
-rw-r--r--source/blender/blenlib/BLI_compiler_attrs.h5
-rw-r--r--source/blender/blenlib/BLI_compiler_compat.h5
-rw-r--r--source/blender/blenlib/BLI_compiler_typecheck.h5
-rw-r--r--source/blender/blenlib/BLI_console.h5
-rw-r--r--source/blender/blenlib/BLI_convexhull_2d.h5
-rw-r--r--source/blender/blenlib/BLI_delaunay_2d.h5
-rw-r--r--source/blender/blenlib/BLI_dial_2d.h5
-rw-r--r--source/blender/blenlib/BLI_disjoint_set.hh5
-rw-r--r--source/blender/blenlib/BLI_dlrbTree.h5
-rw-r--r--source/blender/blenlib/BLI_dot_export.hh5
-rw-r--r--source/blender/blenlib/BLI_dot_export_attribute_enums.hh5
-rw-r--r--source/blender/blenlib/BLI_dynlib.h5
-rw-r--r--source/blender/blenlib/BLI_dynstr.h5
-rw-r--r--source/blender/blenlib/BLI_easing.h5
-rw-r--r--source/blender/blenlib/BLI_edgehash.h5
-rw-r--r--source/blender/blenlib/BLI_endian_switch_inline.h5
-rw-r--r--source/blender/blenlib/BLI_expr_pylike_eval.h5
-rw-r--r--source/blender/blenlib/BLI_fileops.h5
-rw-r--r--source/blender/blenlib/BLI_fileops_types.h5
-rw-r--r--source/blender/blenlib/BLI_float2.hh5
-rw-r--r--source/blender/blenlib/BLI_float3.hh5
-rw-r--r--source/blender/blenlib/BLI_float4x4.hh5
-rw-r--r--source/blender/blenlib/BLI_fnmatch.h5
-rw-r--r--source/blender/blenlib/BLI_ghash.h5
-rw-r--r--source/blender/blenlib/BLI_gsqueue.h5
-rw-r--r--source/blender/blenlib/BLI_hash.h5
-rw-r--r--source/blender/blenlib/BLI_hash.hh5
-rw-r--r--source/blender/blenlib/BLI_hash_md5.h5
-rw-r--r--source/blender/blenlib/BLI_hash_mm2a.h5
-rw-r--r--source/blender/blenlib/BLI_hash_mm3.h5
-rw-r--r--source/blender/blenlib/BLI_hash_tables.hh5
-rw-r--r--source/blender/blenlib/BLI_heap.h5
-rw-r--r--source/blender/blenlib/BLI_heap_simple.h5
-rw-r--r--source/blender/blenlib/BLI_index_mask.hh5
-rw-r--r--source/blender/blenlib/BLI_index_range.hh5
-rw-r--r--source/blender/blenlib/BLI_iterator.h5
-rw-r--r--source/blender/blenlib/BLI_jitter_2d.h5
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h5
-rw-r--r--source/blender/blenlib/BLI_kdtree.h5
-rw-r--r--source/blender/blenlib/BLI_lasso_2d.h5
-rw-r--r--source/blender/blenlib/BLI_linear_allocator.hh5
-rw-r--r--source/blender/blenlib/BLI_link_utils.h5
-rw-r--r--source/blender/blenlib/BLI_linklist.h5
-rw-r--r--source/blender/blenlib/BLI_linklist_lockfree.h5
-rw-r--r--source/blender/blenlib/BLI_linklist_stack.h5
-rw-r--r--source/blender/blenlib/BLI_listbase.h5
-rw-r--r--source/blender/blenlib/BLI_listbase_wrapper.hh5
-rw-r--r--source/blender/blenlib/BLI_map.hh5
-rw-r--r--source/blender/blenlib/BLI_map_slots.hh5
-rw-r--r--source/blender/blenlib/BLI_math.h5
-rw-r--r--source/blender/blenlib/BLI_math_base.h5
-rw-r--r--source/blender/blenlib/BLI_math_base_safe.h5
-rw-r--r--source/blender/blenlib/BLI_math_bits.h5
-rw-r--r--source/blender/blenlib/BLI_math_color.h5
-rw-r--r--source/blender/blenlib/BLI_math_color_blend.h5
-rw-r--r--source/blender/blenlib/BLI_math_geom.h37
-rw-r--r--source/blender/blenlib/BLI_math_inline.h5
-rw-r--r--source/blender/blenlib/BLI_math_interp.h5
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h5
-rw-r--r--source/blender/blenlib/BLI_math_rotation.h5
-rw-r--r--source/blender/blenlib/BLI_math_solvers.h5
-rw-r--r--source/blender/blenlib/BLI_math_statistics.h5
-rw-r--r--source/blender/blenlib/BLI_math_vector.h8
-rw-r--r--source/blender/blenlib/BLI_memarena.h5
-rw-r--r--source/blender/blenlib/BLI_memblock.h5
-rw-r--r--source/blender/blenlib/BLI_memiter.h5
-rw-r--r--source/blender/blenlib/BLI_memory_utils.hh5
-rw-r--r--source/blender/blenlib/BLI_mempool.h5
-rw-r--r--source/blender/blenlib/BLI_noise.h5
-rw-r--r--source/blender/blenlib/BLI_path_util.h5
-rw-r--r--source/blender/blenlib/BLI_polyfill_2d.h5
-rw-r--r--source/blender/blenlib/BLI_polyfill_2d_beautify.h5
-rw-r--r--source/blender/blenlib/BLI_probing_strategies.hh5
-rw-r--r--source/blender/blenlib/BLI_quadric.h5
-rw-r--r--source/blender/blenlib/BLI_rand.h5
-rw-r--r--source/blender/blenlib/BLI_rand.hh5
-rw-r--r--source/blender/blenlib/BLI_rect.h5
-rw-r--r--source/blender/blenlib/BLI_resource_collector.hh5
-rw-r--r--source/blender/blenlib/BLI_scanfill.h5
-rw-r--r--source/blender/blenlib/BLI_session_uuid.h68
-rw-r--r--source/blender/blenlib/BLI_set.hh5
-rw-r--r--source/blender/blenlib/BLI_set_slots.hh5
-rw-r--r--source/blender/blenlib/BLI_smallhash.h5
-rw-r--r--source/blender/blenlib/BLI_sort.h5
-rw-r--r--source/blender/blenlib/BLI_sort_utils.h5
-rw-r--r--source/blender/blenlib/BLI_span.hh5
-rw-r--r--source/blender/blenlib/BLI_stack.h5
-rw-r--r--source/blender/blenlib/BLI_stack.hh5
-rw-r--r--source/blender/blenlib/BLI_strict_flags.h5
-rw-r--r--source/blender/blenlib/BLI_string.h5
-rw-r--r--source/blender/blenlib/BLI_string_cursor_utf8.h5
-rw-r--r--source/blender/blenlib/BLI_string_ref.hh5
-rw-r--r--source/blender/blenlib/BLI_string_utf8.h5
-rw-r--r--source/blender/blenlib/BLI_string_utils.h5
-rw-r--r--source/blender/blenlib/BLI_sys_types.h5
-rw-r--r--source/blender/blenlib/BLI_system.h5
-rw-r--r--source/blender/blenlib/BLI_threads.h5
-rw-r--r--source/blender/blenlib/BLI_timecode.h5
-rw-r--r--source/blender/blenlib/BLI_timeit.hh5
-rw-r--r--source/blender/blenlib/BLI_timer.h5
-rw-r--r--source/blender/blenlib/BLI_utildefines_iter.h5
-rw-r--r--source/blender/blenlib/BLI_utildefines_stack.h5
-rw-r--r--source/blender/blenlib/BLI_utildefines_variadic.h5
-rw-r--r--source/blender/blenlib/BLI_utility_mixins.hh5
-rw-r--r--source/blender/blenlib/BLI_uvproject.h7
-rw-r--r--source/blender/blenlib/BLI_vector.hh5
-rw-r--r--source/blender/blenlib/BLI_vector_set.hh5
-rw-r--r--source/blender/blenlib/BLI_vector_set_slots.hh5
-rw-r--r--source/blender/blenlib/BLI_vfontdata.h5
-rw-r--r--source/blender/blenlib/BLI_voronoi_2d.h5
-rw-r--r--source/blender/blenlib/BLI_voxel.h5
-rw-r--r--source/blender/blenlib/BLI_winstuff.h5
-rw-r--r--source/blender/blenlib/CMakeLists.txt3
-rw-r--r--source/blender/blenlib/PIL_time.h5
-rw-r--r--source/blender/blenlib/PIL_time_utildefines.h5
-rw-r--r--source/blender/blenlib/intern/BLI_assert.c51
-rw-r--r--source/blender/blenlib/intern/math_geom.c291
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c16
-rw-r--r--source/blender/blenlib/intern/session_uuid.c78
-rw-r--r--source/blender/blenlib/intern/uvproject.c2
137 files changed, 562 insertions, 679 deletions
diff --git a/source/blender/blenlib/BLI_alloca.h b/source/blender/blenlib/BLI_alloca.h
index 5297296b7ef..92567ed35fa 100644
--- a/source/blender/blenlib/BLI_alloca.h
+++ b/source/blender/blenlib/BLI_alloca.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ALLOCA_H__
-#define __BLI_ALLOCA_H__
+#pragma once
/** \file
* \ingroup bli
@@ -25,6 +24,8 @@
/* BLI_array_alloca / alloca */
+#include <stdlib.h>
+
#if defined(__GNUC__) || defined(__clang__)
# if defined(__cplusplus) && (__cplusplus > 199711L)
# define BLI_array_alloca(arr, realsize) (decltype(arr)) alloca(sizeof(*arr) * (realsize))
@@ -34,5 +35,3 @@
#else
# define BLI_array_alloca(arr, realsize) alloca(sizeof(*arr) * (realsize))
#endif
-
-#endif /* __BLI_ALLOCA_H__ */
diff --git a/source/blender/blenlib/BLI_allocator.hh b/source/blender/blenlib/BLI_allocator.hh
index 47d8156476f..3f753d1d81d 100644
--- a/source/blender/blenlib/BLI_allocator.hh
+++ b/source/blender/blenlib/BLI_allocator.hh
@@ -13,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ALLOCATOR_HH__
-#define __BLI_ALLOCATOR_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -100,5 +99,3 @@ class RawAllocator {
};
} // namespace blender
-
-#endif /* __BLI_ALLOCATOR_HH__ */
diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h
index 9031cd2ba2f..54b5161f15a 100644
--- a/source/blender/blenlib/BLI_args.h
+++ b/source/blender/blenlib/BLI_args.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_ARGS_H__
-#define __BLI_ARGS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -78,5 +77,3 @@ const char **BLI_argsArgv(struct bArgs *ba);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h
index 5b85711f8ac..6ea01d45f79 100644
--- a/source/blender/blenlib/BLI_array.h
+++ b/source/blender/blenlib/BLI_array.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_ARRAY_H__
-#define __BLI_ARRAY_H__
+#pragma once
/** \file
* \ingroup bli
@@ -173,5 +172,3 @@ void _bli_array_grow_func(void **arr_p,
((void)0)
/** \} */
-
-#endif /* __BLI_ARRAY_H__ */
diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh
index c7b4bdc977f..796123af765 100644
--- a/source/blender/blenlib/BLI_array.hh
+++ b/source/blender/blenlib/BLI_array.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ARRAY_HH__
-#define __BLI_ARRAY_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -369,5 +368,3 @@ template<typename T, int64_t InlineBufferCapacity = default_inline_buffer_capaci
using RawArray = Array<T, InlineBufferCapacity, RawAllocator>;
} // namespace blender
-
-#endif /* __BLI_ARRAY_HH__ */
diff --git a/source/blender/blenlib/BLI_array_store.h b/source/blender/blenlib/BLI_array_store.h
index a8a7dde63b5..78d718117ba 100644
--- a/source/blender/blenlib/BLI_array_store.h
+++ b/source/blender/blenlib/BLI_array_store.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ARRAY_STORE_H__
-#define __BLI_ARRAY_STORE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -53,5 +52,3 @@ bool BLI_array_store_is_valid(BArrayStore *bs);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_ARRAY_STORE_H__ */
diff --git a/source/blender/blenlib/BLI_array_store_utils.h b/source/blender/blenlib/BLI_array_store_utils.h
index 5b5263bf8a4..771f4f962a7 100644
--- a/source/blender/blenlib/BLI_array_store_utils.h
+++ b/source/blender/blenlib/BLI_array_store_utils.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ARRAY_STORE_UTILS_H__
-#define __BLI_ARRAY_STORE_UTILS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -47,5 +46,3 @@ void BLI_array_store_at_size_calc_memory_usage(struct BArrayStore_AtSize *bs_str
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_ARRAY_STORE_UTILS_H__ */
diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h
index afa9a3d2241..b8d63e7cdc1 100644
--- a/source/blender/blenlib/BLI_array_utils.h
+++ b/source/blender/blenlib/BLI_array_utils.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ARRAY_UTILS_H__
-#define __BLI_ARRAY_UTILS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -93,5 +92,3 @@ bool _bli_array_is_zeroed(const void *arr, unsigned int arr_len, size_t arr_stri
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_ARRAY_UTILS_H__ */
diff --git a/source/blender/blenlib/BLI_asan.h b/source/blender/blenlib/BLI_asan.h
index fdade805c2a..a2a44e164ab 100644
--- a/source/blender/blenlib/BLI_asan.h
+++ b/source/blender/blenlib/BLI_asan.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ADDRESS_SANITIZER_H__
-#define __BLI_ADDRESS_SANITIZER_H__
+#pragma once
/* Clang defines this. */
#ifndef __has_feature
@@ -41,5 +40,3 @@
* Mark a region of memory as usable again.
*/
#define BLI_asan_unpoison(addr, size) ASAN_UNPOISON_MEMORY_REGION(addr, size)
-
-#endif /* __BLI_ADDRESS_SANITIZER_H__ */
diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h
index 603be115b35..172a2fb44ca 100644
--- a/source/blender/blenlib/BLI_assert.h
+++ b/source/blender/blenlib/BLI_assert.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ASSERT_H__
-#define __BLI_ASSERT_H__
+#pragma once
/** \file
* \ingroup bli
@@ -30,58 +29,33 @@
extern "C" {
#endif
-#ifndef NDEBUG /* for BLI_assert */
-# include <stdio.h>
-#endif
+/* Utility functions. */
+void _BLI_assert_print_pos(const char *file, const int line, const char *function, const char *id);
+void _BLI_assert_print_backtrace(void);
+void _BLI_assert_abort(void);
#ifdef _MSC_VER
# include <crtdbg.h> /* for _STATIC_ASSERT */
#endif
-/* BLI_assert(), default only to print
- * for aborting need to define WITH_ASSERT_ABORT
- */
-/* For 'abort' only. */
-#include <stdlib.h>
-
#ifndef NDEBUG
-# include "BLI_system.h"
/* _BLI_ASSERT_PRINT_POS */
# if defined(__GNUC__)
-# define _BLI_ASSERT_PRINT_POS(a) \
- fprintf(stderr, \
- "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \
- __FILE__, \
- __LINE__, \
- __func__, \
- #a)
+# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, __func__, # a)
# elif defined(_MSC_VER)
-# define _BLI_ASSERT_PRINT_POS(a) \
- fprintf(stderr, \
- "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \
- __FILE__, \
- __LINE__, \
- __FUNCTION__, \
- #a)
+# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, __func__, # a)
# else
-# define _BLI_ASSERT_PRINT_POS(a) \
- fprintf(stderr, "BLI_assert failed: %s:%d, at \'%s\'\n", __FILE__, __LINE__, #a)
+# define _BLI_ASSERT_PRINT_POS(a) _BLI_assert_print_pos(__FILE__, __LINE__, "<?>", # a)
# endif
/* _BLI_ASSERT_ABORT */
# ifdef WITH_ASSERT_ABORT
-# ifdef __GNUC__
-/* Cast to remove 'noreturn' attribute since this suppresses missing return statements,
- * allowing changes to debug builds to accidentally to break release builds. */
-# define _BLI_ASSERT_ABORT ((void (*)(void))(*(((void **)abort))))
-# else
-# define _BLI_ASSERT_ABORT abort
-# endif
+# define _BLI_ASSERT_ABORT _BLI_assert_abort
# else
# define _BLI_ASSERT_ABORT() (void)0
# endif
/* BLI_assert */
# define BLI_assert(a) \
- (void)((!(a)) ? ((BLI_system_backtrace(stderr), \
+ (void)((!(a)) ? ((_BLI_assert_print_backtrace(), \
_BLI_ASSERT_PRINT_POS(a), \
_BLI_ASSERT_ABORT(), \
NULL)) : \
@@ -117,5 +91,3 @@ extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_ASSERT_H__ */
diff --git a/source/blender/blenlib/BLI_astar.h b/source/blender/blenlib/BLI_astar.h
index 8a70371cbcb..fe5c4ddad69 100644
--- a/source/blender/blenlib/BLI_astar.h
+++ b/source/blender/blenlib/BLI_astar.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_ASTAR_H__
-#define __BLI_ASTAR_H__
+#pragma once
/** \file
* \ingroup bli
@@ -121,5 +120,3 @@ bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_ASTAR_H__ */
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
index 2b811e50efb..61a50662d79 100644
--- a/source/blender/blenlib/BLI_bitmap.h
+++ b/source/blender/blenlib/BLI_bitmap.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_BITMAP_H__
-#define __BLI_BITMAP_H__
+#pragma once
/** \file
* \ingroup bli
@@ -118,5 +117,3 @@ void BLI_bitmap_or_all(BLI_bitmap *dst, const BLI_bitmap *src, size_t bits);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_bitmap_draw_2d.h b/source/blender/blenlib/BLI_bitmap_draw_2d.h
index f5f8b28b27f..8331d8fac08 100644
--- a/source/blender/blenlib/BLI_bitmap_draw_2d.h
+++ b/source/blender/blenlib/BLI_bitmap_draw_2d.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_BITMAP_DRAW_2D_H__
-#define __BLI_BITMAP_DRAW_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -48,5 +47,3 @@ void BLI_bitmap_draw_2d_poly_v2i_n(const int xmin,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_BITMAP_DRAW_2D_H__ */
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index 4ebef814337..a9e8c55b6b4 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -47,8 +47,7 @@
* standard libraries.
*/
-#ifndef __BLI_BLENLIB_H__
-#define __BLI_BLENLIB_H__
+#pragma once
#include <stdlib.h>
@@ -63,5 +62,3 @@
#include "BLI_fileops.h"
#include "BLI_rect.h"
-
-#endif
diff --git a/source/blender/blenlib/BLI_boxpack_2d.h b/source/blender/blenlib/BLI_boxpack_2d.h
index 762cb7aaa44..c36cbc03928 100644
--- a/source/blender/blenlib/BLI_boxpack_2d.h
+++ b/source/blender/blenlib/BLI_boxpack_2d.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_BOXPACK_2D_H__
-#define __BLI_BOXPACK_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -64,5 +63,3 @@ void BLI_box_pack_2d_fixedarea(struct ListBase *boxes,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_BOXPACK_2D_H__ */
diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h
index d81446af14b..fc348c25c46 100644
--- a/source/blender/blenlib/BLI_buffer.h
+++ b/source/blender/blenlib/BLI_buffer.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_BUFFER_H__
-#define __BLI_BUFFER_H__
+#pragma once
/** \file
* \ingroup bli
@@ -100,5 +99,3 @@ void _bli_buffer_free(BLI_Buffer *buffer);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_BUFFER_H__ */
diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh
index 72caa5b1118..c0d2f43645d 100644
--- a/source/blender/blenlib/BLI_color.hh
+++ b/source/blender/blenlib/BLI_color.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_COLOR_HH__
-#define __BLI_COLOR_HH__
+#pragma once
#include <iostream>
@@ -127,5 +126,3 @@ struct Color4b {
};
} // namespace blender
-
-#endif /* __BLI_COLOR_HH__ */
diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h
index 24da0be122c..680c4bc78da 100644
--- a/source/blender/blenlib/BLI_compiler_attrs.h
+++ b/source/blender/blenlib/BLI_compiler_attrs.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_COMPILER_ATTRS_H__
-#define __BLI_COMPILER_ATTRS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -99,5 +98,3 @@
#else
# define ATTR_ALIGN(x) __attribute__((aligned(x)))
#endif
-
-#endif /* __BLI_COMPILER_ATTRS_H__ */
diff --git a/source/blender/blenlib/BLI_compiler_compat.h b/source/blender/blenlib/BLI_compiler_compat.h
index 056ea1a08c6..0870d01872a 100644
--- a/source/blender/blenlib/BLI_compiler_compat.h
+++ b/source/blender/blenlib/BLI_compiler_compat.h
@@ -19,8 +19,8 @@
/* #define typeof() triggers a bug in some clang-format versions, disable format
* for entire file to keep results consistent. */
-#ifndef __BLI_COMPILER_COMPAT_H__
-#define __BLI_COMPILER_COMPAT_H__
+#pragma once
+
/** \file
* \ingroup bli
@@ -56,4 +56,3 @@ template<typename T> static inline T decltype_helper(T x)
# define BLI_NOINLINE
#endif
-#endif /* __BLI_COMPILER_COMPAT_H__ */
diff --git a/source/blender/blenlib/BLI_compiler_typecheck.h b/source/blender/blenlib/BLI_compiler_typecheck.h
index 0a2eddc4ecc..d9c2bfc1d58 100644
--- a/source/blender/blenlib/BLI_compiler_typecheck.h
+++ b/source/blender/blenlib/BLI_compiler_typecheck.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_COMPILER_TYPECHECK_H__
-#define __BLI_COMPILER_TYPECHECK_H__
+#pragma once
/** \file
* \ingroup bli
@@ -692,5 +691,3 @@
/* clang-format on */
#define GENERIC_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_GENERIC_TYPE_ANY, __VA_ARGS__)
-
-#endif /* __BLI_COMPILER_TYPECHECK_H__ */
diff --git a/source/blender/blenlib/BLI_console.h b/source/blender/blenlib/BLI_console.h
index d666de3a8e8..dc07d3df754 100644
--- a/source/blender/blenlib/BLI_console.h
+++ b/source/blender/blenlib/BLI_console.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_CONSOLE_H__
-#define __BLI_CONSOLE_H__
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -40,5 +39,3 @@ extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_CONSOLE_H__ */
diff --git a/source/blender/blenlib/BLI_convexhull_2d.h b/source/blender/blenlib/BLI_convexhull_2d.h
index 7417c1e3a98..e930117822f 100644
--- a/source/blender/blenlib/BLI_convexhull_2d.h
+++ b/source/blender/blenlib/BLI_convexhull_2d.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_CONVEXHULL_2D_H__
-#define __BLI_CONVEXHULL_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -34,5 +33,3 @@ float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], unsigned int n
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_CONVEXHULL_2D_H__ */
diff --git a/source/blender/blenlib/BLI_delaunay_2d.h b/source/blender/blenlib/BLI_delaunay_2d.h
index 95111dbbbf7..a826a6b2677 100644
--- a/source/blender/blenlib/BLI_delaunay_2d.h
+++ b/source/blender/blenlib/BLI_delaunay_2d.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_DELAUNAY_2D_H__
-#define __BLI_DELAUNAY_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -209,5 +208,3 @@ void BLI_delaunay_2d_cdt_free(CDT_result *result);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_DELAUNAY_2D_H__ */
diff --git a/source/blender/blenlib/BLI_dial_2d.h b/source/blender/blenlib/BLI_dial_2d.h
index a39543720e6..f43237f6b75 100644
--- a/source/blender/blenlib/BLI_dial_2d.h
+++ b/source/blender/blenlib/BLI_dial_2d.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_DIAL_2D_H__
-#define __BLI_DIAL_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -59,5 +58,3 @@ float BLI_dial_angle(Dial *dial, const float current_position[2]);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_DIAL_2D_H__ */
diff --git a/source/blender/blenlib/BLI_disjoint_set.hh b/source/blender/blenlib/BLI_disjoint_set.hh
index e0580709a44..2002577f956 100644
--- a/source/blender/blenlib/BLI_disjoint_set.hh
+++ b/source/blender/blenlib/BLI_disjoint_set.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_DISJOINT_SET_HH__
-#define __BLI_DISJOINT_SET_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -102,5 +101,3 @@ class DisjointSet {
};
} // namespace blender
-
-#endif /* __BLI_DISJOINT_SET_HH__ */
diff --git a/source/blender/blenlib/BLI_dlrbTree.h b/source/blender/blenlib/BLI_dlrbTree.h
index 5db0dd16a34..fc52904d699 100644
--- a/source/blender/blenlib/BLI_dlrbTree.h
+++ b/source/blender/blenlib/BLI_dlrbTree.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_DLRBTREE_H__
-#define __BLI_DLRBTREE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -166,5 +165,3 @@ void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_DLRBTREE_H__ */
diff --git a/source/blender/blenlib/BLI_dot_export.hh b/source/blender/blenlib/BLI_dot_export.hh
index 0870d8c4c30..2d6dbb1f600 100644
--- a/source/blender/blenlib/BLI_dot_export.hh
+++ b/source/blender/blenlib/BLI_dot_export.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_DOT_EXPORT_HH__
-#define __BLI_DOT_EXPORT_HH__
+#pragma once
/**
* Language grammar: https://www.graphviz.org/doc/info/lang.html
@@ -288,5 +287,3 @@ class NodeWithSocketsRef {
};
} // namespace blender::dot
-
-#endif /* __BLI_DOT_EXPORT_HH__ */
diff --git a/source/blender/blenlib/BLI_dot_export_attribute_enums.hh b/source/blender/blenlib/BLI_dot_export_attribute_enums.hh
index 94c7025b2a6..8cbe7a3e6e6 100644
--- a/source/blender/blenlib/BLI_dot_export_attribute_enums.hh
+++ b/source/blender/blenlib/BLI_dot_export_attribute_enums.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_DOT_EXPORT_ATTRIBUTE_ENUMS_HH__
-#define __BLI_DOT_EXPORT_ATTRIBUTE_ENUMS_HH__
+#pragma once
#include "BLI_string_ref.hh"
@@ -119,5 +118,3 @@ inline StringRef dirType_to_string(Attr_dirType value)
}
} // namespace blender::dot
-
-#endif /* __BLI_DOT_EXPORT_ATTRIBUTE_ENUMS_HH__ */
diff --git a/source/blender/blenlib/BLI_dynlib.h b/source/blender/blenlib/BLI_dynlib.h
index 4adffd51e17..628e33b6f02 100644
--- a/source/blender/blenlib/BLI_dynlib.h
+++ b/source/blender/blenlib/BLI_dynlib.h
@@ -21,8 +21,7 @@
* \ingroup bli
*/
-#ifndef __BLI_DYNLIB_H__
-#define __BLI_DYNLIB_H__
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -38,5 +37,3 @@ void BLI_dynlib_close(DynamicLibrary *lib);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_DYNLIB_H__ */
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h
index cb1f3d58f23..075786c4424 100644
--- a/source/blender/blenlib/BLI_dynstr.h
+++ b/source/blender/blenlib/BLI_dynstr.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_DYNSTR_H__
-#define __BLI_DYNSTR_H__
+#pragma once
/** \file
* \ingroup bli
@@ -64,5 +63,3 @@ void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL();
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_DYNSTR_H__ */
diff --git a/source/blender/blenlib/BLI_easing.h b/source/blender/blenlib/BLI_easing.h
index 73e17be31b7..e6bf8c3bdfa 100644
--- a/source/blender/blenlib/BLI_easing.h
+++ b/source/blender/blenlib/BLI_easing.h
@@ -28,8 +28,7 @@
* All rights reserved.
*/
-#ifndef __BLI_EASING_H__
-#define __BLI_EASING_H__
+#pragma once
/** \file
* \ingroup bli
@@ -80,5 +79,3 @@ float BLI_easing_sine_ease_in_out(float time, float begin, float change, float d
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_EASING_H__ */
diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h
index 0e2d0b538c7..44dc3cf096b 100644
--- a/source/blender/blenlib/BLI_edgehash.h
+++ b/source/blender/blenlib/BLI_edgehash.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_EDGEHASH_H__
-#define __BLI_EDGEHASH_H__
+#pragma once
/** \file
* \ingroup bli
@@ -158,5 +157,3 @@ BLI_INLINE bool BLI_edgesetIterator_isDone(EdgeSetIterator *esi)
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_EDGEHASH_H__ */
diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h
index 316e24cfc6d..70d428147e2 100644
--- a/source/blender/blenlib/BLI_endian_switch_inline.h
+++ b/source/blender/blenlib/BLI_endian_switch_inline.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ENDIAN_SWITCH_INLINE_H__
-#define __BLI_ENDIAN_SWITCH_INLINE_H__
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -92,5 +91,3 @@ BLI_INLINE void BLI_endian_switch_double(double *val)
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_ENDIAN_SWITCH_INLINE_H__ */
diff --git a/source/blender/blenlib/BLI_expr_pylike_eval.h b/source/blender/blenlib/BLI_expr_pylike_eval.h
index 1db91ea4205..c074b5d8130 100644
--- a/source/blender/blenlib/BLI_expr_pylike_eval.h
+++ b/source/blender/blenlib/BLI_expr_pylike_eval.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_EXPR_PYLIKE_EVAL_H__
-#define __BLI_EXPR_PYLIKE_EVAL_H__
+#pragma once
/** \file
* \ingroup bli
@@ -57,5 +56,3 @@ eExprPyLike_EvalStatus BLI_expr_pylike_eval(struct ExprPyLike_Parsed *expr,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_EXPR_PYLIKE_EVAL_H__ */
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index fe4600b9121..e61e20ee5e9 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -22,8 +22,7 @@
* \brief File and directory operations.
* */
-#ifndef __BLI_FILEOPS_H__
-#define __BLI_FILEOPS_H__
+#pragma once
#include <stdint.h>
#include <stdio.h>
@@ -189,5 +188,3 @@ void BLI_get_short_name(char short_name[256], const char *filename);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_FILEOPS_H__ */
diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h
index 41f916ed0ca..cdae9665f98 100644
--- a/source/blender/blenlib/BLI_fileops_types.h
+++ b/source/blender/blenlib/BLI_fileops_types.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_FILEOPS_TYPES_H__
-#define __BLI_FILEOPS_TYPES_H__
+#pragma once
/** \file
* \ingroup bli
@@ -64,5 +63,3 @@ struct dirlink {
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_FILEOPS_TYPES_H__ */
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh
index 5fe9d1b8ca9..e55a8de4633 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_FLOAT2_HH__
-#define __BLI_FLOAT2_HH__
+#pragma once
#include "BLI_float3.hh"
@@ -120,5 +119,3 @@ struct float2 {
};
} // namespace blender
-
-#endif /* __BLI_FLOAT2_HH__ */
diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh
index b2633985ac7..85575f65365 100644
--- a/source/blender/blenlib/BLI_float3.hh
+++ b/source/blender/blenlib/BLI_float3.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_FLOAT3_HH__
-#define __BLI_FLOAT3_HH__
+#pragma once
#include <iostream>
@@ -232,5 +231,3 @@ struct float3 {
};
} // namespace blender
-
-#endif /* __BLI_FLOAT3_HH__ */
diff --git a/source/blender/blenlib/BLI_float4x4.hh b/source/blender/blenlib/BLI_float4x4.hh
index 185cffd13ac..a8b939ed32e 100644
--- a/source/blender/blenlib/BLI_float4x4.hh
+++ b/source/blender/blenlib/BLI_float4x4.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_FLOAT4X4_HH__
-#define __BLI_FLOAT4X4_HH__
+#pragma once
#include "BLI_float3.hh"
#include "BLI_math_matrix.h"
@@ -121,5 +120,3 @@ struct float4x4 {
};
} // namespace blender
-
-#endif /* __BLI_FLOAT4X4_HH__ */
diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h
index 28169c36e23..d09a14621d8 100644
--- a/source/blender/blenlib/BLI_fnmatch.h
+++ b/source/blender/blenlib/BLI_fnmatch.h
@@ -19,8 +19,7 @@
* Bugs can be reported to bug-glibc@prep.ai.mit.edu.
*/
-#ifndef __BLI_FNMATCH_H__
-#define __BLI_FNMATCH_H__
+#pragma once
/** \file
* \ingroup bli
@@ -77,5 +76,3 @@ extern int fnmatch __P((const char *__pattern, const char *__string, int __flags
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_FNMATCH_H__ */
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 31a9658bd7e..cd84dd4f327 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_GHASH_H__
-#define __BLI_GHASH_H__
+#pragma once
/** \file
* \ingroup bli
@@ -416,5 +415,3 @@ GSet *BLI_gset_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_GHASH_H__ */
diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h
index b69bdb7057c..077d1646d1d 100644
--- a/source/blender/blenlib/BLI_gsqueue.h
+++ b/source/blender/blenlib/BLI_gsqueue.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_GSQUEUE_H__
-#define __BLI_GSQUEUE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -42,5 +41,3 @@ void BLI_gsqueue_free(GSQueue *gq);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_GSQUEUE_H__ */
diff --git a/source/blender/blenlib/BLI_hash.h b/source/blender/blenlib/BLI_hash.h
index 96111ffaf5a..c2be416ef5f 100644
--- a/source/blender/blenlib/BLI_hash.h
+++ b/source/blender/blenlib/BLI_hash.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_HASH_H__
-#define __BLI_HASH_H__
+#pragma once
/** \file
* \ingroup bli
@@ -91,5 +90,3 @@ BLI_INLINE void BLI_hash_pointer_to_color(const void *ptr, int *r, int *g, int *
#ifdef __cplusplus
}
#endif
-
-#endif // __BLI_HASH_H__
diff --git a/source/blender/blenlib/BLI_hash.hh b/source/blender/blenlib/BLI_hash.hh
index b14a4ca933c..ad3224e037a 100644
--- a/source/blender/blenlib/BLI_hash.hh
+++ b/source/blender/blenlib/BLI_hash.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_HASH_HH__
-#define __BLI_HASH_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -210,5 +209,3 @@ template<typename T1, typename T2> struct DefaultHash<std::pair<T1, T2>> {
};
} // namespace blender
-
-#endif /* __BLI_HASH_HH__ */
diff --git a/source/blender/blenlib/BLI_hash_md5.h b/source/blender/blenlib/BLI_hash_md5.h
index b326b17c19b..4a5cd8b19f3 100644
--- a/source/blender/blenlib/BLI_hash_md5.h
+++ b/source/blender/blenlib/BLI_hash_md5.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_HASH_MD5_H__
-#define __BLI_HASH_MD5_H__
+#pragma once
/** \file
* \ingroup bli
@@ -43,5 +42,3 @@ char *BLI_hash_md5_to_hexdigest(void *resblock, char r_hex_digest[33]);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_HASH_MD5_H__ */
diff --git a/source/blender/blenlib/BLI_hash_mm2a.h b/source/blender/blenlib/BLI_hash_mm2a.h
index 840ff31dd19..193a78e6293 100644
--- a/source/blender/blenlib/BLI_hash_mm2a.h
+++ b/source/blender/blenlib/BLI_hash_mm2a.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_HASH_MM2A_H__
-#define __BLI_HASH_MM2A_H__
+#pragma once
/** \file
* \ingroup bli
@@ -47,5 +46,3 @@ uint32_t BLI_hash_mm2(const unsigned char *data, size_t len, uint32_t seed);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_HASH_MM2A_H__ */
diff --git a/source/blender/blenlib/BLI_hash_mm3.h b/source/blender/blenlib/BLI_hash_mm3.h
index e76808812bc..99c24f53dd4 100644
--- a/source/blender/blenlib/BLI_hash_mm3.h
+++ b/source/blender/blenlib/BLI_hash_mm3.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_HASH_MM3_H__
-#define __BLI_HASH_MM3_H__
+#pragma once
/** \file
* \ingroup bli
@@ -32,5 +31,3 @@ uint32_t BLI_hash_mm3(const unsigned char *data, size_t len, uint32_t seed);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_HASH_MM2A_H__ */
diff --git a/source/blender/blenlib/BLI_hash_tables.hh b/source/blender/blenlib/BLI_hash_tables.hh
index 5d8f8862a09..e6026d93e2c 100644
--- a/source/blender/blenlib/BLI_hash_tables.hh
+++ b/source/blender/blenlib/BLI_hash_tables.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_OPEN_ADDRESSING_HH__
-#define __BLI_OPEN_ADDRESSING_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -353,5 +352,3 @@ struct DefaultEquality {
};
} // namespace blender
-
-#endif /* __BLI_OPEN_ADDRESSING_HH__ */
diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h
index ca5edcbead5..4cfb7945303 100644
--- a/source/blender/blenlib/BLI_heap.h
+++ b/source/blender/blenlib/BLI_heap.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_HEAP_H__
-#define __BLI_HEAP_H__
+#pragma once
/** \file
* \ingroup bli
@@ -61,5 +60,3 @@ bool BLI_heap_is_valid(const Heap *heap);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_HEAP_H__ */
diff --git a/source/blender/blenlib/BLI_heap_simple.h b/source/blender/blenlib/BLI_heap_simple.h
index d2bc542491c..b2a1b5582e5 100644
--- a/source/blender/blenlib/BLI_heap_simple.h
+++ b/source/blender/blenlib/BLI_heap_simple.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_HEAP_SIMPLE_H__
-#define __BLI_HEAP_SIMPLE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -44,5 +43,3 @@ void *BLI_heapsimple_pop_min(HeapSimple *heap) ATTR_NONNULL(1);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_HEAP_SIMPLE_H__ */
diff --git a/source/blender/blenlib/BLI_index_mask.hh b/source/blender/blenlib/BLI_index_mask.hh
index ff271faa0c2..48b01edcd6f 100644
--- a/source/blender/blenlib/BLI_index_mask.hh
+++ b/source/blender/blenlib/BLI_index_mask.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_INDEX_MASK_HH__
-#define __BLI_INDEX_MASK_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -208,5 +207,3 @@ class IndexMask {
};
} // namespace blender
-
-#endif /* __BLI_INDEX_MASK_HH__ */
diff --git a/source/blender/blenlib/BLI_index_range.hh b/source/blender/blenlib/BLI_index_range.hh
index 7c813f58b2c..2b060c986cd 100644
--- a/source/blender/blenlib/BLI_index_range.hh
+++ b/source/blender/blenlib/BLI_index_range.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_INDEX_RANGE_HH__
-#define __BLI_INDEX_RANGE_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -245,5 +244,3 @@ class IndexRange {
};
} // namespace blender
-
-#endif /* __BLI_INDEX_RANGE_HH__ */
diff --git a/source/blender/blenlib/BLI_iterator.h b/source/blender/blenlib/BLI_iterator.h
index ce2311aa3f7..c1cd1c21dac 100644
--- a/source/blender/blenlib/BLI_iterator.h
+++ b/source/blender/blenlib/BLI_iterator.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_ITERATOR_H__
-#define __BLI_ITERATOR_H__
+#pragma once
/** \file
* \ingroup bli
@@ -58,5 +57,3 @@ typedef void (*IteratorBeginCb)(BLI_Iterator *iter, void *data_in);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_ITERATOR_H__ */
diff --git a/source/blender/blenlib/BLI_jitter_2d.h b/source/blender/blenlib/BLI_jitter_2d.h
index fa184916b5b..a0af352ddd2 100644
--- a/source/blender/blenlib/BLI_jitter_2d.h
+++ b/source/blender/blenlib/BLI_jitter_2d.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_JITTER_2D_H__
-#define __BLI_JITTER_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -35,5 +34,3 @@ void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_JITTER_2D_H__ */
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 9e4e30181b9..5e317c89625 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_KDOPBVH_H__
-#define __BLI_KDOPBVH_H__
+#pragma once
/** \file
* \ingroup bli
@@ -264,5 +263,3 @@ extern const float bvhtree_kdop_axes[13][3];
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_KDOPBVH_H__ */
diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h
index 9ba045fdbf8..76f39dfbacb 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_KDTREE_H__
-#define __BLI_KDTREE_H__
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -73,5 +72,3 @@ extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_KDTREE_H__ */
diff --git a/source/blender/blenlib/BLI_lasso_2d.h b/source/blender/blenlib/BLI_lasso_2d.h
index fb661c41784..e920d1189a2 100644
--- a/source/blender/blenlib/BLI_lasso_2d.h
+++ b/source/blender/blenlib/BLI_lasso_2d.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_LASSO_2D_H__
-#define __BLI_LASSO_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -47,5 +46,3 @@ bool BLI_lasso_is_edge_inside(const int mcoords[][2],
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_LASSO_2D_H__ */
diff --git a/source/blender/blenlib/BLI_linear_allocator.hh b/source/blender/blenlib/BLI_linear_allocator.hh
index 39a3ed27f42..fcc20d483c9 100644
--- a/source/blender/blenlib/BLI_linear_allocator.hh
+++ b/source/blender/blenlib/BLI_linear_allocator.hh
@@ -22,8 +22,7 @@
* memory. When the current buffer is full, it reallocates a new larger buffer and continues.
*/
-#ifndef __BLI_LINEAR_ALLOCATOR_HH__
-#define __BLI_LINEAR_ALLOCATOR_HH__
+#pragma once
#include "BLI_string_ref.hh"
#include "BLI_utility_mixins.hh"
@@ -219,5 +218,3 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya
};
} // namespace blender
-
-#endif /* __BLI_LINEAR_ALLOCATOR_HH__ */
diff --git a/source/blender/blenlib/BLI_link_utils.h b/source/blender/blenlib/BLI_link_utils.h
index c0db53ca9a3..a877860cd8d 100644
--- a/source/blender/blenlib/BLI_link_utils.h
+++ b/source/blender/blenlib/BLI_link_utils.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_LINK_UTILS_H__
-#define __BLI_LINK_UTILS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -67,5 +66,3 @@
} \
} \
(void)0
-
-#endif /* __BLI_LINK_UTILS_H__ */
diff --git a/source/blender/blenlib/BLI_linklist.h b/source/blender/blenlib/BLI_linklist.h
index 324da859af1..25d58a3050c 100644
--- a/source/blender/blenlib/BLI_linklist.h
+++ b/source/blender/blenlib/BLI_linklist.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_LINKLIST_H__
-#define __BLI_LINKLIST_H__
+#pragma once
/** \file
* \ingroup bli
@@ -101,5 +100,3 @@ LinkNode *BLI_linklist_sort_r(LinkNode *list,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_LINKLIST_H__ */
diff --git a/source/blender/blenlib/BLI_linklist_lockfree.h b/source/blender/blenlib/BLI_linklist_lockfree.h
index 647b00ec658..142fa1cf243 100644
--- a/source/blender/blenlib/BLI_linklist_lockfree.h
+++ b/source/blender/blenlib/BLI_linklist_lockfree.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_LINKLIST_LOCKFREE_H__
-#define __BLI_LINKLIST_LOCKFREE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -73,5 +72,3 @@ void BLI_linklist_lockfree_insert(LockfreeLinkList *list, LockfreeLinkNode *node
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_LINKLIST_H__ */
diff --git a/source/blender/blenlib/BLI_linklist_stack.h b/source/blender/blenlib/BLI_linklist_stack.h
index 3725682d380..065ed12f353 100644
--- a/source/blender/blenlib/BLI_linklist_stack.h
+++ b/source/blender/blenlib/BLI_linklist_stack.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_LINKLIST_STACK_H__
-#define __BLI_LINKLIST_STACK_H__
+#pragma once
/** \file
* \ingroup bli
@@ -194,5 +193,3 @@
(void)0
/** \} */
-
-#endif /* __BLI_LINKLIST_STACK_H__ */
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index b027acb88da..fa7cf7a1847 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_LISTBASE_H__
-#define __BLI_LISTBASE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -190,5 +189,3 @@ struct LinkData *BLI_genericNodeN(void *data);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_LISTBASE_H__ */
diff --git a/source/blender/blenlib/BLI_listbase_wrapper.hh b/source/blender/blenlib/BLI_listbase_wrapper.hh
index 46f4a9d49fa..00f757d4bc2 100644
--- a/source/blender/blenlib/BLI_listbase_wrapper.hh
+++ b/source/blender/blenlib/BLI_listbase_wrapper.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_LISTBASE_WRAPPER_HH__
-#define __BLI_LISTBASE_WRAPPER_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -111,5 +110,3 @@ template<typename T> class ListBaseWrapper {
};
} /* namespace blender */
-
-#endif /* __BLI_LISTBASE_WRAPPER_HH__ */
diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh
index dd375272fdb..f90d59f45a5 100644
--- a/source/blender/blenlib/BLI_map.hh
+++ b/source/blender/blenlib/BLI_map.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_MAP_HH__
-#define __BLI_MAP_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -1242,5 +1241,3 @@ template<typename Key, typename Value> class StdUnorderedMapWrapper {
};
} // namespace blender
-
-#endif /* __BLI_MAP_HH__ */
diff --git a/source/blender/blenlib/BLI_map_slots.hh b/source/blender/blenlib/BLI_map_slots.hh
index b5360795a13..25fb92d61a3 100644
--- a/source/blender/blenlib/BLI_map_slots.hh
+++ b/source/blender/blenlib/BLI_map_slots.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_MAP_SLOTS_HH__
-#define __BLI_MAP_SLOTS_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -357,5 +356,3 @@ template<typename Key, typename Value> struct DefaultMapSlot<Key *, Value> {
};
} // namespace blender
-
-#endif /* __BLI_MAP_SLOTS_HH__ */
diff --git a/source/blender/blenlib/BLI_math.h b/source/blender/blenlib/BLI_math.h
index f8de8b7ed53..51833d081d0 100644
--- a/source/blender/blenlib/BLI_math.h
+++ b/source/blender/blenlib/BLI_math.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_H__
-#define __BLI_MATH_H__
+#pragma once
/** \file
* \ingroup bli
@@ -73,5 +72,3 @@
#include "BLI_math_solvers.h"
#include "BLI_math_statistics.h"
#include "BLI_math_vector.h"
-
-#endif /* __BLI_MATH_H__ */
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index c456ab0ecef..f407da3133f 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_BASE_H__
-#define __BLI_MATH_BASE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -289,5 +288,3 @@ double double_round(double x, int ndigits);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_BASE_H__ */
diff --git a/source/blender/blenlib/BLI_math_base_safe.h b/source/blender/blenlib/BLI_math_base_safe.h
index 88a08c3cbc7..1d6590b2faa 100644
--- a/source/blender/blenlib/BLI_math_base_safe.h
+++ b/source/blender/blenlib/BLI_math_base_safe.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_MATH_BASE_SAFE_H__
-#define __BLI_MATH_BASE_SAFE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -46,5 +45,3 @@ MINLINE float safe_powf(float base, float exponent);
#if BLI_MATH_DO_INLINE
# include "intern/math_base_safe_inline.c"
#endif
-
-#endif /* __BLI_MATH_BASE_SAFE_H__ */
diff --git a/source/blender/blenlib/BLI_math_bits.h b/source/blender/blenlib/BLI_math_bits.h
index 0283622ca89..b602900bedc 100644
--- a/source/blender/blenlib/BLI_math_bits.h
+++ b/source/blender/blenlib/BLI_math_bits.h
@@ -15,8 +15,7 @@
*
* */
-#ifndef __BLI_MATH_BITS_H__
-#define __BLI_MATH_BITS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -68,5 +67,3 @@ MINLINE float xor_fl(float x, int y);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_BITS_H__ */
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 48f8e7d31d9..943f0fc764f 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_COLOR_H__
-#define __BLI_MATH_COLOR_H__
+#pragma once
/** \file
* \ingroup bli
@@ -162,5 +161,3 @@ void lift_gamma_gain_to_asc_cdl(const float *lift,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_COLOR_H__ */
diff --git a/source/blender/blenlib/BLI_math_color_blend.h b/source/blender/blenlib/BLI_math_color_blend.h
index 60ada1e4509..d5e4eedb1a6 100644
--- a/source/blender/blenlib/BLI_math_color_blend.h
+++ b/source/blender/blenlib/BLI_math_color_blend.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_COLOR_BLEND_H__
-#define __BLI_MATH_COLOR_BLEND_H__
+#pragma once
/** \file
* \ingroup bli
@@ -151,5 +150,3 @@ MINLINE void blend_color_interpolate_float(float dst[4],
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_COLOR_BLEND_H__ */
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 64b0dcccda1..213f5a029b0 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_GEOM_H__
-#define __BLI_MATH_GEOM_H__
+#pragma once
/** \file
* \ingroup bli
@@ -403,15 +402,19 @@ bool isect_ray_tri_epsilon_v3(const float ray_origin[3],
float *r_lambda,
float r_uv[2],
const float epsilon);
-bool isect_tri_tri_epsilon_v3(const float t_a0[3],
- const float t_a1[3],
- const float t_a2[3],
- const float t_b0[3],
- const float t_b1[3],
- const float t_b2[3],
- float r_i1[3],
- float r_i2[3],
- const float epsilon);
+bool isect_tri_tri_v3_ex(const float tri_a[3][3],
+ const float tri_b[3][3],
+ float r_i1[3],
+ float r_i2[3],
+ int *r_tri_a_edge_isect_count);
+bool isect_tri_tri_v3(const float t_a0[3],
+ const float t_a1[3],
+ const float t_a2[3],
+ const float t_b0[3],
+ const float t_b1[3],
+ const float t_b2[3],
+ float r_i1[3],
+ float r_i2[3]);
bool isect_tri_tri_v2(const float p1[2],
const float q1[2],
@@ -454,11 +457,11 @@ bool isect_ray_seg_v2(const float ray_origin[2],
float *r_lambda,
float *r_u);
-bool isect_ray_seg_v3(const float ray_origin[3],
- const float ray_direction[3],
- const float v0[3],
- const float v1[3],
- float *r_lambda);
+bool isect_ray_line_v3(const float ray_origin[3],
+ const float ray_direction[3],
+ const float v0[3],
+ const float v1[3],
+ float *r_lambda);
/* point in polygon */
bool isect_point_poly_v2(const float pt[2],
@@ -825,5 +828,3 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3])
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_GEOM_H__ */
diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h
index 3e32a517471..506386f8d25 100644
--- a/source/blender/blenlib/BLI_math_inline.h
+++ b/source/blender/blenlib/BLI_math_inline.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_INLINE_H__
-#define __BLI_MATH_INLINE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -56,5 +55,3 @@ extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_INLINE_H__ */
diff --git a/source/blender/blenlib/BLI_math_interp.h b/source/blender/blenlib/BLI_math_interp.h
index 0f3032fa625..3e9839b4d3a 100644
--- a/source/blender/blenlib/BLI_math_interp.h
+++ b/source/blender/blenlib/BLI_math_interp.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_MATH_INTERP_H__
-#define __BLI_MATH_INTERP_H__
+#pragma once
/** \file
* \ingroup bli
@@ -95,5 +94,3 @@ void BLI_ewa_filter(const int width,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_INTERP_H__ */
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 33fcd750aee..a00fdaa0ae9 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -19,8 +19,7 @@
* The Original Code is: some of this file.
* */
-#ifndef __BLI_MATH_MATRIX_H__
-#define __BLI_MATH_MATRIX_H__
+#pragma once
/** \file
* \ingroup bli
@@ -399,5 +398,3 @@ void print_m4(const char *str, const float M[4][4]);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_MATRIX_H__ */
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index b7ae35b2e23..61708528e24 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_ROTATION_H__
-#define __BLI_MATH_ROTATION_H__
+#pragma once
/** \file
* \ingroup bli
@@ -246,5 +245,3 @@ bool mat3_from_axis_conversion_single(int src_axis, int dst_axis, float r_mat[3]
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_ROTATION_H__ */
diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h
index 193bbdd4e8c..9b2d1eedec7 100644
--- a/source/blender/blenlib/BLI_math_solvers.h
+++ b/source/blender/blenlib/BLI_math_solvers.h
@@ -17,8 +17,7 @@
* All rights reserved.
* */
-#ifndef __BLI_MATH_SOLVERS_H__
-#define __BLI_MATH_SOLVERS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -76,5 +75,3 @@ bool BLI_newton3d_solve(Newton3D_DeltaFunc func_delta,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_SOLVERS_H__ */
diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h
index a9f9ae39506..aebc445002b 100644
--- a/source/blender/blenlib/BLI_math_statistics.h
+++ b/source/blender/blenlib/BLI_math_statistics.h
@@ -17,8 +17,7 @@
* All rights reserved.
* */
-#ifndef __BLI_MATH_STATISTICS_H__
-#define __BLI_MATH_STATISTICS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -57,5 +56,3 @@ void BLI_covariance_m3_v3n(const float (*cos_v3)[3],
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_STATISTICS_H__ */
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index d46c02a961c..1ccfe5d86b1 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -20,8 +20,7 @@
*
* */
-#ifndef __BLI_MATH_VECTOR_H__
-#define __BLI_MATH_VECTOR_H__
+#pragma once
/** \file
* \ingroup bli
@@ -133,6 +132,7 @@ MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3]);
MINLINE void sub_v4_v4(float r[4], const float a[4]);
MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]);
+MINLINE void sub_v2db_v2fl_v2fl(double r[2], const float a[2], const float b[2]);
MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3]);
MINLINE void mul_v2_fl(float r[2], float f);
@@ -205,6 +205,7 @@ MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) ATTR_WARN_UNUS
MINLINE double dot_v3v3_db(const double a[3], const double b[3]) ATTR_WARN_UNUSED_RESULT;
MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT;
+MINLINE double cross_v2v2_db(const double a[2], const double b[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);
MINLINE void cross_v3_v3v3_hi_prec(float r[3], const float a[3], const float b[3]);
MINLINE void cross_v3_v3v3_db(double r[3], const double a[3], const double b[3]);
@@ -221,6 +222,7 @@ MINLINE float len_manhattan_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE int len_manhattan_v2_int(const int v[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE float len_manhattan_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT;
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT;
+MINLINE double len_v2_db(const double v[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE double len_v2v2_db(const double a[2], const double b[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE float len_v2v2_int(const int v1[2], const int v2[2]);
@@ -523,5 +525,3 @@ void mul_vn_db(double *array_tar, const int size, const double f);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MATH_VECTOR_H__ */
diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h
index e0aff82e874..87a320e336d 100644
--- a/source/blender/blenlib/BLI_memarena.h
+++ b/source/blender/blenlib/BLI_memarena.h
@@ -21,8 +21,7 @@
* \ingroup bli
*/
-#ifndef __BLI_MEMARENA_H__
-#define __BLI_MEMARENA_H__
+#pragma once
#include "BLI_compiler_attrs.h"
@@ -55,5 +54,3 @@ void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MEMARENA_H__ */
diff --git a/source/blender/blenlib/BLI_memblock.h b/source/blender/blenlib/BLI_memblock.h
index 8f66ee3b9cb..cb6b31d54e0 100644
--- a/source/blender/blenlib/BLI_memblock.h
+++ b/source/blender/blenlib/BLI_memblock.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_MEMBLOCK_H__
-#define __BLI_MEMBLOCK_H__
+#pragma once
/** \file
* \ingroup bli
@@ -63,5 +62,3 @@ void *BLI_memblock_elem_get(BLI_memblock *mblk, int chunk, int elem) ATTR_WARN_U
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MEMBLOCK_H__ */
diff --git a/source/blender/blenlib/BLI_memiter.h b/source/blender/blenlib/BLI_memiter.h
index 4aa9cdb6b6c..c7a715309e1 100644
--- a/source/blender/blenlib/BLI_memiter.h
+++ b/source/blender/blenlib/BLI_memiter.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_MEMITER_H__
-#define __BLI_MEMITER_H__
+#pragma once
/** \file
* \ingroup bli
@@ -69,5 +68,3 @@ void *BLI_memiter_iter_step_size(BLI_memiter_handle *iter, uint *r_size) ATTR_WA
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MEMITER_H__ */
diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh
index 9f65fe0742e..d663bf4038d 100644
--- a/source/blender/blenlib/BLI_memory_utils.hh
+++ b/source/blender/blenlib/BLI_memory_utils.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_MEMORY_UTILS_HH__
-#define __BLI_MEMORY_UTILS_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -429,5 +428,3 @@ inline constexpr int64_t default_inline_buffer_capacity(size_t element_size)
}
} // namespace blender
-
-#endif /* __BLI_MEMORY_UTILS_HH__ */
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index 3749f9e1b76..3ee6f182593 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_MEMPOOL_H__
-#define __BLI_MEMPOOL_H__
+#pragma once
/** \file
* \ingroup bli
@@ -97,5 +96,3 @@ void BLI_mempool_iter_threadsafe_free(BLI_mempool_iter *iter_arr) ATTR_NONNULL()
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_MEMPOOL_H__ */
diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h
index 32731ff24fc..cb66b0552df 100644
--- a/source/blender/blenlib/BLI_noise.h
+++ b/source/blender/blenlib/BLI_noise.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_NOISE_H__
-#define __BLI_NOISE_H__
+#pragma once
/** \file
* \ingroup bli
@@ -79,5 +78,3 @@ void cellNoiseV(float x, float y, float z, float r_ca[3]);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 30823773d6c..05c256ccf1c 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*/
-#ifndef __BLI_PATH_UTIL_H__
-#define __BLI_PATH_UTIL_H__
+#pragma once
/** \file
* \ingroup bli
@@ -158,5 +157,3 @@ bool BLI_path_suffix(char *string, size_t maxlen, const char *suffix, const char
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_PATH_UTIL_H__ */
diff --git a/source/blender/blenlib/BLI_polyfill_2d.h b/source/blender/blenlib/BLI_polyfill_2d.h
index cb12b73c1d5..ca63ea5af87 100644
--- a/source/blender/blenlib/BLI_polyfill_2d.h
+++ b/source/blender/blenlib/BLI_polyfill_2d.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_POLYFILL_2D_H__
-#define __BLI_POLYFILL_2D_H__
+#pragma once
/** \file
* \ingroup bli
@@ -45,5 +44,3 @@ void BLI_polyfill_calc(const float (*coords)[2],
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_POLYFILL_2D_H__ */
diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h
index 94c4b412225..2c5296269ae 100644
--- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h
+++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_POLYFILL_2D_BEAUTIFY_H__
-#define __BLI_POLYFILL_2D_BEAUTIFY_H__
+#pragma once
/** \file
* \ingroup bli
@@ -51,5 +50,3 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(const float v1[2],
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_POLYFILL_2D_BEAUTIFY_H__ */
diff --git a/source/blender/blenlib/BLI_probing_strategies.hh b/source/blender/blenlib/BLI_probing_strategies.hh
index 0e5338fa6ed..a37a979b754 100644
--- a/source/blender/blenlib/BLI_probing_strategies.hh
+++ b/source/blender/blenlib/BLI_probing_strategies.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_PROBING_STRATEGIES_HH__
-#define __BLI_PROBING_STRATEGIES_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -246,5 +245,3 @@ using DefaultProbingStrategy = PythonProbingStrategy<>;
// clang-format on
} // namespace blender
-
-#endif /* __BLI_PROBING_STRATEGIES_HH__ */
diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h
index 1383a19ed1f..fdb7d1e67ac 100644
--- a/source/blender/blenlib/BLI_quadric.h
+++ b/source/blender/blenlib/BLI_quadric.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_QUADRIC_H__
-#define __BLI_QUADRIC_H__
+#pragma once
/** \file
* \ingroup bli
@@ -50,5 +49,3 @@ bool BLI_quadric_optimize(const Quadric *q, double v[3], const double epsilon);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_QUADRIC_H__ */
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h
index c55bbd26db5..78a323c2431 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_RAND_H__
-#define __BLI_RAND_H__
+#pragma once
#include "BLI_compiler_attrs.h"
#include "BLI_sys_types.h"
@@ -116,5 +115,3 @@ void BLI_hammersley_2d_sequence(unsigned int n, double *r);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_RAND_H__ */
diff --git a/source/blender/blenlib/BLI_rand.hh b/source/blender/blenlib/BLI_rand.hh
index 612ac0bbe19..72c750d9fa2 100644
--- a/source/blender/blenlib/BLI_rand.hh
+++ b/source/blender/blenlib/BLI_rand.hh
@@ -18,8 +18,7 @@
* \ingroup bli
*/
-#ifndef __BLI_RAND_HH__
-#define __BLI_RAND_HH__
+#pragma once
#include "BLI_float2.hh"
#include "BLI_float3.hh"
@@ -105,5 +104,3 @@ class RandomNumberGenerator {
};
} // namespace blender
-
-#endif /* __BLI_RAND_HH__ */
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 14d18308ed6..ae3eb9d2144 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_RECT_H__
-#define __BLI_RECT_H__
+#pragma once
/** \file
* \ingroup bli
@@ -166,5 +165,3 @@ BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_RECT_H__ */
diff --git a/source/blender/blenlib/BLI_resource_collector.hh b/source/blender/blenlib/BLI_resource_collector.hh
index 10d610da618..9c8fefc1202 100644
--- a/source/blender/blenlib/BLI_resource_collector.hh
+++ b/source/blender/blenlib/BLI_resource_collector.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_RESOURCE_COLLECTOR_HH__
-#define __BLI_RESOURCE_COLLECTOR_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -141,5 +140,3 @@ class ResourceCollector : NonCopyable, NonMovable {
};
} // namespace blender
-
-#endif /* __BLI_RESOURCE_COLLECTOR_HH__ */
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index 376ea9d88de..cf74bc14cac 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_SCANFILL_H__
-#define __BLI_SCANFILL_H__
+#pragma once
/** \file
* \ingroup bli
@@ -131,5 +130,3 @@ bool BLI_scanfill_calc_self_isect(ScanFillContext *sf_ctx,
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_session_uuid.h b/source/blender/blenlib/BLI_session_uuid.h
new file mode 100644
index 00000000000..05355a85b39
--- /dev/null
+++ b/source/blender/blenlib/BLI_session_uuid.h
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+/** \file
+ * \ingroup bli
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "DNA_session_uuid_types.h"
+
+/* Generate new UUID which is unique throughout the Blender session. */
+SessionUUID BLI_session_uuid_generate(void);
+
+/* Check whether the UUID is properly generated. */
+bool BLI_session_uuid_is_generated(const SessionUUID *uuid);
+
+/* Check whether two UUIDs are identical. */
+bool BLI_session_uuid_is_equal(const SessionUUID *lhs, const SessionUUID *rhs);
+
+uint64_t BLI_session_uuid_hash_uint64(const SessionUUID *uuid);
+
+/* Utility functions to make it possible to create GHash/GSet with UUID as a key. */
+uint BLI_session_uuid_ghash_hash(const void *uuid_v);
+bool BLI_session_uuid_ghash_compare(const void *lhs_v, const void *rhs_v);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+
+namespace blender {
+
+inline const bool operator==(const SessionUUID &lhs, const SessionUUID &rhs)
+{
+ return BLI_session_uuid_is_equal(&lhs, &rhs);
+}
+
+template<typename T> struct DefaultHash;
+
+template<> struct DefaultHash<SessionUUID> {
+ uint64_t operator()(const SessionUUID &value) const
+ {
+ return BLI_session_uuid_hash_uint64(&value);
+ }
+};
+
+} // namespace blender
+
+#endif
diff --git a/source/blender/blenlib/BLI_set.hh b/source/blender/blenlib/BLI_set.hh
index 90adea69e06..eb4e258b679 100644
--- a/source/blender/blenlib/BLI_set.hh
+++ b/source/blender/blenlib/BLI_set.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_SET_HH__
-#define __BLI_SET_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -831,5 +830,3 @@ template<typename Key,
using RawSet = Set<Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, RawAllocator>;
} // namespace blender
-
-#endif /* __BLI_SET_HH__ */
diff --git a/source/blender/blenlib/BLI_set_slots.hh b/source/blender/blenlib/BLI_set_slots.hh
index b78ed37f534..ee5da17fcaf 100644
--- a/source/blender/blenlib/BLI_set_slots.hh
+++ b/source/blender/blenlib/BLI_set_slots.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_SET_SLOTS_HH__
-#define __BLI_SET_SLOTS_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -411,5 +410,3 @@ template<typename Key> struct DefaultSetSlot<Key *> {
};
} // namespace blender
-
-#endif /* __BLI_SET_SLOTS_HH__ */
diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h
index cb0330d1bad..daea2fcd914 100644
--- a/source/blender/blenlib/BLI_smallhash.h
+++ b/source/blender/blenlib/BLI_smallhash.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_SMALLHASH_H__
-#define __BLI_SMALLHASH_H__
+#pragma once
/** \file
* \ingroup bli
@@ -81,5 +80,3 @@ double BLI_smallhash_calc_quality(SmallHash *sh);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_SMALLHASH_H__ */
diff --git a/source/blender/blenlib/BLI_sort.h b/source/blender/blenlib/BLI_sort.h
index 08e61915a83..969816086e2 100644
--- a/source/blender/blenlib/BLI_sort.h
+++ b/source/blender/blenlib/BLI_sort.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_SORT_H__
-#define __BLI_SORT_H__
+#pragma once
/** \file
* \ingroup bli
@@ -39,5 +38,3 @@ void BLI_qsort_r(void *a, size_t n, size_t es, BLI_sort_cmp_t cmp, void *thunk)
__attribute__((nonnull(1, 5)))
#endif
;
-
-#endif /* __BLI_SORT_H__ */
diff --git a/source/blender/blenlib/BLI_sort_utils.h b/source/blender/blenlib/BLI_sort_utils.h
index 9c99f893a1f..e54252f4e1b 100644
--- a/source/blender/blenlib/BLI_sort_utils.h
+++ b/source/blender/blenlib/BLI_sort_utils.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_SORT_UTILS_H__
-#define __BLI_SORT_UTILS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -64,5 +63,3 @@ int BLI_sortutil_cmp_ptr_reverse(const void *a_, const void *b_);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_SORT_UTILS_H__ */
diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh
index 2d875fe73be..a2de76e080e 100644
--- a/source/blender/blenlib/BLI_span.hh
+++ b/source/blender/blenlib/BLI_span.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_SPAN_HH__
-#define __BLI_SPAN_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -645,5 +644,3 @@ void assert_same_size(const T1 &v1, const T2 &v2, const T3 &v3)
}
} /* namespace blender */
-
-#endif /* __BLI_SPAN_HH__ */
diff --git a/source/blender/blenlib/BLI_stack.h b/source/blender/blenlib/BLI_stack.h
index 9fc25e378a3..b00bc0a2e57 100644
--- a/source/blender/blenlib/BLI_stack.h
+++ b/source/blender/blenlib/BLI_stack.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_STACK_H__
-#define __BLI_STACK_H__
+#pragma once
/** \file
* \ingroup bli
@@ -55,5 +54,3 @@ bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NON
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_STACK_H__ */
diff --git a/source/blender/blenlib/BLI_stack.hh b/source/blender/blenlib/BLI_stack.hh
index 75ae9df79a4..5fa7867e176 100644
--- a/source/blender/blenlib/BLI_stack.hh
+++ b/source/blender/blenlib/BLI_stack.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_STACK_HH__
-#define __BLI_STACK_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -386,5 +385,3 @@ template<typename T, int64_t InlineBufferCapacity = default_inline_buffer_capaci
using RawStack = Stack<T, InlineBufferCapacity, RawAllocator>;
} /* namespace blender */
-
-#endif /* __BLI_STACK_HH__ */
diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h
index cf7888d3c5e..6cee6b64797 100644
--- a/source/blender/blenlib/BLI_strict_flags.h
+++ b/source/blender/blenlib/BLI_strict_flags.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_STRICT_FLAGS_H__
-#define __BLI_STRICT_FLAGS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -53,5 +52,3 @@
# pragma warning(error : 4305) /* truncation from 'type1' to 'type2' */
# pragma warning(error : 4389) /* signed/unsigned mismatch */
#endif
-
-#endif /* __BLI_STRICT_FLAGS_H__ */
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 00e4e3485d1..d1fab065959 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_STRING_H__
-#define __BLI_STRING_H__
+#pragma once
/** \file
* \ingroup bli
@@ -206,5 +205,3 @@ int BLI_string_find_split_words(const char *str,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_STRING_H__ */
diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h
index f8afff214a3..e78c7b56cf7 100644
--- a/source/blender/blenlib/BLI_string_cursor_utf8.h
+++ b/source/blender/blenlib/BLI_string_cursor_utf8.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_STRING_CURSOR_UTF8_H__
-#define __BLI_STRING_CURSOR_UTF8_H__
+#pragma once
/** \file
* \ingroup bli
@@ -59,5 +58,3 @@ void BLI_str_cursor_step_utf32(const char32_t *str,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_STRING_CURSOR_UTF8_H__ */
diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh
index 06fc66f6b55..8bf4821f72a 100644
--- a/source/blender/blenlib/BLI_string_ref.hh
+++ b/source/blender/blenlib/BLI_string_ref.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_STRING_REF_HH__
-#define __BLI_STRING_REF_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -371,5 +370,3 @@ inline StringRef StringRefBase::substr(const int64_t start, const int64_t size)
}
} // namespace blender
-
-#endif /* __BLI_STRING_REF_HH__ */
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index 78e7113b6ef..3620a3ccc55 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_STRING_UTF8_H__
-#define __BLI_STRING_UTF8_H__
+#pragma once
/** \file
* \ingroup bli
@@ -115,5 +114,3 @@ int BLI_str_utf8_offset_from_column(const char *str, int column);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h
index 857b22540e9..46fb096599f 100644
--- a/source/blender/blenlib/BLI_string_utils.h
+++ b/source/blender/blenlib/BLI_string_utils.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_STRING_UTILS_H__
-#define __BLI_STRING_UTILS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -97,5 +96,3 @@ bool BLI_uniquename(struct ListBase *list,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_STRING_UTILS_H__ */
diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h
index ef15ce111b6..ff1f6af9573 100644
--- a/source/blender/blenlib/BLI_sys_types.h
+++ b/source/blender/blenlib/BLI_sys_types.h
@@ -31,8 +31,7 @@
* For these rogue platforms, we make the typedefs ourselves.
*/
-#ifndef __BLI_SYS_TYPES_H__
-#define __BLI_SYS_TYPES_H__
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -89,5 +88,3 @@ typedef unsigned char uchar;
#ifdef __cplusplus
}
#endif
-
-#endif /* eof */
diff --git a/source/blender/blenlib/BLI_system.h b/source/blender/blenlib/BLI_system.h
index 50f8adc20f6..8dd0706e1e2 100644
--- a/source/blender/blenlib/BLI_system.h
+++ b/source/blender/blenlib/BLI_system.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_SYSTEM_H__
-#define __BLI_SYSTEM_H__
+#pragma once
#include <stdio.h>
@@ -64,5 +63,3 @@ void BLI_windows_handle_exception(void *exception);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_SYSTEM_H__ */
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 920a0a8f650..a281aaa5b51 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_THREADS_H__
-#define __BLI_THREADS_H__
+#pragma once
/** \file
* \ingroup bli
@@ -205,5 +204,3 @@ void BLI_thread_put_thread_on_fast_node(void);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h
index d3c6803130a..1dff50efa23 100644
--- a/source/blender/blenlib/BLI_timecode.h
+++ b/source/blender/blenlib/BLI_timecode.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_TIMECODE_H__
-#define __BLI_TIMECODE_H__
+#pragma once
/** \file
* \ingroup BLI
@@ -49,5 +48,3 @@ size_t BLI_timecode_string_from_time_seconds(char *str,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_TIMECODE_H__ */
diff --git a/source/blender/blenlib/BLI_timeit.hh b/source/blender/blenlib/BLI_timeit.hh
index f0968587597..8e107585576 100644
--- a/source/blender/blenlib/BLI_timeit.hh
+++ b/source/blender/blenlib/BLI_timeit.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_TIMEIT_HH__
-#define __BLI_TIMEIT_HH__
+#pragma once
#include <chrono>
#include <iostream>
@@ -56,5 +55,3 @@ class ScopedTimer {
} // namespace blender::timeit
#define SCOPED_TIMER(name) blender::timeit::ScopedTimer scoped_timer(name)
-
-#endif /* __BLI_TIMEIT_HH__ */
diff --git a/source/blender/blenlib/BLI_timer.h b/source/blender/blenlib/BLI_timer.h
index 144fcd0a0d7..19275ff5b9a 100644
--- a/source/blender/blenlib/BLI_timer.h
+++ b/source/blender/blenlib/BLI_timer.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_TIMER_H__
-#define __BLI_TIMER_H__
+#pragma once
#include "BLI_sys_types.h"
@@ -61,5 +60,3 @@ void BLI_timer_on_file_load(void);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_TIMER_H__ */
diff --git a/source/blender/blenlib/BLI_utildefines_iter.h b/source/blender/blenlib/BLI_utildefines_iter.h
index bbd83573e53..5fb6248e1e9 100644
--- a/source/blender/blenlib/BLI_utildefines_iter.h
+++ b/source/blender/blenlib/BLI_utildefines_iter.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_UTILDEFINES_ITER_H__
-#define __BLI_UTILDEFINES_ITER_H__
+#pragma once
/** \file
* \ingroup bli
@@ -42,5 +41,3 @@
for (int _src = (src), _src2 = _src * 2, _dst2 = (dst)*2, _error = _dst2 - _src, i = 0, _delta; \
((void)(_delta = divide_floor_i(_error, _dst2)), (void)(i -= _delta), (i < _src)); \
_error -= (_delta * _dst2) + _src2)
-
-#endif /* __BLI_UTILDEFINES_ITER_H__ */
diff --git a/source/blender/blenlib/BLI_utildefines_stack.h b/source/blender/blenlib/BLI_utildefines_stack.h
index 9f9bfb0405d..f50004ef79a 100644
--- a/source/blender/blenlib/BLI_utildefines_stack.h
+++ b/source/blender/blenlib/BLI_utildefines_stack.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_UTILDEFINES_STACK_H__
-#define __BLI_UTILDEFINES_STACK_H__
+#pragma once
/** \file
* \ingroup bli
@@ -99,5 +98,3 @@
} \
((void)0)
#endif
-
-#endif /* __BLI_UTILDEFINES_STACK_H__ */
diff --git a/source/blender/blenlib/BLI_utildefines_variadic.h b/source/blender/blenlib/BLI_utildefines_variadic.h
index f5a420a7faf..be0d0b93cc7 100644
--- a/source/blender/blenlib/BLI_utildefines_variadic.h
+++ b/source/blender/blenlib/BLI_utildefines_variadic.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_UTILDEFINES_VARIADIC_H__
-#define __BLI_UTILDEFINES_VARIADIC_H__
+#pragma once
/** \file
* \ingroup bli
@@ -47,5 +46,3 @@
_VA_NARGS_GLUE(_VA_NARGS_OVERLOAD_MACRO(name, VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__))
/* clang-format on */
-
-#endif /* __BLI_UTILDEFINES_VARIADIC_H__ */
diff --git a/source/blender/blenlib/BLI_utility_mixins.hh b/source/blender/blenlib/BLI_utility_mixins.hh
index 61444e36725..69b1d85b3b6 100644
--- a/source/blender/blenlib/BLI_utility_mixins.hh
+++ b/source/blender/blenlib/BLI_utility_mixins.hh
@@ -18,8 +18,7 @@
* \ingroup bli
*/
-#ifndef __BLI_UTILITY_MIXINS_HH__
-#define __BLI_UTILITY_MIXINS_HH__
+#pragma once
namespace blender {
@@ -54,5 +53,3 @@ class NonMovable {
};
} // namespace blender
-
-#endif /* __BLI_UTILITY_MIXINS_HH__ */
diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenlib/BLI_uvproject.h
index 8a33ea6961c..6028d95bda0 100644
--- a/source/blender/blenlib/BLI_uvproject.h
+++ b/source/blender/blenlib/BLI_uvproject.h
@@ -13,8 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_UVPROJECT_H__
-#define __BLI_UVPROJECT_H__
+#pragma once
/** \file
* \ingroup bli
@@ -45,7 +44,7 @@ void BLI_uvproject_from_view(float target[2],
float winy);
/* apply ortho uv's */
-void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]);
+void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]);
/* so we can adjust scale with keeping the struct private */
void BLI_uvproject_camera_info_scale(struct ProjCameraInfo *uci, float scale_x, float scale_y);
@@ -53,5 +52,3 @@ void BLI_uvproject_camera_info_scale(struct ProjCameraInfo *uci, float scale_x,
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh
index 1bb674093bb..df577660f4e 100644
--- a/source/blender/blenlib/BLI_vector.hh
+++ b/source/blender/blenlib/BLI_vector.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_VECTOR_HH__
-#define __BLI_VECTOR_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -832,5 +831,3 @@ template<typename T, int64_t InlineBufferCapacity = default_inline_buffer_capaci
using RawVector = Vector<T, InlineBufferCapacity, RawAllocator>;
} /* namespace blender */
-
-#endif /* __BLI_VECTOR_HH__ */
diff --git a/source/blender/blenlib/BLI_vector_set.hh b/source/blender/blenlib/BLI_vector_set.hh
index f007d41118f..c3b15bcf454 100644
--- a/source/blender/blenlib/BLI_vector_set.hh
+++ b/source/blender/blenlib/BLI_vector_set.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_VECTOR_SET_HH__
-#define __BLI_VECTOR_SET_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -744,5 +743,3 @@ template<typename Key,
using RawVectorSet = VectorSet<Key, ProbingStrategy, Hash, IsEqual, Slot, RawAllocator>;
} // namespace blender
-
-#endif /* __BLI_VECTOR_SET_HH__ */
diff --git a/source/blender/blenlib/BLI_vector_set_slots.hh b/source/blender/blenlib/BLI_vector_set_slots.hh
index 49e6d4daedb..0e75c4690a4 100644
--- a/source/blender/blenlib/BLI_vector_set_slots.hh
+++ b/source/blender/blenlib/BLI_vector_set_slots.hh
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BLI_VECTOR_SET_SLOTS_HH__
-#define __BLI_VECTOR_SET_SLOTS_HH__
+#pragma once
/** \file
* \ingroup bli
@@ -167,5 +166,3 @@ template<typename Key> struct DefaultVectorSetSlot {
};
} // namespace blender
-
-#endif /* __BLI_VECTOR_SET_SLOTS_HH__ */
diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h
index 047a72ec59a..0bb32ca24b7 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenlib/BLI_vfontdata.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_VFONTDATA_H__
-#define __BLI_VFONTDATA_H__
+#pragma once
/** \file
* \ingroup bli
@@ -59,5 +58,3 @@ VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int flag);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/blenlib/BLI_voronoi_2d.h b/source/blender/blenlib/BLI_voronoi_2d.h
index a48f32c283a..92c7d367b48 100644
--- a/source/blender/blenlib/BLI_voronoi_2d.h
+++ b/source/blender/blenlib/BLI_voronoi_2d.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_VORONOI_2D_H__
-#define __BLI_VORONOI_2D_H__
+#pragma once
struct ListBase;
@@ -81,5 +80,3 @@ void BLI_voronoi_triangulate(const VoronoiSite *sites,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_VORONOI_2D_H__ */
diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h
index 82854c57928..eb84f0a27ee 100644
--- a/source/blender/blenlib/BLI_voxel.h
+++ b/source/blender/blenlib/BLI_voxel.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_VOXEL_H__
-#define __BLI_VOXEL_H__
+#pragma once
/** \file
* \ingroup bli
@@ -46,5 +45,3 @@ float BLI_voxel_sample_tricubic(const float *data,
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_VOXEL_H__ */
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index 3d59ad21251..2de6098f6be 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BLI_WINSTUFF_H__
-#define __BLI_WINSTUFF_H__
+#pragma once
/** \file
* \ingroup bli
@@ -111,5 +110,3 @@ int BLI_getInstallationDir(char *str);
#ifdef __cplusplus
}
#endif
-
-#endif /* __BLI_WINSTUFF_H__ */
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index c6e04d4147a..9703c78e19c 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -37,6 +37,7 @@ set(INC_SYS
set(SRC
intern/BLI_args.c
intern/BLI_array.c
+ intern/BLI_assert.c
intern/BLI_dial_2d.c
intern/BLI_dynstr.c
intern/BLI_filelist.c
@@ -110,6 +111,7 @@ set(SRC
intern/rct.c
intern/scanfill.c
intern/scanfill_utils.c
+ intern/session_uuid.c
intern/smallhash.c
intern/sort.c
intern/sort_utils.c
@@ -239,6 +241,7 @@ set(SRC
BLI_rect.h
BLI_resource_collector.hh
BLI_scanfill.h
+ BLI_session_uuid.h
BLI_set.hh
BLI_set_slots.hh
BLI_smallhash.h
diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h
index 21ebc9d4b90..311869e844a 100644
--- a/source/blender/blenlib/PIL_time.h
+++ b/source/blender/blenlib/PIL_time.h
@@ -22,8 +22,7 @@
* \brief Platform independent time functions.
*/
-#ifndef __PIL_TIME_H__
-#define __PIL_TIME_H__
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -51,5 +50,3 @@ void PIL_sleep_ms(int ms);
#ifdef __cplusplus
}
#endif
-
-#endif /* __PIL_TIME_H__ */
diff --git a/source/blender/blenlib/PIL_time_utildefines.h b/source/blender/blenlib/PIL_time_utildefines.h
index ffe753badf8..d404a8b2b8a 100644
--- a/source/blender/blenlib/PIL_time_utildefines.h
+++ b/source/blender/blenlib/PIL_time_utildefines.h
@@ -22,8 +22,7 @@
* \brief Utility defines for timing/benchmarks.
*/
-#ifndef __PIL_TIME_UTILDEFINES_H__
-#define __PIL_TIME_UTILDEFINES_H__
+#pragma once
#include "BLI_utildefines.h" /* for AT */
#include "PIL_time.h" /* for PIL_check_seconds_timer */
@@ -127,5 +126,3 @@
fflush(stdout); \
} \
(void)0
-
-#endif /* __PIL_TIME_UTILDEFINES_H__ */
diff --git a/source/blender/blenlib/intern/BLI_assert.c b/source/blender/blenlib/intern/BLI_assert.c
new file mode 100644
index 00000000000..dc22d035459
--- /dev/null
+++ b/source/blender/blenlib/intern/BLI_assert.c
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup bli
+ *
+ * Helper functions for BLI_assert.h header.
+ */
+
+#include "BLI_assert.h" /* Own include. */
+#include "BLI_system.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void _BLI_assert_print_pos(const char *file, int line, const char *function, const char *id)
+{
+ fprintf(stderr, "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", file, line, function, id);
+}
+
+void _BLI_assert_print_backtrace(void)
+{
+#ifndef NDEBUG
+ BLI_system_backtrace(stderr);
+#endif
+}
+
+/**
+ * Wrap to remove 'noreturn' attribute since this suppresses missing return statements,
+ * allowing changes to debug builds to accidentally to break release builds.
+ *
+ * For example `BLI_assert(0);` at the end of a function that returns a value,
+ * will hide that it's missing a return.
+ */
+void _BLI_assert_abort(void)
+{
+ abort();
+}
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 79f1aa1e640..83750277bf6 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -630,7 +630,7 @@ float dist_squared_ray_to_seg_v3(const float ray_origin[3],
float *r_depth)
{
float lambda, depth;
- if (isect_ray_seg_v3(ray_origin, ray_direction, v0, v1, &lambda)) {
+ if (isect_ray_line_v3(ray_origin, ray_direction, v0, v1, &lambda)) {
if (lambda <= 0.0f) {
copy_v3_v3(r_point, v0);
}
@@ -2129,11 +2129,11 @@ bool isect_ray_seg_v2(const float ray_origin[2],
return false;
}
-bool isect_ray_seg_v3(const float ray_origin[3],
- const float ray_direction[3],
- const float v0[3],
- const float v1[3],
- float *r_lambda)
+bool isect_ray_line_v3(const float ray_origin[3],
+ const float ray_direction[3],
+ const float v0[3],
+ const float v1[3],
+ float *r_lambda)
{
float a[3], t[3], n[3];
sub_v3_v3v3(a, v1, v0);
@@ -2311,109 +2311,171 @@ bool isect_plane_plane_v3(const float plane_a[4],
/**
* Intersect two triangles.
*
- * \param r_i1, r_i2: Optional arguments to retrieve the overlapping edge between the 2 triangles.
+ * \param r_i1, r_i2: Retrieve the overlapping edge between the 2 triangles.
+ * \param r_tri_a_edge_isect_count: Indicates how many edges in the first triangle are intersected.
* \return true when the triangles intersect.
*
+ * \note If it exists, \a r_i1 will be a point on the edge of the 1st triangle.
* \note intersections between coplanar triangles are currently undetected.
*/
-bool isect_tri_tri_epsilon_v3(const float t_a0[3],
- const float t_a1[3],
- const float t_a2[3],
- const float t_b0[3],
- const float t_b1[3],
- const float t_b2[3],
- float r_i1[3],
- float r_i2[3],
- const float epsilon)
-{
- const float *tri_pair[2][3] = {{t_a0, t_a1, t_a2}, {t_b0, t_b1, t_b2}};
- float plane_a[4], plane_b[4];
- float plane_co[3], plane_no[3];
-
- BLI_assert((r_i1 != NULL) == (r_i2 != NULL));
+bool isect_tri_tri_v3_ex(const float tri_a[3][3],
+ const float tri_b[3][3],
+ float r_i1[3],
+ float r_i2[3],
+ int *r_tri_a_edge_isect_count)
+{
+ struct {
+ /* Factor that indicates the position of the intersection point on the line
+ * that intersects the planes of the triangles. */
+ float min, max;
+ /* Intersection point location. */
+ float loc[2][3];
+ } range[2];
+
+ float side[2][3];
+ float ba[3], bc[3], plane_a[4], plane_b[4];
+ *r_tri_a_edge_isect_count = 0;
+
+ sub_v3_v3v3(ba, tri_a[0], tri_a[1]);
+ sub_v3_v3v3(bc, tri_a[2], tri_a[1]);
+ cross_v3_v3v3(plane_a, ba, bc);
+ plane_a[3] = -dot_v3v3(tri_a[1], plane_a);
+ side[1][0] = plane_point_side_v3(plane_a, tri_b[0]);
+ side[1][1] = plane_point_side_v3(plane_a, tri_b[1]);
+ side[1][2] = plane_point_side_v3(plane_a, tri_b[2]);
+
+ if (!side[1][0] && !side[1][1] && !side[1][2]) {
+ /* Coplanar case is not supported. */
+ return false;
+ }
- /* normalizing is needed for small triangles T46007 */
- normal_tri_v3(plane_a, UNPACK3(tri_pair[0]));
- normal_tri_v3(plane_b, UNPACK3(tri_pair[1]));
+ if ((side[1][0] && side[1][1] && side[1][2]) && (side[1][0] < 0.0f) == (side[1][1] < 0.0f) &&
+ (side[1][0] < 0.0f) == (side[1][2] < 0.0f)) {
+ /* All vertices of the 2nd triangle are positioned on the same side to the
+ * plane defined by the 1st triangle. */
+ return false;
+ }
- plane_a[3] = -dot_v3v3(plane_a, t_a0);
- plane_b[3] = -dot_v3v3(plane_b, t_b0);
+ sub_v3_v3v3(ba, tri_b[0], tri_b[1]);
+ sub_v3_v3v3(bc, tri_b[2], tri_b[1]);
+ cross_v3_v3v3(plane_b, ba, bc);
+ plane_b[3] = -dot_v3v3(tri_b[1], plane_b);
+ side[0][0] = plane_point_side_v3(plane_b, tri_a[0]);
+ side[0][1] = plane_point_side_v3(plane_b, tri_a[1]);
+ side[0][2] = plane_point_side_v3(plane_b, tri_a[2]);
+ if ((side[0][0] && side[0][1] && side[0][2]) && (side[0][0] < 0.0f) == (side[0][1] < 0.0f) &&
+ (side[0][0] < 0.0f) == (side[0][2] < 0.0f)) {
+ /* All vertices of the 1st triangle are positioned on the same side to the
+ * plane defined by the 2nd triangle. */
+ return false;
+ }
- if (isect_plane_plane_v3(plane_a, plane_b, plane_co, plane_no) &&
- (normalize_v3(plane_no) > epsilon)) {
- /**
- * Implementation note: its simpler to project the triangles onto the intersection plane
- * before intersecting their edges with the ray, defined by 'isect_plane_plane_v3'.
- * This way we can use 'line_point_factor_v3_ex' to see if an edge crosses 'co_proj',
- * then use the factor to calculate the world-space point.
- */
- struct {
- float min, max;
- } range[2] = {{FLT_MAX, -FLT_MAX}, {FLT_MAX, -FLT_MAX}};
- int t;
- float co_proj[3];
-
- closest_to_plane3_normalized_v3(co_proj, plane_no, plane_co);
-
- /* For both triangles, find the overlap with the line defined by the ray [co_proj, plane_no].
- * When the ranges overlap we know the triangles do too. */
- for (t = 0; t < 2; t++) {
- int j, j_prev;
- float tri_proj[3][3];
-
- closest_to_plane3_normalized_v3(tri_proj[0], plane_no, tri_pair[t][0]);
- closest_to_plane3_normalized_v3(tri_proj[1], plane_no, tri_pair[t][1]);
- closest_to_plane3_normalized_v3(tri_proj[2], plane_no, tri_pair[t][2]);
-
- for (j = 0, j_prev = 2; j < 3; j_prev = j++) {
- /* note that its important to have a very small nonzero epsilon here
- * otherwise this fails for very small faces.
- * However if its too small, large adjacent faces will count as intersecting */
- const float edge_fac = line_point_factor_v3_ex(
- co_proj, tri_proj[j_prev], tri_proj[j], 1e-10f, -1.0f);
- /* ignore collinear lines, they are either an edge shared between 2 tri's
- * (which runs along [co_proj, plane_no], but can be safely ignored).
- *
- * or a collinear edge placed away from the ray -
- * which we don't intersect with & can ignore. */
- if (UNLIKELY(edge_fac == -1.0f)) {
- /* pass */
- }
- /* Important to include 0.0f and 1.0f as one of the triangles vertices may be placed
- * exactly on the plane. In this case both it's edges will have a factor of 0 or 1,
- * but not be going through the plane. See T73566. */
- else if (edge_fac >= 0.0f && edge_fac <= 1.0f) {
- float ix_tri[3];
- float span_fac;
-
- interp_v3_v3v3(ix_tri, tri_pair[t][j_prev], tri_pair[t][j], edge_fac);
- /* the actual distance, since 'plane_no' is normalized */
- span_fac = dot_v3v3(plane_no, ix_tri);
-
- range[t].min = min_ff(range[t].min, span_fac);
- range[t].max = max_ff(range[t].max, span_fac);
- }
+ /* Direction of the line that intersects the planes of the triangles. */
+ float isect_dir[3];
+ cross_v3_v3v3(isect_dir, plane_a, plane_b);
+ for (int i = 0; i < 2; i++) {
+ const float(*tri)[3] = i == 0 ? tri_a : tri_b;
+ /* Rearrange the triangle so that the vertex that is alone on one side
+ * of the plane is located at index 1. */
+ int tri_i[3];
+ if ((side[i][0] && side[i][1]) && (side[i][0] < 0.0f) == (side[i][1] < 0.0f)) {
+ tri_i[0] = 1;
+ tri_i[1] = 2;
+ tri_i[2] = 0;
+ }
+ else if ((side[i][1] && side[i][2]) && (side[i][1] < 0.0f) == (side[i][2] < 0.0f)) {
+ tri_i[0] = 2;
+ tri_i[1] = 0;
+ tri_i[2] = 1;
+ }
+ else {
+ tri_i[0] = 0;
+ tri_i[1] = 1;
+ tri_i[2] = 2;
+ }
+
+ float dot_b = dot_v3v3(isect_dir, tri[tri_i[1]]);
+ range[i].min = dot_b;
+ range[i].max = dot_b;
+
+ float sidec = side[i][tri_i[1]];
+ if (sidec) {
+ float dot_a = dot_v3v3(isect_dir, tri[tri_i[0]]);
+ float dot_c = dot_v3v3(isect_dir, tri[tri_i[2]]);
+ float fac0 = sidec / (sidec - side[i][tri_i[0]]);
+ float fac1 = sidec / (sidec - side[i][tri_i[2]]);
+ float offset0 = fac0 * (dot_a - dot_b);
+ float offset1 = fac1 * (dot_c - dot_b);
+ if (offset0 > offset1) {
+ /* Sort min max. */
+ SWAP(float, offset0, offset1);
+ SWAP(float, fac0, fac1);
+ SWAP(int, tri_i[0], tri_i[2]);
}
- if (range[t].min == FLT_MAX) {
- return false;
- }
+ range[i].min += offset0;
+ range[i].max += offset1;
+ interp_v3_v3v3(range[i].loc[0], tri[tri_i[1]], tri[tri_i[0]], fac0);
+ interp_v3_v3v3(range[i].loc[1], tri[tri_i[1]], tri[tri_i[2]], fac1);
}
+ else {
+ copy_v3_v3(range[i].loc[0], tri[tri_i[1]]);
+ copy_v3_v3(range[i].loc[1], tri[tri_i[1]]);
+ }
+ }
- if (((range[0].min > range[1].max) || (range[0].max < range[1].min)) == 0) {
- if (r_i1 && r_i2) {
- project_plane_normalized_v3_v3v3(plane_co, plane_co, plane_no);
- madd_v3_v3v3fl(r_i1, plane_co, plane_no, max_ff(range[0].min, range[1].min));
- madd_v3_v3v3fl(r_i2, plane_co, plane_no, min_ff(range[0].max, range[1].max));
+ if ((range[0].max >= range[1].min) && (range[0].min <= range[1].max)) {
+ /* The triangles intersect because they overlap on the intersection line.
+ * Now identify the two points of intersection that are in the middle to get the actual
+ * intersection between the triangles. (B--C from A--B--C--D) */
+ if (range[0].min >= range[1].min) {
+ copy_v3_v3(r_i1, range[0].loc[0]);
+ if (range[0].max <= range[1].max) {
+ copy_v3_v3(r_i2, range[0].loc[1]);
+ *r_tri_a_edge_isect_count = 2;
+ }
+ else {
+ copy_v3_v3(r_i2, range[1].loc[1]);
+ *r_tri_a_edge_isect_count = 1;
}
-
- return true;
}
+ else {
+ if (range[0].max <= range[1].max) {
+ copy_v3_v3(r_i1, range[0].loc[1]);
+ copy_v3_v3(r_i2, range[1].loc[0]);
+ *r_tri_a_edge_isect_count = 1;
+ }
+ else {
+ copy_v3_v3(r_i1, range[1].loc[0]);
+ copy_v3_v3(r_i2, range[1].loc[1]);
+ }
+ }
+ return true;
}
return false;
}
+bool isect_tri_tri_v3(const float t_a0[3],
+ const float t_a1[3],
+ const float t_a2[3],
+ const float t_b0[3],
+ const float t_b1[3],
+ const float t_b2[3],
+ float r_i1[3],
+ float r_i2[3])
+{
+ float tri_a[3][3], tri_b[3][3];
+ int dummy;
+ copy_v3_v3(tri_a[0], t_a0);
+ copy_v3_v3(tri_a[1], t_a1);
+ copy_v3_v3(tri_a[2], t_a2);
+ copy_v3_v3(tri_b[0], t_b0);
+ copy_v3_v3(tri_b[1], t_b1);
+ copy_v3_v3(tri_b[2], t_b2);
+ return isect_tri_tri_v3_ex(tri_a, tri_b, r_i1, r_i2, &dummy);
+}
+
/* -------------------------------------------------------------------- */
/** \name Tri-Tri Intersect 2D
*
@@ -3000,7 +3062,7 @@ int isect_line_line_epsilon_v3(const float v1[3],
mul_v3_fl(a, dot_v3v3(cb, ab) / dot_v3v3(ab, ab));
add_v3_v3v3(r_i1, v1, a);
- /* for the second line, just substract the offset from the first intersection point */
+ /* for the second line, just subtract the offset from the first intersection point */
sub_v3_v3v3(r_i2, r_i1, t);
return 2; /* two nearest points */
@@ -4176,8 +4238,8 @@ int interp_sparse_array(float *array, const int list_size, const float skipval)
#define DIR_V2_SET(d_len, va, vb) \
{ \
- sub_v2_v2v2((d_len)->dir, va, vb); \
- (d_len)->len = len_v2((d_len)->dir); \
+ sub_v2db_v2fl_v2fl((d_len)->dir, va, vb); \
+ (d_len)->len = len_v2_db((d_len)->dir); \
} \
(void)0
@@ -4185,8 +4247,8 @@ struct Float3_Len {
float dir[3], len;
};
-struct Float2_Len {
- float dir[2], len;
+struct Double2_Len {
+ double dir[2], len;
};
/* Mean value weights - smooth interpolation weights for polygons with
@@ -4209,21 +4271,30 @@ static float mean_value_half_tan_v3(const struct Float3_Len *d_curr,
return 0.0f;
}
-static float mean_value_half_tan_v2(const struct Float2_Len *d_curr,
- const struct Float2_Len *d_next)
+/**
+ * Mean value weights - same as #mean_value_half_tan_v3 but for 2D vectors.
+ *
+ * \note When interpolating a 2D polygon, a point can be considered "outside"
+ * the polygon's bounds. Thus, when the point is very distant and the vectors
+ * have relatively close values, the precision problems are evident since they
+ * do not indicate a point "inside" the polygon.
+ * To resolve this, doubles are used.
+ */
+static double mean_value_half_tan_v2_db(const struct Double2_Len *d_curr,
+ const struct Double2_Len *d_next)
{
- /* different from the 3d version but still correct */
- const float area = cross_v2v2(d_curr->dir, d_next->dir);
+ /* Different from the 3d version but still correct. */
+ const double area = cross_v2v2_db(d_curr->dir, d_next->dir);
/* Compare against zero since 'FLT_EPSILON' can be too large, see: T73348. */
- if (LIKELY(area != 0.0f)) {
- const float dot = dot_v2v2(d_curr->dir, d_next->dir);
- const float len = d_curr->len * d_next->len;
- const float result = (len - dot) / area;
+ if (LIKELY(area != 0.0)) {
+ const double dot = dot_v2v2_db(d_curr->dir, d_next->dir);
+ const double len = d_curr->len * d_next->len;
+ const double result = (len - dot) / area;
if (isfinite(result)) {
return result;
}
}
- return 0.0f;
+ return 0.0;
}
void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[3])
@@ -4328,11 +4399,11 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
const float eps_sq = eps * eps;
const float *v_curr, *v_next;
- float ht_prev, ht; /* half tangents */
+ double ht_prev, ht; /* half tangents */
float totweight = 0.0f;
int i_curr, i_next;
char ix_flag = 0;
- struct Float2_Len d_curr, d_next;
+ struct Double2_Len d_curr, d_next;
/* loop over 'i_next' */
i_curr = n - 1;
@@ -4343,7 +4414,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
DIR_V2_SET(&d_curr, v_curr - 2 /* v[n - 2] */, co);
DIR_V2_SET(&d_next, v_curr /* v[n - 1] */, co);
- ht_prev = mean_value_half_tan_v2(&d_curr, &d_next);
+ ht_prev = mean_value_half_tan_v2_db(&d_curr, &d_next);
while (i_next < n) {
/* Mark Mayer et al algorithm that is used here does not operate well if vertex is close
@@ -4362,8 +4433,8 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
d_curr = d_next;
DIR_V2_SET(&d_next, v_next, co);
- ht = mean_value_half_tan_v2(&d_curr, &d_next);
- w[i_curr] = (ht_prev + ht) / d_curr.len;
+ ht = mean_value_half_tan_v2_db(&d_curr, &d_next);
+ w[i_curr] = (float)((ht_prev + ht) / d_curr.len);
totweight += w[i_curr];
/* step */
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index ca405907bdd..1b47832589e 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -509,6 +509,12 @@ MINLINE void sub_v3_v3v3_db(double r[3], const double a[3], const double b[3])
r[2] = a[2] - b[2];
}
+MINLINE void sub_v2db_v2fl_v2fl(double r[2], const float a[2], const float b[2])
+{
+ r[0] = (double)a[0] - (double)b[0];
+ r[1] = (double)a[1] - (double)b[1];
+}
+
MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3])
{
r[0] = (double)a[0] - (double)b[0];
@@ -917,6 +923,11 @@ MINLINE float cross_v2v2(const float a[2], const float b[2])
return a[0] * b[1] - a[1] * b[0];
}
+MINLINE double cross_v2v2_db(const double a[2], const double b[2])
+{
+ return a[0] * b[1] - a[1] * b[0];
+}
+
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
{
BLI_assert(r != a && r != b);
@@ -997,6 +1008,11 @@ MINLINE float len_v2(const float v[2])
return sqrtf(v[0] * v[0] + v[1] * v[1]);
}
+MINLINE double len_v2_db(const double v[2])
+{
+ return sqrt(v[0] * v[0] + v[1] * v[1]);
+}
+
MINLINE float len_v2v2(const float v1[2], const float v2[2])
{
float x, y;
diff --git a/source/blender/blenlib/intern/session_uuid.c b/source/blender/blenlib/intern/session_uuid.c
new file mode 100644
index 00000000000..8ed96f02149
--- /dev/null
+++ b/source/blender/blenlib/intern/session_uuid.c
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup bli
+ */
+
+#include "BLI_session_uuid.h"
+
+#include "BLI_utildefines.h"
+
+#include "atomic_ops.h"
+
+/* Special value which indicates the UUID has not been assigned yet. */
+#define BLI_SESSION_UUID_NONE 0
+
+static const SessionUUID global_session_uuid_none = {BLI_SESSION_UUID_NONE};
+
+/* Denotes last used UUID.
+ * It might eventually overflow, and easiest is to add more bits to it. */
+static SessionUUID global_session_uuid = {BLI_SESSION_UUID_NONE};
+
+SessionUUID BLI_session_uuid_generate(void)
+{
+ SessionUUID result;
+ result.uuid_ = atomic_add_and_fetch_uint64(&global_session_uuid.uuid_, 1);
+ if (!BLI_session_uuid_is_generated(&result)) {
+ /* Happens when the UUID overflows.
+ *
+ * Just request the UUID once again, hoping that there are not a lot of high-priority threads
+ * which will overflow the counter once again between the previous call and this one.
+ *
+ * NOTE: It is possible to have collisions after such overflow. */
+ result.uuid_ = atomic_add_and_fetch_uint64(&global_session_uuid.uuid_, 1);
+ }
+ return result;
+}
+
+bool BLI_session_uuid_is_generated(const SessionUUID *uuid)
+{
+ return !BLI_session_uuid_is_equal(uuid, &global_session_uuid_none);
+}
+
+bool BLI_session_uuid_is_equal(const SessionUUID *lhs, const SessionUUID *rhs)
+{
+ return lhs->uuid_ == rhs->uuid_;
+}
+
+uint64_t BLI_session_uuid_hash_uint64(const SessionUUID *uuid)
+{
+ return uuid->uuid_;
+}
+
+uint BLI_session_uuid_ghash_hash(const void *uuid_v)
+{
+ const SessionUUID *uuid = (const SessionUUID *)uuid_v;
+ return uuid->uuid_ & 0xffffffff;
+}
+
+bool BLI_session_uuid_ghash_compare(const void *lhs_v, const void *rhs_v)
+{
+ const SessionUUID *lhs = (const SessionUUID *)lhs_v;
+ const SessionUUID *rhs = (const SessionUUID *)rhs_v;
+ return BLI_session_uuid_is_equal(lhs, rhs);
+}
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index a34c551767a..00fef29587c 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -183,7 +183,7 @@ ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float (*rotmat)[4], float
return NULL;
}
-void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4])
+void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4])
{
float pv[3];