blender : python で dopesheetを編集する。

bvhなどを利用する時にkeyframeを間引きしたりするのにスクリプトで一括操作してみます。

1. コマンドでblenderを起動
macの場合。
$ /Applications/Blender/blender.app/Contents/MacOS/blender

2. 編集するファイルを普通に開く

3. Scriptingに変更

4. pythonで書いて Run Scriptすると print()からterminalへ表示されます。

blender python api

http://www.blender.org/documentation/blender_python_api_2_71_release/

適当に触れるようになりました。

import bpy
for action in bpy.data.actions:
if action.name == "Reviving":
print(action.name)
for channel in action.fcurves:
print ( channel.data_path )
for i in range(0,11):
for key in channel.keyframe_points:
# key.select_control_point = False
print(key.type)
print(key.handle_left[0])
print(key.handle_left[1])
print(key.co[0])
print(key.co[1])

This entry was posted on 火曜日, 8月 12th, 2014 at 9:20 AM and is filed under Python, unity. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。