Enable ALL PLUGINS at once

  • If all plugins are set to visible="false" or enabled="false", and I wanted to enable them all at once without having to write a huge action file for each plugin to do so, is there a short method which would enable all of them at the same time?

    I've been messing around with Facebook and managed to get the panos embedded, but the screen size is so small that it plays havoc on plugins. My ideal solution is to start the tour with only a "fullscreen" button enabled. Once clicked, it switches to fullscreen, then enables all the plugins at one time.

    Thanks

    Tony

  • Code
    for(set(i,0), i LT plugin.count, inc(i),
      set(plugin[get(i)].enabled, true);
    );

    or you could add a special tag for certain plugins, to act as a filter (so you still can have some not enabled).

    Code
    for(set(i,0), i LT plugin.count, inc(i),
     if(plugin[get(i)].type == 'facebook',
      set(plugin[get(i)].enabled, true);
    );
    );
  • OK, I follow on the idea here, but I'm not very good at programming. Could you explain this a bit in laymans terms.
    I get that you are setting a variable (i) to zero, and if or while i is LT the plugin count, but I don't get this part... inc(i). Is that "increase" i by 1?

    Basically as I see it we are setting a variable to count all the plugins 1 by 1, setting a plugin to enabled, then repeating until all plugins are enabled and the "for" statement is completed. Correct? It's been 3 years since I took a crash course on programming and even then it was only a short course :(

    Working with KRPano has been testing my memory and I'm failing.

    Is that all the code that's needed? Just run that as an action?

    Thanks Z

  • Hi

    In laymans terms:

    set the variable i to 0 (since 0 refers to the first index of an "array", though krpano objects arent true array)
    if i is small then the total amount of plugins (plugin.count = all plugins, in some languages it would be count(plugin) or plugin.length)
    then increase 1 by 1 (you could alsoo say add(i, 1); )
    then execute the following code
    set the property of enabled of plugin with the index of i to true

    remember this loops all plugins, and that can be a lot, there is a chance it will miss some. if it does that, try asyncfor instead of for. Alsoo its recommended that you add a customproperty of type to the plugin, so it filters the most.

    <plugin type="facebook" name="test" etc .. />

    this should be enough, put it in an action, and execute how you wish it (onclick or event)

  • OK, I understand now. Thanks for the fast response and answer. If I wanted to have an either or statement (else) would this be accurate:

    Code
    for(set(i,0), i LT plugin.count, inc(i),
     if(plugin[get(i)].type == 'facebook',
      set(plugin[get(i)].enabled, true);,
      set(plugin[get(i)].enabled, false);
    );
    );
  • yes, but it would be better to set enabled to false in the plugin itself. Its less requests, and alsoo you dont have an enable action for all plugins other then facebook

    btw your saying

    if the plugins type is facebook, then enable it, else set enabled to false. I'm not sure if thats your intention, or if you want to make a toggle function (enable/disable all plugins of type facebook with 1 function).

    then this would be better:

    Code
    for(set(i,0), i LT plugin.count, inc(i),
     if(plugin[get(i)].type == 'facebook',
      switch(plugin[get(i)].enabled);
    );
    );


    the switch command sets a true to false, or a false to true.

Participate now!

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