diff options
author | Mateo de Mayo <mateodemayo@gmail.com> | 2015-08-04 00:47:46 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-08-04 01:10:33 +0300 |
commit | 23f54076db6d241af2a8f9404ab5f5b8072a4db0 (patch) | |
tree | c13d269da7a6414e0d121f1254afcf16b8541864 /source/gameengine/Ketsji/BL_ActionManager.cpp | |
parent | 73522e1157eba1f475454c153f7c027f5dd097ea (diff) |
BGE: Added getActionName() function to KX_GameObject()
It works similar to getActionFrame(), you have to give a layer or not (for layer 0) as the argument and it returns the name of the animation that the object is currently playing.
Example:
```
import bge
own = bge.logic.getCurrentController().owner
own.playAction("SomeAction",0,20)
print(own.getActionName())
```
>> SomeAction
Here is an example file, just open the blend file with the terminal opened
and press P, you can see how the current animation is being printed:
{F217484}
Reviewers: moguri, hg1, panzergame, campbellbarton
Reviewed By: panzergame
Subscribers: campbellbarton, hg1, #game_engine
Projects: #game_engine
Differential Revision: https://developer.blender.org/D1443
Diffstat (limited to 'source/gameengine/Ketsji/BL_ActionManager.cpp')
-rw-r--r-- | source/gameengine/Ketsji/BL_ActionManager.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp index 975f9ea6da8..9e4690548d3 100644 --- a/source/gameengine/Ketsji/BL_ActionManager.cpp +++ b/source/gameengine/Ketsji/BL_ActionManager.cpp @@ -68,6 +68,12 @@ float BL_ActionManager::GetActionFrame(short layer) return action ? action->GetFrame() : 0.f; } +const char *BL_ActionManager::GetActionName(short layer) +{ + BL_Action *action = GetAction(layer); + return action ? action->GetName() : ""; +} + void BL_ActionManager::SetActionFrame(short layer, float frame) { BL_Action *action = GetAction(layer); |