Skip to content

Instantly share code, notes, and snippets.

@dskjal
Last active April 16, 2022 13:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dskjal/54575a1d8b511b71f24d52754314427c to your computer and use it in GitHub Desktop.
Save dskjal/54575a1d8b511b71f24d52754314427c to your computer and use it in GitHub Desktop.
Blender でスクリプトからボーンにキーフレームを打つ
#ボーンを選択していなくてもできる
bpy.context.active_object.pose.bones['hand.ik.L'].keyframe_insert(data_path='location',group='hand.ik.L')
#ボーンを選択して以下のコマンドでも可能(ただし遅い)
bpy.ops.anim.keyframe_insert_menu(type='LocRotScale')
#ボーンを選択
bpy.ops.pose.select_all(action="DESELECT")
bpy.context.active_object.data.bones['hand.ik.L'].select = True
#ボーンに設定されたプロパティにキーを打つ
#data_path は UI を右クリックして,Copy Data Path でコピーする
bpy.context.active_object.pose.bones['hand.ik.L'].id_data.keyframe_insert(data_path='pose.bones["hand.ik.L"]["ikfk_switch"]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment