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:
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.h')
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 2ea6e9552a2..655bc9ff080 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -63,8 +63,10 @@ class RAS_MeshObject;
class KX_IPhysicsController;
class PHY_IGraphicController;
class PHY_IPhysicsEnvironment;
+class BL_ActionManager;
struct Object;
class KX_ObstacleSimulation;
+struct bAction;
#ifdef WITH_PYTHON
/* utility conversion function */
@@ -116,6 +118,12 @@ protected:
KX_ObstacleSimulation* m_pObstacleSimulation;
+
+ // The action manager is used to play/stop/update actions
+ BL_ActionManager* m_actionManager;
+
+ BL_ActionManager* GetActionManager();
+
public:
bool m_isDeformable;
@@ -201,6 +209,68 @@ public:
*/
void RemoveParent(KX_Scene *scene);
+ /*********************************
+ * Animation API
+ *********************************/
+
+ /**
+ * Adds an action to the object's action manager
+ */
+ bool PlayAction(const char* name,
+ float start,
+ float end,
+ short layer=0,
+ short priority=0,
+ float blendin=0.f,
+ short play_mode=0,
+ float layer_weight=0.f,
+ short ipo_flags=0,
+ float playback_speed=1.f);
+
+ /**
+ * Gets the current frame of an action
+ */
+ float GetActionFrame(short layer);
+
+ /**
+ * Sets the current frame of an action
+ */
+ void SetActionFrame(short layer, float frame);
+
+ /**
+ * Gets the currently running action on the given layer
+ */
+ bAction *GetCurrentAction(short layer);
+
+ /**
+ * Sets play mode of the action on the given layer
+ */
+ void SetPlayMode(short layer, short mode);
+
+ /**
+ * Sets the start and end times of the action on the given layer
+ */
+ void SetTimes(short layer, float start, float end);
+
+ /**
+ * Stop playing the action on the given layer
+ */
+ void StopAction(short layer);
+
+ /**
+ * Check if an action has finished playing
+ */
+ bool IsActionDone(short layer);
+
+ /**
+ * Kick the object's action manager
+ */
+ void UpdateActionManager(float curtime);
+
+ /*********************************
+ * End Animation API
+ *********************************/
+
/**
* Construct a game object. This class also inherits the
* default constructors - use those with care!
@@ -866,6 +936,12 @@ public:
KX_PYMETHOD_DOC_O(KX_GameObject,getVectTo);
KX_PYMETHOD_DOC_VARARGS(KX_GameObject, sendMessage);
KX_PYMETHOD_VARARGS(KX_GameObject, ReinstancePhysicsMesh);
+
+ KX_PYMETHOD_DOC(KX_GameObject, playAction);
+ KX_PYMETHOD_DOC(KX_GameObject, stopAction);
+ KX_PYMETHOD_DOC(KX_GameObject, getActionFrame);
+ KX_PYMETHOD_DOC(KX_GameObject, setActionFrame);
+ KX_PYMETHOD_DOC(KX_GameObject, isPlayingAction);
/* Dict access */
KX_PYMETHOD_VARARGS(KX_GameObject,get);