[Blender][スクリプト]グラフエディタとドープシートに「補間モード」、「外挿モード」、「ハンドルタイプボタン」追加
Blenderのグラフエディタはよく使う機能が奥まった所にあるので表に出した。という感じです。
import bpy
class CUSTOM_PT_FCurvePanel(bpy.types.Panel):
bl_label = "Selected Keys" # パネル名
bl_space_type = 'GRAPH_EDITOR' # グラフエディタ
bl_region_type = 'UI'
bl_category = "Custom" # タブ名
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="Interpolation:")
row = layout.row()
row.operator("graph.interpolation_type", text="", icon='IPO_CONSTANT').type = 'CONSTANT'
row.operator("graph.interpolation_type", text="", icon='IPO_LINEAR').type = 'LINEAR'
row.operator("graph.interpolation_type", text="", icon='IPO_BEZIER').type = 'BEZIER'
row = layout.row()
row.label(text="Extrapolation:")
row = layout.row()
row.operator("graph.extrapolation_type", text="", icon='IPO_CONSTANT').type = 'CONSTANT'
row.operator("graph.extrapolation_type", text="", icon='IPO_LINEAR').type = 'LINEAR'
row = layout.row()
row.label(text="Handle Type:")
row = layout.row()
row.operator("graph.handle_type", text="", icon='HANDLE_FREE').type = 'FREE'
row.operator("graph.handle_type", text="", icon='HANDLE_ALIGNED').type = 'ALIGNED'
row.operator("graph.handle_type", text="", icon='HANDLE_VECTOR').type = 'VECTOR'
row.operator("graph.handle_type", text="", icon='HANDLE_AUTO').type = 'AUTO'
row.operator("graph.handle_type", text="", icon='HANDLE_AUTOCLAMPED').type = 'AUTO_CLAMPED'
class CUSTOM_PT_DopeSheetPanel(bpy.types.Panel):
bl_label = "Selected Keys" # パネル名
bl_space_type = 'DOPESHEET_EDITOR' # ドープシート
bl_region_type = 'UI'
bl_category = "Custom" # タブ名
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="Interpolation:")
row = layout.row()
row.operator("graph.interpolation_type", text="", icon='IPO_CONSTANT').type = 'CONSTANT'
row.operator("graph.interpolation_type", text="", icon='IPO_LINEAR').type = 'LINEAR'
row.operator("graph.interpolation_type", text="", icon='IPO_BEZIER').type = 'BEZIER'
row = layout.row()
row.label(text="Extrapolation:")
row = layout.row()
row.operator("graph.extrapolation_type", text="", icon='IPO_CONSTANT').type = 'CONSTANT'
row.operator("graph.extrapolation_type", text="", icon='IPO_LINEAR').type = 'LINEAR'
row = layout.row()
row.label(text="Handle Type:")
row = layout.row()
row.operator("graph.handle_type", text="", icon='HANDLE_FREE').type = 'FREE'
row.operator("graph.handle_type", text="", icon='HANDLE_ALIGNED').type = 'ALIGNED'
row.operator("graph.handle_type", text="", icon='HANDLE_VECTOR').type = 'VECTOR'
row.operator("graph.handle_type", text="", icon='HANDLE_AUTO').type = 'AUTO'
row.operator("graph.handle_type", text="", icon='HANDLE_AUTOCLAMPED').type = 'AUTO_CLAMPED'
def register():
bpy.utils.register_class(CUSTOM_PT_FCurvePanel)
bpy.utils.register_class(CUSTOM_PT_DopeSheetPanel)
def unregister():
bpy.utils.unregister_class(CUSTOM_PT_FCurvePanel)
bpy.utils.unregister_class(CUSTOM_PT_DopeSheetPanel)
if __name__ == "__main__":
register()