Skip to content

Commit ccbfab0

Browse files
committed
UPBGE: Minor BL_ArmatureObject cleanup.
Replace member for vert deform type by an access to bAramture::gevertdeformer. Directly assign time step to m_objArma->pose->ctime instead tracking it in a member variable.
1 parent 2e369aa commit ccbfab0

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

source/gameengine/Converter/BL_ArmatureObject.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,10 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
205205
BL_ArmatureObject::BL_ArmatureObject(void *sgReplicationInfo,
206206
SG_Callbacks callbacks,
207207
Object *armature,
208-
Scene *scene,
209-
int vert_deform_type)
208+
Scene *scene)
210209
:KX_GameObject(sgReplicationInfo, callbacks),
211210
m_scene(scene),
212211
m_lastframe(0.0),
213-
m_timestep(0.040),
214-
m_vert_deform_type(vert_deform_type),
215212
m_drawDebug(false),
216213
m_lastapplyframe(0.0)
217214
{
@@ -424,9 +421,6 @@ bool BL_ArmatureObject::UnlinkObject(SCA_IObject *clientobj)
424421

425422
void BL_ArmatureObject::ApplyPose() // TODO: bouger dans SetPoseByAction ?
426423
{
427-
// in the GE, we use ctime to store the timestep
428-
m_objArma->pose->ctime = (float)m_timestep;
429-
//m_scene->r.cfra++;
430424
if (m_lastapplyframe != m_lastframe) {
431425
// update the constraint if any, first put them all off so that only the active ones will be updated
432426
for (BL_ArmatureConstraint *constraint : m_controlledConstraints) {
@@ -457,8 +451,10 @@ void BL_ArmatureObject::BlendInPose(bPose *blend_pose, float weight, short mode)
457451
bool BL_ArmatureObject::UpdateTimestep(double curtime)
458452
{
459453
if (curtime != m_lastframe) {
460-
// compute the timestep for the underlying IK algorithm
461-
m_timestep = curtime - m_lastframe;
454+
/* Compute the timestep for the underlying IK algorithm,
455+
* in the GE, we use ctime to store the timestep.
456+
*/
457+
m_objArma->pose->ctime = (float)(curtime - m_lastframe);
462458
m_lastframe = curtime;
463459
}
464460

@@ -474,9 +470,9 @@ Object *BL_ArmatureObject::GetOrigArmatureObject()
474470
return m_origObjArma;
475471
}
476472

477-
int BL_ArmatureObject::GetVertDeformType()
473+
int BL_ArmatureObject::GetVertDeformType() const
478474
{
479-
return m_vert_deform_type;
475+
return ((bArmature *)m_objArma->data)->gevertdeformer;
480476
}
481477

482478
void BL_ArmatureObject::GetPose(bPose **pose) const

source/gameengine/Converter/BL_ArmatureObject.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ class BL_ArmatureObject : public KX_GameObject
5959
// Need for BKE_pose_where_is.
6060
Scene *m_scene;
6161
double m_lastframe;
62-
/// Delta since last pose evaluation.
63-
double m_timestep;
64-
int m_vert_deform_type;
6562
size_t m_constraintNumber;
6663
size_t m_channelNumber;
6764
/// Store the original armature object matrix.
@@ -75,8 +72,7 @@ class BL_ArmatureObject : public KX_GameObject
7572
BL_ArmatureObject(void *sgReplicationInfo,
7673
SG_Callbacks callbacks,
7774
Object *armature,
78-
Scene *scene,
79-
int vert_deform_type);
75+
Scene *scene);
8076
virtual ~BL_ArmatureObject();
8177

8278
virtual CValue *GetReplica();
@@ -99,7 +95,7 @@ class BL_ArmatureObject : public KX_GameObject
9995

10096
Object *GetArmatureObject();
10197
Object *GetOrigArmatureObject();
102-
int GetVertDeformType();
98+
int GetVertDeformType() const;
10399
bool GetDrawDebug() const;
104100
void DrawDebug(RAS_DebugDraw& debugDraw);
105101

source/gameengine/Converter/BL_BlenderDataConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ static KX_GameObject *BL_GameObjectFromBlenderObject(Object *ob, KX_Scene *kxsce
962962
case OB_ARMATURE:
963963
{
964964
bArmature *arm = (bArmature *)ob->data;
965-
gameobj = new BL_ArmatureObject(kxscene, KX_Scene::m_callbacks, ob, kxscene->GetBlenderScene(), arm->gevertdeformer);
965+
gameobj = new BL_ArmatureObject(kxscene, KX_Scene::m_callbacks, ob, kxscene->GetBlenderScene());
966966

967967
kxscene->AddAnimatedObject(gameobj);
968968

0 commit comments

Comments
 (0)