Clearing of animation end function

I started to heavily use animation and animation end functions. The API is nice in general, but there is one thing I find annoying. OnEndAnimation clears the animation function, but the animation end function is not cleared in the same way. It remains registered and has to be manually removed like this: control->SetAnimationEndActionFunction(nullptr); Perhaps the opposite (clearing this function automatically as well) would be annoying in other situation. So my question is: Is this intentional and why?
Thanks a lot.

I think you may be conflating IControl ActionFunctions and AnimationFunctions, which have the same signature.

The main ActionFunction is triggered when the control is SetDirty(true). A typical use of this is to set the control’s AnimationFunction, which will animate for the specified duration. When that duration is over the AnimationFunction is set to nullptr and the AnimationEndActionFunction is triggered. This allows you to do something after a one-shot animation. It is not expected that you’d want to change or remove the AnimationEndActionFunction, but you can do that as you have found out.

I am using the action functions to mutate state of a plug-in which does not expose any automation parameters. The animation functions, on the other hand, are purely for decoration purposes. But sometimes I need the animation to consist of two parts, e.g. a control should change its target RECT after a fading animation. I am using the mAnimationEndActionFunc member for this and now that you mentioned it, I thought it had the type using IAnimationEndFunction (without the Action). So indeed, I am using it in a way that was not intended.

I know I could just put both parts of the animation in one function, but I prefer to have generalized animations with the possibility to extend them by custom animation (action) functions where necessary.