here you go. Seems to work good well and looks nice enough. Thrown together crudely, I'm sure you can improve on it a lot, but hopefully it'll save you the trouble of figuring out a few troublesome issues.
https://github.com/larzeitlin/IPlug-...ples/MultiStep
Note, you'll have to add all of the triggering mechanics / behaviours of an envelope. This is just a control.
You can set the shape and pull out data for a y value for a given x (decimal between 0.0 and 1.0 - a decimal phase if you will);
obv this gif is much lower rez than the real thing...