Hi, everyone.
I'm trying to add scenes at runtime.
I searched the forums and found similar threads and tried to do this, but it didn't work.
I tried something like the code below:
<krpano>
<action autorun="onstart" scope="local">
set(scene[0],
name = 'livingroom_0',
title = 'livingroom',
onstart = '',
thumburl = '%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/thumb.jpg',
lat = '',
lng = '',
heading = '',
content = '
<control bouncinglimits="calc:image.cube ? true : false" />
<view hlookat="0.0" vlookat="0.0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/preview.jpg" />
<image>
<cube url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/pano_%s.jpg" />
</image>
');
debugvar(scene[0]);
loadscene(get(scene[0].name), null, KEEPPLUGINS, OPENBLEND(0.5, 0.0, 0.75, 0.05, linear));
</action>
</krpano>
Display More
The log output is as follows:
DEBUG: scene[0]=[Object] type=object
DEBUG: scene[0].content=[
<control bouncinglimits="calc:image.cube ? true : false"/>
<view hlookat="0.0" vlookat="0.0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto"/>
<preview url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/preview.jpg"/>
<image>
<cube url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/pano_%s.jpg"/>
</image>
] type=string
DEBUG: scene[0].heading=[] type=string
DEBUG: scene[0].lat=[] type=string
DEBUG: scene[0].lng=[] type=string
DEBUG: scene[0].name=[livingroom_0] type=string
DEBUG: scene[0].onstart=[] type=string
DEBUG: scene[0].thumburl=[%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/thumb.jpg] type=string
DEBUG: scene[0].title=[livingroom] type=string
ERROR: loadscene() - scene "livingroom_0" not found
Display More
The output of debugvar(scene[0]) shows that it is set correctly in the scene.
However, the loadscene function says that livingroom_0 does not found.
I coded like this to solve this problem.
<krpano>
<action autorun="onstart" scope="local">
<![CDATA[
calc(local.scene_string, '
<krpano>
<scene name="livingroom_0" title="livingroom" onstart="" thumburl="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/thumb.jpg" lat="" lng="" heading="">
<control bouncinglimits="calc:image.cube ? true : false" />
<view hlookat="0.0" vlookat="0.0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/preview.jpg" />
<image>
<cube url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/pano_%s.jpg" />
</image>
</scene>
</krpano>
');
includexmlstring(get(local.scene_string));
debugvar(scene[0]);
loadscene(get(scene[0].name), null, KEEPPLUGINS, OPENBLEND(0.5, 0.0, 0.75, 0.05, linear));
]]>
</action>
</krpano>
Display More
Similar to the log results shown earlier, but the loadscene function does not fail.
DEBUG: scene[0]=[Object] type=object
DEBUG: scene[0].content=[
<control bouncinglimits="calc:image.cube ? true : false"/>
<view hlookat="0.0" vlookat="0.0" fovtype="MFOV" fov="120" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto"/>
<preview url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/preview.jpg"/>
<image>
<cube url="%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/pano_%s.jpg"/>
</image>
] type=string
DEBUG: scene[0].heading=[] type=string
DEBUG: scene[0].lat=[] type=string
DEBUG: scene[0].lng=[] type=string
DEBUG: scene[0].name=[livingroom_0] type=string
DEBUG: scene[0].onstart=[] type=string
DEBUG: scene[0].thumburl=[%VIEWER%/panos/104b_0_on/desktop/livingroom_0.tiles/thumb.jpg] type=string
DEBUG: scene[0].title=[livingroom] type=string
Display More
Is it not possible to add a scene with the set function in krpano?