Shape Key Question

Does anyone know where data for individual shape keys are stored and can I add new variables in that location through Python?

I’m making adjustments to the shape keys and I need changes made to each shape key to be isolated to only itself. From what I can tell, individual shapekey data is stored in:bpy.data.shape_keys[“Key”].key_blocks[B] *note: B is the index to selected shape key

But when I try to add an RNA to this using:bpy.data.shape_keys[“Key”].key_blocks[B].myVal = bpy.props.FloatProperty[values here]

I get an error. Any ideas?

From what I can tell, when I use: bpy.context.object.active_shape_key
The code just points to the currently selected shape key_block which appears to be read_only. From a Key_block, I can access certain functions and variables like Value, slider_min, slider_max, but I can’t create a new variable for the key_block.

If I can’t work with shape keys directly, I’m thinking about trying to create f dictionary and then use the index of the shape key as a key for the dictionary. This is quickly turning into a hack-job. smh

When I add a property to an object using this code:

bpy.types.Object.TestA = bpy.props.FloatProperty(name=“FLOAT VALUE”,min=-9999.9,max=9999.9,default=0.0)

and then use: bpy.types.Object.TestA

It returns:
(<built-in function FloatProperty>, {‘default’: 0.0, ‘max’: 9999.9, ‘name’: ‘FLOAT VALUE’, ‘attr’: ‘Test4’, ‘min’: -9999.9})

BUT, when I use: bpy.context.object.TestA

It evaluates the code and returns an actual number. This is great, but the weird thing is that when I try to store a property in a shapekey, it will not evaluate the property no matter how I try to access it.

When I use:

bpy.types.ShapeKey.TestB = bpy.props.FloatProperty(name=“FLOAT VALUE”,min=-9999.9,max=9999.9,default=0.0)

and then access in the console with: bpy.types.ShapeKey.TestB

It returns: (<built-in function FloatProperty>, {‘default’: 0.0, ‘max’: 9999.9, ‘name’: ‘FLOAT VALUE’, ‘min’: -9999.9})

Which is the same as with the Object. Naturally, I figured that if I accessed the value using its context, it would evaluate to a number. So I used this code:

bpy.context.object.active_shape_key.TestB

but what returned was the same:
(<built-in function FloatProperty>, {‘default’: 0.0, ‘max’: 9999.9, ‘name’: ‘FLOAT VALUE’, ‘min’: -9999.9})

I really need a solution to this problem…

EDIT:

Okay, so it looks like everything I create within bpy.types.ShapeKey becomes read only. When I create properties within bpy.types.Object it can be edited. This is going to be difficult to work around if not impossible without recompiling everything in C.

I can’t create a new variable for the key_block.

You seem to mean custom PROPERTIES. They are only supported on ID types and Bones: