Jump to content

UAK tabber problem


Vida Marcell
 Share

Go to solution Solved by Josh,

Recommended Posts

This actually is fine. You want to create a panel inside the tabber client area, and it will cover up the mess. I think in the development build I have added an extra rectangle block to cover that up.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

#include "UltraEngine.h"

using namespace UltraEngine;

int sidepanelwidth = 380;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1200, 800, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CENTER);
    window->SetMinSize(800, 600);

    //Create User Interface
    auto ui = CreateInterface(window);
    double bgcolor = 0.187;
    ui->root->SetColor(bgcolor, bgcolor, bgcolor);

    //Create Menu
    auto menu = CreateMenu("", ui->root);
    menu->SetColor(bgcolor, bgcolor, bgcolor);
    auto menu_file = CreateMenu("File", menu);
    auto menu_edit = CreateMenu("Edit", menu);
    auto menu_view = CreateMenu("View", menu);
    auto menu_window = CreateMenu("Window", menu);
    auto menu_help = CreateMenu("Help", menu);

    //Create viewport
    int gap = 6;
    int y_size = 30;
    auto sz = ui->root->GetSize();
    auto viewport = CreateTabber(gap, y_size, sz.x - sidepanelwidth - gap, sz.y - gap - y_size, ui->root);
    viewport->AddItem("Albedo", true);
    viewport->AddItem("Normal");
    viewport->AddItem("Roughness");
    viewport->AddItem("AmbientOcclusion");
    viewport->SetLayout(1, 1, 1, 1);

    auto albedo_p = CreatePanel(0, 0, sz.x, sz.y, viewport);
    albedo_p->SetLayout(1, 1, 1, 1);
    viewport->items[0].extra = albedo_p;
    auto normal_p = CreatePanel(0, 0, sz.x, sz.y, viewport);
    normal_p->SetLayout(1, 1, 1, 1);
    viewport->items[1].extra = normal_p;
    auto rough_p = CreatePanel(0, 0, sz.x, sz.y, viewport);
    rough_p->SetLayout(1, 1, 1, 1);
    viewport->items[2].extra = rough_p;
    auto ao_p = CreatePanel(0, 0, sz.x, sz.y, viewport);
    ao_p->SetLayout(1, 1, 1, 1);
    viewport->items[3].extra = ao_p;

    auto sidepanel = CreateTabber(viewport->GetSize().x + gap + gap, y_size, sidepanelwidth - gap - gap, sz.y - gap - y_size, ui->root);
    sidepanel->SetLayout(0, 1, 1, 1);
    sidepanel->AddItem("Setup", true);
    sidepanel->AddItem("De-Lit");
    auto setup_p = CreatePanel(0, 0, sz.x, sz.y, sidepanel);
    setup_p->SetLayout(1, 1, 1, 1);
    sidepanel->items[0].extra = setup_p;
    auto delit_p = CreatePanel(0, 0, sz.x, sz.y, sidepanel);
    delit_p->SetLayout(1, 1, 1, 1);
    sidepanel->items[0].extra = delit_p;


    while (true)
    {
        const Event ev = WaitEvent();
        switch (ev.id)
        {
            case EVENT_WIDGETACTION:
                Print("Item " + String(ev.data) + " action");
                break;
            case EVENT_WIDGETSELECT:
                if (ev.source == viewport)
                {
                    for (int n = 0; n < viewport->items.size(); ++n)
                    {
                        if (viewport->items[n].extra)
                        {
                            auto panel = viewport->items[n].extra->As<Widget>();
                            if (n == ev.data)
                            {
                                panel->Show();
                            }
                            else
                            {
                                panel->Hide();
                            }
                        }
                    }
                }
                else if (ev.source == sidepanel)
                {
                    for (int n = 0; n < sidepanel->items.size(); ++n)
                    {
                        if (sidepanel->items[n].extra)
                        {
                            auto panel = sidepanel->items[n].extra->As<Widget>();
                            if (n == ev.data)
                            {
                                panel->Show();
                            }
                            else
                            {
                                panel->Hide();
                            }
                        }
                    }
                }
                break;
            case EVENT_QUIT:
            case EVENT_WINDOWCLOSE:
                return 0;
                break;
            default: break;
        }
    }
    return 0;
}

for example add this to "viewport": viewport->AddItem("Metalness"); or viewport->AddItem("Height");

  • Thanks 1
Link to comment
Share on other sites

The code you posted does not match your screenshots. It creates four tabs on the left panel, and I see four tabs when I run the code. What is the problem with this code?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Allright sorry Josh,

#include "UltraEngine.h"

using namespace UltraEngine;

int sidepanelwidth = 380;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1200, 800, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CENTER);
    window->SetMinSize(800, 600);

    //Create User Interface
    auto ui = CreateInterface(window);
    double bgcolor = 0.187;
    ui->root->SetColor(bgcolor, bgcolor, bgcolor);

    //Create Menu
    auto menu = CreateMenu("", ui->root);
    menu->SetColor(bgcolor, bgcolor, bgcolor);
    auto menu_file = CreateMenu("File", menu);
    auto menu_edit = CreateMenu("Edit", menu);
    auto menu_view = CreateMenu("View", menu);
    auto menu_window = CreateMenu("Window", menu);
    auto menu_help = CreateMenu("Help", menu);

    //Create viewport
    int gap = 6;
    int y_size = 30;
    auto sz = ui->root->GetSize();
    auto viewport = CreateTabber(gap, y_size, sz.x - sidepanelwidth - gap, sz.y - gap - y_size, ui->root);
    viewport->AddItem("Albedo", true);
    viewport->AddItem("Normal");
    viewport->AddItem("Roughness");
    viewport->AddItem("AmbientOcclusion");
    viewport->AddItem("Metalness");
    viewport->AddItem("Height");
    viewport->SetLayout(1, 1, 1, 1);

    while (true)
    {
        const Event ev = WaitEvent();
        switch (ev.id)
        {
        case EVENT_WIDGETACTION:
            Print("Item " + String(ev.data) + " action");
            break;
        case EVENT_WIDGETSELECT:
            break;
        case EVENT_QUIT:
        case EVENT_WINDOWCLOSE:
            return 0;
            break;
        default: break;
        }
    }
    return 0;
}

now this should be allright, as you can see i added 2 more tabs, but a taked out the functioning of the tabber, but that doesnt change anything, as you can see, i'm running this code now:image.png.f17050fca5a2618ae29c410146442373.png

the AO has the same position as the Metalness

Link to comment
Share on other sites

  • Solution

Here it is with my current build:

Untitled.png.fb5c3cb030a0cc0293cf0a04adcc8b50.png

But with the build on Steam I can indeed produce the error. So I guess it was fixed and I need to put an update out soon.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...