Quote from: NewK on Jul 21, 2020, 12:29 AMNice work umar. Nice to see more people taking advantage of buildmode to create stuff like this.Hey mate. Thank you for pointing those things out. I updated the respository. It now supports DecUI components and does the optimization.
There's a 2 things about DecUI internals you should probably know about which will help you improve your editor.
1) The code you're using at the moment will work for all GUIElements but will not work for DecUI components (Grid, Datatable, Circle, Combobox, etc...). This is because when you do "typeof e" for a DecUI component, it will return "instance" because DecUI components are classes. However, all DecUI components are wrapped in a GUICanvas with the exact same ID as the component. So you just have to check if typeof returns "instance" and if it does, you build the code as if it's a GUICanvas.
2) When printing/copying code to the clipboard, you should avoid additional lookups and use a local variable instead. Avoid doing this:Code SelectUI.Label("newLabel").Position3D = ...
UI.Label("newLabel").Rotation3D = ...
UI.Label("newLabel").Size3D = ...
and do this instead:Code Selectlocal newLabel = UI.Label("newLabel");
newLabel.Position3D = ...
newLabel.Rotation3D = ...
newLabel.Size3D = ...
This will be faster and is a good optimization to keep in mind when working with DecUI in general, because every time you do UI<Type>(ID) to fetch something, a tree traversal will be made to find the ID you passed, and if you repeat UI.Label("newLabel") 3 times, you will be making 3 unecessary searches. It's better to just do the search once, save it in a variable ( local always, never global). And then just re-use the same variable. This is an optimization which seems small if you dont have alot of GUIElements created, but once you start having alot of GUIElements this will make a big difference.