Josh Posted January 15, 2023 Share Posted January 15, 2023 If you have a panel with a lot of sub-objects, like the object properties panel in Leadwerks, which has a ton of detailed controls for different entity properties, it can slow down the speed of your redraws when the window or side panel is resized. This is because when a widget is resized, all of its children have to be adjusted, even if they are hidden. An easy way to improve this is to set the widget layout of the panel to (1,0,1,0) when it is hidden: panel->SetHidden(true); panel->SetLayout(1,0,1,0); This locks it to the top-right so it doesn't get resized when the parent resizes, and all of its children can safely be skipped in the layout update routine, since its size does not get modified when the parent resizes. When you show the panel, do it like this: auto parent = panel->GetParent(); auto sz = parent->ClientSize(); panel->SetShape(0,0,sz.x,sz.y); panel->SetLayout(1,1,1,1); panel->SetHidden(false); When I did this with the Ultra Engine editor side tabber panels, the side panel resizing got noticeably faster. Another trick is to set a panel's background alpha to 0 if it's the same color as the underlying surface, and background rendering for that widget will be skipped: panel->SetColor(0,0,0,0); This can make redrawing a little bit faster, especially if you have a lot of overlapping panels. 1 1 Quote 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 More sharing options...
SpiderPig Posted January 15, 2023 Share Posted January 15, 2023 Thanks I'm sure this will speed up my inventory system. 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.