Hi Klaus and krpano community,
I'm trying to dynamically inject <depthmap> definitions into my panorama scenes at runtime, but the mesh doesn't load.
krpano 1.22.2 (build 2024-11-20)
What I'm doing:
- I build the krpano XML dynamically. Inside the <scene> → <image> tag, I include a $DEPTHMAP placeholder.
- Then I create a pano object and call .kr.embedpano(pano).
- Once onready is triggered, I initialize my custom plugins.
If the current panorama requires the Measurements Plugin, I:
- Get the original XML from the krpano instance via krpano.xml.filecontent.
- Replace $DEPTHMAP with a fully-formed <depthmap>...</depthmap> tag.
- Then I reload krpano via:
Code
krpano.call("loadxml(newXml, null, REMOVESCENES)");
krpano.call("loadscene(sceneName, null, BLEND(0))");
❗ The issue:
The scene visually reloads, but the mesh files (.mesh) are never requested — nothing appears in the network tab, and no depth-based rendering happens.
✅ What works:
If I include the <depthmap> in the XML before calling .kr.embedpano(pano), everything works perfectly — the mesh loads and renders correctly.
What I’ve tried:
- Switching between MERGE|KEEPVIEW, REMOVESCENES, or no flags with loadxml().
- Calling loadscene() immediately afterward.
- Inspecting krpano.get('scene[sceneName].depthmap.src'), which returns undefined.
❓ My question:
What is the correct way to dynamically inject or update <depthmap> definitions at runtime and force krpano to actually load the mesh?
Thanks in advance — I’d really appreciate any guidance
.