You are not logged in.

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

1

Thursday, November 10th 2016, 2:31pm

webvr.isenabled does not work?

Hi all,

I need to deactivate some hotspots for the webvr tour. But

Source code

1
<hotspot name="hs_1a" if="webvr.isenabled == false"


does not work. Something wrong with this idea? Is there an alternative standard approach to this?

Any help appreciated very much,

Yours,
Michael

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

2

Thursday, November 10th 2016, 2:57pm

Try cycling these spots via for(); and if webvr.isenabled == true, then disable them and if it's false, then enable the spots.
Regards,

Alexey

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

3

Thursday, November 10th 2016, 3:08pm

Well, thank you.

I tried something like that before. I added a parameter to a hotspot style ("tag1") and an action to the vtourskin.xml code for the webvr plugin:

vtourskin.xml:

Source code

1
2
3
4
5
	<plugin name="WebVR" keep="true" devices="html5"
          	(...)
	    	onentervr="skin_showloading(false); webvr_onentervr(); webvr_setup(); skin_reloadscene_webvr(); a_hiderichmediahs();"
	    	onexitvr="webvr_onexitvr(); webvr_setup(); skin_reloadscene_webvr(); a_showrichmediahs();"
	    	/>


tour.xml:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<style name="details-hs" tag="hs" tag1="vrno" distorted="false" url="detail.png" onover="tween(scale,0.6);" onout="tween(scale,0.4);" scale="0.4" zorder="1" />

(...)

 <action name="a_showrichmediahs">
		for (set(i,0), i LT hotspot.count, inc(i),
			if (hotspot[get(i)].tag1 == vrno,
				set(hotspot[get(i)].visible,true);
				set(hotspot[get(i)].enabled,true);				
			  );
			);
	</action>	

	<action name="a_hiderichmediahs">
		for (set(i,0), i LT hotspot.count, inc(i),
			if (hotspot[get(i)].tag1 == vrno 
				set(hotspot[get(i)].visible,false);
				set(hotspot[get(i)].enabled,false);				
			  );
			);
	</action>	


But that did not work as expected. The hotspots were hidden in vrmode only, but - in vr mode - when returning to the same scene the hotspots showed up again.

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

4

Thursday, November 10th 2016, 3:20pm

You need to check spots not only when entering or exiting VR, but also when you go from scene to scene (onnewpano).
Regards,

Alexey

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

5

Thursday, November 10th 2016, 3:44pm

You need to check spots not only when entering or exiting VR, but also when you go from scene to scene (onnewpano).

Ahhhh...

Source code

1
2
3
4
5
<plugin name="WebVR" keep="true" devices="html5"
(...)
onentervr="... a_hiderichmediahs();"
onexitvr="... a_showrichmediahs();"
/>



Source code

1
2
3
4
	<events name="webvr_events" keep="true" devices="html5"
              	(...)
	    	onnewpano="a_hiderichmediahs();"	    	
	    	/>



Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
	<action name="a_showrichmediahs">
		for (set(i,0), i LT hotspot.count, inc(i),
			if (hotspot[get(i)].tag1 == vrno,
				set(hotspot[get(i)].visible,true);
				set(hotspot[get(i)].enabled,true);				
			  );
			);
	</action>	

	<action name="a_hiderichmediahs">
		for (set(i,0), i LT hotspot.count, inc(i),
			if (hotspot[get(i)].tag1 == vrno AND webvr.isenabled == true,
				set(hotspot[get(i)].visible,false);
				set(hotspot[get(i)].enabled,false);				
			  );
			);
	</action>	



Thank you very much!

Michael

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

6

Thursday, November 10th 2016, 3:56pm

... but still, I wonder why that really easy snippet of "hotspot name="hs_1a" if="webvr.isenabled == false" is not working. Shouldn't it?

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

7

Friday, November 11th 2016, 8:04am

Yep, I was doing the same task as you and the first thought was to use that 'if' check inside hotspots, but it was not simple. I made a test then and added two hotspots into first pano of the tour (one with webvr.isenabled == true and one with false) to see how it works and there were issues and Krpano works very logical here, the only thing is to understand its behaviour:

1) First pano is loaded before the VR plugin (it seemed so to me), so inside first pano none of the two spots were visible initially. That is, "if" check works only when xml is being parsed, so for Krpano there were no hotspots in this case (I used normal panos).
2) If I go from first scene to second and then return back, I see the spot with 'webvr.isenabled == false". If I enter VR then, the same spot stays visible. The reason here is that normal pano is not being reloaded when entering VR (Multires ones are reloaded to use webvr-ready images).
3) This is all quite logical, because "if" check inside attributes is meant only for xml parsing check - Krpano goes thtough xml at startup and checks those 'ifs' to see which elements are needed and which are not.

All this is based on my tests and experience, maybe Klaus and other guys here may add something about it. ;-)
Regards,

Alexey

8

Friday, November 11th 2016, 9:32am

Hi,
All this is based on my tests and experience, maybe Klaus and other guys here may add something about it.
All correct - the if="..." attribute is a xml-filter - it defines if that element will be used or skipped during the xml parsing - see:
http://krpano.com/docu/xml/#if

Best regards,
Klaus

mstoss

Intermediate

  • "mstoss" started this thread

Posts: 297

Location: Berlin

  • Send private message

9

Friday, November 11th 2016, 5:57pm

Wow...