Action "Bouncing" when mixing automatic and manual action updates #45945

Closed
opened 2015-08-29 07:14:12 +02:00 by mobious · 13 comments

System Information
Windows 7 64-bit
Intel HD Graphics 4000

Blender Version
Broken: 2.75 c6b042b

Files
action_bouncing.blend -- Contains a cube with a script that starts playing an action and manually updates the action's frame on alternating logic ticks. The animation frame rate is set to 1.

Short description of error
When an action is playing and the action's frame is manually set using setActionFrame() on alternating logic ticks and the action's play speed (playAction() speed argument multiplied by the Animation Frame Rate) is low, the "bounces" between the set frame and the start frame.

Exact steps for others to reproduce the error
Open the attached file and start the game engine. Note how the cube flickers between its starting position and its animated position. This jump to the action's start frame only occurs on logic ticks where the setActionFrame() method is not called and when the animation frame rate is relatively low. It occurs with less frequency as the animation frame rate is increased (either via the Animation Frame Rate option under the Properties tab or with the speed argument for playAction(). Also note that as the action continues to play, the bouncing will briefly stop during perios where the cubes current frame is behind the frame the action would be at if it was left to play by itself (i.e. if no calls made to setActionFrame()).

Additional Notes

  • It does not matter if the action is played on an object or armature.
  • The bouncing appears to stop after the point where the action would have finished if left to play by itself.
  • setActionFrame() must not be called on every logic tick for the bouncing to occur, i.e. you must skip some logic ticks by setting the Skip option on the Always sensor to some value greater than 0.
**System Information** Windows 7 64-bit Intel HD Graphics 4000 **Blender Version** Broken: 2.75 c6b042b **Files** [action_bouncing.blend](https://archive.blender.org/developer/F228894/action_bouncing.blend) -- Contains a cube with a script that starts playing an action and manually updates the action's frame on alternating logic ticks. The animation frame rate is set to 1. **Short description of error** When an action is playing and the action's frame is manually set using setActionFrame() on alternating logic ticks and the action's play speed (playAction() speed argument multiplied by the Animation Frame Rate) is low, the "bounces" between the set frame and the start frame. **Exact steps for others to reproduce the error** Open the attached file and start the game engine. Note how the cube flickers between its starting position and its animated position. This jump to the action's start frame only occurs on logic ticks where the setActionFrame() method is not called and when the animation frame rate is relatively low. It occurs with less frequency as the animation frame rate is increased (either via the Animation Frame Rate option under the Properties tab or with the speed argument for playAction(). Also note that as the action continues to play, the bouncing will briefly stop during perios where the cubes current frame is behind the frame the action would be at if it was left to play by itself (i.e. if no calls made to setActionFrame()). **Additional Notes** - It does not matter if the action is played on an object or armature. - The bouncing appears to stop after the point where the action would have finished if left to play by itself. - setActionFrame() must not be called on every logic tick for the bouncing to occur, i.e. you must skip some logic ticks by setting the Skip option on the Always sensor to some value greater than 0.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @mobious

Added subscriber: @mobious

Added subscriber: @Sergey

Added subscriber: @Sergey

Not sure what exactly "bounding" and "flickers" means here, can you describe it a bit more?

Also, you're using original 2.75 release, please test 2.75a release and latest builds from builder.blender.org

Not sure what exactly "bounding" and "flickers" means here, can you describe it a bit more? Also, you're using original 2.75 release, please test 2.75a release and latest builds from builder.blender.org
Author

By "bouncing", I mean that on a logic tick where I call setActionFrame(frameNumber), the cube will be place at position corresponding to frameNumber. On next logic tick (where setActionFrame() is not called) the cube is place at the position corresponding to the start frame value used in the original call to playAction().

This repeats every single time setActionFrame() is called on a logic tick and not called on the following logic tick, causing the cube to rappidly jump (e.g. visually flicker) back and forth between the two positions.

I tested it with the same results on 2.75a and the latest build from builder.blender.org, both with the exact same results. Did you download and run the file I attached? It should be obvious what the issue is when you run it.

By "bouncing", I mean that on a logic tick where I call setActionFrame(*frameNumber*), the cube will be place at position corresponding to *frameNumber*. On next logic tick (where setActionFrame() is not called) the cube is place at the position corresponding to the start frame value used in the original call to playAction(). This repeats every single time setActionFrame() is called on a logic tick and not called on the following logic tick, causing the cube to rappidly jump (e.g. visually flicker) back and forth between the two positions. I tested it with the same results on 2.75a and the latest build from builder.blender.org, both with the exact same results. Did you download and run the file I attached? It should be obvious what the issue is when you run it.

Yes, i've downloaded the file you attached. It just runs too fast here and not really clear if the "ghosting" effect there is a bug or some aspect of BGE.

At this point leaving this will leave the report up to BGE developers to fix the issue.

Yes, i've downloaded the file you attached. It just runs too fast here and not really clear if the "ghosting" effect there is a bug or some aspect of BGE. At this point leaving this will leave the report up to BGE developers to fix the issue.

Added subscribers: @brita, @hg1, @panzergame

Added subscribers: @brita, @hg1, @panzergame
Author

I'm fairly certain that this is not the desired behavior for actions to have. Even if it was intentional, the behavior is inconsistent in its current implementation as the "bouncing" does not occur at higher animation playback speeds and will stop after the point were the action would have completed if left to play by itself.

To add to the discussion, the reason I discovered this bug was because I was trying to work around the fact that you currently cannot disable automatic animation updates by setting the play speed to 0. Instead, I set the play speed to a very low value which caused this bug to arise. Please take a look at this thread for some other improvements I think need to be made to the API with regard to action playback.

http://blenderartists.org/forum/showthread.php?379708-REQUEST-Improve-Python-interface-for-controlling-Actions

I'm fairly certain that this is not the desired behavior for actions to have. Even if it was intentional, the behavior is inconsistent in its current implementation as the "bouncing" does not occur at higher animation playback speeds and will stop after the point were the action would have completed if left to play by itself. To add to the discussion, the reason I discovered this bug was because I was trying to work around the fact that you currently cannot disable automatic animation updates by setting the play speed to 0. Instead, I set the play speed to a very low value which caused this bug to arise. Please take a look at this thread for some other improvements I think need to be made to the API with regard to action playback. http://blenderartists.org/forum/showthread.php?379708-REQUEST-Improve-Python-interface-for-controlling-Actions

Added subscriber: @you.le

Added subscriber: @you.le

If you comment line 409 in BL_Action.cpp: //m_calc_localtime = true; , the problem disappears... (maybe there's a modification to do in SetLocalTime function).

If you comment line 409 in BL_Action.cpp: //m_calc_localtime = true; , the problem disappears... (maybe there's a modification to do in SetLocalTime function).

After further investigations it seems that it is these lines which causes the problem in BL_Action.cpp Update function:

Grab the start time here so we don't end up with a negative m_localtime when suspending and resuming scenes.
if (m_starttime < 0)
m_starttime = curtime;

Because m_starttime switch beetween negative and positive value... This causes the "bouncing". But I don't understand the comment.

After further investigations it seems that it is these lines which causes the problem in BL_Action.cpp Update function: *Grab the start time here so we don't end up with a negative m_localtime when* suspending and resuming scenes. if (m_starttime < 0) m_starttime = curtime; Because m_starttime switch beetween negative and positive value... This causes the "bouncing". But I don't understand the comment.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

This issue was referenced by f10db730bc

This issue was referenced by f10db730bc4d8139e86ce078dd0fdd9fd07a8f35
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#45945
No description provided.