Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2011-06-29 06:42:46 +0400
committerMitchell Stokes <mogurijin@gmail.com>2011-06-29 06:42:46 +0400
commit3afe0e9c8803bd04daa7a8e0ae813796b455a4b4 (patch)
tree6a864b18bb563e3c16828890e4c6a20a66a28bdb
parentd122f24c1af429dd59a0051db01650fd2b1abbba (diff)
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.
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp8
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.h2
-rw-r--r--source/gameengine/Ketsji/BL_Action.cpp11
-rw-r--r--source/gameengine/Ketsji/BL_ActionManager.cpp3
4 files changed, 15 insertions, 9 deletions
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index c6c20a96482..f33eafce620 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -137,10 +137,8 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
/* 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 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
dstweight = 1.0F - srcweight;
break;
case ACTSTRIPMODE_ADD:
- dstweight = 1.0F;
- break;
default :
dstweight = 1.0F;
}
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h
index 2c3ca7404b3..92a9a3685c9 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.h
+++ b/source/gameengine/Converter/BL_ArmatureObject.h
@@ -145,7 +145,7 @@ protected:
};
/* 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);
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index 149189b6a79..33e4e179071 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -46,6 +46,7 @@ extern "C" {
#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 @@ bool BL_Action::Play(const char* name,
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 @@ void BL_Action::Update(float curtime)
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);
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp
index dfa06bd19d5..096235eeb99 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -67,6 +67,9 @@ bool BL_ActionManager::PlayAction(const char* name,
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);
}