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:
authorCampbell Barton <ideasman42@gmail.com>2009-06-17 00:38:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-17 00:38:18 +0400
commit54ed699743dd605a41bc02b2c3b0f59a7dd311a0 (patch)
treeddbaff551e8936e02a34dda827d4c54e901a0d17
parentecb39291e97742524ff6b091bbca22a5a915f92c (diff)
ActionActuator in the game engine working again to display deformed meshes with the new animation system.
Note that the animation conversion from existing 2.4x blend files doesnt yet set the Action pointer in the actuator so the only way to test is to use the python api to set the new converted action active on the actuator because there is no user interface.
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp30
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp9
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.h5
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp3
-rw-r--r--source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp2
5 files changed, 42 insertions, 7 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 0c7b99df387..131d48aed4f 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -57,6 +57,13 @@
#include <config.h>
#endif
+extern "C" {
+#include "BKE_animsys.h"
+#include "BKE_action.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+}
+
BL_ActionActuator::~BL_ActionActuator()
{
if (m_pose)
@@ -360,10 +367,31 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
/* Get the underlying pose from the armature */
obj->GetPose(&m_pose);
-
+
+// 2.4x function,
/* Override the necessary channels with ones from the action */
// XXX extract_pose_from_action(m_pose, m_action, m_localtime);
+
+
+// 2.5x - replacement for extract_pose_from_action(...) above.
+ {
+ struct PointerRNA id_ptr;
+ Object *arm= obj->GetArmatureObject();
+ bPose *pose_back= arm->pose;
+
+ arm->pose= m_pose;
+ RNA_id_pointer_create((ID *)arm, &id_ptr);
+ animsys_evaluate_action(&id_ptr, m_action, NULL, m_localtime);
+
+ arm->pose= pose_back;
+
+// 2.5x - could also do this but looks too high level, constraints use this, it works ok.
+// Object workob; /* evaluate using workob */
+// what_does_obaction((Scene *)obj->GetScene(), obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime);
+ }
+ // done getting the pose from the action
+
/* Perform the user override (if any) */
if (m_userpose){
extract_pose_from_pose(m_pose, m_userpose);
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 6fc5c40d570..f8a9b1b637f 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -38,6 +38,7 @@
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
#include "MT_Matrix4x4.h"
@@ -48,10 +49,12 @@
BL_ArmatureObject::BL_ArmatureObject(
void* sgReplicationInfo,
SG_Callbacks callbacks,
- Object *armature )
+ Object *armature,
+ Scene *scene)
: KX_GameObject(sgReplicationInfo,callbacks),
m_objArma(armature),
+ m_scene(scene), // maybe remove later. needed for where_is_pose
m_framePose(NULL),
m_lastframe(0.0),
m_activeAct(NULL),
@@ -93,9 +96,9 @@ void BL_ArmatureObject::ApplyPose()
{
m_armpose = m_objArma->pose;
m_objArma->pose = m_pose;
-
+ //m_scene->r.cfra++;
if(m_lastapplyframe != m_lastframe) {
- where_is_pose(NULL, m_objArma); // XXX
+ where_is_pose(m_scene, m_objArma); // XXX
m_lastapplyframe = m_lastframe;
}
}
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h
index d5402cfd126..e1e176840a6 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.h
+++ b/source/gameengine/Converter/BL_ArmatureObject.h
@@ -51,7 +51,8 @@ public:
BL_ArmatureObject(
void* sgReplicationInfo,
SG_Callbacks callbacks,
- Object *armature
+ Object *armature,
+ Scene *scene
);
virtual ~BL_ArmatureObject();
@@ -67,6 +68,7 @@ public:
struct bArmature * GetArmature() { return m_armature; }
const struct bArmature * GetArmature() const { return m_armature; }
+ const struct Scene * GetScene() const { return m_scene; }
Object* GetArmatureObject() {return m_objArma;}
@@ -84,6 +86,7 @@ protected:
struct bPose *m_pose;
struct bPose *m_armpose;
struct bPose *m_framePose;
+ struct Scene *m_scene; // need for where_is_pose
double m_lastframe;
class BL_ActionActuator *m_activeAct;
short m_activePriority;
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index c25bdbe71f7..b907e300879 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1795,7 +1795,8 @@ static KX_GameObject *gameobject_from_blenderobject(
gameobj = new BL_ArmatureObject(
kxscene,
KX_Scene::m_callbacks,
- ob // handle
+ ob,
+ blenderscene // handle
);
/* Get the current pose from the armature object and apply it as the rest pose */
break;
diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
index 1ae96350197..20829524558 100644
--- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
+++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
@@ -27,7 +27,7 @@
*/
#include "KX_BlenderScalarInterpolator.h"
-#include "stdio.h"
+
#include <cstring>
extern "C" {