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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-11-09 21:47:10 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-11-09 23:00:53 +0300
commit865796375bcfa6be4288cca4243dddcb4092f70b (patch)
tree5264d4b9b0f9d392b6e1b942e0f6fd802de1fff4 /source/blender/blenkernel/intern/freestyle.c
parentcf959a879eb5ffbdfa573c5f3a00965e69d7a976 (diff)
Cleanup: avoid incrementing/decrementing id->us outside of BKE_library.
We have callbacks for that, they also do some checks and help ensure things are done correctly. Only place where this is assumed not true is blenloader (since here we may affect refcount of library IDs as well...).
Diffstat (limited to 'source/blender/blenkernel/intern/freestyle.c')
-rw-r--r--source/blender/blenkernel/intern/freestyle.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c
index f6c4263cff7..3a15be5a09d 100644
--- a/source/blender/blenkernel/intern/freestyle.c
+++ b/source/blender/blenkernel/intern/freestyle.c
@@ -35,6 +35,7 @@
#include "DNA_group_types.h"
#include "BKE_freestyle.h"
+#include "BKE_library.h"
#include "BKE_linestyle.h"
#include "BLI_blenlib.h"
@@ -65,11 +66,11 @@ void BKE_freestyle_config_free(FreestyleConfig *config)
for (lineset = (FreestyleLineSet *)config->linesets.first; lineset; lineset = lineset->next) {
if (lineset->group) {
- lineset->group->id.us--;
+ id_us_min(&lineset->group->id);
lineset->group = NULL;
}
if (lineset->linestyle) {
- lineset->linestyle->id.us--;
+ id_us_min(&lineset->linestyle->id);
lineset->linestyle = NULL;
}
}
@@ -107,7 +108,7 @@ static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *linese
{
new_lineset->linestyle = lineset->linestyle;
if (new_lineset->linestyle)
- new_lineset->linestyle->id.us++;
+ id_us_plus(&new_lineset->linestyle->id);
new_lineset->flags = lineset->flags;
new_lineset->selection = lineset->selection;
new_lineset->qi = lineset->qi;
@@ -117,7 +118,7 @@ static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *linese
new_lineset->exclude_edge_types = lineset->exclude_edge_types;
new_lineset->group = lineset->group;
if (new_lineset->group) {
- new_lineset->group->id.us++;
+ id_us_plus(&new_lineset->group->id);
}
strcpy(new_lineset->name, lineset->name);
}
@@ -215,10 +216,10 @@ bool BKE_freestyle_lineset_delete(FreestyleConfig *config, FreestyleLineSet *lin
if (BLI_findindex(&config->linesets, lineset) == -1)
return false;
if (lineset->group) {
- lineset->group->id.us--;
+ id_us_min(&lineset->group->id);
}
if (lineset->linestyle) {
- lineset->linestyle->id.us--;
+ id_us_min(&lineset->linestyle->id);
}
BLI_remlink(&config->linesets, lineset);
MEM_freeN(lineset);