GarageGames / Torque2D

MIT Licensed Open Source version of Torque 2D game engine from GarageGames
MIT License
1.67k stars 1.56k forks source link

GuiControl clone is partially broken #211

Open capnlove opened 10 years ago

capnlove commented 10 years ago

When using Guicontrol.clone(), some information from the original Guicontrol is copied over to the new object while other elements are not.

Elements not being copied to the clone :

This occurs regardless of the boolean argument passed to the function, which is supposed to determine if dynamic fields are copied to the new object.

lilligreen commented 10 years ago

I'm surprised that any of the static fields specific to GuiControl are being copied - there is no copyTo method for GuiControl or any other Gui class. Only the fields that get inherited from SimObject have this implemented.

I haven't tried a fix yet, but as a starting point I would look at how the copyTo methods are built for scene objects and assets and write a similar function that would apply to GuiControl.

capnlove commented 10 years ago

The advantage of this would be to use .taml Gui profiles as templates, from which you could easily instance copies of.

lilligreen commented 10 years ago

Small update: I have a local branch where the profile field is successfully cloned. Next step is to implement copying for the rest of the fields. This is actually a massive amount of work - in addition to reformatting I'm also going back and adding missing script methods as well (hello getProfile). Writing out to Taml is still completely broken.

capnlove commented 10 years ago

I wouldn't list this as a priority, just a "would be nice to have" feature. Maybe documenting the work required would help someone who wants to get their hands dirty.