[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22205] trunk/blender/source/gameengine: no need to store the physics env in each KX_GameObject

Campbell Barton ideasman42 at gmail.com
Tue Aug 4 07:14:11 CEST 2009


Revision: 22205
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22205
Author:   campbellbarton
Date:     2009-08-04 07:14:10 +0200 (Tue, 04 Aug 2009)

Log Message:
-----------
no need to store the physics env in each KX_GameObject

Modified Paths:
--------------
    trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    trunk/blender/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
    trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.cpp

Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2009-08-04 03:21:58 UTC (rev 22204)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2009-08-04 05:14:10 UTC (rev 22205)
@@ -1806,7 +1806,6 @@
 	}
 	if (gameobj) 
 	{
-		gameobj->SetPhysicsEnvironment(kxscene->GetPhysicsEnvironment());
 		gameobj->SetLayer(ob->lay);
 		gameobj->SetBlenderObject(ob);
 		/* set the visibility state based on the objects render option in the outliner */

Modified: trunk/blender/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_ConstraintActuator.cpp	2009-08-04 03:21:58 UTC (rev 22204)
+++ trunk/blender/source/gameengine/Ketsji/KX_ConstraintActuator.cpp	2009-08-04 05:14:10 UTC (rev 22205)
@@ -36,6 +36,7 @@
 #include "MT_Matrix3x3.h"
 #include "KX_GameObject.h"
 #include "KX_RayCast.h"
+#include "KX_PythonInit.h" // KX_GetActiveScene
 #include "blendef.h"
 
 #ifdef HAVE_CONFIG_H
@@ -329,7 +330,7 @@
 			}
 			{
 				MT_Point3 topoint = position + (m_maximumBound) * direction;
-				PHY_IPhysicsEnvironment* pe = obj->GetPhysicsEnvironment();
+				PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
 				KX_IPhysicsController *spc = obj->GetPhysicsController();
 
 				if (!pe) {
@@ -442,7 +443,7 @@
 			}
 			normal.normalize();
 			{
-				PHY_IPhysicsEnvironment* pe = obj->GetPhysicsEnvironment();
+				PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
 				KX_IPhysicsController *spc = obj->GetPhysicsController();
 
 				if (!pe) {

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2009-08-04 03:21:58 UTC (rev 22204)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2009-08-04 05:14:10 UTC (rev 22205)
@@ -103,7 +103,6 @@
 	m_bOccluder(false),
 	m_pPhysicsController1(NULL),
 	m_pGraphicController(NULL),
-	m_pPhysicsEnvironment(NULL),
 	m_xray(false),
 	m_pHitObject(NULL),
 	m_isDeformable(false),
@@ -2604,8 +2603,7 @@
 		toDir.normalize();
 		toPoint = fromPoint + (dist) * toDir;
 	}
-
-	PHY_IPhysicsEnvironment* pe = GetPhysicsEnvironment();
+	PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
 	KX_IPhysicsController *spc = GetPhysicsController();
 	KX_GameObject *parent = GetParent();
 	if (!spc && parent)
@@ -2732,7 +2730,7 @@
 		return none_tuple_3();
 	}
 	
-	PHY_IPhysicsEnvironment* pe = GetPhysicsEnvironment();
+	PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
 	KX_IPhysicsController *spc = GetPhysicsController();
 	KX_GameObject *parent = GetParent();
 	if (!spc && parent)

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.h	2009-08-04 03:21:58 UTC (rev 22204)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.h	2009-08-04 05:14:10 UTC (rev 22205)
@@ -94,8 +94,6 @@
 
 	KX_IPhysicsController*				m_pPhysicsController1;
 	PHY_IGraphicController*				m_pGraphicController;
-	// used for ray casting
-	PHY_IPhysicsEnvironment*			m_pPhysicsEnvironment;
 	STR_String							m_testPropName;
 	bool								m_xray;
 	KX_GameObject*						m_pHitObject;
@@ -334,21 +332,7 @@
 		bool ang_vel_local
 	);
 
-
 	/**
-	 * @return a pointer to the physics environment in use during the game, for rayCasting
-	 */
-	PHY_IPhysicsEnvironment* GetPhysicsEnvironment()
-	{
-		return m_pPhysicsEnvironment;
-	}
-
-	void SetPhysicsEnvironment(PHY_IPhysicsEnvironment* physicsEnvironment)
-	{
-		m_pPhysicsEnvironment = physicsEnvironment;
-	}
-
-	/**
 	 * @return a pointer to the physics controller owned by this class.
 	 */
 

Modified: trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.cpp
===================================================================
--- trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.cpp	2009-08-04 03:21:58 UTC (rev 22204)
+++ trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.cpp	2009-08-04 05:14:10 UTC (rev 22205)
@@ -126,10 +126,7 @@
 		RAS_MaterialBucket* bucket = *bit;
 		RAS_MeshSlot* ms;
 		// remove the mesh slot form the list, it culls them automatically for next frame
-		for(ms = bucket->GetNextActiveMeshSlot();
-			ms!= NULL;
-			ms = bucket->GetNextActiveMeshSlot())
-		{
+		while((ms = bucket->GetNextActiveMeshSlot())) {
 			slots[i++].set(ms, bucket, pnorm);
 		}
 	}
@@ -179,9 +176,7 @@
 		RAS_MaterialBucket* bucket = *bit;
 		RAS_MeshSlot* ms;
 		// remove the mesh slot form the list, it culls them automatically for next frame
-		for(ms = bucket->GetNextActiveMeshSlot();
-			ms!= NULL;
-			ms = bucket->GetNextActiveMeshSlot())
+		while((ms = bucket->GetNextActiveMeshSlot()))
 		{
 			rendertools->SetClientObject(rasty, ms->m_clientObj);
 			while (bucket->ActivateMaterial(cameratrans, rasty, rendertools))





More information about the Bf-blender-cvs mailing list