karim.salama Posted November 18, 2021 Share Posted November 18, 2021 Hi, In a very simple UnigineScript file, I added the following code : WidgetWindow window; int init() { Gui gui = engine.getGui(); window = new WidgetWindow(gui, "Hello from C++", 4, 4); window.setWidth(320); window.setSizeable(1); WidgetEditLine editline = new WidgetEditLine(gui, "Edit me"); window.addChild(editline, GUI_ALIGN_EXPAND); editline.setFontSize(16); WidgetButton button = new WidgetButton(gui, "Press me"); window.addChild(button, GUI_ALIGN_EXPAND); button.setFontSize(18); window.arrange(); gui.addChild(window, GUI_ALIGN_OVERLAP | GUI_ALIGN_CENTER); return 1; } The code seems to be executed without any errors or warnings, but I can't see any window upon initialization. Am I missing something? Thanks Link to comment
silent Posted November 19, 2021 Share Posted November 19, 2021 Hi Karim, When and how this code is being executed? Where you can't see window - in the final application without editor running? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
karim.salama Posted November 19, 2021 Author Share Posted November 19, 2021 (edited) Hi silent, The code is executed using the -system_script argument when launching the editor. Here is the batch script that loads it launch_editor.bat Edited November 19, 2021 by karim.salama Link to comment
silent Posted November 19, 2021 Share Posted November 19, 2021 Have you tried to switch to the Engine viewport (Windows -> Engine Viewport). Your window should appear here. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
karim.salama Posted November 19, 2021 Author Share Posted November 19, 2021 Yes, that worked! But how can I create a separate window outside of the viewport? Link to comment
silent Posted November 19, 2021 Share Posted November 19, 2021 Right now you can do it only by writing a fully-functional C++ / Qt plugin: https://developer.unigine.com/en/docs/2.14.1/editor2/extensions/custom_plugin?rlang=cpp In 2.15 it would be slightly easier, but you would anyway need to use C++ / Qt a bit. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
karim.salama Posted November 19, 2021 Author Share Posted November 19, 2021 Ok, thank you. I will give this a try. Link to comment
karim.salama Posted November 19, 2021 Author Share Posted November 19, 2021 Is it possible to add Unigine::Widgets to a QWidget? Link to comment
victor Posted November 19, 2021 Share Posted November 19, 2021 Hello Karim, It will be possible. You will be able to see it in a new Editor plugin in 2.15 - EngineGuiWindow. 1 1 Link to comment
karim.salama Posted November 19, 2021 Author Share Posted November 19, 2021 Excellent! Link to comment
Recommended Posts