Re: Animation not working properly with the latest version



hi;

On 7 May 2013 15:48, Jiří Techet <techet gmail com> wrote:
Hi Emmanuele,

works fine now, thanks.

But by looking at the patch it's only thanks to the exception on
opacity, the other cases won't work. This looks a bit strange from the
clutter's user point of view - imagine for instance all people
starting to use clutter who put all their code into main() and perform
implicit animation on rotation or whatever else - it won't work.

that's an incomplete assessment: if the actor is mapped and has been
painted at least oncee, then all transitions will still be created.
they will only be skipped if the actor is marked as invisible, or if
any of its parents are not visible. since all actors are visible when
added to a parent actor, you need to set up the transitions after the
scene graph has been built.

prior to having a well defined scene graph, Clutter cannot determine
various things: size, transformations, visibility. performing
animations in these cases would yield weird, inconsistent, or simply
pointless results.

the "opacity exception" is there because clutter_actor_paint() will
automatically skip all actors that have an opacity of 0 (i.e. they are
fully transparent), so we need to factor that in.

I don't quite understand the purpose of this optimization - in my
opinion if users of clutter don't want animation to start when the
actor hasn't been painted yet, it should be the users of clutter who
should skip the animations if they don't want them, not clutter. Of
course clutter should perform optimizations like not painting actors
which are not visible and similar stuff but not not to optimize out
calls which have some effect.

first of all: these are *implicit* transitions. the implementation and
behaviour of those are entirely up to Clutter, so it's really up to
Clutter to decide whether or not those transitions should take place.
all that Clutter can do is to make their behaviour consistent so that
you know what to expect.

the fact that those calls may or may not have some effect is entirely
dependent on whether Clutter optimizes away some calls or not.
queueing redraws or relayouts on invisible actors means that most of
those transitions will not be visible anyway. this wasn't strictly
enforced, and was a source of unnecessary work.

another consideration is that the initial state of a ClutterActor is
neutral: we simply don't know what an actor should look like or do
before we put it into the scene run a frame. implicit transitions
always take the current state as the initial one, and transition to a
final state you defined; if the initial state is not defined,
transitions will look out of place — and *that* would look strange.
try, for instance, to set the easing state duration to 250 msecs on
any actor in Clutter 1.14 when adding them to a layout manager;
Clutter will try to animate the allocation from the default box of {
0, 0, 0, 0 } to the first valid allocation. that also applies to any
transition that depends on layout state, e.g. through a pivot point.

if you want to start an implicit transition when the actor becomes
visible, for instance, then you can use the ::show signal to set it
up. or you can transition from fully transparent to fully opaque.

alternatively, if you think you know better than Clutter, then you can
use an explicit transition: those will always be executed when added
to an actor.

I can definitely tweak some of the conditions, like I did for opacity
and allocation: for instance, allow implicit transitions on
transformations to happen only if we have a valid modelview — though
that usually happens only when the actor has been painted at least
once, so it would be a small superset of valid use cases.

in the future, we may schedule implicit transitions to start only
after the actor has been painted once, instead of immediately, but
that would require a major rework of how we handle time in Clutter,
and would probably be breaking invariants.

ciao,
 Emmanuele.

On Mon, May 6, 2013 at 7:12 PM, Emmanuele Bassi <ebassi gmail com> wrote:
hi;

I reworked the patch, and pushed it after Zeeshan tested it on both
Boxes and Maps, so the bug has been closed.

I also added the issue in the release notes for 1.16; basically:
implicit transitions will always be skipped on actors that are not
mapped (i.e. they are not visible or are children of not visible
parents), unless they are in a branch of the scene graph that is being
cloned. this was an implicit behaviour of Clutter, as ClutterActor
skipped paint and layout on those actors as well, so any implicit
transition would just be pointless busy work with no visible result.

on top of that, implicit transitions on allocation are ignored until
the actor has been allocated at least once; this is to avoid actors
"flying in" into their position and size on their first frame. this
should make UIs a bit more stable even in case of default, non-zero
easing durations.

I'm going to try and add more conditions on a per property/per
property class basis, to minimize the amount of work Clutter does, and
avoid unnecessary paint/layout cycles.

ciao,
 Emmanuele.


On 6 May 2013 09:03, Lionel Landwerlin <llandwerlin gmail com> wrote:
You might want to have a look at this bug report :
https://bugzilla.gnome.org/show_bug.cgi?id=698766


On 04/05/13 10:43, Jiří Techet wrote:

Ah, In the above, substitute "mapped" with "painted" - it's of course
OK to skip the animation when the actor isn't mapped but the animation
shouldn't be skipped when it hasn't been painted yet which is the case
now.

Jiri

On Sat, May 4, 2013 at 11:37 AM, Jiří Techet <techet gmail com> wrote:

Hi,

I'm a maintainer of libchamplain and tried to build it with the latest
clutter version from jhbuild but after building it, libchamplain
doesn't work properly - basically no animations work and the code
which should be executed in animation completion handlers isn't
executed. I have bisected this issue to the following clutter commit:

8f032d595263a2f4fdb057ae5d954ee8236e96cf
actor: Skip transitions on invisible actors

It seems that the animation is completely skipped now if the actor
isn't mapped - which means it is not possible just to create an actor,
add it to the stage and run the animation because at that point the
actor isn't mapped. Minimal example (by modifying clutter's test) is
below:

#include <stdlib.h>
#include <gmodule.h>
#include <clutter/clutter.h>

static ClutterActor *stage;

static gboolean
animate (ClutterActor *actor)
{
  clutter_actor_save_easing_state (actor);
  clutter_actor_set_easing_duration (actor, 2000);
  clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 360.0);
  clutter_actor_restore_easing_state (actor);

  return FALSE;
}

G_MODULE_EXPORT int
test_animation_main (int argc, char *argv[])
{
  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  stage = clutter_stage_new ();
  clutter_actor_set_background_color (stage, clutter_color_get_static
(CLUTTER_COLOR_SKY_BLUE));
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  ClutterActor *actor = clutter_actor_new ();
  clutter_actor_set_background_color (actor, clutter_color_get_static
(CLUTTER_COLOR_ORANGE_LIGHT));
  clutter_actor_add_child (stage, actor);
  clutter_actor_set_size (actor, 100, 100);
  clutter_actor_set_pivot_point (actor, .5f, .5f);
  clutter_actor_set_translation (actor, -50, -50, 0);
  clutter_actor_set_position (actor,
                              clutter_actor_get_width (stage) / 2,
                              clutter_actor_get_height (stage) / 2);

  animate (actor);
//  g_timeout_add (350, animate, actor);

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}

The above code won't trigger the animation. You can only get it
working if you comment-out the timeout function but I believe this is
not the intended behavior (if it is, it should only be done in 2.0
because this behavior is backward-incompatible and I bet it breaks a
lot of applications).

Jiri

_______________________________________________
clutter-list mailing list
clutter-list gnome org
https://mail.gnome.org/mailman/listinfo/clutter-list



_______________________________________________
clutter-list mailing list
clutter-list gnome org
https://mail.gnome.org/mailman/listinfo/clutter-list




--
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/
_______________________________________________
clutter-list mailing list
clutter-list gnome org
https://mail.gnome.org/mailman/listinfo/clutter-list



--
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]