It fix T46381. Normally BL_Action::Update (manage action time, end, loop…) should be called the same number of times as BL_Action::UpdateIPO (update action position, scale ect… in the game object).
But the bug report shows that UpdateIPO is called one less time than Update. To fix it i revert the commit 362b25b38287cb75e4d22b30bdbc7f47e8eb3fdf and implement a mutex in BL_Action::Update.
Example file : {F245823}
Reviewers: lordloki, kupoman, campbellbarton, youle, moguri, sybren
Reviewed By: youle, moguri, sybren
Maniphest Tasks: T39928, T46381
Differential Revision: https://developer.blender.org/D1562
We now keep actions around when they are finished playing so scripts can
still get access to information such as the current frame. Playing a new
action in the same layer still overwrites the previous action as before this
commit. Using an explicit KX_GameObject.stopAction() will free the memory. The
action is also freed when the KX_GameObject is freed as before.
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 patch removes the limitations on the number of action layers in the BGE.
BL_ActionManager currently uses a fixed array to keep track of the action layers. This patch replaces the fixed array with a map which allows for dynamic allocation of action layers. Layers (map items) are automatically removed on BL_ActionManager's update function. The maximum number of layers is roughly the value of a short. Backwards functionality is maintained and there are no changes to the Python API.
Task Discussion:
https://developer.blender.org/T39572
Author: Kevin Ednalino
Reviewers: moguri
Differential Revision: https://developer.blender.org/D491
Updating object IPOs is not currently thread-safe since it also updates
children. This leads to problems when parents and children are both
animated. For now, updating object IPOs is done in its own loop to avoid
threading issues.
* Blendin for Loop End works even after a negative pulse. Flipper could still use some work in this area.
* Continuous works a lot better.
* BL_Action::SetFrame() should work a little smoother.
* Adding BL_Action::Play() and BL_Action::Stop()
* Making BL_ActonManger reuse BL_Actions instead of recreating them all the time
* Making the Property play type work for the Action actuator.
BL_ActionManager:
* IsActionDone(short layer) - Checks to see if the animation on the given layer has finished.
KX_GameObject:
* PlayAction(...) - Adds an action to the object's action manager
* StopAction(short layer) - Remove an action from the object's action manager
* IsActionDone(short layer) - Check if an action has finished playing