Get Wrapper from gui editor jsons (GUI, GUI Editor)

Hi all!

I am making an application in which I decided to build the ENTIRE interface on the Babylon GUI. I have already used Babylon GUI Editor many times (I really like it and it’s very convenient).

I made many different modal windows and different interface.

My modals always look like this:

They always have a Wrapper root element.

In order to see my interface, I always do like this:

    const adv = GUI.AdvancedDynamicTexture.CreateFullscreenUI('UI')
    await adv.parseFromURLAsync('some_modal.json')

How can I get a Wrapper without creating an AdvancedDynamicTexture ?

I don’t need multiple AdvancedDynamicTexture. I would like to just take Wrapper from jsons and dynamically add/remove them from one main AdvancedDynamicTexture

1 Like

Something like this playground?

1 Like

Thanks for the answer and for the example!

This is not exactly what I would like to know. In this example the Wrapper is inside the code. I would like to know if it is possible to take this Wrapper (GUI.Rectangle) from a json file.

The idea is something like this. I have only 1 AdvancedDynamicTexture and many json files.

I wanted to know if there is any function that would return me a Wrapper from json. Without creating other AdvancedDynamicTexture

I need to be able to get the Wrapper from json and call addControl on my main AdvancedDynamicTexture.

Like in this example:

const adv = GUI.AdvancedDynamicTexture.CreateFullscreenUI('UI')

const wrapper_1 = await getControlFromJson('some_modal.json', 'Wrapper')
adv.addControl(wrapper_1)

const wrapper_2 = await getControlFromJson('some_modal_2.json', 'Wrapper')
adv.addControl(wrapper_2)

cc @carolhmj to check if there is a way ?

1 Like

You want to use json data to create gui control? For this it is possible to parse serializedObject. Hope it helps.

PG:

2 Likes

Apparently, now in Babylon there is no functionality to take control from json
without creating a new AdvancedDynamicTexture.

This solution is a bit like a crutch, but I think it will work for me.

Thanks a lot!

Yes, he is useful