How create a spline in realtime by adding spline points?

The answer is too long. So I cant really paste it here.
We did a video on this for draping vines using Unreal engine and speed tree with spline mesh components in c++.