From 87b974caa1e2b780c8031d67a42488039036c489 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 10 Jul 2016 14:52:00 +0200 Subject: Cleanup/Refactor: pass Main pointer to all ID copy functions. Also allows us to get rid of a few _copy_ex() versions... --- source/gameengine/Converter/BL_ArmatureObject.cpp | 8 ++++---- source/gameengine/Converter/BL_ShapeDeformer.cpp | 6 +++--- source/gameengine/Converter/KX_BlenderSceneConverter.cpp | 6 +++--- source/gameengine/Ketsji/BL_Action.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index a1819a8dc92..a5af525e13a 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -233,8 +233,8 @@ BL_ArmatureObject::BL_ArmatureObject( m_lastapplyframe(0.0) { 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); + m_objArma = BKE_object_copy(G.main, armature); + m_objArma->data = BKE_armature_copy(G.main, (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; @@ -433,8 +433,8 @@ void BL_ArmatureObject::ProcessReplica() KX_GameObject::ProcessReplica(); bArmature* tmp = (bArmature*)m_objArma->data; - m_objArma = BKE_object_copy(m_objArma); - m_objArma->data = BKE_armature_copy(tmp); + m_objArma = BKE_object_copy(G.main, m_objArma); + m_objArma->data = BKE_armature_copy(G.main, tmp); m_pose = m_objArma->pose; } diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp index ef9e9544c30..94256a64d75 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.cpp +++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp @@ -75,7 +75,7 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj, m_useShapeDrivers(false), m_lastShapeUpdate(-1) { - m_key = m_bmesh->key ? BKE_key_copy(m_bmesh->key) : NULL; + m_key = m_bmesh->key ? BKE_key_copy(G.main, m_bmesh->key) : NULL; }; /* this second constructor is needed for making a mesh deformable on the fly. */ @@ -91,7 +91,7 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj, m_useShapeDrivers(false), m_lastShapeUpdate(-1) { - m_key = m_bmesh->key ? BKE_key_copy(m_bmesh->key) : NULL; + m_key = m_bmesh->key ? BKE_key_copy(G.main, m_bmesh->key) : NULL; }; BL_ShapeDeformer::~BL_ShapeDeformer() @@ -117,7 +117,7 @@ void BL_ShapeDeformer::ProcessReplica() BL_SkinDeformer::ProcessReplica(); m_lastShapeUpdate = -1; - m_key = m_key ? BKE_key_copy(m_key) : NULL; + m_key = m_key ? BKE_key_copy(G.main, m_key) : NULL; } bool BL_ShapeDeformer::LoadShapeDrivers(KX_GameObject* parent) diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index b97d0b2a85d..08b569fa4c2 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -1425,7 +1425,7 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene *kx_scene, #ifdef DEBUG printf("Mesh has a user \"%s\"\n", name); #endif - me = (ID*)BKE_mesh_copy_ex(from_maggie, (Mesh*)me); + me = (ID*)BKE_mesh_copy(from_maggie, (Mesh*)me); id_us_min(me); } BLI_remlink(&from_maggie->mesh, me); /* even if we made the copy it needs to be removed */ @@ -1447,12 +1447,12 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene *kx_scene, /* if its tagged its a replaced material */ if (mat_old && (mat_old->id.tag & LIB_TAG_DOIT) == 0) { Material *mat_old = mesh->mat[i]; - Material *mat_new = BKE_material_copy(mat_old); + Material *mat_new = BKE_material_copy(from_maggie, mat_old); mat_new->id.tag |= LIB_TAG_DOIT; id_us_min(&mat_old->id); - BLI_remlink(&G.main->mat, mat_new); // BKE_material_copy uses G.main, and there is no BKE_material_copy_ex + BLI_remlink(&from_maggie->mat, mat_new); // BKE_material_copy uses G.main, and there is no BKE_material_copy_ex BLI_addtail(&maggie->mat, mat_new); mesh->mat[i] = mat_new; diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 45946f30827..7175eb877dd 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -161,7 +161,7 @@ bool BL_Action::Play(const char* name, BKE_libblock_free(G.main, m_tmpaction); m_tmpaction = NULL; } - m_tmpaction = BKE_action_copy(m_action); + m_tmpaction = BKE_action_copy(G.main, m_action); // First get rid of any old controllers ClearControllerList(); -- cgit v1.2.3