Jump to content

Spidervision: how to set which viewport gets the console?


photo

Recommended Posts

Posted

Hello,

I have this sv files for a setup with two screens attached, and I couldn't find any way to force the view_0 on display 0 to always be the one with the console. There is nothing like a  "main_display" attribute in the sv. Switching view_0 with view_1 inside the file has no effect. And the button "Set as Main Window" in the spidervision window doesn't seem to save its effect.sensor2.sv

Posted

Hi Stephane,

Looks like there is currently no option to make the window as "main". It's either the window where SpiderVision configurator is being opened or just a random window from SV.

As a workaround try to set the main window via code to the desired SV window on start-up.

Something like that should in theory do the trick:

#include "AppSystemLogic.h"
#include <UnigineComponentSystem.h>
#include <plugins/Unigine/SpiderVision/UnigineSpiderVision.h>

using namespace Unigine;

<...>

int AppSystemLogic::init()
{
    auto sv = Unigine::Plugins::SpiderVision::Manager::get();
    if (!sv)
        return 1;

    int target_id = sv->findViewportID("m1");
    if (target_id < 0)
    {
        Unigine::Log::warning("SpiderVision: viewport \"m1\" not found\n");
        return 1;
    }

    auto config = sv->getConfig();
    for (unsigned int i = 0; i < config->getNumViewports(); i++)
    {
        auto viewport = config->getViewportByIndex(i);
        auto window = sv->getEngineWindow(viewport->getID());
        if (!window)
            continue;

        bool is_target = (viewport->getID() == target_id);
        window->setMain(is_target);
        window->setHoldEngine(is_target);
        window->setConsoleUsage(is_target);
    }

    return 1;
}

<...>

Thanks!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted
2 hours ago, silent said:

As a workaround try to set the main window via code to the desired SV window on start-up.

That will do for now, but a saved option in the sv file would be great. Thanks!

  • Like 1
×
×
  • Create New...