Hi Steve,
Here's my problem (Adressing with actions like LoadScene() )
<scene name="pano[001]" >
</scene>
Currently, i'm still making my scenes statically. By using the Arrays in krpano, i'm hoping to be able to create Scenes dynamically (by actions).
I'm not sure how to call my scenes.
I can call them pano[001] , pano_001 or 001 (I think the last one is the best)
An example
My TourData node
<TourData fovmin="60" fovmax="100"> <!--The TourData node with all global settings for all scenes.-->
<pano name="The first panorama" caption="the first caption" tilesize="745" firstlevel="5215" secondlevel="2608" thirdlevel="1304" startH="20" startV="10" startFov="30" endH="0" endV="30" endFov="90">
<hotspot target=002 ath=-93 atv=-3 />
</pano>
<pano name="The second panorama" caption="the second caption " tilesize="745" firstlevel="5215" secondlevel="2608" thirdlevel="1304 startH="20" startV="10" startFov="30" endH="0" endV="30" endFov="90">
<hotspot target=001 ath=-93 atv=-3 />
</pano>
</TourData>
As i've said before, I want to dynamically create scenes and hotspots.
So it would theoretically be something like this
foreach(TourData.pano.count,i,
NewScene(i);
foreach(TourData.pano.hotspot.count,j,
NewHotspot(j,i);
);
);
<action name="NewScene">
add(startingat1,%1,1); <!-- because the variable i starts at 0, and i want to start the counting at 1.(for the names, but the array index needs to be 0, right?)-->
AddScene(%startingat1);
<!--The following set()'s will dynamically make everything i'm now declaring statically...-->
set(scene[%startingat1].onstart,IndexText(%startingat1);IntroAnimation(%startingat1););
set(scene[%startingat1].view.fovmin,get(TourData.fovmin));
set(scene[%startingat1].view.fovmax,get(TourData.fovmax));
set(scene[%startingat1].view.maxpixelzoom,1.0);
set(scene[%startingat1].view.hlookat,TourData.pano[%startingat1].startH);
set(scene[%startingat1].view.vlookat,TourData.pano[%startingat1].startV);
set(scene[%startingat1].view.fov,TourData.pano[%startingat1].startFov);
set(scene[%startingat1].image.type,CUBE);
set(scene[%startingat1].image.multires,true);
set(scene[%startingat1].image.tilesize,TourData.pano[%startingat1].tilesize);
set(scene[%startingat1].image.level[0].tiledimagewidth,TourData.pano[%startingat1].firstlevel); <!-- I think the dimensions could be calculated with only the width and height of the equirectangular? (something with the number pi) -->
set(scene[%startingat1].image.level[0].tiledimageheight,TourData.pano[%startingat1].firstlevel);
set(scene[%startingat1].image.level[0].left.url,Pano/%startingat1/l3_l_%0v_%0h.jpg);
set(scene[%startingat1].image.level[0].front.url,Pano/%startingat1/l3_f_%0v_%0h.jpg);
set(scene[%startingat1].image.level[0].right.url,Pano/%startingat1/l3_r_%0v_%0h.jpg);
set(scene[%startingat1].image.level[0].back.url,Pano/%startingat1/l3_b_%0v_%0h.jpg);
set(scene[%startingat1].image.level[0].up.url,Pano/%startingat1/l3_u_%0v_%0h.jpg);
set(scene[%startingat1].image.level[0].down.url,Pano/%startingat1/l3_d_%0v_%0h.jpg);
set(scene[%startingat1].image.level[1].tiledimagewidth,TourData.pano[%startingat1].secondlevel);
set(scene[%startingat1].image.level[1].tiledimageheight,TourData.pano[%startingat1].secondlevel);
set(scene[%startingat1].image.level[1].left.url,Pano/%startingat1/l3_l_%0v_%0h.jpg);
set(scene[%startingat1].image.level[1].front.url,Pano/%startingat1/l3_f_%0v_%0h.jpg);
set(scene[%startingat1].image.level[1].right.url,Pano/%startingat1/l3_r_%0v_%0h.jpg);
set(scene[%startingat1].image.level[1].back.url,Pano/%startingat1/l3_b_%0v_%0h.jpg);
set(scene[%startingat1].image.level[1].up.url,Pano/%startingat1/l3_u_%0v_%0h.jpg);
set(scene[%startingat1].image.level[1].down.url,Pano/%startingat1/l3_d_%0v_%0h.jpg);
set(scene[%startingat1].image.level[2].tiledimagewidth,TourData.pano[%startingat1].thirdlevel);
set(scene[%startingat1].image.level[2].tiledimageheight,TourData.pano[%startingat1].thirdlevel);
set(scene[%startingat1].image.level[2].left.url,Pano/%startingat1/l3_l_%0v_%0h.jpg);
set(scene[%startingat1].image.level[2].front.url,Pano/%startingat1/l3_f_%0v_%0h.jpg);
set(scene[%startingat1].image.level[2].right.url,Pano/%startingat1/l3_r_%0v_%0h.jpg);
set(scene[%startingat1].image.level[2].back.url,Pano/%startingat1/l3_b_%0v_%0h.jpg);
set(scene[%startingat1].image.level[2].up.url,Pano/%startingat1/l3_u_%0v_%0h.jpg);
set(scene[%startingat1].image.level[2].down.url,Pano/%startingat1/l3_d_%0v_%0h.jpg);
set(scene[%startingat1].preview.type,CUBESTRIP);
set(scene[%startingat1].preview.url,pano/%/preview.jpg);
</action>
Display More
and offcourse for the hotspots: (I don't really know how to make sure the hotspot is only for the current scene)
<action name="NewHotspot">
addhotspot(%1);
set(hotspot[%1].url,Data/Assets/Hotspot.swf);
set(hotspot[%1].ath,TourData.pano[%2].hotspot.ath);
set(hotspot[%1].atv,TourData.pano[%2].hotspot.atv);
set(hotspot[%1].zoom,true);
sub(num1,%1,1);
txtadd(txt%1,"Go to ",get(TourData.pano[%num1].name)); <!-- I'm giving the temporary text the name "txt%1" because when i use just "txt", all my hotspots would have the same onhover text (dont know why but this is my solution) -->
set(hotspot[%1].onhover,showtext(get(txt%1),TextstyleButton));
set(hotspot[%1].onclick,looktohotspot(%1);ViewScene(%1));
</action>
Display More
for some extra information about other actions:
<action name="ViewScene">
loadscene(Pano[%1], null, MERGE, BLEND(1))
</action>
</action name="IntoAnimation">
sub(tempnum,%1,1);
tween(view.hlookat,get(TourData.pano[%tempnum].endH),2);
tween(view.vlookat,get(TourData.pano[%tempnum].endV),2);
tween(view.fov,get(TourData.pano[%tempnum].endFov),2);
</action>
If really like if the AddScene function would be added to krpano, Klaus told me in another thread, this isn't possible yet.
He said that for now, it is only possible to set it with set(scene.content,PUTALLTHEXMLHERE);
But i hope that he can make scene adding and deleting dynamically, like addhotspot and addlensflare.
So my 2 questions are:
- Can i use an array with the scene node, so i don't have to give them a name?
- Could a addscene function be added to krpano?