[Bf-blender-cvs] [6b7be85] temp-bge-cleanup: Special cleanup for BL_ArmatureObject
Porteries Tristan
noreply at git.blender.org
Mon May 4 20:42:23 CEST 2015
Commit: 6b7be85ae2858fbe1aeb79c7617ddb9f29507a40
Author: Porteries Tristan
Date: Mon May 4 20:39:43 2015 +0200
Branches: temp-bge-cleanup
https://developer.blender.org/rB6b7be85ae2858fbe1aeb79c7617ddb9f29507a40
Special cleanup for BL_ArmatureObject
===================================================================
M source/gameengine/Converter/BL_ArmatureObject.cpp
M source/gameengine/Converter/BL_ArmatureObject.h
===================================================================
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 84a81c9..08d7eaf 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -146,8 +146,6 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
*dst = out;
}
-
-
/* Only allowed for Poses with identical channels */
static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode)
{
@@ -157,12 +155,10 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
float dstweight;
int i;
- if (mode == BL_Action::ACT_BLEND_BLEND)
- {
+ if (mode == BL_Action::ACT_BLEND_BLEND) {
dstweight = 1.0f - srcweight;
}
- else if (mode == BL_Action::ACT_BLEND_ADD)
- {
+ else if (mode == BL_Action::ACT_BLEND_ADD) {
dstweight = 1.0f;
}
else {
@@ -211,23 +207,21 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
dst->ctime = src->ctime;
}
-BL_ArmatureObject::BL_ArmatureObject(
- void *sgReplicationInfo,
- SG_Callbacks callbacks,
- Object *armature,
- Scene *scene,
- int vert_deform_type)
-
- : KX_GameObject(sgReplicationInfo, callbacks),
+BL_ArmatureObject::BL_ArmatureObject(void *sgReplicationInfo,
+ SG_Callbacks callbacks,
+ Object *armature,
+ Scene *scene,
+ int vert_deform_type)
+ : KX_GameObject(sgReplicationInfo, callbacks),
m_controlledConstraints(),
m_poseChannels(),
m_scene(scene), // maybe remove later. needed for BKE_pose_where_is
- m_lastframe(0.0),
- m_timestep(0.040),
+ m_lastframe(0.0f),
+ m_timestep(0.040f),
m_vert_deform_type(vert_deform_type),
m_constraintNumber(0),
m_channelNumber(0),
- m_lastapplyframe(0.0)
+ m_lastapplyframe(0.0f)
{
m_origObjArma = armature; // Keep a copy of the original armature so we can fix drivers later
m_objArma = BKE_object_copy(armature);
@@ -256,7 +250,6 @@ BL_ArmatureObject::~BL_ArmatureObject()
BKE_libblock_free(G.main, m_objArma);
}
-
void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter *converter)
{
// first delete any existing constraint (should not have any)
@@ -382,8 +375,7 @@ BL_ArmatureChannel *BL_ArmatureObject::GetChannel(bPoseChannel *pchan)
{
LoadChannels();
SG_DList::iterator<BL_ArmatureChannel> cit(m_poseChannels);
- for (cit.begin(); !cit.end(); ++cit)
- {
+ for (cit.begin(); !cit.end(); ++cit) {
BL_ArmatureChannel *channel = *cit;
if (channel->m_posechannel == pchan)
return channel;
@@ -395,8 +387,7 @@ BL_ArmatureChannel *BL_ArmatureObject::GetChannel(const char *str)
{
LoadChannels();
SG_DList::iterator<BL_ArmatureChannel> cit(m_poseChannels);
- for (cit.begin(); !cit.end(); ++cit)
- {
+ for (cit.begin(); !cit.end(); ++cit) {
BL_ArmatureChannel *channel = *cit;
if (!strcmp(channel->m_posechannel->name, str))
return channel;
@@ -495,7 +486,7 @@ void BL_ArmatureObject::RestorePose()
void BL_ArmatureObject::SetPose(bPose *pose)
{
extract_pose_from_pose(m_pose, pose);
- m_lastapplyframe = -1.0;
+ m_lastapplyframe = -1.0f;
}
void BL_ArmatureObject::SetPoseByAction(bAction *action, float localtime)
@@ -607,9 +598,8 @@ PyMethodDef BL_ArmatureObject::Methods[] = {
};
PyAttributeDef BL_ArmatureObject::Attributes[] = {
-
- KX_PYATTRIBUTE_RO_FUNCTION("constraints", BL_ArmatureObject, pyattr_get_constraints),
- KX_PYATTRIBUTE_RO_FUNCTION("channels", BL_ArmatureObject, pyattr_get_channels),
+ KX_PYATTRIBUTE_RO_FUNCTION("constraints", BL_ArmatureObject, pyattr_get_constraints),
+ KX_PYATTRIBUTE_RO_FUNCTION("channels", BL_ArmatureObject, pyattr_get_channels),
{NULL} //Sentinel
};
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h
index 20e896a..850a154 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.h
+++ b/source/gameengine/Converter/BL_ArmatureObject.h
@@ -43,6 +43,9 @@
struct bArmature;
struct Bone;
struct bConstraint;
+struct bPose;
+struct bPoseChannel;
+struct bAction;
class BL_ActionActuator;
class BL_ArmatureActuator;
class MT_Matrix4x4;
@@ -60,53 +63,59 @@ public:
virtual void Relink(CTR_Map<CTR_HashedPtr, void *> *obj_map);
virtual bool UnlinkObject(SCA_IObject *clientobj);
- BL_ArmatureObject(
- void *sgReplicationInfo,
- SG_Callbacks callbacks,
- Object *armature,
- Scene *scene,
- int vert_deform_type
- );
+ BL_ArmatureObject(void *sgReplicationInfo,
+ SG_Callbacks callbacks,
+ Object *armature,
+ Scene *scene,
+ int vert_deform_type);
virtual ~BL_ArmatureObject();
virtual CValue *GetReplica();
- void GetPose(struct bPose **pose);
- void SetPose(struct bPose *pose);
- struct bPose *GetOrigPose() {
+ void GetPose(bPose **pose);
+ void SetPose(bPose *pose);
+ bPose *GetOrigPose()
+ {
return m_pose;
} // never edit this, only for accessing names
void ApplyPose();
- void SetPoseByAction(struct bAction *action, float localtime);
- void BlendInPose(struct bPose *blend_pose, float weight, short mode);
+ void SetPoseByAction(bAction *action, float localtime);
+ void BlendInPose(bPose *blend_pose, float weight, short mode);
void RestorePose();
bool UpdateTimestep(double curtime);
- struct bArmature *GetArmature() {
+ bArmature *GetArmature()
+ {
return (bArmature *)m_objArma->data;
}
- const struct bArmature *GetArmature() const {
+ const bArmature *GetArmature() const
+ {
return (bArmature *)m_objArma->data;
}
- const struct Scene *GetScene() const {
+ const Scene *GetScene() const
+ {
return m_scene;
}
- Object *GetArmatureObject() {
+ Object *GetArmatureObject()
+ {
return m_objArma;
}
- Object *GetOrigArmatureObject() {
+ Object *GetOrigArmatureObject()
+ {
return m_origObjArma;
}
- int GetVertDeformType() {
+ int GetVertDeformType()
+ {
return m_vert_deform_type;
}
// for constraint python API
void LoadConstraints(KX_BlenderSceneConverter *converter);
- size_t GetConstraintNumber() const {
+ size_t GetConstraintNumber() const
+ {
return m_constraintNumber;
}
BL_ArmatureConstraint *GetConstraint(const char *posechannel, const char *constraint);
@@ -114,7 +123,8 @@ public:
BL_ArmatureConstraint *GetConstraint(int index);
// for pose channel python API
void LoadChannels();
- size_t GetChannelNumber() const {
+ size_t GetChannelNumber() const
+ {
return m_channelNumber;
}
BL_ArmatureChannel *GetChannel(bPoseChannel *channel);
@@ -128,7 +138,8 @@ public:
/// Returns the bone length. The end of the bone is in the local y direction.
float GetBoneLength(Bone *bone) const;
- virtual int GetGameObjectType() {
+ virtual int GetGameObjectType()
+ {
return OBJ_ARMATURE;
}
@@ -146,11 +157,11 @@ protected:
SG_DListHead<BL_ArmatureConstraint> m_controlledConstraints;
/* list element: BL_ArmatureChannel. Use SG_DList to avoid list replication */
SG_DList m_poseChannels;
- Object *m_objArma;
- Object *m_origObjArma;
- struct bPose *m_pose;
- struct bPose *m_armpose;
- struct Scene *m_scene; // need for BKE_pose_where_is
+ Object *m_objArma;
+ Object *m_origObjArma;
+ bPose *m_pose;
+ bPose *m_armpose;
+ Scene *m_scene; // need for BKE_pose_where_is
double m_lastframe;
double m_timestep; // delta since last pose evaluation.
int m_vert_deform_type;
More information about the Bf-blender-cvs
mailing list