Page MenuHome

UI Animation System
Needs ReviewPublic

Authored by Julian Eisel (Severin) on Aug 10 2015, 2:12 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

UI Animation System

Motivation

Currently, several steps are needed to create an UI animation (handle timer, add operator or modal handler that listens to timer events to update a property, adjust drawing based on animated properties, handle data for animation, ...) which means quite some work needs to be done for setting up an UI animation.
This was already done for several UI animations, resulting in unnecessary code duplication.

System implemented here

This implements a generic system that helps setting up interface animations.
Basic idea is to take a single float property (don't think other types are really needed) and update it using cubic ease in-out equations (later we can also add others if needed).
*One* operator handles all animations using this system. Timer handling, animation data handling and updating of the animated property happens automatically. Custom update callbacks with access to custom data can be defined additionally, creating high flexibility.
Basically, only setting up the animation and using the animated property to influence drawing needs to be handled manually.

To test the functionality, this patch also makes the transparent region fade in-out effect (e.g. toggling 3D View toolshelf with 'Region Overlap' enabled) use the new system.

Rationale

De-duplicates code and makes developer life easier ;)

Next steps

Steps to take this further would be:

  • BPY access
  • Make other UI animations use the new system
  • Create more fancy UI animations!

Diff Detail

Repository
rB Blender
Branch
ui-animation-patch-update (branched from master)
Build Status
Buildable 9169
Build 9169: arc lint + arc unit

Event Timeline

Sry for CCing so many people, but think the changes made here might be interesting for people that work in UI code ;)
(Maybe also a bit overkill, just trying to communicate things well)

  • ARegion->regiontimer isn't needed anymore
  • Merge branch 'master' into ui-animation-patch-update

I was curious about this patch the other day so I updated it to current master.
There were lots of changes in the last five years so this doesn't work correctly
right now but I like the idea of having a common system for animations in the
interface, we should use them more.

  • Merge branch 'master' into ui-animation-patch-update
  • Use bool instead of int
  • Miscellaneous updates

Mostly messing around trying to get this to work, although I also made a few functions static.
The issue seems to be that the interface animations operator is never even called.