alexoy Posted May 28, 2018 Share Posted May 28, 2018 Hi, Short question: When we set control.isVisible = false to a GUI element - does that mean, that element still exists, but is fully transparent or it is not being calculated at all (just like setEnabled(false) for meshes)? Maybe stupid question, I think the second should be correct, but just to clarify Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 28, 2018 Share Posted May 28, 2018 https://github.com/BabylonJS/Babylon.js/blob/master/gui/src/2D/controls/control.ts#L469 That might tell things. :) control.notRenderable(true), I guess... same as setEnabled(false); I'm no pro... but... we gotz some evidence. :) Quote Link to comment Share on other sites More sharing options...
alexoy Posted May 28, 2018 Author Share Posted May 28, 2018 @Wingnut, Seems there is no such function - https://www.babylonjs-playground.com/#1M6B0C Line 39 doesn't work; line 41 is a private variable, so shouldn't be used (but works); So line 40 is a correct equivalent to setEnabled(false) ? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 28, 2018 Share Posted May 28, 2018 Well THAT's odd. hmm. Line 41 works, though, huh? https://www.babylonjs-playground.com/#1M6B0C#2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 28, 2018 Share Posted May 28, 2018 https://www.babylonjs-playground.com/indexStable.html#1M6B0C#3 Or maybe not. :) It won't disable text1 after 5 secs, anyway. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 28, 2018 Share Posted May 28, 2018 Ok, yes it does. https://www.babylonjs-playground.com/#1M6B0C#4 I forgot to markAssDirty Quote Link to comment Share on other sites More sharing options...
alexoy Posted May 28, 2018 Author Share Posted May 28, 2018 If we skip using internal private variables - this works as expected - https://www.babylonjs-playground.com/indexStable.html#1M6B0C#5 However what do you think about missing function control.notRenderable(true)? It seems public Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 28, 2018 Share Posted May 28, 2018 .notRenderable... hunh... yeah, that works fine... good find. hmm. I'm really not qualified to "think about" too much. Let's watch for more-informed answers about .notRenderable(). Off the top of my head, I would say... that the source code we are looking-at... is NOT "for" the current build that's being used in the playground. Speculation, though. I'm really only qualified to help with simple things. You are asking complicated things that I USUALLY answer incorrectly (Wingnut foot in mouth) Quote Link to comment Share on other sites More sharing options...
Guest Posted May 29, 2018 Share Posted May 29, 2018 Hello team!! this should be in the doc, my bad * notRenderable will only hide (not draw) the current control * isVisibile = false will not render the control and all its children alexoy 1 Quote Link to comment Share on other sites More sharing options...
alexoy Posted May 29, 2018 Author Share Posted May 29, 2018 notRenderable is ignored if label is linked with a mesh, should it be like that? isVisible still works. @Deltakosh, by children you mean cases like when there is a GUI rectangle and a GUI label attached to it, so label is a child of the rect.? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 30, 2018 Share Posted May 30, 2018 @alexoy - I don't think "attached" is a good word to use, there. "added" is better. Notice which controls are containers, and which not. Also, as you use BJS GUI more and more, you will do console.log(somecontainer.children), fairly often, especially if you like to examine GUI controls in the browser F12 dev-tools OBJECT INSPECTOR. There, you just click the children property and you can see all the controls that you have "added" to a container, or to the ADT itself, which is also a container, of course. But yes, your example is correct. Rectangle is a container... often used to put a border around anything inside. But stackpanels, too... and later... if you build GUI tables/lists... you'll likely have vertical stackpanels full of horizontal stackpanels full of rectangles full of (user-interaction/content-)controls. Containers of containers of containers... ad nauseum. That's my take. Delta might have different words. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 30, 2018 Share Posted May 30, 2018 @Wingnut is correct Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.