feature(subtitles): add frog_subtitles addon

This commit is contained in:
2025-09-23 00:16:43 +02:00
parent 6c8d542e53
commit d3eff4e006
21 changed files with 371 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
#if TOOLS
using Godot;
namespace Frog;
[Tool]
public partial class SubtitlesPlugin : EditorPlugin
{
private SubtitlesImportPlugin? importPlugin;
public override void _EnterTree()
{
Script videoStreamSubtitlesScript = GD.Load<Script>("res://addons/frog_subtitles/nodes/VideoStreamSubtitles.cs");
Texture2D videoStreamSubtitlesIcon = GD.Load<Texture2D>("res://addons/frog_subtitles/icons/video_subtitles.svg");
this.AddCustomType(nameof(VideoStreamSubtitles), nameof(RichTextLabel), videoStreamSubtitlesScript, videoStreamSubtitlesIcon);
Script audioStreamSubtitlesScript = GD.Load<Script>("res://addons/frog_subtitles/nodes/AudioStreamSubtitles.cs");
Texture2D audioStreamSubtitlesIcon = GD.Load<Texture2D>("res://addons/frog_subtitles/icons/audio_subtitles.svg");
this.AddCustomType(nameof(AudioStreamSubtitles), nameof(RichTextLabel), audioStreamSubtitlesScript, audioStreamSubtitlesIcon);
this.importPlugin = new SubtitlesImportPlugin();
this.AddImportPlugin(this.importPlugin);
}
public override void _ExitTree()
{
this.RemoveImportPlugin(this.importPlugin);
this.importPlugin = null;
this.RemoveCustomType(nameof(AudioStreamSubtitles));
this.RemoveCustomType(nameof(VideoStreamSubtitles));
}
}
#endif