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.
|
|
Quellcode |
1 2 3 4 5 |
<style name="PANONAMES" Pano_001index="Kantine" Pano_002index="Labratory" Pano_003index="classroom" </style> |
|
|
Quellcode |
1 2 3 4 5 |
<plugin name="indextext" url="Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="indextext">
set(plugin[textfield].html,[p]get(style[PANONAMES].%1index)[/p])
</action>
|
|
|
Quellcode |
1 2 3 4 5 |
set(mynumber,squaremynumber(%1)) <action name="squaremynumber"> return(mult(%1,%1)) </action> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<krpano version="1.0.8" onstart="indextext(001)" >
<style name="PANONAMES"
Pano_001index="Kantine"
Pano_002index="Labratory"
Pano_003index="classroom"
/>
<plugin name="indextext" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="indextext">
txtadd(html,"[p]",get(style[PANONAMES].Pano_%1index),"[/p]");
set(plugin[indextext].html,get(html));
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<krpano version="1.0.8" onstart="indextext(0)" >
<style name="PANONAMES" >
<pano name="Kantine" />
<pano name="Labratory" />
<pano name="classroom" />
</style>
<plugin name="indextext" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="indextext">
txtadd(html,"[p]",get(style[PANONAMES].pano[%1].name),"[/p]");
set(plugin[indextext].html,get(html));
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<krpano version="1.0.8" onstart="indextext(2)" >
<style name="PANONAMES" >
<pano name="Kantine" caption="This is the kantine where grey food is served"/>
<pano name="Labratory" caption="This is the labratory where we perform evil experiments"/>
<pano name="classroom" caption="This is the classroom where we catch up on our sleep"/>
</style>
<plugin name="indextext" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="indextext">
txtadd(html,"[p]",get(style[PANONAMES].pano[%1].name),"[br]the caption=",get(style[PANONAMES].pano[%1].caption),"[/p]");
set(plugin[indextext].html,get(html));
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
|
|
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 |
<krpano version="1.0.8" onstart="indextext(2)" >
<style name="PANONAMES" >
<pano name="Kantine" caption="This is the kantine where grey food is served" date="3/3/09"/>
<pano name="Labratory" caption="This is the labratory where we perform evil experiments" date="20/4/09"/>
<pano name="classroom" caption="This is the classroom where we catch up on our sleep" date="14/1/09"/>
</style>
<plugin name="indextext" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="indextext">
txtadd(html,"[b]there are ",get(style[PANONAMES].pano.count)," panoramas in this tour[/b][br][br]");
foreach(style[PANONAMES].pano,i,
pano_description(html,get(i));
);
set(plugin[indextext].html,get(html));
</action>
<!-- concatenates a description of the pano onto the strname of pano[index] -->
<action name="pano_description"> <!--strname.str,index.num -->
txtadd(%1,get(%1),"panorama number %2 is ",get(style[PANONAMES].pano[%2].name),"[br]");
txtadd(%1,get(%1)," it was taken on ",get(style[PANONAMES].pano[%2].date),"[br]");
txtadd(%1,get(%1)," it's caption is '",get(style[PANONAMES].pano[%2].caption),"'[br][br]");
</action>
<!-- _foreach_action
private function to execute foreach loop body action -->
<action name="_foreach_action">
trace("Error in foreach loop: push/pop stack corrupted"); <!-- this line should never execute -->
</action>
<!-- foreach <objectid> <index.str> <body.str>
foreach loop function which iterates the action across each of the objects-->
<action name="foreach"> <!--objectid.str,index.str,body.str-->
set(%2,0);
push(action[_foreach_action].content);
set(action[_foreach_action].content,"if(%2 LT %1.count,%3;inc(%2);_foreach_action(););");
_foreach_action();
pop(action[_foreach_action].content);
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »pinsane« (28. Februar 2010, 19:31)
|
|
Quellcode |
1 2 3 4 5 |
<style name="PANONAMES" > <pano name="Kantine" caption="This is the kantine where grey food is served"/> <pano name="Labratory" caption="This is the labratory where we perform evil experiments"/> <pano name="classroom" caption="This is the classroom where we catch up on our sleep"/> </style> |
|
|
Quellcode |
1 2 3 4 5 6 |
<action name="IndexText"> add(VAR_num,%1,1); txtadd(VAR_txt,"[p]",get(style[DATA].pano[get(VAR_num)].caption),"[/p]"); set(plugin[IndexText].html,get(VAR_txt)); set(plugin[IndexText].effect,glow(0x000000,0.7,4,2)); </action> |
Hi, I'm trying to use that array possibility within style nodes, but i want the counting to start at 1 instead of 0.
One easy way to do this is to add a dummy pano which will take the 0 position:|
|
Quellcode |
1 2 3 4 5 6 |
<style name="PANONAMES" > <pano name="Dummy" caption="This is the index zero entry which should never be accessed" /> <pano name="Kantine" caption="This is the kantine where grey food is served"/> <pano name="Labratory" caption="This is the labratory where we perform evil experiments"/> <pano name="classroom" caption="This is the classroom where we catch up on our sleep"/> </style> |
![]()
Quellcode
1 2 3 4 5 6 <action name="IndexText"> add(VAR_num,%1,1); txtadd(VAR_txt,"[p]",get(style[DATA].pano[get(VAR_num)].caption),"[/p]"); set(plugin[IndexText].html,get(VAR_txt)); set(plugin[IndexText].effect,glow(0x000000,0.7,4,2)); </action>
But this doesn't work: NULL, the problem lies at the get(VAR_num)
Any ideas?
Declan
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<krpano version="1.0.8" onstart="indextext(1)" >
<style name="PANONAMES" >
<pano name="Dummy" caption="This is the index zero entry which should never be accessed" />
<pano name="Kantine" caption="This is the kantine where grey food is served"/>
<pano name="Labratory" caption="This is the labratory where we perform evil experiments"/>
<pano name="classroom" caption="This is the classroom where we catch up on our sleep"/>
</style>
<plugin name="indextext" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="IndexText">
txtadd(plugin[IndexText].html,"[p]",get(style[PANONAMES].pano[%1].caption),"[/p]");
set(plugin[IndexText].effect,glow(0x000000,0.7,4,2));
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<krpano version="1.0.8" onstart="indextext(1)" >
<style name="PANONAMES" >
<pano name="Kantine" caption="This is the kantine where grey food is served"/>
<pano name="Labratory" caption="This is the labratory where we perform evil experiments"/>
<pano name="classroom" caption="This is the classroom where we catch up on our sleep"/>
</style>
<plugin name="indextext" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="IndexText">
sub(VAR_num,%1,1);
txtadd(plugin[IndexText].html,"[p]",get(style[PANONAMES].pano[%VAR_num].caption),"[/p]");
set(plugin[IndexText].effect,glow(0x000000,0.7,4,2));
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<krpano version="1.0.8" onstart="indextext(1)" >
<pano name="Kantine" caption="This is the kantine where grey food is served"/>
<pano name="Labratory" caption="This is the labratory where we perform evil experiments"/>
<pano name="classroom" caption="This is the classroom where we catch up on our sleep"/>
<plugin name="indextext" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="IndexText">
sub(VAR_num,%1,1);
txtadd(plugin[IndexText].html,"[p]",get(pano[%VAR_num].caption),"[/p]");
set(plugin[IndexText].effect,glow(0x000000,0.7,4,2));
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
Zitat
1) because you need to reference style[PANONAMES], not style[DATA]
Zitat
2) krpano's action language does not currently allow you to use the get() function as an index. What you can do is use an argument (such as %1).
|
|
Quellcode |
1 2 3 4 5 |
set(plugin[IndexText].html,%VAR_txt); instead of set(plugin[IndexText].html,get(VAR_txt)); |
|
|
Quellcode |
1 2 3 4 5 6 |
<TourData> <pano name="Kantine" caption="This is the kantine where grey food is served"/> <hotspot ath="170" atv="20" target="003" /> <pano name="Labratory" caption="This is the labratory where we perform evil experiments"/> <pano name="classroom" caption="This is the classroom where we catch up on our sleep"/> </TourData> |
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »rctdeclan« (11. April 2010, 13:12)
the get() function is a very special one, can be only used for a single parameter
Zitat
set(plugin[textfield].html,[p]get(style[PANONAMES].%1index)[/p])
i've tried to add the 2 p's and my code in a string with txtadd, but it doesnt work.
Zitat
Isn't there a way of making your one variables and being able to return them in a action, like:
right, krpano doesn't have such
Zitat
I'm now using a foreach loop, but krpano said it doesn't have a foreach action command.

Zitat
Zitat
I'm now using a foreach loop, but krpano said it doesn't have a foreach action command.
right, krpano doesn't have such

Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »rctdeclan« (12. April 2010, 18:55)
Hi Klaus,
My pano's are called Pano[001], Pano[002] and so on... Now i'm trying to pass a counting variable (i) to the index of the Pano[index] array. But then it isn't Pano[001] but Pano[1]. Is there anyway to make sure the variable has 3 digits?
|
|
Quellcode |
1 2 3 |
<pano name="001" caption="This is pano 001, it is really fun"/> <pano name="002" caption="This is pano 002, it is really cool"/> <pano name="003" caption="This is pano 003, it is really wee"/> |
|
|
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 |
<krpano version="1.0.8" >
<events onpreviewcomplete="delayedcall(0,indextest(););" />
<pano name="001" caption="This is pano 001, it is really fun"/>
<pano name="002" caption="This is pano 002, it is really cool"/>
<pano name="003" caption="This is pano 003, it is really wee"/>
<plugin name="indextext1" url="%SWFPATH%../Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<plugin name="indextext2" align="centertop" url="%SWFPATH%Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<plugin name="indextext3" align="righttop" url="%SWFPATH%Plugins/textfield.swf" css="p{font-size:14;font-family:arial;}" />
<action name="addtext">
<!-- this uses the argument to address the centertop plugin -->
txtadd(plugin[IndexText2].html,"[p]",get(pano[00%1].caption),"[/p]");
</action>
<action name="indextest">
trace("pano.count=",pano.count);
trace("pano[0].caption=",pano[0].caption," pano[0].name=",pano[0].name);
trace("pano[1].caption=",pano[1].caption," pano[1].name=",pano[1].name);
trace("pano[2].caption=",pano[2].caption," pano[2].name=",pano[2].name);
trace("pano[3].caption=",pano[3].caption," pano[3].name=",pano[3].name);
foreach(pano,i,
<!-- this section indexes the lefttop plugin with a string directly -->
if (i == 1,txtadd(plugin[IndexText1].html,"[p]",get(pano[001].caption),"[/p]"););
if (i == 2,txtadd(plugin[IndexText1].html,"[p]",get(pano[002].caption),"[/p]"););
if (i == 3,txtadd(plugin[IndexText1].html,"[p]",get(pano[003].caption),"[/p]"););
<!-- this section indexes the centertop plugin via an argument-->
addtext(get(i));
<!-- this section indexes the righttop plugin via a variable (tmp) -->
txtadd(tmp,'00',get(i));
txtadd(plugin[IndexText3].html,"[p]",get(pano[%tmp].caption),"[/p]");
wait(0);
txtadd(tmp,'alert(loop i=',get(i),')');
js(get(tmp));
);
</action>
<!-- _foreach_action
private function to execute foreach loop body action -->
<action name="_foreach_action">
trace("Error in foreach loop: push/pop stack corrupted"); <!-- this line should never execute -->
</action>
<!-- foreach <objectid> <index.str> <body.str>
foreach loop function which iterates the action across each of the objects-->
<action name="foreach"> <!--objectid.str,index.str,body.str-->
set(%2,0);
push(action[_foreach_action].content);
set(action[_foreach_action].content,"if(%2 LT %1.count,%3;inc(%2);_foreach_action(););");
_foreach_action();
pop(action[_foreach_action].content);
</action>
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
</krpano>
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »pinsane« (13. April 2010, 09:19)
|
|
Quellcode |
1 2 |
<scene name="pano[001]" > </scene> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 |
<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> |
|
|
Quellcode |
1 2 3 4 5 6 |
foreach(TourData.pano.count,i, NewScene(i); foreach(TourData.pano.hotspot.count,j, NewHotspot(j,i); ); ); |
|
|
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 |
<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> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 |
<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> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 |
<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>
|
with %1,%2,%3,... and so on you will get the content of a parameter which will be set when calling an action,i'd like to know how this "%" thing works exactly. I think if I understood that a lot of things would fall in place.
|
|
Quellcode |
1 2 3 4 5 6 |
<action name="MakeMyHotspots"> NewLink(000,000); NewLink(000,001); NewLink(000,002); NewLink(000,003); </action> |
|
|
Quellcode |
1 2 3 |
<action name="MakeMyHotspots"> foreach(Tour.pano.link,i,NewLink(000,get(i))); </action> |
Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von »rctdeclan« (24. April 2010, 13:41)
krpano uses the "name" attribute to identify an element as array item,Why do we need to give a node a name before we can use it as an array?
maybe try not to use numbers as names...the following: