On Mon, 2009-05-25 at 14:46 +0200, Jonas Bonn wrote: > Hi, > > I had a short discussion with ebassi on #clutter... we decided I would send > an > email detailing what I feel are some weaknesses in the Animation > API/implementation. Thanks for considering this; my thoughts follow: > > ---- > > An Animation currently keeps track of: > > timeline > mode > duration > loop
I agree that the Animation properties should not go out of sync with the underlying objects. personally, my take is that the Animation should: - cache the values in case the Alpha and/or the Timeline instances are not present, or if they are being replaced - proxy the values otherwise which is basically what are you proposing, except that I wouldn't remove the loop, duration and mode variables from AnimationPrivate. the behaviour of the Animation class would then match these invariants: - set_mode() + no alpha set: create an alpha (without a timeline) + alpha set: set the mode - set_duration(): + no alpha set: create an alpha, then a timeline + alpha set: get the timeline of the alpha, set duration - set_loop() + same as set_duration() - get_mode() - get_duration() - get_loop() + no alpha or no timeline are set: return the cached values + alpha or timeline set: return the alpha or timeline values for the set_alpha() and set_timeline() we need some more hand-holding, because we depend on instances to make the animation machinery work: - set_alpha(): + no alpha set and passed NULL, create alpha (without a timeline) + no alpha set and passed !NULL, own the alpha and use its timeline + alpha set and passed NULL, create alpha and reuse the timeline from the old alpha + alpha set and passed !NULL, own the alpha and use its timeline - set_timeline() + no alpha set and passed NULL: create alpha and timeline using stored values, and assign the timeline to the alpha + no alpha set and passed !NULL: create alpha and assign passed timeline to the alpha + alpha set and passed NULL: create timeline using stored values and assign it to the alpha + alpha set and passed !NULL: assign timeline to the alpha - get_alpha() + no alpha set: create an alpha using the stored values, with no timeline + alpha set: return alpha - get_timeline() + return the timeline assigned to the alpha in short: the Alpha should be available as soon as: - :mode, :duration or :loop are set - get_alpha() or get_timeline() are called while the Timeline will be available as soon as: - :duration or :loop are set I'll document this properly before the 1.0 release. > I hope this makes some sense and I look forward to your comments. I'm happy > to > provide clarification where things are less than clear. thanks for your feedback! ciao, Emmanuele. -- Emmanuele Bassi, Senior Engineer | emmanuele.ba...@intel.com Intel Open Source Technology Center | http://oss.intel.com -- To unsubscribe send a mail to clutter+unsubscr...@o-hand.com