1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

BlenderのドープシートにタイムラインのUIを追加するアドオン

Last updated at Posted at 2023-10-14

Blenderでアニメを作る人の間のトークイベントの
UIをどういう風にしているかの話題の中で
ドープシートを表示してタイムラインを表示していないと自動キー挿入の状態が分からない
という話がありました。

BlenderはアドオンからUIのパーツ追加等もできるので
自動キーの挿入や 現在のフレーム等のUIを追加するアドオンを作成してみました
image.png
(キャプチャでは下側が通常のタイムラインのメニュー 緑色が追加したUIです)
必要に応じて改変してご利用ください

y_additem_ dopesheet.py
bl_info = {
    "name": "add timeline item on dopesheet",
    "author": "Yukimi",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "View3D ",
    "description": "ドープシートメニューにタイムラインのUIを追加",
    "warning": "",
    "support": "COMMUNITY",
    "wiki_url": "",
    "tracker_url": "",
    "category": "User Interface"
}
import bpy


def draw_keyframe_insert_auto(self, context):
    # 自動キーフレームのUI挿入
    tool_settings = context.tool_settings
    screen = context.screen
    layout = self.layout
    # 区切り線
    layout.separator_spacer()
    #自動キー挿入
    row = layout.row(align=True)
    row.prop(tool_settings, "use_keyframe_insert_auto", text="", toggle=True)
    sub = row.row(align=True)
    sub.active = tool_settings.use_keyframe_insert_auto
    #前後のキーフレームに移動
    row = layout.row(align=True)
    row.operator("screen.keyframe_jump", text="", icon='PREV_KEYFRAME').next = False
    row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
    
def draw_frame_range(self, context):
    # フレーム範囲のUI
    scene = context.scene
    layout = self.layout
    row = layout.row()
    if scene.show_subframe:
        row.scale_x = 1.0
        row.prop(scene, "frame_float", text="")
    else:
        row.scale_x = 0.8
        row.prop(scene, "frame_current", text="")

    row = layout.row(align=True)
    row.prop(scene, "use_preview_range", text="", toggle=True)
    sub = row.row(align=True)
    sub.scale_x = 0.7
    if not scene.use_preview_range:
        sub.prop(scene, "frame_start", text="Start")
        sub.prop(scene, "frame_end", text="End")
    else:
        sub.prop(scene, "frame_preview_start", text="Start")
        sub.prop(scene, "frame_preview_end", text="End")

def register():
    # ドープシートメニューに項目を追加
    bpy.types.DOPESHEET_MT_editor_menus.append(draw_keyframe_insert_auto)
    bpy.types.DOPESHEET_MT_editor_menus.append(draw_frame_range)


def unregister():
    # ドープシートメニューから項目を削除
    bpy.types.DOPESHEET_MT_editor_menus.remove(draw_keyframe_insert_auto)
    bpy.types.DOPESHEET_MT_editor_menus.remove(draw_frame_range)

if __name__ == "__main__":
    register()

他のメニュー項目の表示位置を変更する記事も以前に書いてあるので参照してください

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?