Page MenuHome

BGE: Fix T46650 animation on culled armature, refactor 583fa7d1e (Fix for T32054)
Needs ReviewPublic

Authored by Porteries Tristan (panzergame) on Nov 1 2015, 10:50 AM.

Details

Summary

T32054 can be fixed by only initialize m_starttime with KX_GetActiveEngine()->GetFrameTime() - kxscene->getSuspendedDelta() instead of only KX_GetActiveEngine()->GetFrameTime(). With this way we remove a check in Update().

The issue in T46650 is that action time are not managed when an armature (child of armature) is culled, to manage the time but disallow deformer update a new argument is added for KX_GameObject::UpdateActionManager(float curtime, bool apply). When "aplly" is to false we only manage time and action desactivation. But a new issue is introduced : when the action was fully played for a culled armature and that is not culled in a next frame the action will be not applied to the armature. Indeed BL_Action::Update do nothing when m_done is to true, we must allow at least one update to set the action tranform. The new attribute "m_applied" solves this. This attribute show if the action was applied to the object in a previous update, and in case of the issue it force an update because m_applied will be always to false when the object is culled.

Example file :


Set view to camera, press O to open the doors and to rotate the camera. press C to un-rotate camera.

Diff Detail

Repository
rB Blender
Branch
ge_action_armature_culled

Event Timeline

Porteries Tristan (panzergame) retitled this revision from to BGE: Fix T46650 animation on culled armature, refactor 583fa7d1e (Fix for T32054).Nov 1 2015, 10:50 AM
Porteries Tristan (panzergame) updated this object.
Porteries Tristan (panzergame) updated this revision to Diff 5352.

Hi, as far I understand it looks good to me. I made nevertheless a few inline comments. But I'm not experimenced enough to approve the patch without someone else review :)
Furthermore, it concerns only the case where an action is triggered exactly at the same time the door comes out frustum (doesn't it?)... I'm wondering if we can find a simpler way to solve the issue but I've no proposition for the moment (too complex for me :) )

71 in BL_Action.h: "when the last action update transforms object"? Sorry, can't find a way to edit inline comments...

source/gameengine/Ketsji/BL_Action.cpp
439

(culled armature children?)(no transformation needed?)

source/gameengine/Ketsji/BL_Action.h
71

Set to true when in the last the last action update applies transformation to the object?

source/gameengine/Ketsji/KX_Scene.cpp
1660

(we must nevertheless/at least update action time)...

1680

Since animation"s" are update"d"?
Your patch seems to work without child->UpdateBuckets(false); and gameobj->UpdateBuckets(false); . It seems UpdateBuckets function is called every frame (or often :) ) in KX_Scene::PhysicsCullingCallback (called in KX_Scene::CalculateVisibleMeshes) and perhaps elsewhere? So is calling UpdateBuckets here really needed?

@Ulysse Martin (youle) : Thanks for the numerous comments correction.

source/gameengine/Ketsji/KX_Scene.cpp
1680

As you noticed UpdateBuckets is called in the culling process. But this process is called before culling to avoid animation update for armatures. So it means that all animated objects are one frame gap between the render object's matrix and the object's "normal" matrix.

I tested the demofile.blend from the bugtracker (https://developer.blender.org/T46698).

It shows there is no animation delay to see. So from my side this fixes bug T46698

source/gameengine/Ketsji/BL_Action.h
107

The apply parameter should be well explained in the comment.

source/gameengine/Ketsji/BL_ActionManager.h
127

The apply parameter should be well explained in the comment.

source/gameengine/Ketsji/KX_GameObject.h
330

The apply parameter should be well explained in the comment.

source/gameengine/Ketsji/KX_Scene.cpp
1660

This comment is still unclear, and incorrect English.

source/gameengine/Ketsji/BL_Action.h
107

Doesn't every action transform an object? Don't you mean "deform" instead? There is also a semantical difference between "the action frame" and "the action's frame", while further down you write "the actions frame"; please check that the spelling is correct.

source/gameengine/Ketsji/BL_Action.h
107

I mean transform object is : modify the object scene node (= position/rotation .... transformation in general).
Yes it's the frame of the action, so action's frame and later actions' frame (sorry for spelling again)

Resigning as reviewer, as I don't have time for BGE work any more.