Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Freitag, 27. April 2012, 12:32

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:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
	<action name="start-ani">
			set(plugin[ani-bg].visible,true);
			tween(plugin[ani-bg].alpha,1,2);
			for(set(i,1), i LT %1, inc(i),
									txtadd(ani-name,'ani-',get(i));
									set(plugin[get(ani-name)].zorder,get(i));
									set(plugin[get(ani-name)].visible,true);
									tween(plugin[get(ani-name)].alpha,1,3);
									wait(5);
				);
			wait(5);
			stop-ani();
			set(autorotate.enabled,true); set(autorotate.speed,-3);set(autorotate.waittime,10);


preventing KRPano from listening to other user events?

Any help appreciated very much!

Michael

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »mstoss« (27. April 2012, 14:06)


2

Freitag, 27. April 2012, 13:03

Hi Micheal,

I not really checked your code, but the "wait" might be the problem. Did you try to use the "delayedcall" instead? The wait-command deactivates the whole tour until the time is over.

BR
Nupsi

3

Freitag, 27. April 2012, 13:18

Thank you so much Nupsi, that sounds after a good explanation. I'll try to replace the wait().

4

Freitag, 27. April 2012, 14:04

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:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
	<action name="start-ani">
			set(plugin[ani-bg].visible,true);
			tween(plugin[ani-bg].alpha,1,2);
			for(set(i,1), i LT %1, inc(i),
						delayedcall
						(2,
							ani-go(get(i)););
						);
			stop-ani();
	</action>
	
	<action name="ani-go">
	  			txtadd(ani-name,'ani-',%1);
				trace(ani-name);
				set(plugin[get(ani-name)].zorder,%1);
				set(plugin[get(ani-name)].visible,true);
				tween(plugin[get(ani-name)].alpha,1,3);			
	</action>


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...

5

Sonntag, 29. April 2012, 16:18

Hi

from the documentation I get this

Zitat

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

6

Montag, 30. April 2012, 10:49

Thank you Peter! I'll try that as well.

Michael

7

Montag, 30. April 2012, 12:05

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

8

Montag, 30. April 2012, 16:04

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

Quellcode

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


Your for loop could be modified like this

Quellcode

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


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

LG
Peter

9

Freitag, 4. Mai 2012, 22:50

Thank you once again, Peter. A rough idea was just what I needed :-)

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