Sunday, August 15, 2010

Making a SfxPoolItem child

...would actually be very simple if you could have an example to grab onto - the problem is that some Sfx*Item-s are way to complicated and you can't really understand how simple they really are - you just need to keep whatever you want to use as a private type, and expose a couple of methods required by the base class. The only two 'required' methods are Clone() and operator==, although an item would be quite useless without it's Which, and GetValue()

Only very much later I understood that there are no limitations in using this item in whichever way you want, so my plan is to hack it further to contain information for removing effects from a stylesheet and the main sequence.

The way the SfxAnimationItem is currently made is, it encloses one STLPropertySet pointer, and has some simple operators. Although it seemed a bit pointless to make a test for something as simple, it turned out to have a huge benefit later and discovered some bugs that would have been very difficult to catch. The test also exposed the need to have an operator== for the STLPropertySet, or one wouldn't be able to determine if two animations are the same.

The SfxAnimationItem was at one point changed to contain a std::list, when we started implementing the UI to support a list of effects. However, that UI (and the support for it) turned out to be too complicated so I reverted back in time (thanks to Git) and went back to the original SfxAnimationItem. That, however, made me understand how much the SfxPoolItem actually allows flexibility

No comments:

Post a Comment