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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-12-17 03:56:18 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-12-17 03:56:18 +0400
commit4d6c34462c1473afb6a0896f97bc5cd2393d0171 (patch)
tree2d889285b713fbb05b64e64981d4e982cb85b658 /source/blender/blenlib/intern
parent6f24642a2d5ff7754cf15c3cf21a89e2db54555d (diff)
Fix #29640: make duplicates release keep hierarchy and parent properties not
working for multiple objects. ID.newid only worked for one object, now it uses a hash instead.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index c1894088300..13f33f01420 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -285,3 +285,31 @@ unsigned int BLI_ghashutil_strhash(const void *ptr) {
int BLI_ghashutil_strcmp(const void *a, const void *b) {
return strcmp(a, b);
}
+
+GHashPair *BLI_ghashutil_pairalloc(const void *first, int second) {
+ GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair");
+ pair->first = first;
+ pair->second = second;
+ return pair;
+}
+
+unsigned int BLI_ghashutil_pairhash(const void *ptr) {
+ const GHashPair *pair = ptr;
+ unsigned int hash = BLI_ghashutil_ptrhash(pair->first);
+ return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second));
+}
+
+int BLI_ghashutil_paircmp(const void *a, const void *b) {
+ const GHashPair *A = a;
+ const GHashPair *B = b;
+
+ int cmp = BLI_ghashutil_ptrcmp(A->first, B->first);
+ if(cmp == 0)
+ return BLI_ghashutil_intcmp(SET_INT_IN_POINTER(A->second), SET_INT_IN_POINTER(B->second));
+ return cmp;
+}
+
+void BLI_ghashutil_pairfree(const void *ptr) {
+ MEM_freeN((void*)ptr);
+}
+