Polymorphism on a collection of PropertyGroup (v2.79)


I’m doing “little bit” of an overhaul/expansion of the game logic UI, and part of it is handling a collection property for each object, each property within the collection being possibly of a different type that may very well be changed multiple times by the user.

So I can sense that I need to have the collection be of type some base class and morph each element into a subclass as needed, but I’m not sure what is the right way to do it with the API. I tried to morph the properties through an update function on the type enum, but that change doesn’t register.

Any tips or ideas?

Alright, after sifting through every reference I could find, it does seem like this is NOT something the API is designed to handle. Uh, how inconvenient.

No matter! I have cooked up a solution. Every value within the collection is a property group, and one of the properties within the group is a string that gets reinterpreted as necessary. This does mean juggling converter functions around a lot any time you’re writting or reading from the value, but oh well; better than nothing I suppose.