onremovepano unexpected behavior

  • Normal behavior for arrays in scenes just overwrites the array items. I'm trying to kill it onremovepano if a loadscene occurs however onremovepano seems to be working after loadscene not before.
    In all cases the following traces 0 for datastructure.count

  • Hi,

    the problem here is probably the 'queuing' of the actions calls - depending on the other calls and events around the loadpano/loadscene call, this code might get executed too late (after loading the new pano).

    This is a bit a problem of the current actions architecture. I'm already planing a new actions architecture here, but this can be only made in incompatible way, so this is more for a 'krpano 2.0' version or for a version where both architectures - the old and the new one (e.g. switched by the version setting in the xml) are supported.

    Best regards,
    Klaus

  • Ok. What are your suggestions?

    I have virtual tours that change scenes in many ways, loadscene, loadxml via hotspots, thumbnail plugins etc. As such I would need to check every method for changing scenes and ensure I clear the array prior.

    I'm trying to make it so that arrays inside scenes will not contain items from other scenes left over when the current array count is less than a previous array count. I was thinking onremovepano would be perfect for this.

    The only thing I can think of now is to maybe use php to set the array.count manually from scene onstart.

  • Hi,

    regarding suggestions - there should be several possibilities here, but maybe try this:

    Use an element that has a 'keep' flag, like <plugin> or <events>, and store your data there - then that element would become automatically removed when loading new panos/scenes. And if you would keep the data, just add keep="true" to that element.

    E.g. define via:

    Code
    <plugin name="storage">
      <datastructure name="id1" value="123" />
      <datastructure name="id2" value="456" />
      <datastructure name="id3" value="789" />
    </plugin>

    access via:

    Code
    plugin[storage].datastructure[id1].value

    Best regards,
    Klaus

  • Thanks! That sounds like a great idea. I found that html5 seems different. In flash if i delete data.count prior to loadscene it works, but in html5 , delete then loadscene krpano finds no object. In any case, I will try your method, I'm sure everything will be normal then.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!