I would like to ask if someone can do this script idea i have.

Hello, i wlould like a Blender addon that converts a ShapeKey to a VertexGroup.
This seems like a crazy idea and impossible to fathom, but, what i need is to compare the original shape with the shapekey, and map the differences in vertex location to a value between 0.0 and 1.0, in other words, th vertex that moves farthest away from it’s original position, will have a value of 1.0, and all the vertices that stay in place, will have a value of 0.0.
All the other vertices that moved will have a value between these two, generating then, a vertex group.

However, i have no knowledge whatsoever in coding, and it just blows my mind, i can’t really understand how coding works, even if i try the hardest i can, it just doesn’t make sense to me, sometime i will learn though.
So, i would like to ask if someone can make this addon for me.

Seems to work:

import bpy

ob = bpy.context.object
me = ob.data
shape = ob.active_shape_key.data

max = float('-inf')
dists = []
for v in me.vertices:
    dist = (v.co - shape[v.index].co).length
    dists.append(dist)
    if dist > max:
        max = dist
        
vgroup = ob.vertex_groups.new("Dist Ratio")

for i, val in enumerate(map(lambda x: x / max, dists)):
    print(val)
    vgroup.add((i,), val, 'REPLACE')

Cool! I’ll test it later, many thanks man!

EDIT: Works like a charm, that’s exactly what i needed, thanks again!