Hello guys it possible to disable the depthmap.backgroundurl by onclick=" " ?
<depthmap url="panos/untitled2.obj" backgroundurl="panos/vid_main_optim2.jpg" scale="100" hittest="true" cull="front" />
Hello guys it possible to disable the depthmap.backgroundurl by onclick=" " ?
<depthmap url="panos/untitled2.obj" backgroundurl="panos/vid_main_optim2.jpg" scale="100" hittest="true" cull="front" />
Hi,
The action below allows for changing the background URL.
You can use it to set the url of the skybox, for example:
or to clear the backgroundurl:
Action code:
<action name="change_backgroundurl" type="javascript" args="url" scope="local"><![CDATA[
var url = args[1];
var parser = new DOMParser();
var scene = krpano.get('scene[get(xml.scene)]');
var xml = '<scene>' + scene.content + '</scene>';
var xmlDoc = parser.parseFromString(xml,"text/xml");
var depthmap = xmlDoc.getElementsByTagName("depthmap")[0];
depthmap.setAttribute("backgroundurl", url);
scene.content = xmlDoc.documentElement.innerHTML;
krpano.call("loadscene(get(xml.scene),, MERGE|KEEPVIEW|KEEPSCENES|PRELOAD, BLEND);");
]]>
</action>
Display More
I hope Klaus will come with some better support to change the backgroundurl
And now that I posted this, I think of another way: just duplicate your scene with and without a background and use loadscene to switch between the 2?
<scene name="scene_with_background" autoload="true" title="hello" onstart="" >
<image>
<depthmap backgroundurl="skybox.jpg" id="depthmap" url="models/gallery_06.obj" subdiv="0" rendermode="3dmodel" hittest="true" scale="100" textured="true" waitforload="true" center="0,0,0" axis="+x+y+z"/>
</image>
</scene>
<scene name="scene_without_background" autoload="true" title="hello" onstart="" >
<image>
<depthmap id="depthmap" url="models/gallery_06.obj" subdiv="0" rendermode="3dmodel" hittest="true" scale="100" textured="true" waitforload="true" center="0,0,0" axis="+x+y+z"/>
</image>
</scene>
Display More
And then:
or
Which basically does the same as the action in the previous post, but then not dynamically.
Display MoreHi,
The action below allows for changing the background URL.
You can use it to set the url of the skybox, for example:
or to clear the backgroundurl:
Action code:
I hope Klaus will come with some better support to change the backgroundurl
Thank you very much, when calling change_background url(") it gives an error : ERROR: change_backgroundurl - TypeError: Cannot read properties of undefined (reading 'setAttribute')
Do you have a depthmap inside your <image> ?
the <scene> i have tested with looks like this:
<scene name="scene_with_background" autoload="true" title="hello" onstart="" >
<image>
<depthmap id="depthmap" url="models/gallery_06.obj" subdiv="0" rendermode="3dmodel" hittest="true" scale="100" textured="true" waitforload="true" center="0,0,0" axis="+x+y+z"/>
</image>
</scene>
Is there an example online to simulate the error?
here is my scene :
<scene name="model" minpixelzoom="0" autoload="true" >
<view hlookat="90" vlookat="0" fovtype="MFOV" fov="140.000" maxpixelzoom="1" minpixelzoom="0" fovmin="70" fovmax="140" limitview="lookat" vlookatmin="-90" vlookatmax="90" />
<image prealign="-0.0|-0.0|-0.0" ox="0" oy="25" oz="0" >
<depthmap id="depthmap" url="panos/untitled2.obj" backgroundurl="panos/vid_main_optim2.jpg" scale="100" hittest="true" waitforload="true" cull="front" subdiv="0" />
</image>
</scene>
looks good.
where are you calling the function?
the scene must be loaded before it can be called...
onclick="change_backgroundurl('');
<scene name="model" minpixelzoom="0" autoload="true" >
<view hlookat="90" vlookat="0" fovtype="MFOV" fov="140.000" maxpixelzoom="1" minpixelzoom="0" fovmin="70" fovmax="140" limitview="lookat" vlookatmin="-90" vlookatmax="90" />
<image prealign="-0.0|-0.0|-0.0" ox="0" oy="25" oz="0" >
<depthmap id="depthmap" url="panos/untitled2.obj" backgroundurl="panos/vid_main_optim2.jpg" scale="100" hittest="true" waitforload="true" cull="front" subdiv="0" />
</image>
<layer name="dron_container"
type="container"
bgalpha="1"
bgborder="0 0x000000 0"
alpha="1"
align="bottom"
keep="true"
x="-37.5"
y="90"
scale="1"
scale.mobile="1"
visible="true"
bgcapture="false"
onover="set(layer[podpis_dron].visible,true); "
onout="set(layer[podpis_dron].visible,false); ">
<layer name="dron_knopka"
type="image"
url="skin/dron.svg"
width="75"
height="75"
onclick="change_backgroundurl(''); dollhouse_view(); set(layer[dron_container].visible,false); "
onover=" "
onout=" "
visible="true"
scale.mobile="0.6"
y.mobile="65"
x.mobile="-7"
bgcapture="false"/>
</layer>
</scene>
Display More
I have updated the <action> in the second post to work with more <scene> tags :)
(I also added KEEPVIEW so the view stays the same even when a view is defined in the scene)
Hi,
it should be even easier using loadpanoimage & image.reset:
image.reset('copy'); // copy the current image settings
image.depthmap.backgroundurl = ''; // clear the backgroundurl
loadpanoimage(KEEPVIEW|PRELOAD,BLEND(0.5)); // load the new image
Best regards,
Klaus
beauty in simplicity
Don’t have an account yet? Register yourself now and be a part of our community!