Re: libseed-list Clutter.Animator.set_key - g_value_set_float: assertion `G_VALUE_HOLDS_FLOAT (value)' failed
- From: "Alan Knowles" <alan akbkhome com>
- To: "tomw" <tomw ubilix com>
- Cc: libseed-list gnome org, libseed-list-bounces gnome org
- Subject: Re: libseed-list Clutter.Animator.set_key - g_value_set_float: assertion `G_VALUE_HOLDS_FLOAT (value)' failed
- Date: Sun, 12 Dec 2010 22:38:24 +0800
That's about right, after you have created the value, you can run set_float() on it as I described before.
Regards
Alan
--- On 12/Dec/2010, tomw wrote:
> thanks, that helps a lot.
>
> just to make sure I understand it correctly - you are calling the
> g_value_init() method with the GType and the uninitialized value, right?
>
> best, tomw
>
> On Sat, 2010-12-11 at 23:23 +0800, Alan Knowles wrote:
> > try using this as the constructor for the gvalue.
> > new GObject.Value([ imports.gi.GObject.TYPE_FLOAT, 200 ])
> >
> > eg.
> >
> > animator.set_key(rec, "x", 2, a, new GObject.Value([ imports.gi.GObject.TYPE_FLOAT, 200 ]));
> > animator.set_key(rec, "x", 2, b, new GObject.Value( [ imports.gi.GObject.TYPE_FLOAT, 300 ]));
> >
> > Regards
> > Alan
> >
> > --- On 10/Dec/2010, Alan Knowles wrote:
> > > Ok - I'll have to have a play over the weekend and see what's happening.
> > >
> > > Regards
> > > Alan
> > >
> > > --- On 10/Dec/2010, tomw wrote:
> > > > thanks for your swift reply.
> > > >
> > > > On Fri, 2010-12-10 at 16:24 +0800, Alan Knowles wrote:
> > > > > Try this..
> > > > >
> > > > > var start_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
> > > > > var end_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
> > > > >
> > > > > start_value.set_float(200);
> > > > > end_value.set_float( 300);
> > > >
> > > > does not change anything, same errors
> > > > >
> > > > > in your version, the start_value was set to a Javascript number, which gets converted to a DOUBLE type
> > > > >
> > > > > otherwise you could do:
> > > > >
> > > > > animator.set_key(rec, "x", 2, a, [ imports.gi.GObject.TYPE_FLOAT, start_value]);
> > > > > animator.set_key(rec, "x", 2, b, [ imports.gi.GObject.TYPE_FLOAT, end_value] );
> > > >
> > > > gives:
> > > >
> > > > (seed:2938): GLib-GObject-CRITICAL **: g_value_set_float: assertion
> > > > `G_VALUE_HOLDS_FLOAT (value)' failed
> > > >
> > > > (seed:2938): GLib-GObject-CRITICAL **: g_value_set_float: assertion
> > > > `G_VALUE_HOLDS_FLOAT (value)' failed
> > > >
> > > > ** (seed:2938): WARNING **: ArgumentError - probably due to incorrect
> > > > gir file (which may be fixed upstream) argument 5 must not be null for
> > > > function: Animator.set_key
> > > >
> > > >
> > > > >
> > > > > Regards
> > > > > Alan
> > > > >
> > > > > --- On 10/Dec/2010, tomw wrote:
> > > > > > Hi,
> > > > > >
> > > > > > trying to pass the variable to a Clutter.Animator.set_key method I'm
> > > > > > getting the following error messages:
> > > > > >
> > > > > > (seed:2219): GLib-GObject-CRITICAL **: g_value_set_float: assertion
> > > > > > `G_VALUE_HOLDS_FLOAT (value)' failed
> > > > > >
> > > > > > (seed:2219): Clutter-CRITICAL **: clutter_interval_set_initial_value:
> > > > > > assertion `G_VALUE_TYPE (value) == priv->value_type' failed
> > > > > >
> > > > > > from my limited knowledge it seems that the values are not properly
> > > > > > passed to the method
> > > > > >
> > > > > > Any idea how to fix this?
> > > > > >
> > > > > > br, tomw
> > > > > >
> > > > > >
> > > > > >
> > > > > > the code is as follows:
> > > > > >
> > > > > > #!/usr/bin/env seed
> > > > > >
> > > > > > const Clutter = imports.gi.Clutter;
> > > > > > const GObject = imports.gi.GObject;
> > > > > >
> > > > > > Clutter.init(Seed.argv);
> > > > > >
> > > > > >
> > > > > > var stage = Clutter.Stage.get_default ();
> > > > > >
> > > > > > stage.set_size(640, 480);
> > > > > >
> > > > > > var rec = new Clutter.Rectangle();
> > > > > > var col = new Clutter.Color();
> > > > > > col.from_string("light blue");
> > > > > > rec.set_color(col);
> > > > > > rec.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
> > > > > > rec.set_size(100,100);
> > > > > >
> > > > > >
> > > > > > var start_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
> > > > > > var end_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
> > > > > >
> > > > > > start_value = 200;
> > > > > > end_value = 300;
> > > > > > a = 0.5;
> > > > > > b = 0.8;
> > > > > >
> > > > > > var animator = new Clutter.Animator();
> > > > > > var tl = new Clutter.Timeline({duration: 10000});
> > > > > >
> > > > > > animator.set_timeline(tl);
> > > > > > animator.set_duration(3000);
> > > > > > animator.set_key(rec, "x", 2, a, start_value);
> > > > > > animator.set_key(rec, "x", 2, b, end_value);
> > > > > >
> > > > > >
> > > > > > stage.add_actor(rec);
> > > > > > stage.show();
> > > > > > animator.start();
> > > > > >
> > > > > > Clutter.main();
> > > > > >
> > > > > > stage.destroy();
> > > > > >
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > libseed-list mailing list
> > > > > > libseed-list gnome org
> > > > > > http://mail.gnome.org/mailman/listinfo/libseed-list
> > > > >
> > > > > _______________________________________________
> > > > > libseed-list mailing list
> > > > > libseed-list gnome org
> > > > > http://mail.gnome.org/mailman/listinfo/libseed-list
> > >
> > > _______________________________________________
> > > libseed-list mailing list
> > > libseed-list gnome org
> > > http://mail.gnome.org/mailman/listinfo/libseed-list
> >
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]