68 lines
1.7 KiB
Python
68 lines
1.7 KiB
Python
"""
|
|
Blender VoiceVox Plugin
|
|
VoiceVoxを使用した音声合成と字幕表示を同時に行うBlenderアドオン
|
|
"""
|
|
|
|
bl_info = {
|
|
"name": "VoiceVox TTS & Subtitles",
|
|
"author": "Your Name",
|
|
"version": (1, 0, 0),
|
|
"blender": (5, 0, 0),
|
|
"location": "View3D > Sidebar > VoiceVox",
|
|
"description": "VoiceVoxによる音声合成と字幕表示",
|
|
"warning": "",
|
|
"doc_url": "",
|
|
"category": "Sequencer",
|
|
}
|
|
|
|
import bpy
|
|
from . import operators
|
|
from . import operators_reference
|
|
from . import operators_speaker
|
|
from . import panels
|
|
from . import properties
|
|
|
|
|
|
classes = (
|
|
properties.VoiceVoxProperties,
|
|
operators.VOICEVOX_OT_generate_speech,
|
|
operators.VOICEVOX_OT_add_subtitle,
|
|
operators.VOICEVOX_OT_test_connection,
|
|
operators_reference.VOICEVOX_OT_set_reference_text,
|
|
operators_reference.VOICEVOX_OT_clear_reference_text,
|
|
operators_speaker.VOICEVOX_OT_refresh_speakers,
|
|
panels.VOICEVOX_PT_main_panel,
|
|
)
|
|
|
|
|
|
def register():
|
|
"""アドオンを登録"""
|
|
for cls in classes:
|
|
bpy.utils.register_class(cls)
|
|
|
|
# シーンにプロパティを追加
|
|
bpy.types.Scene.voicevox = bpy.props.PointerProperty(type=properties.VoiceVoxProperties)
|
|
|
|
# 初回起動時に話者リストを取得
|
|
try:
|
|
properties.update_speaker_cache()
|
|
except:
|
|
pass # 初回はVoiceVoxが起動していない可能性があるのでスキップ
|
|
|
|
print("VoiceVox Plugin registered")
|
|
|
|
|
|
def unregister():
|
|
"""アドオンを登録解除"""
|
|
for cls in reversed(classes):
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
# シーンからプロパティを削除
|
|
del bpy.types.Scene.voicevox
|
|
|
|
print("VoiceVox Plugin unregistered")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
register()
|