CadetEditor/CadetEngine-as

Copy-paste ImageSkin duplicates Texture component as well

Opened this issue · 0 comments

In the editor:

  • create Texture
  • set Texture's bitmapData to any bitmap
  • create ImageSkin
  • set ImageSkin's texture to Texture
  • copy & paste ImageSkin

Current behaviour: New ImageSkin instance is pasted, but its internal DisplayObject is never validated, so nothing is displayed. Texture instance is serialized and deserialized along with the ImageSkin instance (new Texture instance is created in effect). Copied Texture is never added to scene nor validated (by validateNow() call), so its internal texture never gets created. Copied ImageSkin instance relies on this texture when creating its internal DisplayObject.

Expected behaviour: Copied ImageSkin instance should use the same Texture instance as the original one does. No new Texture instance should be created.

Probably this problem does not only occur with ImageSkins and Textures, but with any objects copied & pasted, which reference other object, outside of the copied object hierarchy.