[Bf-blender-cvs] [105c6a6] free-refcount-ids: Free IDs: Action & Armature.

Bastien Montagne noreply at git.blender.org
Thu Oct 1 17:44:24 CEST 2015


Commit: 105c6a6c26ca2e2e8dddfc6eb9281fcfabf8dde4
Author: Bastien Montagne
Date:   Thu Oct 1 16:57:28 2015 +0200
Branches: free-refcount-ids
https://developer.blender.org/rB105c6a6c26ca2e2e8dddfc6eb9281fcfabf8dde4

Free IDs: Action & Armature.

===================================================================

M	source/blender/blenkernel/BKE_action.h
M	source/blender/blenkernel/BKE_armature.h
M	source/blender/blenkernel/intern/action.c
M	source/blender/blenkernel/intern/armature.c
M	source/blender/blenkernel/intern/library.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 3fceef5..e9adec8 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -61,7 +61,7 @@ struct bAction *add_empty_action(struct Main *bmain, const char name[]);
 struct bAction *BKE_action_copy(struct bAction *src);
 
 /* Deallocate all of the Action's data, but not the Action itself */
-void BKE_action_free(struct bAction *act);
+void BKE_action_free(struct bAction *act, const bool do_id_user);
 
 // XXX is this needed?
 void BKE_action_make_local(struct bAction *act);
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index e1885e4..80066cd 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -73,7 +73,7 @@ extern "C" {
 struct bArmature *BKE_armature_add(struct Main *bmain, const char *name);
 struct bArmature *BKE_armature_from_object(struct Object *ob);
 void BKE_armature_bonelist_free(struct ListBase *lb);
-void BKE_armature_free(struct bArmature *arm);
+void BKE_armature_free(struct bArmature *arm, const bool do_id_user);
 void BKE_armature_make_local(struct bArmature *arm);
 struct bArmature *BKE_armature_copy(struct bArmature *arm);
 
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index b77ae45..32b174d 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -159,22 +159,16 @@ void BKE_action_make_local(bAction *act)
 
 /* .................................. */
 
-void BKE_action_free(bAction *act)
-{
-	/* sanity check */
-	if (act == NULL)
-		return;
-	
+void BKE_action_free(bAction *act, const bool UNUSED(do_id_user))
+{	
 	/* Free F-Curves */
 	free_fcurves(&act->curves);
 	
 	/* Free groups */
-	if (act->groups.first)
-		BLI_freelistN(&act->groups);
+	BLI_freelistN(&act->groups);
 		
 	/* Free pose-references (aka local markers) */
-	if (act->markers.first)
-		BLI_freelistN(&act->markers);
+	BLI_freelistN(&act->markers);
 }
 
 /* .................................. */
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 6afe7f1..1bc86d8 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -106,30 +106,24 @@ void BKE_armature_bonelist_free(ListBase *lb)
 	BLI_freelistN(lb);
 }
 
-void BKE_armature_free(bArmature *arm)
+void BKE_armature_free(bArmature *arm, const bool UNUSED(do_id_user))
 {
-	if (arm) {
-		BKE_armature_bonelist_free(&arm->bonebase);
+	BKE_animdata_free(&arm->id);
 
-		/* free editmode data */
-		if (arm->edbo) {
-			BLI_freelistN(arm->edbo);
+	BKE_armature_bonelist_free(&arm->bonebase);
 
-			MEM_freeN(arm->edbo);
-			arm->edbo = NULL;
-		}
+	/* free editmode data */
+	if (arm->edbo) {
+		BLI_freelistN(arm->edbo);
 
-		/* free sketch */
-		if (arm->sketch) {
-			freeSketch(arm->sketch);
-			arm->sketch = NULL;
-		}
+		MEM_freeN(arm->edbo);
+		arm->edbo = NULL;
+	}
 
-		/* free animation data */
-		if (arm->adt) {
-			BKE_animdata_free(&arm->id);
-			arm->adt = NULL;
-		}
+	/* free sketch */
+	if (arm->sketch) {
+		freeSketch(arm->sketch);
+		arm->sketch = NULL;
 	}
 }
 
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 0244b97..c472332 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1009,10 +1009,10 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, bool do_id_user)
 			BKE_group_free((Group *)id);
 			break;
 		case ID_AR:
-			BKE_armature_free((bArmature *)id);
+			BKE_armature_free((bArmature *)id, do_id_user);
 			break;
 		case ID_AC:
-			BKE_action_free((bAction *)id);
+			BKE_action_free((bAction *)id, do_id_user);
 			break;
 		case ID_NT:
 			ntreeFreeTree_ex((bNodeTree *)id, do_id_user);  /* TODO! */




More information about the Bf-blender-cvs mailing list