On Thu, 2007-12-13 at 19:48 +0100, Murray Cumming wrote:
> > I guess that should be made clearer in the API reference too. You could
> > unref it after the mainloop has stopped but in the real world you'd
> > actually want to unref it when the timeline stops, which means handling
> > its completed signal, which would be tedious.
>
> 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, 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, just get the alpha from the latter and from the
alpha get the timeline:
timeline = behaviour.get_alpha().get_timeline()
> 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.
ciao,
Emmanuele.
--
Emmanuele Bassi, OpenedHand Ltd.
Unit R, Homesdale Business Centre
216-218 Homesdale Rd., Bromley - BR12QZ
http://www.o-hand.com
--
To unsubscribe send a mail to [EMAIL PROTECTED]