[Bf-blender-cvs] [d2fac7d] master: BGE: Fix T45544 Adding Armatures takes an increasing amount of logic time

Porteries Tristan noreply at git.blender.org
Fri Jul 24 17:10:08 CEST 2015


Commit: d2fac7df32889a8a8da2f08f0b7c7af6869fb888
Author: Porteries Tristan
Date:   Fri Jul 24 17:05:38 2015 +0200
Branches: master
https://developer.blender.org/rBd2fac7df32889a8a8da2f08f0b7c7af6869fb888

BGE: Fix T45544 Adding Armatures takes an increasing amount of logic time

Armatures were not totaly freed (only the armature object not the armature) and the original armature user count was not decrease after replication.

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

M	source/gameengine/Converter/BL_ArmatureObject.cpp

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

diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 795a7a9..fb5055c 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -230,6 +230,8 @@ BL_ArmatureObject::BL_ArmatureObject(
 	m_origObjArma = armature; // Keep a copy of the original armature so we can fix drivers later
 	m_objArma = BKE_object_copy(armature);
 	m_objArma->data = BKE_armature_copy((bArmature *)armature->data);
+	// During object replication ob->data is increase, we decrease it now because we get a copy.
+	id_us_min(&((bArmature *)m_origObjArma->data)->id);
 	m_pose = m_objArma->pose;
     // need this to get iTaSC working ok in the BGE
     m_pose->flag |= POSE_GAME_ENGINE;
@@ -250,8 +252,10 @@ BL_ArmatureObject::~BL_ArmatureObject()
 		delete channel;
 	}
 
-	if (m_objArma)
+	if (m_objArma) {
+		BKE_libblock_free(G.main, m_objArma->data);
 		BKE_libblock_free(G.main, m_objArma);
+	}
 }




More information about the Bf-blender-cvs mailing list