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.

  • "sachagriffin" started this thread

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

1

Tuesday, September 20th 2011, 6:38pm

xml.scene acting weird.

I was trying to replace the following standard action because some of my scene content explodes this action into a shower of sparks.
So I was trying to use xml.scene instead.. should be a lot less material in the variable.
However, on the initial load, xml.scene does NOT contain the scene name but only the index. Any ideas? After loading a second scene, the name is there.

<action name="nextscene">
if(%1 != findnext, set(i,0));
set(scenename,get(scene[get(i)].name));
trace(scenename,' ',get(xml.scene));
if(scenename == get(xml.scene),
trace('scene checked is next');
inc(i);
if(i == scene.count, set(i,0));
loadscene(get(scene[get(i)].name), null, MERGE, BLEND(1));
,
inc(i);
if(i LT scene.count, nextscene(findnext));
);
</action>
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Tuesday, September 20th 2011, 7:33pm

Hi Sacha,

I try your code and I am not able to understand your request....
But I note an error in your second if call... get(xml.scene) should be xml.scene

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
	<action name="nextscene">
		if(%1 != findnext, set(i,0));
		set(scenename,get(scene[get(i)].name));
		trace(scenename,' ',get(xml.scene));
		if(scenename == xml.scene,
			trace('scene checked is next');
			inc(i);
			if(i == scene.count, set(i,0));
			loadscene(get(scene[get(i)].name), null, MERGE, BLEND(1));
			,
			inc(i);
			if(i LT scene.count, nextscene(findnext));
			);
	</action> 


reference about if

SAlut.

  • "sachagriffin" started this thread

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

3

Tuesday, September 20th 2011, 7:58pm

They both work.
Otherwise im just trace(xml.scene) to get the bug.
Something is weird though. In my cms it works, but not in my standaland static environment.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

4

Tuesday, September 20th 2011, 8:50pm

Sacha... I think you are making a mistake here.
Try this code:

Source code

1
2
3
4
5
6
7
<action name="incorrect">
	if(xml.scene == get(xml.scene),
	trace(the condition is true);
	,
	trace(the condition is false);
	); 
</action> 

it return the condition is false

Source code

1
2
3
4
5
6
7
<action name="correct">
	if(xml.scene == xml.scene,
	trace(the condition is true);
	,
	trace(the condition is false);
	);
</action> 

it return the condition is true
2. Comparing two variables or values:
if(var1 OPERATOR var2, ...);
The var1 or var2 can be a variables or values. When var1 or var2 is a variable then the content of the variable will be used for comparison. Only when using a 'strict' comparison operator (=== or !==) then var1 and var2 must be variables (or null).
SAlut.

  • "sachagriffin" started this thread

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

5

Tuesday, September 20th 2011, 9:30pm

That's not really the issue, its just vaguely what I was working on..
trace(xml.scene); was returning an INDEX instead of the scene name.
Now, I have to figure out why and how. I thought maybe it was happening to everyone else as well. But it looks like there's something more complex since it works fine in my CMS.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

  • "sachagriffin" started this thread

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

6

Tuesday, September 20th 2011, 10:10pm

Found it by breaking it down until no code remained!

loadscene(get(startscene),null,MERGE);

in my html I use using an index.. which explains my my cms worked "it has more complicated scene names here".
viewer.addVariable("startscene", "<?php print $id-1?>);
should have been
viewer.addVariable("startscene", "scene<?php print $id-1?>");

and my scenes where scene1 scene2 etc..
So the mystery becomes why it worked in the first place instead of black screening..

Thanks all!
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

  • "sachagriffin" started this thread

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

7

Wednesday, September 21st 2011, 12:57am

Turns out, there wasn't much wrong with the next action except that it didn't support that many panoramas on iDevices. My broken panorama was on the edge of the rope (30/60).
It appears the actions overflow limit is MUCh lower on iDevices.
Using a delayedcall broke up the tremendous amount of code I was calling at once.. and perhaps scenename saves a stitch in memory.

<action name="nextscene">
if(%1 != findnext, set(i,0));
set(scenename,get(scene[get(i)].name));
if(scenename == xml.scene,
inc(i);
if(i == scene.count, set(i,0));
loadscene(get(scene[get(i)].name), null, MERGE, BLEND(1));
,
inc(i);
if(i LT scene.count, delayedcall(0.02,nextscene(findnext)));
);
</action>
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour