On Fri, 2007-12-14 at 10:49 +0000, Emmanuele Bassi wrote:
> On Thu, 2007-12-13 at 19:48 +0100, Murray Cumming wrote:
> > So this is a question for the Clutter developers. Are we really meant to
> > connect to ClutterTimeline's "completed" signal just so we can unref the
> > timeline and any behaviours that are used by that timeline?
> 
> well, yes and no:
> 
>   - if you want to destroy the behaviour as soon as the timeline is
>     complete, connect to the ClutterTimeline::completed signal and
>     unref the behaviour there
>   - if you want to do "manual garbage collection", just reuse the
>     timelines and behaviours throughout you application and destroy
>     them when quitting
> 
> the timeline and behaviour classes are meant to be reusable.
> 
> ClutterAlpha instances have a floating reference,

Ah, I missed this. I'll update that part of the tutorial.

>  because they don't
> mean anything if now bound to a behaviour; the alpha objects keep a
> reference on the timelines as well, so:
> 
>   timeline = clutter_timeline_new_for_duration (1000);
>   alpha = clutter_alpha_new_full (timeline, clutter_alpha_ramp_inc, NULL, 
> NULL);
>   g_object_unref (timeline);
>   behaviour = clutter_behaviour_opacity_new (alpha, 0, 255);
> 
> will make the timeline disappear as soon as the behaviour is disposed,
> so you have to keep a single object around; to retrieve the timeline
> from the behaviour,

Great. I guess I wasn't seeing this because I was doing an unnecessary
extra unref of the alpha.

>  just get the alpha from the latter and from the
> alpha get the timeline:
> 
>   timeline = behaviour.get_alpha().get_timeline()

By the way, I don't really see the point of ClutterAlpha in the public
API, unless you are planning to add more functions to it. At the moment
it seems like behaviours could just take the alpha callback, and that
alpha callback could receive the timeline as a parameter, instead of
getting it from a ClutterAlpha.

> >  This seems
> > to be necessary at the moment. Currently, unrefing either the timeline
> > or the behaviours before completion will stop the behaviour from
> > happening.
> 
> yes, because the behaviours and the timelines are top-level objects,
> like ClutterScript, ClutterScore and ClutterModel. 


-- 
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to