Sie sind nicht angemeldet.

viewinz

Fortgeschrittener

  • »viewinz« ist der Autor dieses Themas

Beiträge: 145

Wohnort: Wellington, New Zealand

Beruf: Trying to build an entire walkthrough of NZ for tourists

  • Nachricht senden

1

Sonntag, 14. Februar 2010, 09:49

next/previous buttons

Hello,

I've been trying to create next and previous buttons that will load the previous or next scenes in a scenes document.

The code that is almost working is :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<action name="prenex">
trace(scene.count);
set(totalviews,get(scene.count));
set(i,0);
prenex2(get(i),%1,get(cview));
</action>

<action name="prenex2">
if(scene[%1].name==%3,
	set(v,%1);
	prenex3(%1,%2,get(totalviews))
,
	inc(i);
	prenex2(get(i),%2,%3);
);	
</action>

<action name="prenex3">
trace(%1___%2___%3);
if(%2==prev,
	if(%1==0,
		dec(totalviews);
		prenex_load(get(totalviews))
	,
		dec(v); 
		prenex_load(get(v))
	);
);
if(%2==next,
	if(%1==%3,
		prenex_load(0)
	,
		inc(v); 
		prenex_load(get(v))
	);
);

</action>

<action name="prenex_load">
trace(%1);
loadscene(get(scene[%1].name),null,MERGE,blend(0.3)),
</action>


The problem I think is that each time the current scene number (cview) is being reset to zero, so I can do next and previous scenes but not the ones after. Any ideas on how I can dynamically define scene numbers so I can set a list?

Cheers

2

Montag, 15. Februar 2010, 22:24

Hi,

here would be a fully automated solution (without any additional variables):

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<action name="prevscene">
    if(%1 != findnext, sub(i,scene.count,1));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       dec(i);
       if(i LT 0, sub(i,scene.count,1));
       loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
      ,
       dec(i);
       if(i GE 0, prevscene(findnext));
      );
</action>

<action name="nextscene">
    if(%1 != findnext, set(i,0));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       inc(i);
       if(i == scene.count, set(i,0));
       loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
      ,
       inc(i);
       if(i LT scene.count, nextscene(findnext));
      );
</action>


just call either the 'prevscene' or 'nextscene' action,

best regards,
Klaus

viewinz

Fortgeschrittener

  • »viewinz« ist der Autor dieses Themas

Beiträge: 145

Wohnort: Wellington, New Zealand

Beruf: Trying to build an entire walkthrough of NZ for tourists

  • Nachricht senden

3

Montag, 15. Februar 2010, 23:57

Cheers Klaus, that is so much more elegant than the way I was doing it! And works perfectly thank you so much *thumbup* .

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

4

Dienstag, 16. Februar 2010, 00:05

Interesting!

will this way also work with 'no scene' pano's? or is there an other code for that..

so like if 19.xml... next is 20.xml *confused*
*wacko*

Thanx
Tuur *thumbsup*

5

Dienstag, 16. Februar 2010, 01:20

Klaus how in the did you get so smart? Does code just come naturally? my next and previos buttons work but not like that. i had to create 12 different actions then set the onclicks to set what the next onclick would load.

6

Mittwoch, 17. Februar 2010, 13:43

Hi,
will this way also work with 'no scene' pano's? or is there an other code for that..
no, not that code, the informations about the scenes are all loaded and there and it's possible to check for them,
krpano can't know if there are other xml files out there,
but it would be possible to predefine a variable for the current xml and one for the number of the xml files and
then increase or decrease this variable and load the right xml file...


Klaus how in the did you get so smart? Does code just come naturally? my next and previos buttons work but not like that. i had to create 12 different actions then set the onclicks to set what the next onclick would load.
I have used a small trick for that:
internally when loading a scene, it's content is stored in the "xml.content" variable (inside a <krpano> tag),
then I loop through all scenes (known via "scene.count") and check if it is the current scene, and if yes,
the previous or next scene will be loaded,

another trick is - when the action is called without a parameter (%1), the counter variable (i) will be set to
the start value, and in the other case when it was called with parameter (findnext), the varialbe 'i' will be
not changed,
this allows small loopings,

best regards,
Klaus

7

Donnerstag, 18. Februar 2010, 12:57

Hi, Klaus

Possible to disable the Preview Button when you are in scene1, and the Next Button when you are in the last scene , eg scene6 ?

I try with the if but not working, I think I don't have the good syntax

8

Montag, 22. Februar 2010, 15:31

Hi,
Possible to disable the Preview Button when you are in scene1, and the Next Button when you are in the last scene , eg scene6 ?
that's a bit more complex,
but here is an example code:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<action name="enable_button">
    set(plugin[%1].enabled,%2);
    if(%2 == false, tween(plugin[%1].alpha, 0.2), tween(plugin[%1].alpha, 1.0));
</action>

<action name="update_prev_next_buttons">
    sub(maxsceneindex, scene.count, 1);
    if(%1 LE 0,             enable_button('prev scene', false), enable_button('prev scene', true));
    if(%1 GE maxsceneindex, enable_button('next scene', false), enable_button('next scene', true));
</action>

<action name="prevscene">
    if(%1 != findnext, sub(i,scene.count,1));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       dec(i);
       if(i GE 0, loadscene(get(scene[%i].name), null, MERGE, BLEND(1)); );
       update_prev_next_buttons(get(i));
      ,
       dec(i);
       if(i GE 0, prevscene(findnext));
      );
</action>

<action name="nextscene">
    if(%1 != findnext, set(i,0));
    txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
    if(scenexml == xml.content,
       inc(i);
       if(i LT scene.count, loadscene(get(scene[%i].name), null, MERGE, BLEND(1)); );
       update_prev_next_buttons(get(i));
      ,
       inc(i);
       if(i LT scene.count, nextscene(findnext));
      );
</action>


best regards,
Klaus

9

Montag, 22. Februar 2010, 18:53

Wahou great code, I try this later and come back make a reply

Thank Klaus

10

Samstag, 3. April 2010, 19:38

I have used a small trick for that:
internally when loading a scene, it's content is stored in the "xml.content" variable (inside a <krpano> tag),
then I loop through all scenes (known via "scene.count") and check if it is the current scene, and if yes,
the previous or next scene will be loaded,
Hi Klaus. I know this is a great solution but since I am thick could you please check why mine is not working

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<krpano version="1.0.8" logkey="false">
 <include url="%SWFPATH%/plugins.xml" />
	<include url="videotour0.xml"/>
	<plugin name="data" keep="true"/>
	
	<textstyle name="DEFAULT" alpha="1" bold="false" font="Arial" fontsize="16" italic="false" textcolor="0xff000000"/>
	
	<plugin name="logo" url="videotourdata/graphics/logo.png" keep="true" align="rightbottom" x="10" y="10" width="109" height="18" onclick="openurl(http://www.myomsk.info,_blank)"/>
	<plugin name="in" align="bottom" keep="true" ondown="set(movevectorz,-1);" onout="set(blendmode,normal);" onover="set(blendmode,add);" onup="set(movevectorz,0);" url="videotourdata/graphics/menu/menu0.png" x="-160" y="10"/>
	<plugin name="out" align="bottom" keep="true" ondown="set(movevectorz,+1);" onout="set(blendmode,normal);" onover="set(blendmode,add);" onup="set(movevectorz,0);" url="videotourdata/graphics/menu/menu1.png" x="-120" y="10"/>
	<plugin name="left" align="bottom" keep="true" ondown="set(movevectorx,-1);" onout="set(blendmode,normal);" onover="set(blendmode,add);" onup="set(movevectorx,0);" url="videotourdata/graphics/menu/menu2.png" x="-80" y="10"/>
	<plugin name="right" align="bottom" keep="true" ondown="set(movevectorx,+1);" onout="set(blendmode,normal);" onover="set(blendmode,add);" onup="set(movevectorx,0);" url="videotourdata/graphics/menu/menu3.png" x="-40" y="10"/>

	<plugin name="prevscene" align="bottom" keep="true"  onclick="action(prevscene);" onout="set(blendmode,normal);" onover="set(blendmode,add);" url="videotourdata/graphics/menu/menu4.png" x="0" y="10"/>
	<plugin name="nextscene" align="bottom" keep="true"  onclick="action(nextscene);" onout="set(blendmode,normal);" onover="set(blendmode,add);"  url="videotourdata/graphics/menu/menu5.png" x="40" y="10"/>


	<plugin name="home" align="bottom" blendmode="normal" keep="true" onclick="lookto(get(panoview.h),get(panoview.v),get(panoview.fov),smooth(100,20,50));" onout="set(blendmode,normal);" onover="set(blendmode,add);" url="videotourdata/graphics/menu/menu6.png" x="80" y="10"/>
	<plugin name="openfs" align="bottom" blendmode="screen" keep="true" onclick="set(fullscreen,true);" onout="set(blendmode,screen);" onover="set(blendmode,add);" url="videotourdata/graphics/menu/menu7.png" x="120" y="10"/>
	<plugin name="closefs" align="bottom" blendmode="screen" keep="true" onclick="set(fullscreen,false);" onout="set(blendmode,screen);" onover="set(blendmode,add);" url="videotourdata/graphics/menu/menu8.png" visible="false" x="120" y="10"/>
	<events onenterfullscreen="set(plugin[openfs].visible,false); set(plugin[closefs].visible,true);" onexitfullscreen="set(plugin[openfs].visible,true); set(plugin[closefs].visible,false);"/>
	<plugin name="autorotation" align="bottom" blendmode="screen" keep="true" onclick="switch(autorotate.enabled);" onout="set(blendmode,screen);" onover="set(blendmode,add);" url="videotourdata/graphics/menu/menu9.png" x="160" y="10"/>
	<action name="prevscene">
	if(%1 != findnext, sub(i,scene.count,1));
	txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
	if(scenexml == xml.content,
   	dec(i);
   	if(i LT 0, sub(i,scene.count,1));
   	loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
  	,
   	dec(i);
   	if(i GE 0, prevscene(findnext));
  	);
</action>

<action name="nextscene">
	if(%1 != findnext, set(i,0));
	txtadd(scenexml,'<krpano>',get(scene[%i].content),'</krpano>');
	if(scenexml == xml.content,
   	inc(i);
   	if(i == scene.count, set(i,0));
   	loadscene(get(scene[%i].name), null, MERGE, BLEND(1));
  	,
   	inc(i);
   	if(i LT scene.count, nextscene(findnext));
  	);
</action>
</krpano>
	
	


Thank you

11

Mittwoch, 7. April 2010, 22:58

Hi,
Hi Klaus. I know this is a great solution but since I am thick could you please check why mine is not working
do you have a link?
the posted code itself looks right,

best regards,
Klaus

12

Sonntag, 10. April 2011, 20:34

Transitioning the images without stopping autorotate

Hi Klaus,
Any chance that you could better (improve) this code by allowing the scene to transition, or tween, into the next scene without stopping when autorotate is enabled? That would make it perfect for timelapse shots.
Thanks for the consideration.
Tony

13

Donnerstag, 14. April 2011, 15:52

Hi,
Any chance that you could better (improve) this code by allowing the scene to transition, or tween, into the next scene without stopping when autorotate is enabled? That would make it perfect for timelapse shots.
I'm already planing that, but this needs a bigger change in the core viewer engine, so it can still take some time,

best regards,
Klaus

14

Donnerstag, 14. April 2011, 19:32

Thanks for your dedication

Thanks for the update Klaus. I understand the complexity of that and figured it could prove more, well - complex. Thanks for your devotion. I'm in for the long run and can wait.
Tony

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »nefar1ous« (21. April 2011, 16:58)


Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

15

Montag, 23. Mai 2011, 01:25

Hi,

i try to make next picture button..

here some code.. but get stuck in the next_pic action (the buttons under the big picture :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<plugin name="btn_pic_next" url="../../skin/gallery_right.png" keep="true" visible="false" alpha="0.6" parent="base_pic" align="center" x="240" y="145" scale="0.2" zorder="100" onover="tween(alpha,1)" onout="tween(alpha,0.6)" onclick="next_pic();" />


<action name="next_pic" >
		if(plugin[firstthumb].visible == true, 
			removeplugin(firstthumb);
			inc(i);

			,
			inc(i);
			
			
			<!-- ???????????? tried a lot different things... but no succes -->
);

trace('name=',get(plugin[get(pn)].url)); 
	</action>	
	

<action name="open_gallery">
		
wait(2);
		tween(plugin[pic_bg].height,350,0.5);
		tween(plugin[pic_bg].width,100,0.5,,WAIT);
		tween(plugin[pic_bg].width,550,0.7,,WAIT);
	set(plugin[btn_pic_next].visible,true);
	set(plugin[btn_pic_previous].visible,true);
		addplugin(firstthumb);
			set(plugin[firstthumb].url, get(pic.thumb[thumb_0].url)); 						
			set(plugin[firstthumb].alpha, 1); 						
			set(plugin[firstthumb].visible, true); 						
			set(plugin[firstthumb].align, center);
			set(plugin[firstthumb].zorder, 100);
			set(plugin[firstthumb].x, 200);
			set(plugin[firstthumb].y, -20);
			set(plugin[firstthumb].effect,glow(0xFFFFFF,1,15,10000));
			set(plugin[firstthumb].roundedge,20);
	</action>

<action name="showpic">		
			if(plugin[firstthumb].visible == true, removeplugin(firstthumb););					

		removeplugin(get(pn));
		txtadd(pn,'thumb_',get(i)); 													
		addplugin(get(pn));
			set(plugin[get(pn)].url, get(pic.thumb[get(name)].url)); 						
			set(plugin[get(pn)].alpha, 1); 						
			set(plugin[get(pn)].visible, true); 						
			set(plugin[get(pn)].align, center);
			set(plugin[get(pn)].zorder, 100);
			set(plugin[get(pn)].x, 200);
			set(plugin[get(pn)].y, -20);
			set(plugin[get(pn)].effect,glow(0xFFFFFF,1,15,10000));
			set(plugin[get(pn)].roundedge,20);
	</action>	

<pic>
	
	<thumb name="thumb_0" 	url="../images/001.jpg"  title="Test" 			todo="lookat(240,0,50);showpic();" />
	<thumb name="thumb_1" 	url="../images/002.jpg"  title="Test"			todo="lookat(40,0,50);" />
	<thumb name="thumb_2" 	url="../images/003.jpg"  title="Test"			todo="lookat(340,0,50);" />
	<thumb name="thumb_3"  	url="../images/004.jpg"  title="another test"	todo="showpic();" />
	<thumb name="thumb_4" 	url="../images/005.jpg"  title="Test"			todo="showpic();" />
	<thumb name="thumb_5" 	url="../images/006.jpg"  title="Test"			todo="showpic();" />
	<thumb name="thumb_6" 	url="../images/007.jpg"	 title="Test"			todo="" />
	<thumb name="thumb_7" 	url="../images/008.jpg"  title="Test"			todo="showpic();" />
	<thumb name="thumb_8"   url="../images/009.jpg"	 title="keep testing"	todo="lookat(140,0,50);" />
	<thumb name="thumb_9"   url="../images/010.jpg"	 title="keep testing"	todo="lookat(140,0,50);" />
	<thumb name="thumb_10"  url="../images/011.jpg"  title="keep testing"	todo="lookat(140,0,50);" />
	<thumb name="thumb_11"  url="../images/012.jpg"  title="keep testing"	todo="lookat(140,0,50);" />
</pic>


*cry* *wacko*

full xml: http://www.virtualtuur.com/krpano/simple/9/gallery9.xml (but i'm editing some here.. so it changes..)

example: http://www.virtualtuur.com/krpano/simple/9/



Tuur *thumbsup*

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

16

Montag, 23. Mai 2011, 01:26

Hi,

i try to make next picture button..

here some code.. but get stuck in the next_pic action (the buttons under the big picture :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<plugin name="btn_pic_next" url="../../skin/gallery_right.png" keep="true" visible="false" alpha="0.6" parent="base_pic" 
align="center" x="240" y="145" scale="0.2" zorder="100" onover="tween(alpha,1)" onout="tween(alpha,0.6)" onclick="next_pic();" />


<action name="next_pic" >
		if(plugin[firstthumb].visible == true, 
			removeplugin(firstthumb);
			inc(i);

			,
			inc(i);
			
			
			<!-- ???????????? tried a lot different things... but no succes -->
);

trace('name=',get(plugin[get(pn)].url)); 
	</action>	
	

<action name="open_gallery">
		
wait(2);
		tween(plugin[pic_bg].height,350,0.5);
		tween(plugin[pic_bg].width,100,0.5,,WAIT);
		tween(plugin[pic_bg].width,550,0.7,,WAIT);
	set(plugin[btn_pic_next].visible,true);
	set(plugin[btn_pic_previous].visible,true);
		addplugin(firstthumb);
			set(plugin[firstthumb].url, get(pic.thumb[thumb_0].url)); 						
			set(plugin[firstthumb].alpha, 1); 						
			set(plugin[firstthumb].visible, true); 						
			set(plugin[firstthumb].align, center);
			set(plugin[firstthumb].zorder, 100);
			set(plugin[firstthumb].x, 200);
			set(plugin[firstthumb].y, -20);
			set(plugin[firstthumb].effect,glow(0xFFFFFF,1,15,10000));
			set(plugin[firstthumb].roundedge,20);
	</action>

<action name="showpic">		
			if(plugin[firstthumb].visible == true, removeplugin(firstthumb););					

		removeplugin(get(pn));
		txtadd(pn,'thumb_',get(i)); 													
		addplugin(get(pn));
			set(plugin[get(pn)].url, get(pic.thumb[get(name)].url)); 						
			set(plugin[get(pn)].alpha, 1); 						
			set(plugin[get(pn)].visible, true); 						
			set(plugin[get(pn)].align, center);
			set(plugin[get(pn)].zorder, 100);
			set(plugin[get(pn)].x, 200);
			set(plugin[get(pn)].y, -20);
			set(plugin[get(pn)].effect,glow(0xFFFFFF,1,15,10000));
			set(plugin[get(pn)].roundedge,20);
	</action>	

<pic>
	
	<thumb name="thumb_0" 	url="../images/001.jpg"  title="Test" 			todo="lookat(240,0,50);showpic();" />
	<thumb name="thumb_1" 	url="../images/002.jpg"  title="Test"			todo="lookat(40,0,50);" />
	<thumb name="thumb_2" 	url="../images/003.jpg"  title="Test"			todo="lookat(340,0,50);" />
	<thumb name="thumb_3"  	url="../images/004.jpg"  title="another test"	todo="showpic();" />
	<thumb name="thumb_4" 	url="../images/005.jpg"  title="Test"			todo="showpic();" />
	<thumb name="thumb_5" 	url="../images/006.jpg"  title="Test"			todo="showpic();" />
	<thumb name="thumb_6" 	url="../images/007.jpg"	 title="Test"			todo="" />
	<thumb name="thumb_7" 	url="../images/008.jpg"  title="Test"			todo="showpic();" />
	<thumb name="thumb_8"   url="../images/009.jpg"	 title="keep testing"	todo="lookat(140,0,50);" />
	<thumb name="thumb_9"   url="../images/010.jpg"	 title="keep testing"	todo="lookat(140,0,50);" />
	<thumb name="thumb_10"  url="../images/011.jpg"  title="keep testing"	todo="lookat(140,0,50);" />
	<thumb name="thumb_11"  url="../images/012.jpg"  title="keep testing"	todo="lookat(140,0,50);" />
</pic>


*cry* *wacko*

full xml: http://www.virtualtuur.com/krpano/simple/9/gallery9.xml (but i'm editing some here.. so it changes..)

example: http://www.virtualtuur.com/krpano/simple/9/


i thought and am trying also something with copy and inc i ... *unsure*


Tuur *thumbsup*

17

Samstag, 28. Mai 2011, 20:54

Great Work

This is really nice Tuur. When you finish it, I'd love to see. I nice option (in the end) would be to have it as a Pop Up from a button so you could turn it off and on.

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

Ähnliche Themen