Blender - Exporting Keying Sets with Shape Keys, for python import

Share with others..
Post Reply
User avatar
Draise
Captain
Posts: 2811
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Blender - Exporting Keying Sets with Shape Keys, for python import

Post by Draise » 15 Aug 2017, 00:34

Issue is the following:

I've found that the default Keying set that Blender exports from the Keying Set Panel, when you have shape keys added to the keyset - will pull the following error and be useless for importing keysets into new scenes:

!
TypeError: 'builtin_function_or_method' object is not subscriptable
Error: Python script fail, look in the console for now...
The solution is changing the shape key ID to the correct one:
# Keying Set: KeyingSet
import bpy

scene = bpy.context.scene

# Keying Set Level declarations
ks = scene.keying_sets.new(idname="KeyingSet", name="Keyset_Name")
ks.bl_description = ""

ks.use_insertkey_needed = False
ks.use_insertkey_visual = False
ks.use_insertkey_xyz_to_rgb = True

# ID's that are commonly used

## This is the default in blender, and it is broken.
#id_0 = bpy.types.key["Key"]

### Use this instead:
id_0 = bpy.context.object.data.shape_keys

# Path Definitions
ksp = ks.paths.add(id_0, 'key_blocks["Shape_Name"].value', index=-1)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests