[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23238] branches/itasc/source/gameengine/ Converter: BGE: fix blending bugs in 2.5
Benoit Bolsee
benoit.bolsee at online.be
Tue Sep 15 11:26:55 CEST 2009
Revision: 23238
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23238
Author: ben2610
Date: 2009-09-15 11:25:58 +0200 (Tue, 15 Sep 2009)
Log Message:
-----------
BGE: fix blending bugs in 2.5
Blending was based on flags that are not set anymore by
the 2.5 animation system. Apply blending on all channels
unconditionally (will also fix bug #18643). Fix bug with
blending disabled when more than one action plays at the
same time (blending is not working well on more than one
action at a time though). Fix bug with pose at the start
of the frame not correctly saved in case a high priority
action overwrites a previous low priority action (make
effect of actions independent of order)
These fixes will be merged with trunk when the itasc
branch is merged.
Modified Paths:
--------------
branches/itasc/source/gameengine/Converter/BL_ActionActuator.cpp
branches/itasc/source/gameengine/Converter/BL_ArmatureObject.cpp
Modified: branches/itasc/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- branches/itasc/source/gameengine/Converter/BL_ActionActuator.cpp 2009-09-15 03:54:13 UTC (rev 23237)
+++ branches/itasc/source/gameengine/Converter/BL_ActionActuator.cpp 2009-09-15 09:25:58 UTC (rev 23238)
@@ -571,7 +571,6 @@
return NULL;
}
- pchan->flag |= POSE_ROT|POSE_LOC|POSE_SIZE;
Py_RETURN_NONE;
}
Modified: branches/itasc/source/gameengine/Converter/BL_ArmatureObject.cpp
===================================================================
--- branches/itasc/source/gameengine/Converter/BL_ArmatureObject.cpp 2009-09-15 03:54:13 UTC (rev 23237)
+++ branches/itasc/source/gameengine/Converter/BL_ArmatureObject.cpp 2009-09-15 09:25:58 UTC (rev 23238)
@@ -150,41 +150,32 @@
schan= (bPoseChannel*)src->chanbase.first;
for (dchan = (bPoseChannel*)dst->chanbase.first; dchan; dchan=(bPoseChannel*)dchan->next, schan= (bPoseChannel*)schan->next){
- if (schan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE)) {
- /* replaced quat->matrix->quat conversion with decent quaternion interpol (ton) */
+ // always blend on all channels since we don't know which one has been set
+ /* quat interpolation done separate */
+ if (schan->rotmode == PCHAN_ROT_QUAT) {
+ float dquat[4], squat[4];
- /* Do the transformation blend */
- if (schan->flag & POSE_ROT) {
- /* quat interpolation done separate */
- if (schan->rotmode == PCHAN_ROT_QUAT) {
- float dquat[4], squat[4];
-
- QUATCOPY(dquat, dchan->quat);
- QUATCOPY(squat, schan->quat);
- if (mode==ACTSTRIPMODE_BLEND)
- QuatInterpol(dchan->quat, dquat, squat, srcweight);
- else {
- QuatMulFac(squat, srcweight);
- QuatMul(dchan->quat, dquat, squat);
- }
-
- NormalQuat(dchan->quat);
- }
+ QUATCOPY(dquat, dchan->quat);
+ QUATCOPY(squat, schan->quat);
+ if (mode==ACTSTRIPMODE_BLEND)
+ QuatInterpol(dchan->quat, dquat, squat, srcweight);
+ else {
+ QuatMulFac(squat, srcweight);
+ QuatMul(dchan->quat, dquat, squat);
}
+
+ NormalQuat(dchan->quat);
+ }
- for (i=0; i<3; i++) {
- /* blending for loc and scale are pretty self-explanatory... */
- if (schan->flag & POSE_LOC)
- dchan->loc[i] = (dchan->loc[i]*dstweight) + (schan->loc[i]*srcweight);
- if (schan->flag & POSE_SIZE)
- dchan->size[i] = 1.0f + ((dchan->size[i]-1.0f)*dstweight) + ((schan->size[i]-1.0f)*srcweight);
-
- /* euler-rotation interpolation done here instead... */
- // FIXME: are these results decent?
- if ((schan->flag & POSE_ROT) && (schan->rotmode))
- dchan->eul[i] = (dchan->eul[i]*dstweight) + (schan->eul[i]*srcweight);
- }
- dchan->flag |= schan->flag;
+ for (i=0; i<3; i++) {
+ /* blending for loc and scale are pretty self-explanatory... */
+ dchan->loc[i] = (dchan->loc[i]*dstweight) + (schan->loc[i]*srcweight);
+ dchan->size[i] = 1.0f + ((dchan->size[i]-1.0f)*dstweight) + ((schan->size[i]-1.0f)*srcweight);
+
+ /* euler-rotation interpolation done here instead... */
+ // FIXME: are these results decent?
+ if (schan->rotmode)
+ dchan->eul[i] = (dchan->eul[i]*dstweight) + (schan->eul[i]*srcweight);
}
for(dcon= (bConstraint*)dchan->constraints.first, scon= (bConstraint*)schan->constraints.first; dcon && scon; dcon= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) {
/* no 'add' option for constraint blending */
@@ -298,6 +289,8 @@
}
if (m_pose)
game_free_pose(m_pose);
+ if (m_framePose)
+ game_free_pose(m_framePose);
}
@@ -544,18 +537,20 @@
m_lastframe= curtime;
m_activeAct = NULL;
// remember the pose at the start of the frame
- m_framePose = m_pose;
+ GetPose(&m_framePose);
}
if (act)
{
if (priority<=m_activePriority)
{
- if (priority<m_activePriority)
+ if (priority<m_activePriority) {
// this action overwrites the previous ones, start from initial pose to cancel their effects
- m_pose = m_framePose;
- if (m_activeAct && (m_activeAct!=act))
- m_activeAct->SetBlendTime(0.0); /* Reset the blend timer */
+ //SetPose(m_framePose);
+ if (m_activeAct && (m_activeAct!=act))
+ /* Reset the blend timer since this new action cancels the old one */
+ m_activeAct->SetBlendTime(0.0);
+ }
m_activeAct = act;
m_activePriority = priority;
m_lastframe = curtime;
More information about the Bf-blender-cvs
mailing list