dynamically remove all hotspots

  • i am using the addhotspot command to create 15 hotpost in a pano. is there a way i can remove them all at once without declaring each individual hotspot to remove? maybe using this type of looping i found in another thread. can it be modified to remove hotspots?

    <action name="loop_all_hotspots">
    set(i,0);
    loop_all_hotspots_next(get(i));
    </action>

    <action name="loop_all_hotspots_next">
    trace(hotspot[%1].name);
    set(hotspot[%1].onclick, ...);
    ...
    inc(i);
    if(i LT hotspot.count, loop_all_hotspots_next(get(i)) );
    </action>

  • Hi VN2009 *smile* ,

    At first it seems not so difficult... But it is not so easy than it seems *wink* ... The more important here is to remove the hotspot array from the greater to smaller...
    So, here a code based on your:

    Hope this help...

    SAlut.

  • ok i need a slight modification to this action but i just cannot figure it out.

    i now want to remove groups of hotspots based on an added attribute. for all my hotspots I added a variable called "tag" and it is set to different values based on the group the hotspot belongs to. "ground" "lakewalk" "businesses" so for the hotspots you would see tag="lw" for some and tag="gr" for others. how to modify this so that it detects the state of that variable and only deletes it if it is in the correct state.

  • Hi VN2009,

    Perhaps something like this:


    based on your request above, it could be:
    removing_hotspots(tag,ground);
    This will remove all the hotspots with attribute tag="ground" and only these hotspots...

    Hope this help...

    SAlut.

    Edited 2 times, last by michel (October 19, 2010 at 8:26 PM).

  • Great!

    but were is that ground thing?? is that typo count?

    i try to understand this placeholder thing with the maths... very difficult..

    Tuur *thumbsup*

  • ok how to modify this code to set certain plugins visible="false" based off the "tag" again. I tried this and it does not work.

    <action name="invisible_hotspots">
    sub(i,hotspot.count,1);
    if(i GE 0,invisible_loop_all_hotspots(get(i),%1,%2));
    </action>

    <action name="invisible_loop_all_hotspots">
    if(%2 == null,
    set(hotspot[%1].visible,false);
    ,
    if(hotspot[%1].%2 == %3,
    set(hotspot[%1].visible,false));
    );
    );
    dec(i);
    if(i GE 0, invisible_loop_all_hotspots(get(i),%2,%3) );
    </action>

  • Hi VN2009,

    Perhaps something like this:


    ex: this should set all plugins to scale = 1...
    set_hotspots/plugin(plugin,scale,1);
    ex: this should set only hotspots with custom attribute tag="ground" to visible = false...
    set_hotspots/plugin(hotspot,visible,false,tag,ground);

    Hope this help...

    SAlut.

  • Michel this has turned out to be one hell of a script. By setting tags on all hotspots and plugins with this code we essentially have a way so set variables on groups of hotspots and plugins all at the same time. This can be used over and over again in numerous ways.

  • EDIT:
    IT IS WORKING HAHA!!! SORRY!!!
    AND THANKS FOR THIS CODE! I LOVE IT!


    Ariel M.
    Need help with krpano code?
    I'm a freelance KRpano developer with vast experience building customized virtual tours.
    My portfolio in ciudadesferica.com and virtualmedia360.net

    Edited 3 times, last by Ariel (January 3, 2011 at 6:55 PM).

  • hmmm your code looks right. here is the code I use.

    along with "set_hotspots/plugin(hotspot,visible,false,tag,attract);"

    are you sure you are using the latest krpano version?

  • 4 more arguments

    %6 "tween" if set to tween will tween
    %7 %8 %9
    time*,tweentype*,donecall*)


    sub(i,%1.count,1);
    if(i GE 0,set_loop_all_hotspots/plugin(get(i),%1,%2,%3,%4,%5,%6,%7,%8,%9));
    </action>

    if(%5 == null,
    set(%2[%1].%3,%4);
    ,
    if(%2[%1].%5 == %6,
    if(%7 == tween,
    tween(%2[%1].%3,%4,%8,%9,%10);

    ,
    set(%2[%1].%3,%4);

    );
    );
    );
    dec(i);
    if(i GE 0, set_loop_all_hotspots/plugin(get(i),%2,%3,%4,%5,%6,%7,%8,%9,%10));
    </action>

Participate now!

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