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/blenkernel/intern/linestyle.c')
-rw-r--r--source/blender/blenkernel/intern/linestyle.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 0875321a779..ac2c4e35dce 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -123,43 +123,24 @@ FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, const char *name)
return linestyle;
}
-/**
- * Free (or release) any data used by this linestyle (does not free the linestyle itself).
- *
- * \param linestyle The linestyle to free.
- * \param do_id_user When \a true, ID datablocks used (referenced) by this linestyle are 'released'
- * (their user count is decreased).
- */
-void BKE_linestyle_free(FreestyleLineStyle *linestyle, const bool do_id_user)
+void BKE_linestyle_free(FreestyleLineStyle *linestyle)
{
LineStyleModifier *m;
- int a;
-
- if (do_id_user) {
- MTex *mtex;
-
- for (a = 0; a < MAX_MTEX; a++) {
- mtex = linestyle->mtex[a];
- if (mtex && mtex->tex) {
- id_us_min(&mtex->tex->id);
- mtex->tex = NULL;
- }
- }
- }
- BKE_animdata_free(&linestyle->id);
+ MTex *mtex;
+ int a;
for (a = 0; a < MAX_MTEX; a++) {
- MEM_SAFE_FREE(linestyle->mtex[a]);
+ mtex = linestyle->mtex[a];
+ if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (mtex) MEM_freeN(mtex);
}
-
- /* is no lib link block, but linestyle extension */
if (linestyle->nodetree) {
- ntreeFreeTree(linestyle->nodetree, true); /* XXX Or do_id_user? */
+ ntreeFreeTree(linestyle->nodetree);
MEM_freeN(linestyle->nodetree);
- linestyle->nodetree = NULL;
}
+ BKE_animdata_free(&linestyle->id);
while ((m = (LineStyleModifier *)linestyle->color_modifiers.first))
BKE_linestyle_color_modifier_remove(linestyle, m);
while ((m = (LineStyleModifier *)linestyle->alpha_modifiers.first))
@@ -177,7 +158,7 @@ FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle *l
int a;
new_linestyle = BKE_linestyle_new(bmain, linestyle->id.name + 2);
- BKE_linestyle_free(new_linestyle, true);
+ BKE_linestyle_free(new_linestyle);
for (a = 0; a < MAX_MTEX; a++) {
if (linestyle->mtex[a]) {