• Hi ,

    I like to do an if /else thing (in xml)... so that it gets if a certain panorama (xml) is loaded...

    Is that possible??

    for example:

    Code
    <action name="areasur">
    set(area4,get(pano[3.xml].visible));
    		if(area4  == false, set(plugin[surounding].visible,false);, set(plugin[surounding].visible,true);
    </action>

    any idea?

    Cheers
    Tuur *thumbsup*

  • Hi ,

    I like to do an if /else thing (in xml)... so that it gets if a certain panorama (xml) is loaded...

    for example:

    Code
    <action name="areasur">
    set(area4,get(pano[3.xml].visible));
    		if(area4  == false, set(plugin[surounding].visible,false);, set(plugin[surounding].visible,true);
    </action>

    Tuur,

    In your code example, you're trying to use an array and addressing it with the xml name. Great idea, but unfortunately this won't work for a couple of reasons: 1) names of array elements can't contain a period 2) in your example, names of array elements can't start with a number.

    Problem 1 could be addressed by using the basename of the xml file name (the part of the name before the .xml). Problem 2 could be addressed by prepending the names of the array with a character or string (for instance _1 or pano_1).

    As far as I know, extracting the basename for your xml.url cannot be done in the krpano action language without going into javascript. It would be nice if Klaus provided a xml.basename attribute and/or a %BASENAME% macro that would resolve everywhere (not just in url attributes). I actually use this technique and preprocess the xml files using perl to get the basenames.

    Some other ways to accomplish this:

    1) Write an onxmlcomplete function which uses if statements to set the visible attribute:

    Code
    if (xml.url == "3.xml",set(plugin[surrounding].visible,true));
    	if (xml.url == "4.xml",set(plugin[surrounding].visible,false));
    	...

    This is a little harder to maintain because you're hardcoding file names into your function, but it will work...

    2) Include the surrounding plugin only in the xmls you in which you want it to appear and set keep="false"

    [b]3) Include a variable in the krpano tag which you use to set the visibility

    Code
    <krpano version="1.0.9" surroundingvis="true" >
    
    
    <events onxmlcomplete="onxmlcomplete()" />
    
    
    <action name="onxmlcomplete">
    	copy(plugin[surrounding].visible,surroundingvis);
    </action>
    </krpano>


    Of course, you'll need to remember to put the surroundingvis attribute in the krpano tag for every xmlfile.

    Hope this helps.

    steve

  • Hi Steve,

    Thanx for the explanation.. i try to understand...

    I also get crazy to understand the %Basename % thing sand the %1 , %2 things.. but that is an other thing..

    What i try to achieve is that i want to make a plugin only visible when a certain pano is loaded...
    But then not triggered by an action.. So is this (for example) drumset pano is loaded, in the code,
    that i say. Ahhh that one is loaded so let's make the plugin visible...

    actualy i like to make a hotspot, keep false.. with an x and y option and no atv ath
    and a parent stage position (also when no stage is set) so that when i turn the pano that it stay at the same screen spot.. like you can do with a plugin..
    but a plugin needs to be triggered when visible false by an action..
    I need the hotspot/plugin to be triggered when 'the code' knows that we are looking to a specific panorama,

    plugin keep = false would do also the trick but i don'y want it loaded before this pano is visited ( we are talking a lot of pano's)

    so keep is false but also visible is true and just loaded with the pano when visited.. as an hotspot does..


    So when i understand you guys well i can do..



    cheers
    Tuur *thumbsup*

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!