[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37933] branches/soc-2011-pepper/source/ gameengine: BGE Animations: Beginning work on layer blending.

Mitchell Stokes mogurijin at gmail.com
Wed Jun 29 04:42:46 CEST 2011


Revision: 37933
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37933
Author:   moguri
Date:     2011-06-29 02:42:46 +0000 (Wed, 29 Jun 2011)
Log Message:
-----------
BGE Animations: Beginning work on layer blending. Blending armature actions works, but needs more testing. Also, currently the mode is forced to ADD and the weight to 1.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.cpp
    branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.h
    branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp
    branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp

Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.cpp	2011-06-29 01:53:17 UTC (rev 37932)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.cpp	2011-06-29 02:42:46 UTC (rev 37933)
@@ -137,10 +137,8 @@
 
 
 /* Only allowed for Poses with identical channels */
-void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
-{
-	short mode= ACTSTRIPMODE_BLEND;
-	
+void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode)
+{	
 	bPoseChannel *dchan;
 	const bPoseChannel *schan;
 	bConstraint *dcon, *scon;
@@ -152,8 +150,6 @@
 		dstweight = 1.0F - srcweight;
 		break;
 	case ACTSTRIPMODE_ADD:
-		dstweight = 1.0F;
-		break;
 	default :
 		dstweight = 1.0F;
 	}

Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.h	2011-06-29 01:53:17 UTC (rev 37932)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ArmatureObject.h	2011-06-29 02:42:46 UTC (rev 37933)
@@ -145,7 +145,7 @@
 };
 
 /* Pose function specific to the game engine */
-void game_blend_poses(struct bPose *dst, struct bPose *src, float srcweight/*, short mode*/); /* was blend_poses */
+void game_blend_poses(struct bPose *dst, struct bPose *src, float srcweight, short mode); /* was blend_poses */
 //void extract_pose_from_pose(struct bPose *pose, const struct bPose *src);
 void game_copy_pose(struct bPose **dst, struct bPose *src, int copy_con);
 void game_free_pose(struct bPose *pose);

Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp	2011-06-29 01:53:17 UTC (rev 37932)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_Action.cpp	2011-06-29 02:42:46 UTC (rev 37933)
@@ -46,6 +46,7 @@
 #include "BKE_action.h"
 #include "RNA_access.h"
 #include "RNA_define.h"
+#include "DNA_nla_types.h"
 }
 
 BL_Action::BL_Action(class KX_GameObject* gameobj)
@@ -172,6 +173,7 @@
 	m_endframe = end;
 	m_blendin = blendin;
 	m_playmode = play_mode;
+	m_blendmode = blend_mode;
 	m_endtime = 0.f;
 	m_blendframe = 0.f;
 	m_blendstart = 0.f;
@@ -328,12 +330,17 @@
 			float weight = 1.f - (m_blendframe/m_blendin);
 
 			// Blend the poses
-			game_blend_poses(m_pose, m_blendpose, weight);
+			game_blend_poses(m_pose, m_blendpose, weight, ACTSTRIPMODE_BLEND);
 		}
 
 
 		// Handle layer blending
-		
+		if (m_blendmode != ACT_BLEND_NONE)
+		{
+			obj->GetMRDPose(&m_blendpose);
+			game_blend_poses(m_pose, m_blendpose, 1.f, ACTSTRIPMODE_ADD);
+		}
+
 		obj->SetPose(m_pose);
 
 		obj->SetActiveAction(NULL, 0, curtime);

Modified: branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp	2011-06-29 01:53:17 UTC (rev 37932)
+++ branches/soc-2011-pepper/source/gameengine/Ketsji/BL_ActionManager.cpp	2011-06-29 02:42:46 UTC (rev 37933)
@@ -67,6 +67,9 @@
 								short ipo_flags,
 								float playback_speed)
 {
+	// Disable layer blending on the first layer
+	if (layer == 0) blend_mode = BL_Action::ACT_BLEND_NONE;
+
 	return m_layers[layer]->Play(name, start, end, priority, blendin, play_mode, blend_mode, ipo_flags, playback_speed);
 }
 




More information about the Bf-blender-cvs mailing list