86 lines
2.7 KiB
Python
86 lines
2.7 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="Text to Speech", icon='FILE_TEXT')
|
|
box.prop(props, "text", text="")
|
|
|
|
# 生成ボタン(テキスト入力の直下)
|
|
col = box.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")
|
|
|
|
layout.separator()
|
|
|
|
# 音声設定
|
|
box = layout.box()
|
|
box.label(text="Voice Settings", icon='SPEAKER')
|
|
row = box.row()
|
|
row.prop(props, "speaker", text="")
|
|
row.operator("voicevox.refresh_speakers", text="", icon='FILE_REFRESH')
|
|
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')
|
|
|
|
# リファレンステキスト
|
|
if props.reference_text_strip:
|
|
row = box.row()
|
|
row.label(text=f"Ref: {props.reference_text_strip}", icon='LINKED')
|
|
row.operator("voicevox.clear_reference_text", text="", icon='X')
|
|
else:
|
|
box.operator("voicevox.set_reference_text", icon='EYEDROPPER')
|
|
|
|
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()
|
|
|
|
# 接続設定(最下部)
|
|
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')
|