How to remove or disable plugin when change scene?

  • I added plugin ThreeJs to show model 3D , but the problem is it show model 3d in all scene, i just want it show in a scene, how to do it?
    i tried with set(plugin[threejs].visible,false) and removeplugin(threejs) but it's not work *whistling*

    *thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

  • put your plugin into the scene and remove keep="true"

  • then your plugin is not working correctly.
    its unloadplugin() function should remove threejs and everything it installed (events etc)

    then your plugin is not working correctly.
    its unloadplugin() function should remove threejs and everything it installed (events etc)


    This is my threejs plugin, i dont know what's wrong :( *confused*

    *thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

  • you can have a look at the default plugin example here:
    https://krpano.com/docu/plugininterface/#top

    Code
    // unloadplugin - exit point for the plugin (optionally)
        // - will be called from krpano when the plugin will be removed
        // - everything that was added by the plugin should be removed here
        local.unloadplugin = function()
        {
            /* REMOVE YOUR THREEJS STUFF HERE */
            plugin = null;
            krpano = null;
        }


    your plugin has no unloadplugin() function at all

  • you can have a look at the default plugin example here:
    https://krpano.com/docu/plugininterface/#top

    Code
    // unloadplugin - exit point for the plugin (optionally)
        // - will be called from krpano when the plugin will be removed
        // - everything that was added by the plugin should be removed here
        local.unloadplugin = function()
        {
            /* REMOVE YOUR THREEJS STUFF HERE */
            plugin = null;
            krpano = null;
        }


    your plugin has no unloadplugin() function at all

    i tried add that code but have this problem

    *thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

  • if(krpano !== null) { }

    put this code in that place *confused*

    for example. put if(krpano !== null) in function has "krapno" *thumbup*

    *thumbup* Woody *thumbup* KEEP MOVING FORWARD *thumbup*

  • maybe to add...

    if your plugin is in a scene it gets (re-)initialized every time you enter the scene
    and with keep=false removed using unloadplugin() when you leave.
    a proper initialization and unloading is very important.

    if you for example would do not remove an installed renderloop,
    you would get a 2nd one when you enter the scene again.
    such things can hog down the performance and your devices memory etc.

    by the way
    plugin[..].visible does not work in this case, because the plugin doesn't handle it.
    visible is a krpano attribute, it would need special code to your hide threejs stuff

    in general combining threejs with krpano is complicated and not ideal for performance
    it is maybe better to wait for 3d object support in krpano itself

    ps. yes it would be nice to see your online example *smile*

Jetzt mitmachen!

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