Question about XML Structure of tour/scene data

  • Please note in the example below I have added an "architectural" section to my xml scene. I'm having difficulty understanding the syntax of accessing child node information from the tour.xml files. Let's say I'm storing scene data in the following format so I have some additional scene information to use:

    <scene name="name" title="title" active="true" thumburl="panos/blahblah/thumb.jpg" datahere="blahblah">
    <view hlookat="190" vlookat="-20" fovtype="MFOV" fov="90" maxpixelzoom="1.5" fovmin="80" fovmax="100" limitview="auto"/>
    <preview url="panos/blahblah.tiles/preview.jpg"/>
    <image>
    <cube url="panos/blahblah/pano_%s.jpg"/>
    <cube url="panos/blahblah/mobile/pano_%s.jpg" devices="mobile"/>
    </image>
    <architectural type="residential" status="active" price="240,000" sf="1400" bedrooms="2" bathrooms="2.5"/>
    </scene>



    I can have an action that loops through the data like this...


    for(set(i,0), i LT scene.count, inc(i),
    copy(name, scene[get(i)].name);
    copy(datahere, scene[get(i)].datahere);
    trace(name);
    trace(datahere);
    );


    That works fine. I can access any attribute of "scene", name, title, datahere, etc.
    What I can not do however is access the architectural "type", "price", etc.


    I've tried:
    scene[get(i)].architectural.price);

    architectural[get(i)].price);


    etc.


    What am I missing here? KRpano is clearly accessing view, hotspot data, etc. that is stored as children of "scene". What syntax does KRpano use to access attributes of scene children?
    Thanks.

    EDIT: This works to access the price of the CURRENT scene
    architectural[get(xml.scene)].price
    and i realize that xml.scene returns the name of the current scene but something like this does NOT work.


    copy(name, scene[get(i)].name);

    trace(architectural[get(name)].price );

    It seems like it may not be possible to access xml child nodes without having the scene loaded. Is this correct? If so, they could be stores directly as scene attributes rather than in an child node I suppose but I'm trying to keep the data structure cleaner.


    Edited 5 times, last by bhh (July 27, 2017 at 11:00 PM).

  • Hi,

    I suggest is to create the <architectural type="residential" status="active" price="240,000" sf="1400" bedrooms="2" bathrooms="2.5"/> outside the scene, and link the <scene> and the <architectural> by adding additional attribute on <architectural>

    for example
    <architectural name="name" type="residential" status="active" price="240,000" sf="1400" bedrooms="2" bathrooms="2.5"/>

    <scene name="name" title="title" active="true" thumburl="panos/blahblah/thumb.jpg" datahere="blahblah">
    <view hlookat="190" vlookat="-20" fovtype="MFOV" fov="90" maxpixelzoom="1.5" fovmin="80" fovmax="100" limitview="auto"/>
    <preview url="panos/blahblah.tiles/preview.jpg"/>
    <image>
    <cube url="panos/blahblah/pano_%s.jpg"/>
    <cube url="panos/blahblah/mobile/pano_%s.jpg" devices="mobile"/>
    </image>
    </scene>


    so you can this:


    trace(architectural[get(xml.scene)].price);
    or
    trace(architectural["name"].price);

    Yanward *squint*

  • Yanward,
    Sorry I didn't respond sooner but I was on vacation for a couple of days. Thank you for your reply. I haven't tried it yet but I suspect that will work just fine.

    Thank you.

  • I'm implementing a sort feature so I need to be able to access the "architectural" category prior to a scene load. I think I'm just going to move the "architectural" attributes to regular "scene" attributes and remove the architectural category all-together. I think that is cleaner than moving the architectural category outside of the scene elements.

  • if you place architectural outside a scene it will be accessible independent of the scene (before it is loaded)
    if you place it inside it is loaded with the scene and will overwrite the "global" value
    in this case you can only read the value if the corresponding scene was loaded.
    if you havent loaded the scene you cant access these values at all!
    this is important to understand:
    you cant read sub-values of other scenes! but you can read the properties of other scenes.
    simplified: loading a scene replaces or deletes (unless they have a keep=true property) the global values

    so you can define the structure outside the scenes, or add it to the scenes properties.
    <scene name="name1" ... />
    <architectural name="name1" ... />
    or simpler...
    <scene name="name1" ...
    archtype="residential" status="active" price="240,000" sf="1400" bedrooms="2" bathrooms="2.5"/>

  • "<scene name="name1" ...
    archtype="residential" status="active" price="240,000" sf="1400" bedrooms="2" bathrooms="2.5"/>"

    This is exactly what I was doing originally and reverted back to it yesterday. I wrote a CMS to interface with the XML files and moved these types of items to the "architectural" category at that time in order to try and add a bit more legibility to the xml files. My old sort algorithm was setup to work this way so it made sense to just go back to it.

    Thanks all!

Participate now!

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