webvr.isenabled does not work?
-
-
Try cycling these spots via for(); and if webvr.isenabled == true, then disable them and if it's false, then enable the spots.
-
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:
Code<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:
Code
Display More<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.
-
You need to check spots not only when entering or exiting VR, but also when you go from scene to scene (onnewpano).
-
You need to check spots not only when entering or exiting VR, but also when you go from scene to scene (onnewpano).
Ahhhh...Code<plugin name="WebVR" keep="true" devices="html5" (...) onentervr="... a_hiderichmediahs();" onexitvr="... a_showrichmediahs();" />
Code<events name="webvr_events" keep="true" devices="html5" (...) onnewpano="a_hiderichmediahs();" />
Code
Display More<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
-
... but still, I wonder why that really easy snippet of "hotspot name="hs_1a" if="webvr.isenabled == false" is not working. Shouldn't it?
-
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.
-
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:
https://krpano.com/docu/xml/#ifBest regards,
Klaus -
Wow...
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!