does a for loop prevent plugins from reacting?

  • Hi,

    I have scripted a loop which shows different states of an object, a bit like a slide show, right before the tour is running. When the loop is finished, the pano starts. This works nicely so far, but now I want to add a button to stop the loop and find that the button is not even enabled. Without the loop, the button is working. Is a loop like this:

    preventing KRPano from listening to other user events?

    Any help appreciated very much!

    Michael

    Edited once, last by mstoss (April 27, 2012 at 2:06 PM).

  • Hm. This does not work as expected, unfortunately.

    Adding wait() obviously kills it all, you are right. But adding delayedcall() does not work neither.

    I tried this:

    Adding wait() does work, it delays the loop but for the price of a totally passive behavior. Omitting wait results in no visible action at all, the animation elements don't show up, whilst trace shows, that the plug-in name is counted as it should.

    Sigh...

  • Hi

    from the documentation I get this

    Quote

    Note - The user interface and all other actions are blocked during the waiting. That means
    the next action will be executed when the current action was done. The oninterrupt
    action can be used to make this action interrupt able by the user.

    May the oninterrupt feature help?
    Also the async version of loop/for could do the trick?

    Greetings
    Peter

  • I tried both the oninterrupt and asyncfor-loop. Oninterrupt is working so far by letting me stop the slide-show, but nothing more.

    Maybe I am completely wrong with this approach?

    Has anyone an idea to achieve this slide-show like effect?

    1. On pano start the panorama is dimmed to be a background image only by some bg-image.jpg - DONE
    2. A background image (ani-bg-image.jpg, set to be a parent object) for the slide show with 2 buttons to stop/restart the slide-show is tweening in. -DONE
    3. The elements of the slide show are defined as child objects, set to invisible, alpha 0, disabled, their names being different only by a number (ani-1, ani-2 ... etc.). - DONE
    4. An action which is displaying the child objects one by one, with adjustable duration before the next element is shown DONE SO FAR BUT NOT WORKING together with
    5. Option to stop the slide-show or restart it.

    Hm. Is there something like an array in KRPano?

    Michael

  • Hi Michael,


    couldn't you use a kind of 'state-variable' which you toggle in the oninterrupt-action and according to the current state you execute your
    delayedcall ani-go(get(i)

    I think, more as a sketch, this way

    Code
    oninterrupt( if(StopSlide,set(StopSlide,False),set(StopSlide,True)));

    Your for loop could be modified like this

    Code
    for...
    ifnot(StopSlide==True,ani_go(%1))...

    As mentioned just a rough idea, syntax me be wrong....

    LG
    Peter

  • Thank you once again, Peter. A rough idea was just what I needed *smile*

    Anyway, I stepped back from the whole interrupt idea in favour of another approach. The problem was caused by the inactive buttons during the for loop running, the finished loop starting the panorama immediately. So no chance to press a stop, start button, right? Now I simply let the for loop run til its end and keep the panorama paused. Then the buttons are working as usual so that I can place a Restart Animation or Start Panorama Tour button beneath the animation. When the client has accepted this solution, I might place a link.

    Thank you very much Nupsi and Peter for your thoughts so far.

    Michael

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!