azanin Posted March 10, 2016 Share Posted March 10, 2016 Hi, I'm trying to use WidgetSpriteVideo to display video on in-game screen models and it works pretty fine. However, I can't have the video cropped properly. As I show on my screenshot, I'd like the right part of the video not being displayed. I've made some research, found this topic and tried to do the same. Here is the code in which I try to create my WidgetSpriteVideo and attach it to my GuiObject: // gui: Gui of my ObjectGui WidgetHBox container = new WidgetHBox(gui); container.setStencil(1); WidgetSpriteVideo videoSprite = new WidgetSpriteVideo(gui, "MyVideo.ogv", 0); videoSprite.setFlags(GUI_ALIGN_OVERLAP); container.addChild(videoSprite); gui.addChild(container); What am I missing? Thanks, Alexandre. Link to comment
futurist Posted March 15, 2016 Share Posted March 15, 2016 Hi, Can you use ObjectGuiMesh rather than ObjectGui? // ObjectGuiMesh on left side of image ObjectGuiMesh object_mesh_gui = node_cast(engine.editor.getNodeByName("ObjectGuiMesh_0")); Gui gui = object_mesh_gui.getGui(); WidgetHBox container = new WidgetHBox(gui); container.setStencil(1); WidgetSpriteVideo videoSprite = new WidgetSpriteVideo(gui, "MyVideo.ogv", 0); videoSprite.setFlags(GUI_ALIGN_OVERLAP); container.addChild(videoSprite); videoSprite.setPosition(100,100); container.setPosition(100,100); container.setWidth(100); container.setHeight(100); gui.addChild(container,GUI_ALIGN_OVERLAP | GUI_ALIGN_FIXED); // ObjectGui on right side of image ObjectGui object_gui = node_cast(engine.editor.getNodeByName("ObjectGui_0")); gui = object_gui.getGui(); container = new WidgetHBox(gui); container.setStencil(1); videoSprite = new WidgetSpriteVideo(gui, "MyVideo.ogv", 0); videoSprite.setFlags(GUI_ALIGN_OVERLAP); container.addChild(videoSprite); videoSprite.setPosition(100,100); container.setPosition(100,100); container.setWidth(100); container.setHeight(100); gui.addChild(container,GUI_ALIGN_OVERLAP | GUI_ALIGN_FIXED); Link to comment
azanin Posted March 15, 2016 Author Share Posted March 15, 2016 I guess I can but isn't that sub-optimal in my case? I know it's a plane. Is it a bug in the engine? Is it planned to be fixed eventually? Link to comment
futurist Posted March 16, 2016 Share Posted March 16, 2016 Hi, No it is not a bug. I found solution which works with ObjectGui. You must rewrite your code in that way. ObjectGui object_mesh_gui = node_cast(engine.editor.getNodeByName("ObjectGui_0")); Gui gui = object_mesh_gui.getGui(); // gui: Gui of my ObjectGui WidgetHBox container = new WidgetHBox(gui); container.setStencil(1); WidgetSpriteVideo videoSprite = new WidgetSpriteVideo(gui, "MyVideo.ogv", 0); container.addChild(videoSprite, GUI_ALIGN_OVERLAP); gui.addChild(container, GUI_ALIGN_EXPAND); Unfortunately addChild function has two arguments, name of the second is flags. The second argument has default value 0. And when you write videoSprite.setFlags(GUI_ALIGN_OVERLAP); container.addChild(videoSprite); it means videoSprite.setFlags(GUI_ALIGN_OVERLAP); container.addChild(videoSprite, 0); You can use container.addChild(videoSprite); videoSprite.setFlags(GUI_ALIGN_OVERLAP); or simple container.addChild(videoSprite, GUI_ALIGN_OVERLAP); Link to comment
silent Posted April 13, 2016 Share Posted April 13, 2016 Fixed in 2.2.1. 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
Recommended Posts