mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
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
This commit is contained in:
parent
73522e1157
commit
23f54076db
7 changed files with 65 additions and 4 deletions
|
|
@ -972,6 +972,16 @@ base class --- :class:`SCA_IObject`
|
|||
:return: The current frame of the action
|
||||
:rtype: float
|
||||
|
||||
.. method:: getActionName(layer=0)
|
||||
|
||||
Gets the name of the current action playing in the supplied layer.
|
||||
|
||||
:arg layer: The layer that you want to get the action name from.
|
||||
:type layer: integer
|
||||
|
||||
:return: The name of the current action
|
||||
:rtype: string
|
||||
|
||||
.. method:: setActionFrame(frame, layer=0)
|
||||
|
||||
Set the current frame of the action playing in the supplied layer.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue