You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

MichaelN

Beginner

  • "MichaelN" started this thread

Posts: 26

Location: Bayern

  • Send private message

1

Friday, April 1st 2011, 7:17pm

Scene prev next buttons with multiple xmls

Hi,

I`m building a tour using the scene tags. For several reasons i had to store the scenes in multiple xml files. Each xml represents a level in a building, so I've got
different thumbs and different maps for each xml file. So far so good - but now I would like to use Klaus' prev next buttons example.

So the problem with this example is that as soon as i go to another level in the building, meaning opening another xml, the scenes in this xml are also used for the prev/next action when i go back to the start-scene.

It looks like krpano stores all the scenes in the ram, independent from the xml which contain them.
Is there any solution for this, so that the prev/next actions include only the scenes from the current xml?

Thank in advance & regards
Michael

Code of Klaus' example:


Source code

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>	

Posts: 1,857

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Saturday, April 2nd 2011, 12:35am

You see that it's checking the scene array each and everytime to count the scenes and check if it's got to loop around and whether it goes up or down in the load index.

you need to store the xml and scene of where you came from and what your next xml is, and if you are leaving your index negatively or positivity you know you need to change xmls.
Your next scene in a new xml will always be 0 but you don't know how many scenes were in your previous xml unless you saved it.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

MichaelN

Beginner

  • "MichaelN" started this thread

Posts: 26

Location: Bayern

  • Send private message

3

Saturday, April 2nd 2011, 8:59am

Hi,

thanks for your answer. Yeah - I understand the problem and what the solution should be. But I don't see any way how the code has to look like and how it could be done with the xml reference to save the number of scenes of the previous xml?

Best regards,
Michael

4

Tuesday, April 5th 2011, 3:08pm

Hi,

either remove all <scene> elements by doing:

Source code

1
set(scene.count,0);

before loading the new xml,

or just use the latest 1.0.8.14 from here:
http://krpano.com/download/beta/

there this will be done automatically,

best regards,
Klaus

MichaelN

Beginner

  • "MichaelN" started this thread

Posts: 26

Location: Bayern

  • Send private message

5

Tuesday, April 5th 2011, 3:18pm

Hi,

thanks, works perfectly *thumbsup*

Best regards
Michael

Similar threads