blender-voicevox-pl/panels.py
2026-02-04 19:51:39 +09:00

80 lines
2.3 KiB
Python

"""
UIパネル
Blenderのサイドバーに表示されるUIを定義
"""
import bpy
from bpy.types import Panel
class VOICEVOX_PT_main_panel(Panel):
"""VoiceVoxメインパネル"""
bl_label = "VoiceVox TTS"
bl_idname = "VOICEVOX_PT_main_panel"
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
bl_category = 'VoiceVox'
def draw(self, context):
layout = self.layout
props = context.scene.voicevox
# 接続設定
box = layout.box()
box.label(text="VoiceVox Engine", icon='NETWORK_DRIVE')
row = box.row()
row.prop(props, "voicevox_host")
row.prop(props, "voicevox_port")
box.operator("voicevox.test_connection", icon='FILE_REFRESH')
layout.separator()
# テキスト入力
box = layout.box()
box.label(text="Text to Speech", icon='FILE_TEXT')
box.prop(props, "text", text="")
layout.separator()
# 音声設定
box = layout.box()
box.label(text="Voice Settings", icon='SPEAKER')
box.prop(props, "speaker_id")
box.prop(props, "speed_scale", slider=True)
box.prop(props, "pitch_scale", slider=True)
box.prop(props, "intonation_scale", slider=True)
box.prop(props, "volume_scale", slider=True)
layout.separator()
# 字幕設定
box = layout.box()
box.label(text="Subtitle Settings", icon='FONT_DATA')
box.prop(props, "subtitle_font_size")
box.prop(props, "subtitle_position_y", slider=True)
layout.separator()
# チャンネル設定
box = layout.box()
box.label(text="Channel Settings", icon='LINENUMBERS_ON')
row = box.row()
row.prop(props, "audio_channel")
row.prop(props, "subtitle_channel")
layout.separator()
# 出力設定
box = layout.box()
box.label(text="Output Settings", icon='FILE_FOLDER')
box.prop(props, "output_directory")
box.prop(props, "auto_add_to_sequencer")
layout.separator()
# アクション
col = layout.column(align=True)
col.scale_y = 1.5
col.operator("voicevox.generate_speech", icon='PLAY_SOUND', text="Generate Speech & Subtitle")
col.operator("voicevox.add_subtitle", icon='FONT_DATA', text="Add Subtitle Only")