Default Shape Key ID in Keying Set files broken - TypeError: 'builtin_function_or_method' object is not subscriptable #52401

Closed
opened 2017-08-15 02:19:48 +02:00 by Andres Stephens · 4 comments

System Information
Windows 10

Blender Version
Broken: 2.78c, 2.79 rc1
Worked: N/A

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:

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)

Exact steps for others to reproduce the error

  1. Create a Shape key
  2. Create a Keying Set
  3. Select Shapekey value and then add to active Keying Set
  4. Export Keyingset
  5. Load python Keyingset and append object with shape key
  6. Run
  7. Error
**System Information** Windows 10 **Blender Version** Broken: 2.78c, 2.79 rc1 Worked: N/A 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: ``` 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) ``` **Exact steps for others to reproduce the error** 1. Create a Shape key 2. Create a Keying Set 3. Select Shapekey value and then add to active Keying Set 4. Export Keyingset 5. Load python Keyingset and append object with shape key 6. Run 7. Error

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @AndresStephens

Added subscriber: @AndresStephens
Joshua Leung self-assigned this 2017-08-17 13:03:19 +02:00

This issue was referenced by blender/blender@743bacaa6f

This issue was referenced by blender/blender@743bacaa6f4e7dd4b621b8b908513ea6ce7b18e4
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#52401
No description provided.