[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49386] branches/soc-2011-tomato: Merging r49362 through r49385 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Mon Jul 30 09:53:06 CEST 2012


Revision: 49386
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49386
Author:   nazgul
Date:     2012-07-30 07:53:05 +0000 (Mon, 30 Jul 2012)
Log Message:
-----------
Merging r49362 through r49385 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49362
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49385

Modified Paths:
--------------
    branches/soc-2011-tomato/extern/bullet2/readme.txt
    branches/soc-2011-tomato/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
    branches/soc-2011-tomato/source/blender/ikplugin/intern/itasc_plugin.cpp
    branches/soc-2011-tomato/source/gameengine/Converter/BL_SkinDeformer.cpp
    branches/soc-2011-tomato/source/gameengine/Ketsji/KX_KetsjiEngine.cpp

Added Paths:
-----------
    branches/soc-2011-tomato/extern/bullet2/patches/ghost_character.patch

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-49361
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-49385

Copied: branches/soc-2011-tomato/extern/bullet2/patches/ghost_character.patch (from rev 49385, trunk/blender/extern/bullet2/patches/ghost_character.patch)
===================================================================
--- branches/soc-2011-tomato/extern/bullet2/patches/ghost_character.patch	                        (rev 0)
+++ branches/soc-2011-tomato/extern/bullet2/patches/ghost_character.patch	2012-07-30 07:53:05 UTC (rev 49386)
@@ -0,0 +1,28 @@
+Index: extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
+===================================================================
+--- extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp	(revision 49183)
++++ extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp	(working copy)
+@@ -77,6 +77,9 @@
+ 		if (convexResult.m_hitCollisionObject == m_me)
+ 			return btScalar(1.0);
+ 
++		if (!convexResult.m_hitCollisionObject->hasContactResponse())
++			return btScalar(1.0);
++
+ 		btVector3 hitNormalWorld;
+ 		if (normalInWorldSpace)
+ 		{
+@@ -173,7 +176,12 @@
+ 		m_manifoldArray.resize(0);
+ 
+ 		btBroadphasePair* collisionPair = &m_ghostObject->getOverlappingPairCache()->getOverlappingPairArray()[i];
+-		
++		btCollisionObject* obj0 = static_cast<btCollisionObject*>(collisionPair->m_pProxy0->m_clientObject);
++		btCollisionObject* obj1 = static_cast<btCollisionObject*>(collisionPair->m_pProxy1->m_clientObject);
++
++		if ((obj0 && !obj0->hasContactResponse()) || (obj1 && !obj1->hasContactResponse()))
++			continue;
++
+ 		if (collisionPair->m_algorithm)
+ 			collisionPair->m_algorithm->getAllContactManifolds(m_manifoldArray);
+ 

Modified: branches/soc-2011-tomato/extern/bullet2/readme.txt
===================================================================
--- branches/soc-2011-tomato/extern/bullet2/readme.txt	2012-07-30 07:45:37 UTC (rev 49385)
+++ branches/soc-2011-tomato/extern/bullet2/readme.txt	2012-07-30 07:53:05 UTC (rev 49386)
@@ -13,3 +13,7 @@
 Apply patches/make_id.patch to prevent duplicated define of MAKE_ID macro in blender
 side and bullet side.
 Sergey
+
+Apply patches/ghost_character.path to prevent characters from colliding with ghost objects.
+Mitchell
+

Modified: branches/soc-2011-tomato/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
===================================================================
--- branches/soc-2011-tomato/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp	2012-07-30 07:45:37 UTC (rev 49385)
+++ branches/soc-2011-tomato/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp	2012-07-30 07:53:05 UTC (rev 49386)
@@ -77,6 +77,9 @@
 		if (convexResult.m_hitCollisionObject == m_me)
 			return btScalar(1.0);
 
+		if (!convexResult.m_hitCollisionObject->hasContactResponse())
+			return btScalar(1.0);
+
 		btVector3 hitNormalWorld;
 		if (normalInWorldSpace)
 		{
@@ -173,7 +176,12 @@
 		m_manifoldArray.resize(0);
 
 		btBroadphasePair* collisionPair = &m_ghostObject->getOverlappingPairCache()->getOverlappingPairArray()[i];
-		
+		btCollisionObject* obj0 = static_cast<btCollisionObject*>(collisionPair->m_pProxy0->m_clientObject);
+		btCollisionObject* obj1 = static_cast<btCollisionObject*>(collisionPair->m_pProxy1->m_clientObject);
+
+		if ((obj0 && !obj0->hasContactResponse()) || (obj1 && !obj1->hasContactResponse()))
+			continue;
+
 		if (collisionPair->m_algorithm)
 			collisionPair->m_algorithm->getAllContactManifolds(m_manifoldArray);
 


Property changes on: branches/soc-2011-tomato/source/blender/editors/interface/interface.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-49361
   + /branches/ge_candy/source/blender/editors/interface/interface.c:45070-46163
/branches/ge_harmony/source/blender/editors/interface/interface.c:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber/source/blender/editors/interface/interface.c:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers/source/blender/editors/interface/interface.c:38694-39989
/trunk/blender/source/blender/editors/interface/interface.c:36831-49385


Property changes on: branches/soc-2011-tomato/source/blender/editors/space_outliner
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-49361
   + /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/trunk/blender/source/blender/editors/space_outliner:36831-49385

Modified: branches/soc-2011-tomato/source/blender/ikplugin/intern/itasc_plugin.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/ikplugin/intern/itasc_plugin.cpp	2012-07-30 07:45:37 UTC (rev 49385)
+++ branches/soc-2011-tomato/source/blender/ikplugin/intern/itasc_plugin.cpp	2012-07-30 07:53:05 UTC (rev 49386)
@@ -1256,7 +1256,7 @@
 			ret = arm->addSegment(joint, parent, KDL::Joint::TransY, rot[ikchan->ndof - 1]);
 			const float ikstretch = pchan->ikstretch * pchan->ikstretch;
 			/* why invert twice here? */
-			weight[1] = (1.0 - minf(1.0 - ikstretch, 1.0f - IK_STRETCH_STIFF_EPS));
+			weight[1] = (1.0 - minf(1.0 - ikstretch, 1.0f - 0.001f));
 			weights.push_back(weight[1]);
 		}
 		if (!ret)

Modified: branches/soc-2011-tomato/source/gameengine/Converter/BL_SkinDeformer.cpp
===================================================================
--- branches/soc-2011-tomato/source/gameengine/Converter/BL_SkinDeformer.cpp	2012-07-30 07:45:37 UTC (rev 49385)
+++ branches/soc-2011-tomato/source/gameengine/Converter/BL_SkinDeformer.cpp	2012-07-30 07:53:05 UTC (rev 49386)
@@ -238,6 +238,7 @@
 	MDeformVert *dverts = m_bmesh->dvert;
 	bDeformGroup *dg;
 	int defbase_tot = BLI_countlist(&m_objMesh->defbase);
+	Eigen::Matrix4f pre_mat, post_mat, chan_mat, norm_chan_mat;
 
 	if (!dverts)
 		return;
@@ -257,15 +258,18 @@
 		}
 	}
 
+	post_mat = Eigen::Matrix4f::Map((float*)m_obmat).inverse() * Eigen::Matrix4f::Map((float*)m_armobj->GetArmatureObject()->obmat);
+	pre_mat = post_mat.inverse();
+
 	MDeformVert *dv= dverts;
+	MDeformWeight *dw;
 
 	for (int i=0; i<m_bmesh->totvert; ++i, dv++)
 	{
-		float contrib = 0.f, weight, max_weight=0.f;
+		float contrib = 0.f, weight, max_weight=-1.f;
 		bPoseChannel *pchan=NULL;
-		Eigen::Map<Eigen::Vector3f> norm(m_transnors[i]);
+		Eigen::Map<Eigen::Vector3f> norm = Eigen::Vector3f::Map(m_transnors[i]);
 		Eigen::Vector4f vec(0, 0, 0, 1);
-		Eigen::Matrix4f norm_chan_mat;
 		Eigen::Vector4f co(m_transverts[i][0],
 							m_transverts[i][1],
 							m_transverts[i][2],
@@ -274,8 +278,10 @@
 		if (!dv->totweight)
 			continue;
 
-		MDeformWeight *dw= dv->dw;
+		co = pre_mat * co;
 
+		dw= dv->dw;
+
 		for (unsigned int j= dv->totweight; j != 0; j--, dw++)
 		{
 			const int index = dw->def_nr;
@@ -286,12 +292,10 @@
 
 				if (weight)
 				{
-					Eigen::Vector4f cop(co);
-					Eigen::Matrix4f chan_mat = Eigen::Matrix4f::Map((float*)pchan->chan_mat);
+					chan_mat = Eigen::Matrix4f::Map((float*)pchan->chan_mat);
 
 					// Update Vertex Position
-					cop = chan_mat*cop;
-					vec += (cop - co)*weight;
+					vec.noalias() += (chan_mat*co - co)*weight;
 
 					// Save the most influential channel so we can use it to update the vertex normal
 					if (weight > max_weight)
@@ -304,17 +308,15 @@
 				}
 			}
 		}
-
 		
 		// Update Vertex Normal
 		norm = norm_chan_mat.topLeftCorner<3, 3>()*norm;
-				
-		if (contrib > 0.0001f)
-		{
-			vec *= 1.f/contrib;
-			co += vec;
-		}
 
+		co.noalias() += vec/contrib;
+		co[3] = 1.f; // Make sure we have a 1 for the w component!
+
+		co = post_mat * co;
+
 		m_transverts[i][0] = co[0];
 		m_transverts[i][1] = co[1];
 		m_transverts[i][2] = co[2];

Modified: branches/soc-2011-tomato/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
===================================================================
--- branches/soc-2011-tomato/source/gameengine/Ketsji/KX_KetsjiEngine.cpp	2012-07-30 07:45:37 UTC (rev 49385)
+++ branches/soc-2011-tomato/source/gameengine/Ketsji/KX_KetsjiEngine.cpp	2012-07-30 07:53:05 UTC (rev 49386)
@@ -784,21 +784,21 @@
 	// Handle the animations independently of the logic time step
 	if (GetRestrictAnimationFPS())
 	{
-		m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true);
+		double clocktime = m_kxsystem->GetTimeInSeconds();
+		m_logger->StartLog(tc_animations, clocktime, true);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list