keyframe_insert() and keyframe_delete() with index=-1 always fail #33726

Closed
opened 2013-01-01 16:06:24 +01:00 by Shinsuke Irie · 3 comments
Member

%%%In a Python script, keyframe cannot be inserted/deleted for a single channel failing as follows:

k=bpy.data.meshes['face'].shape_keys.key_blocks['a']
k.keyframe_insert(data_path="value", frame=0)

Traceback (most recent call last):

File "<blender_console>", line 1, in <module>

TypeError: bpy_struct.keyframe_insert() index 0 was given while property "value" is not an array

k.keyframe_insert(data_path="value", index=-1, frame=0)

Traceback (most recent call last):

File "<blender_console>", line 1, in <module>

TypeError: bpy_struct.keyframe_insert() index 0 was given while property "value" is not an array

index=-1 doesn't work, because pyrna_struct_anim_args_parse() in bpy_rna_anim.c changes index=-1 to 0 and pyrna_struct_keyframe_parse() calls it twice, so the second call (index=0) throws the error.

Attached a patch (fix_anim_keyframe_parse_error.patch).

r53476
Ubuntu 12.10
%%%

%%%In a Python script, keyframe cannot be inserted/deleted for a single channel failing as follows: >>> k=bpy.data.meshes['face'].shape_keys.key_blocks['a'] >>> k.keyframe_insert(data_path="value", frame=0) Traceback (most recent call last): ``` File "<blender_console>", line 1, in <module> ``` TypeError: bpy_struct.keyframe_insert() index 0 was given while property "value" is not an array >>> k.keyframe_insert(data_path="value", index=-1, frame=0) Traceback (most recent call last): ``` File "<blender_console>", line 1, in <module> ``` TypeError: bpy_struct.keyframe_insert() index 0 was given while property "value" is not an array >>> index=-1 doesn't work, because pyrna_struct_anim_args_parse() in bpy_rna_anim.c changes index=-1 to 0 and pyrna_struct_keyframe_parse() calls it twice, so the second call (index=0) throws the error. Attached a patch (fix_anim_keyframe_parse_error.patch). r53476 Ubuntu 12.10 %%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'

%%%thanks for the patch but infact there was no need to call the function twice, perhaps baddly applied patch, fixed r53505.%%%

%%%thanks for the patch but infact there was no need to call the function twice, perhaps baddly applied patch, fixed r53505.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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#33726
No description provided.