There's at least one script which will do this, made by doppelganger.
Convert MIDI note's velocity in selected items to points on selected envelope
https://forum.cockos.com/showthread.php?t=200353
I don't know if this script is accessible from ReaPack, but the link will lead to the script text which can be copied and saved as a lua file.
You will need Lokasenna's GUI Library:
https://github.com/ReaTeam/ReaScript.../Lokasenna_GUI
According to the script description, this one cannot be used with looped items. Also, the Online mode is not recommended because it is very CPU intensive. Other than that, it has worked fine the little I have tested it.