diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-01 12:03:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-01 12:03:25 +0300 |
commit | b65ea517eb932bde950bde51979c6a3fd258efa8 (patch) | |
tree | 8f3a291a7e1778bb3af45cdb1d98a621efbd1a7d /source/blender/blenlib | |
parent | 916c91bd08933d596eaca3e369467daf7964612e (diff) | |
parent | 473f17b3d557adbb06b89e0a186be48a0129086d (diff) |
Merge branch 'master' into blender2.8
- Undo that changes modes currently asserts,
since undo is now screen data.
Most likely we will change how object mode and workspaces work
since it's not practical/maintainable at the moment.
- Removed view_layer from particle settings
(wasn't needed and complicated undo).
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_sort_utils.h | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/sort_utils.c | 22 |
2 files changed, 27 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_sort_utils.h b/source/blender/blenlib/BLI_sort_utils.h index e08f4e5ac83..f6bd80b30d3 100644 --- a/source/blender/blenlib/BLI_sort_utils.h +++ b/source/blender/blenlib/BLI_sort_utils.h @@ -32,7 +32,7 @@ * \note keep \a sort_value first, * so cmp functions can be reused. */ -struct SortPointerByFloat { +struct SortPtrByFloat { float sort_value; void *data; }; @@ -42,7 +42,7 @@ struct SortIntByFloat { int data; }; -struct SortPointerByInt { +struct SortPtrByInt { int sort_value; void *data; }; @@ -58,4 +58,7 @@ int BLI_sortutil_cmp_float_reverse(const void *a_, const void *b_); int BLI_sortutil_cmp_int(const void *a_, const void *b_); int BLI_sortutil_cmp_int_reverse(const void *a_, const void *b_); +int BLI_sortutil_cmp_ptr(const void *a_, const void *b_); +int BLI_sortutil_cmp_ptr_reverse(const void *a_, const void *b_); + #endif /* __BLI_SORT_UTILS_H__ */ diff --git a/source/blender/blenlib/intern/sort_utils.c b/source/blender/blenlib/intern/sort_utils.c index c75e8e7455f..2d55e77b98b 100644 --- a/source/blender/blenlib/intern/sort_utils.c +++ b/source/blender/blenlib/intern/sort_utils.c @@ -37,6 +37,10 @@ struct SortAnyByInt { int sort_value; }; +struct SortAnyByPtr { + const void *sort_value; +}; + int BLI_sortutil_cmp_float(const void *a_, const void *b_) { const struct SortAnyByFloat *a = a_; @@ -72,3 +76,21 @@ int BLI_sortutil_cmp_int_reverse(const void *a_, const void *b_) else if (a->sort_value > b->sort_value) return -1; else return 0; } + +int BLI_sortutil_cmp_ptr(const void *a_, const void *b_) +{ + const struct SortAnyByPtr *a = a_; + const struct SortAnyByPtr *b = b_; + if (a->sort_value > b->sort_value) return 1; + else if (a->sort_value < b->sort_value) return -1; + else return 0; +} + +int BLI_sortutil_cmp_ptr_reverse(const void *a_, const void *b_) +{ + const struct SortAnyByPtr *a = a_; + const struct SortAnyByPtr *b = b_; + if (a->sort_value < b->sort_value) return 1; + else if (a->sort_value > b->sort_value) return -1; + else return 0; +} |