From ee8a89e084a7e80eb39371dc021ec624e9356ba9 Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Sun, 28 Sep 2025 15:04:54 +0200 Subject: [PATCH 1/9] Draft: TagToggler --- addons/bbcode_edit.editor/bbcode_edit.gd | 14 +++- addons/bbedit/tag_toggler/plugin.cfg | 7 ++ addons/bbedit/tag_toggler/tag_toggler.gd | 82 +++++++++++++++++++ addons/bbedit/tag_toggler/tag_toggler.gd.uid | 1 + .../tag_toggler/tag_toggler_auto_load.gd | 55 +++++++++++++ .../tag_toggler/tag_toggler_auto_load.gd.uid | 1 + addons/bbedit/tag_toggler/tag_toggler_main.gd | 22 +++++ .../tag_toggler/tag_toggler_main.gd.uid | 1 + project.godot | 8 +- test_bbcode.tscn | 15 +++- 10 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 addons/bbedit/tag_toggler/plugin.cfg create mode 100644 addons/bbedit/tag_toggler/tag_toggler.gd create mode 100644 addons/bbedit/tag_toggler/tag_toggler.gd.uid create mode 100644 addons/bbedit/tag_toggler/tag_toggler_auto_load.gd create mode 100644 addons/bbedit/tag_toggler/tag_toggler_auto_load.gd.uid create mode 100644 addons/bbedit/tag_toggler/tag_toggler_main.gd create mode 100644 addons/bbedit/tag_toggler/tag_toggler_main.gd.uid diff --git a/addons/bbcode_edit.editor/bbcode_edit.gd b/addons/bbcode_edit.editor/bbcode_edit.gd index 61dbf8f..36725f6 100644 --- a/addons/bbcode_edit.editor/bbcode_edit.gd +++ b/addons/bbcode_edit.editor/bbcode_edit.gd @@ -18,11 +18,16 @@ enum CompletionKind { const Completions = preload("res://addons/bbcode_edit.editor/completions_db/completions.gd") const Scraper = preload("res://addons/bbcode_edit.editor/editor_interface_scraper.gd") +## @deprecated: Superseded by Tag Toggler const ACTION_TOGGLE_BOLD = &"bbcode_edit/toggle_bold" +## @deprecated: Superseded by Tag Toggler const ACTION_TOGGLE_ITALIC = &"bbcode_edit/toggle_italic" +## @deprecated: Superseded by Tag Toggler const ACTION_TOGGLE_UNDERLINE = &"bbcode_edit/toggle_underline" +## @deprecated: Superseded by Tag Toggler const ACTION_TOGGLE_STRIKE = &"bbcode_edit/toggle_strike" +## @deprecated: Superseded by Tag Toggler const TOGGLING_ACTIONS = { ACTION_TOGGLE_BOLD: "b", ACTION_TOGGLE_ITALIC: "i", @@ -664,6 +669,7 @@ func add_enums(enums: PackedStringArray) -> void: ) +## @deprecated: Superseded by bbedit/tag_toggler sub-plugin func toggle_tag(tag: String) -> void: var prefix: String = "[" + tag + "]" var prefix_len: int = prefix.length() @@ -866,12 +872,12 @@ func _gui_input(event: InputEvent) -> void: if event is InputEventKey or event is InputEventMouseButton: get_node(COLOR_PICKER_CONTAINER_PATH).free() - for action in TOGGLING_ACTIONS: - if is_action(event, action): - toggle_tag(TOGGLING_ACTIONS[action]) + #for action in TOGGLING_ACTIONS: + #if is_action(event, action): + #toggle_tag(TOGGLING_ACTIONS[action]) -func is_action(event: InputEvent, action: StringName) -> bool: +static func is_action(event: InputEvent, action: StringName) -> bool: return InputMap.has_action(action) and event.is_action(action, true) diff --git a/addons/bbedit/tag_toggler/plugin.cfg b/addons/bbedit/tag_toggler/plugin.cfg new file mode 100644 index 0000000..d6c1611 --- /dev/null +++ b/addons/bbedit/tag_toggler/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="BBEdit Tag Toggler" +description="Allow toggling BBCode tags everywhere." +author="Patou" +version="1.0" +script="tag_toggler_main.gd" diff --git a/addons/bbedit/tag_toggler/tag_toggler.gd b/addons/bbedit/tag_toggler/tag_toggler.gd new file mode 100644 index 0000000..98cf220 --- /dev/null +++ b/addons/bbedit/tag_toggler/tag_toggler.gd @@ -0,0 +1,82 @@ +extends Object + + +# TODO make so that if it's surrounded by another tag it works too. +# exemple: [b][i]bold italic[/b][/i] → toggling b when selecting only the text would work. +static func toggle_tag(editor: TextEdit, tag: String) -> void: + var prefix: String = "[" + tag + "]" + var prefix_len: int = prefix.length() + var suffix: String = "[/" + tag + "]" + var suffix_len: int = suffix.length() + + var main_selection_from_column: int = editor.get_selection_from_column() + var main_selection_from_line: int = editor.get_selection_from_line() + var main_selection_to_column: int = editor.get_selection_to_column() + var main_selection_to_line: int = editor.get_selection_to_line() + var main_selection_end_line: String = editor.get_line(main_selection_to_line) + + if ( + main_selection_from_column >= prefix_len + and editor.get_line(main_selection_from_line).substr( + main_selection_from_column - prefix_len, + prefix_len + ) == prefix + and main_selection_to_column <= main_selection_end_line.length() - suffix_len + and main_selection_end_line.substr( + main_selection_to_column, + suffix_len + ) == suffix + ): + editor.begin_complex_operation() + editor.begin_multicaret_edit() + + for caret in editor.get_caret_count(): + if editor.multicaret_edit_ignore_caret(caret): + continue + + var initial_text: String = editor.get_selected_text(caret) + var initial_start_column: int = editor.get_selection_from_column(caret) + var initial_end_column: int = editor.get_selection_to_column(caret) + + editor.select( + editor.get_selection_from_line(caret), + initial_start_column - prefix_len, + editor.get_selection_to_line(caret), + initial_end_column + suffix_len, + caret + ) + editor.insert_text_at_caret(initial_text, caret) + editor.select( + editor.get_selection_from_line(caret), + initial_start_column - prefix_len, + editor.get_selection_to_line(caret), + initial_end_column - prefix_len, + caret + ) + + editor.end_multicaret_edit() + editor.end_complex_operation() + return + + editor.begin_complex_operation() + editor.begin_multicaret_edit() + + for caret in editor.get_caret_count(): + if editor.multicaret_edit_ignore_caret(caret): + continue + + var initial_start_column: int = editor.get_selection_from_column(caret) + var initial_end_column: int = editor.get_selection_to_column(caret) + + editor.insert_text_at_caret(prefix + editor.get_selected_text(caret) + suffix, caret) + + editor.select( + editor.get_selection_from_line(caret), + initial_start_column + prefix_len, + editor.get_selection_to_line(caret), + initial_end_column + prefix_len, + caret + ) + + editor.end_multicaret_edit() + editor.end_complex_operation() diff --git a/addons/bbedit/tag_toggler/tag_toggler.gd.uid b/addons/bbedit/tag_toggler/tag_toggler.gd.uid new file mode 100644 index 0000000..d97f6ac --- /dev/null +++ b/addons/bbedit/tag_toggler/tag_toggler.gd.uid @@ -0,0 +1 @@ +uid://vbfluupq1gbw diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd new file mode 100644 index 0000000..403e865 --- /dev/null +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd @@ -0,0 +1,55 @@ +@tool +extends Node + +const TagToggler = preload("uid://vbfluupq1gbw") + +const ACTION_TOGGLE_BOLD = &"bbcode_edit/toggle_bold" +const ACTION_TOGGLE_ITALIC = &"bbcode_edit/toggle_italic" +const ACTION_TOGGLE_UNDERLINE = &"bbcode_edit/toggle_underline" +const ACTION_TOGGLE_STRIKE = &"bbcode_edit/toggle_strike" + +const TOGGLING_ACTIONS = { + ACTION_TOGGLE_BOLD: "b", + ACTION_TOGGLE_ITALIC: "i", + ACTION_TOGGLE_UNDERLINE: "u", + ACTION_TOGGLE_STRIKE: "s", +} + +#var focused_editor: TextEdit = null + + +func _ready() -> void: + print("ready") + get_window().gui_focus_changed.connect(_on_focus_changed) + + +func disconnect_from(editor: TextEdit) -> void: + editor.gui_input.disconnect(_on_focused_editor_gui_input) + +func connect_to(editor: TextEdit) -> void: + editor.gui_input.connect(_on_focused_editor_gui_input.bind(editor)) + + +func _on_focus_changed(control: Control) -> void: + #if focused_editor: + #disconnect_from(focused_editor) + print("focus changed to", control) + if control is TextEdit: + print("connecting to: ", control) + connect_to(control) + + +func _on_focused_editor_gui_input(input_event: InputEvent, editor: TextEdit) -> void: + if not input_event.is_pressed() or input_event.is_echo(): + return + + print("gui input: ", editor) + for action in TOGGLING_ACTIONS: + if is_action(input_event, action): + print("TOGGLED BY THE TOGGLER") + TagToggler.toggle_tag(editor, TOGGLING_ACTIONS[action]) + + +# TODO Find some place to put this with the one of BBCodeEdit +static func is_action(event: InputEvent, action: StringName) -> bool: + return InputMap.has_action(action) and event.is_action(action, true) diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd.uid b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd.uid new file mode 100644 index 0000000..67e024d --- /dev/null +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd.uid @@ -0,0 +1 @@ +uid://dowgrccvxw60n diff --git a/addons/bbedit/tag_toggler/tag_toggler_main.gd b/addons/bbedit/tag_toggler/tag_toggler_main.gd new file mode 100644 index 0000000..d25c254 --- /dev/null +++ b/addons/bbedit/tag_toggler/tag_toggler_main.gd @@ -0,0 +1,22 @@ +@tool +extends EditorPlugin + + + +const ADDON_NAME = "BBEdit: Tag Toggler" + + + + + + +func _enable_plugin() -> void: + print("Enabling ", ADDON_NAME) + add_autoload_singleton("TagToggler", "res://addons/bbedit/tag_toggler/tag_toggler_auto_load.gd") + print("Enabled ", ADDON_NAME) + + +func _disable_plugin() -> void: + print("Disabling ", ADDON_NAME) + remove_autoload_singleton("TagToggler") + print("Disabled ", ADDON_NAME) diff --git a/addons/bbedit/tag_toggler/tag_toggler_main.gd.uid b/addons/bbedit/tag_toggler/tag_toggler_main.gd.uid new file mode 100644 index 0000000..c7fa00d --- /dev/null +++ b/addons/bbedit/tag_toggler/tag_toggler_main.gd.uid @@ -0,0 +1 @@ +uid://4wvml1anw6eh diff --git a/project.godot b/project.godot index 0b56ae7..39c3c8d 100644 --- a/project.godot +++ b/project.godot @@ -13,12 +13,16 @@ config_version=5 config/name="BBCodeEdit" config/tags=PackedStringArray("addon") run/main_scene="res://test_export.tscn" -config/features=PackedStringArray("4.4", "GL Compatibility") +config/features=PackedStringArray("4.5", "GL Compatibility") config/icon="res://icon.png" +[autoload] + +TagToggler="*res://addons/bbedit/tag_toggler/tag_toggler_auto_load.gd" + [editor_plugins] -enabled=PackedStringArray("res://addons/bbcode_edit.editor/plugin.cfg", "res://addons/explore-editor-theme/plugin.cfg") +enabled=PackedStringArray("res://addons/bbcode_edit.editor/plugin.cfg", "res://addons/bbedit/tag_toggler/plugin.cfg", "res://addons/explore-editor-theme/plugin.cfg") [input] diff --git a/test_bbcode.tscn b/test_bbcode.tscn index 4794547..eceb066 100644 --- a/test_bbcode.tscn +++ b/test_bbcode.tscn @@ -7,6 +7,17 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 bbcode_enabled = true -text = "Press [b]Ctrl + C[/b]. +text = "test + + + +Press [b]Ctrl + C[/b]. Press [b ]Ctrl + C[/b]. -Press [color= red ]Ctrl + C[/color]." +[b][b]Press[/b][/b] [color= red ]Ctrl + C[/color]." + +[node name="TextEdit" type="TextEdit" parent="."] +layout_mode = 0 +offset_left = 300.0 +offset_top = 221.0 +offset_right = 525.0 +offset_bottom = 390.0 From f691ef10a8dc4408fa98ea4f6234d2ad66e8e216 Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Tue, 30 Sep 2025 17:13:47 +0200 Subject: [PATCH 2/9] Don't use UID Godot 4.3 compatibility --- addons/bbedit/tag_toggler/tag_toggler_auto_load.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd index 403e865..2d99515 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd @@ -1,7 +1,7 @@ @tool extends Node -const TagToggler = preload("uid://vbfluupq1gbw") +const TagToggler = preload("res://addons/bbedit/tag_toggler/tag_toggler.gd") const ACTION_TOGGLE_BOLD = &"bbcode_edit/toggle_bold" const ACTION_TOGGLE_ITALIC = &"bbcode_edit/toggle_italic" From b31fddc98de218e197f4ad6ad12c38a36b3a5c2e Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Tue, 30 Sep 2025 18:00:45 +0200 Subject: [PATCH 3/9] TagToggler accross multiple windows (but only in Godot 4.5) --- .../tag_toggler/tag_toggler_auto_load.gd | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd index 2d99515..d509f34 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd @@ -20,7 +20,7 @@ const TOGGLING_ACTIONS = { func _ready() -> void: print("ready") - get_window().gui_focus_changed.connect(_on_focus_changed) + connect_to_window(get_window()) func disconnect_from(editor: TextEdit) -> void: @@ -30,6 +30,38 @@ func connect_to(editor: TextEdit) -> void: editor.gui_input.connect(_on_focused_editor_gui_input.bind(editor)) +func connect_to_window(window: Window) -> void: + if window.gui_focus_changed.is_connected(_on_focus_changed): + print_rich("[color=green]Skipping already connected " + str(window)) + return + + print_rich("[color=green]Connecting to " + str(window)) + window.gui_focus_changed.connect(_on_focus_changed) + window.focus_exited.connect(_on_window_focus_exited.call_deferred) + + +func _on_window_focus_exited() -> void: + print_rich("[color=red]FOCUS LOST") + connect_to_window(await get_current_focused_window()) + + +func get_current_focused_window() -> Window: + if Engine.get_version_info().hex >= 0x04_05_00: # only in Godot 4.5 + var focused_window: Window = null + while focused_window == null: + await get_tree().process_frame + focused_window = Window.get_focused_window() + print("attempting") + return focused_window + + print("Compatibility problem with Godot 4.4-") + # TODO Find a way to do that pre Godot 4.4 + return get_window() + + +#func _process(_delta: float) -> void: + #print(Window.get_focused_window()) + func _on_focus_changed(control: Control) -> void: #if focused_editor: #disconnect_from(focused_editor) From 7f9489891ba2fdd0f7e88ed521b911b93a69ee83 Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Tue, 30 Sep 2025 18:10:15 +0200 Subject: [PATCH 4/9] Fix static analysis error pre Godot 4.5 --- addons/bbedit/tag_toggler/tag_toggler_auto_load.gd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd index d509f34..6120e5c 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd @@ -50,7 +50,11 @@ func get_current_focused_window() -> Window: var focused_window: Window = null while focused_window == null: await get_tree().process_frame - focused_window = Window.get_focused_window() + + focused_window = get_window().get_focused_window() # I know that + # calling the static method directly on Window would be more elegant, + # but it would cause a static analysis error on Godot 4.4 and before. + print("attempting") return focused_window From e1fa7d7da02cdde49a89fc64562e4c779e59f36f Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Tue, 30 Sep 2025 18:15:17 +0200 Subject: [PATCH 5/9] TagToggler: Increase reliability of listening to currently focused Control node --- addons/bbedit/tag_toggler/tag_toggler_auto_load.gd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd index 6120e5c..d8b8628 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd @@ -21,6 +21,7 @@ const TOGGLING_ACTIONS = { func _ready() -> void: print("ready") connect_to_window(get_window()) + connect_to_window(await get_current_focused_window()) func disconnect_from(editor: TextEdit) -> void: @@ -38,6 +39,7 @@ func connect_to_window(window: Window) -> void: print_rich("[color=green]Connecting to " + str(window)) window.gui_focus_changed.connect(_on_focus_changed) window.focus_exited.connect(_on_window_focus_exited.call_deferred) + _on_focus_changed(window.gui_get_focus_owner()) func _on_window_focus_exited() -> void: From a87a72f7f028bf174443eb1b87d99bf784bd55e0 Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Tue, 30 Sep 2025 18:17:46 +0200 Subject: [PATCH 6/9] TagToggler: Prevent error: "already connected " --- addons/bbedit/tag_toggler/tag_toggler_auto_load.gd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd index d8b8628..c9d993f 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd @@ -28,6 +28,9 @@ func disconnect_from(editor: TextEdit) -> void: editor.gui_input.disconnect(_on_focused_editor_gui_input) func connect_to(editor: TextEdit) -> void: + if editor.gui_input.is_connected(_on_focused_editor_gui_input): + print_rich("[color=green]Skipping already connected TextEdit.") + return editor.gui_input.connect(_on_focused_editor_gui_input.bind(editor)) From 1dd6a9fcc68d4c337f095c7b6bab671ee884605c Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Tue, 30 Sep 2025 18:46:16 +0200 Subject: [PATCH 7/9] TagToggler: multi-window is available for Godot 4.4 and before --- .../tag_toggler/tag_toggler_auto_load.gd | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd index c9d993f..9bc138f 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd +++ b/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd @@ -64,9 +64,34 @@ func get_current_focused_window() -> Window: return focused_window print("Compatibility problem with Godot 4.4-") - # TODO Find a way to do that pre Godot 4.4 - return get_window() - + + var windows := get_windows() + var focused_window: Window = null + while focused_window == null: + await get_tree().create_timer(0.2).timeout + + for window in windows: + #prints(window, window.has_focus()) + if window.has_focus(): + return window # I know that + # calling the static method directly on Window would be more elegant, + # but it would cause a static analysis error on Godot 4.4 and before. + + print("attempting") + return focused_window + +## @deprecated: Useless in Godot 4.5+ +func get_windows() -> Array[Window]: + var windows: Array[Window] = [] + var to_check: Array[Node] = [get_tree().root] + + while to_check: + var current_node: Node = to_check.pop_back() + if current_node is Window: + windows.push_back(current_node) + to_check.append_array(current_node.get_children()) + + return windows #func _process(_delta: float) -> void: #print(Window.get_focused_window()) From 04712d56169fa65a4e4c40361b2d8dd5a29b84d1 Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Thu, 2 Oct 2025 07:46:21 +0200 Subject: [PATCH 8/9] Reorganized the files --- .../color_completion.gif | Bin .../color_completion.mp4 | Bin .../reference_completion.gif | Bin .../reference_completion.mp4 | Bin .../shortcuts.gif | Bin .../shortcuts.mp4 | Bin .../snippet.gif | Bin .../snippet.mp4 | Bin .gitattributes | 6 ++-- .../plugin.cfg => bbcode_edit/.plugin.cfg} | 2 +- .../LICENCE.txt | 0 .../README.md | 15 ++++---- addons/bbcode_edit/bbcode_edit_main.gd | 33 ++++++++++++++++++ addons/bbcode_edit/bbcode_edit_main.gd.uid | 1 + .../doc_comment.editor/LICENCE.txt | 21 +++++++++++ .../bbcode_completion_icon.svg | 0 .../bbcode_completion_icon.svg.import | 12 +++++-- .../doc_comment.editor}/bbcode_edit.gd | 10 +++--- .../doc_comment.editor}/bbcode_edit.gd.uid | 0 .../doc_comment.editor}/bbcode_edit_main.gd | 6 ++-- .../bbcode_edit_main.gd.uid | 0 .../doc_comment.editor}/color_picker.tscn | 0 .../completions_db/builtin_classes_4.3.txt | 0 .../completions_db/builtin_classes_4.4.txt | 0 .../completions_db/builtin_classes_4.5.txt | 0 .../completions_db/completions.gd | 8 ++--- .../completions_db/completions.gd.uid | 0 .../completions_db/fetch_builtin_classes.gd | 2 +- .../fetch_builtin_classes.gd.uid | 0 .../completions_db/fetch_builtin_classes.tscn | 2 +- .../completions_db/godot_version.gd | 0 .../completions_db/godot_version.gd.uid | 0 .../editor_interface_scraper.gd | 0 .../editor_interface_scraper.gd.uid | 0 .../bbcode_edit/doc_comment.editor/plugin.cfg | 7 ++++ addons/bbcode_edit/tag_toggler/LICENCE.txt | 21 +++++++++++ .../tag_toggler/plugin.cfg | 2 +- .../tag_toggler/tag_toggler.gd | 0 .../tag_toggler/tag_toggler.gd.uid | 0 .../tag_toggler/tag_toggler_auto_load.gd | 2 +- .../tag_toggler/tag_toggler_auto_load.gd.uid | 0 .../tag_toggler/tag_toggler_main.gd | 4 +-- .../tag_toggler/tag_toggler_main.gd.uid | 0 project.godot | 4 +-- test_open_doc_named.gd | 6 ++-- test_param.gd | 2 +- 46 files changed, 126 insertions(+), 40 deletions(-) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/color_completion.gif (100%) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/color_completion.mp4 (100%) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/reference_completion.gif (100%) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/reference_completion.mp4 (100%) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/shortcuts.gif (100%) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/shortcuts.mp4 (100%) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/snippet.gif (100%) rename {addons/bbcode_edit.editor/.assets_for_readme => .assets_for_readme}/snippet.mp4 (100%) rename addons/{bbcode_edit.editor/plugin.cfg => bbcode_edit/.plugin.cfg} (84%) rename addons/{bbcode_edit.editor => bbcode_edit}/LICENCE.txt (100%) rename addons/{bbcode_edit.editor => bbcode_edit}/README.md (86%) create mode 100644 addons/bbcode_edit/bbcode_edit_main.gd create mode 100644 addons/bbcode_edit/bbcode_edit_main.gd.uid create mode 100644 addons/bbcode_edit/doc_comment.editor/LICENCE.txt rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/bbcode_completion_icon.svg (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/bbcode_completion_icon.svg.import (60%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/bbcode_edit.gd (98%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/bbcode_edit.gd.uid (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/bbcode_edit_main.gd (95%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/bbcode_edit_main.gd.uid (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/color_picker.tscn (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/builtin_classes_4.3.txt (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/builtin_classes_4.4.txt (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/builtin_classes_4.5.txt (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/completions.gd (95%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/completions.gd.uid (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/fetch_builtin_classes.gd (85%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/fetch_builtin_classes.gd.uid (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/fetch_builtin_classes.tscn (67%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/godot_version.gd (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/completions_db/godot_version.gd.uid (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/editor_interface_scraper.gd (100%) rename addons/{bbcode_edit.editor => bbcode_edit/doc_comment.editor}/editor_interface_scraper.gd.uid (100%) create mode 100644 addons/bbcode_edit/doc_comment.editor/plugin.cfg create mode 100644 addons/bbcode_edit/tag_toggler/LICENCE.txt rename addons/{bbedit => bbcode_edit}/tag_toggler/plugin.cfg (79%) rename addons/{bbedit => bbcode_edit}/tag_toggler/tag_toggler.gd (100%) rename addons/{bbedit => bbcode_edit}/tag_toggler/tag_toggler.gd.uid (100%) rename addons/{bbedit => bbcode_edit}/tag_toggler/tag_toggler_auto_load.gd (97%) rename addons/{bbedit => bbcode_edit}/tag_toggler/tag_toggler_auto_load.gd.uid (100%) rename addons/{bbedit => bbcode_edit}/tag_toggler/tag_toggler_main.gd (64%) rename addons/{bbedit => bbcode_edit}/tag_toggler/tag_toggler_main.gd.uid (100%) diff --git a/addons/bbcode_edit.editor/.assets_for_readme/color_completion.gif b/.assets_for_readme/color_completion.gif similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/color_completion.gif rename to .assets_for_readme/color_completion.gif diff --git a/addons/bbcode_edit.editor/.assets_for_readme/color_completion.mp4 b/.assets_for_readme/color_completion.mp4 similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/color_completion.mp4 rename to .assets_for_readme/color_completion.mp4 diff --git a/addons/bbcode_edit.editor/.assets_for_readme/reference_completion.gif b/.assets_for_readme/reference_completion.gif similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/reference_completion.gif rename to .assets_for_readme/reference_completion.gif diff --git a/addons/bbcode_edit.editor/.assets_for_readme/reference_completion.mp4 b/.assets_for_readme/reference_completion.mp4 similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/reference_completion.mp4 rename to .assets_for_readme/reference_completion.mp4 diff --git a/addons/bbcode_edit.editor/.assets_for_readme/shortcuts.gif b/.assets_for_readme/shortcuts.gif similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/shortcuts.gif rename to .assets_for_readme/shortcuts.gif diff --git a/addons/bbcode_edit.editor/.assets_for_readme/shortcuts.mp4 b/.assets_for_readme/shortcuts.mp4 similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/shortcuts.mp4 rename to .assets_for_readme/shortcuts.mp4 diff --git a/addons/bbcode_edit.editor/.assets_for_readme/snippet.gif b/.assets_for_readme/snippet.gif similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/snippet.gif rename to .assets_for_readme/snippet.gif diff --git a/addons/bbcode_edit.editor/.assets_for_readme/snippet.mp4 b/.assets_for_readme/snippet.mp4 similarity index 100% rename from addons/bbcode_edit.editor/.assets_for_readme/snippet.mp4 rename to .assets_for_readme/snippet.mp4 diff --git a/.gitattributes b/.gitattributes index 1a97d66..d01486a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,8 +4,8 @@ # Only include the addons folder when downloading from the Asset Library. /** export-ignore /addons !export-ignore -/addons/bbcode_edit.editor !export-ignore -/addons/bbcode_edit.editor/** !export-ignore -/addons/bbcode_edit.editor/.assets_for_readme/*.mp4 export-ignore +/addons/bbcode_edit !export-ignore +/addons/bbcode_edit/** !export-ignore +/addons/bbcode_edit/.assets_for_readme/*.mp4 export-ignore /addons/any_icon.editor !export-ignore /addons/any_icon.editor/** !export-ignore \ No newline at end of file diff --git a/addons/bbcode_edit.editor/plugin.cfg b/addons/bbcode_edit/.plugin.cfg similarity index 84% rename from addons/bbcode_edit.editor/plugin.cfg rename to addons/bbcode_edit/.plugin.cfg index 2db739e..c029289 100644 --- a/addons/bbcode_edit.editor/plugin.cfg +++ b/addons/bbcode_edit/.plugin.cfg @@ -1,6 +1,6 @@ [plugin] -name="BBCodeEdit (for script editor)" +name="BBCodeEdit" description="A Godot addon that brings BBCode completion and QOL tools to the script editor in order to help formatting documentation comments." author="Patou" version="1.2.1" diff --git a/addons/bbcode_edit.editor/LICENCE.txt b/addons/bbcode_edit/LICENCE.txt similarity index 100% rename from addons/bbcode_edit.editor/LICENCE.txt rename to addons/bbcode_edit/LICENCE.txt diff --git a/addons/bbcode_edit.editor/README.md b/addons/bbcode_edit/README.md similarity index 86% rename from addons/bbcode_edit.editor/README.md rename to addons/bbcode_edit/README.md index 9f45a35..3ec6456 100644 --- a/addons/bbcode_edit.editor/README.md +++ b/addons/bbcode_edit/README.md @@ -11,22 +11,22 @@ in order to help format documentation comments. There are **shortcuts** to easily toggle some formattings: -![Using the keyboard to toggle bold, italic, underline, striketrough](/addons/bbcode_edit.editor/.assets_for_readme/shortcuts.gif) +![Using the keyboard to toggle bold, italic, underline, striketrough](/.assets_for_readme/shortcuts.gif) **Completion** for formatting tags, with some special completions implemented for specific tags: -![Advanced completion for color tag](/addons/bbcode_edit.editor/.assets_for_readme/color_completion.gif) +![Advanced completion for color tag](/.assets_for_readme/color_completion.gif) **Documentation references** are completed: -![Reference completion](/addons/bbcode_edit.editor/.assets_for_readme/reference_completion.gif) +![Reference completion](/.assets_for_readme/reference_completion.gif) Some useful **snippets** are included: -![A "Note" snippet, with the same formatting as the one used in the official documentation](/addons/bbcode_edit.editor/.assets_for_readme/snippet.gif) +![A "Note" snippet, with the same formatting as the one used in the official documentation](/.assets_for_readme/snippet.gif) ## Features / Roadmap @@ -84,17 +84,14 @@ You can download the addon: - On GitHub: `Code` → `Download ZIP`. - Through the editor: `AssetLib` → Search for "BBCodeEdit" -*By default, this readme is included, along with it's illustrations. If you don't want them, -do not download `addons/bbcode_edit.editor/README.md` nor `addons/bbcode_edit.editor/.assets_for_readme/*`* - -*You can also remove `addons/bbcode_edit.editor/completions_cd/builtin_classes_[godot versions that you don't use].txt`* +*You can remove `addons/bbcode_edit/doc_comment.editor/completions_cd/builtin_classes_[godot versions that you don't use].txt`* To edit shortcuts: - *If they don't show up* in the input map GUI: first restart the editor - modify them in the input map GUI - **restart** the editor to update the input map. -You can also exclude `*.editor/*` or `bbcode_edit.editor/` from your export presets, +You can also exclude `*.editor/*` or `bbcode_edit/doc_comment.editor/` from your export presets, because this addon is (for now[^editor_only]) script-editor-only. diff --git a/addons/bbcode_edit/bbcode_edit_main.gd b/addons/bbcode_edit/bbcode_edit_main.gd new file mode 100644 index 0000000..be6f160 --- /dev/null +++ b/addons/bbcode_edit/bbcode_edit_main.gd @@ -0,0 +1,33 @@ +@tool +extends EditorPlugin + + + +#const ADDON_NAME = "BBCodeEdit" +# +# +#const SUB_PLUGINS: Array[String] = [ + #"doc_comment.editor", + #"tag_toggler", +#] +# +# +#func _enable_plugin() -> void: + #print("Enabling ", ADDON_NAME) + #set_sub_plugins_enabled(true) + #print("Enabled ", ADDON_NAME) +# +# +#func _disable_plugin() -> void: + #print("Disabling ", ADDON_NAME) + #set_sub_plugins_enabled(false) + #print("Disabled ", ADDON_NAME) +# +# +#func set_sub_plugins_enabled(enabled: bool) -> void: + #for sub_plugin in SUB_PLUGINS: + #if DirAccess.dir_exists_absolute("res://addons/bbcode_edit".path_join(sub_plugin)): + #EditorInterface.set_plugin_enabled( + #"bbcode_edit".path_join(sub_plugin), + #true + #) diff --git a/addons/bbcode_edit/bbcode_edit_main.gd.uid b/addons/bbcode_edit/bbcode_edit_main.gd.uid new file mode 100644 index 0000000..fda4195 --- /dev/null +++ b/addons/bbcode_edit/bbcode_edit_main.gd.uid @@ -0,0 +1 @@ +uid://ctmw73yoaxrks diff --git a/addons/bbcode_edit/doc_comment.editor/LICENCE.txt b/addons/bbcode_edit/doc_comment.editor/LICENCE.txt new file mode 100644 index 0000000..3e37514 --- /dev/null +++ b/addons/bbcode_edit/doc_comment.editor/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Patou + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/addons/bbcode_edit.editor/bbcode_completion_icon.svg b/addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg similarity index 100% rename from addons/bbcode_edit.editor/bbcode_completion_icon.svg rename to addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg diff --git a/addons/bbcode_edit.editor/bbcode_completion_icon.svg.import b/addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg.import similarity index 60% rename from addons/bbcode_edit.editor/bbcode_completion_icon.svg.import rename to addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg.import index 180befb..d5a883c 100644 --- a/addons/bbcode_edit.editor/bbcode_completion_icon.svg.import +++ b/addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg.import @@ -3,7 +3,7 @@ importer="texture" type="CompressedTexture2D" uid="uid://bpwcspqlqm78h" -path="res://.godot/imported/bbcode_completion_icon.svg-e050b1e9fb923c5a17b0f52532042234.ctex" +path="res://.godot/imported/bbcode_completion_icon.svg-a242f72402b90907e6e67e820acf8aa8.ctex" metadata={ "has_editor_variant": true, "vram_texture": false @@ -11,14 +11,16 @@ metadata={ [deps] -source_file="res://addons/bbcode_edit.editor/bbcode_completion_icon.svg" -dest_files=["res://.godot/imported/bbcode_completion_icon.svg-e050b1e9fb923c5a17b0f52532042234.ctex"] +source_file="res://addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg" +dest_files=["res://.godot/imported/bbcode_completion_icon.svg-a242f72402b90907e6e67e820acf8aa8.ctex"] [params] compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -26,6 +28,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/addons/bbcode_edit.editor/bbcode_edit.gd b/addons/bbcode_edit/doc_comment.editor/bbcode_edit.gd similarity index 98% rename from addons/bbcode_edit.editor/bbcode_edit.gd rename to addons/bbcode_edit/doc_comment.editor/bbcode_edit.gd index 36725f6..93f4c3d 100644 --- a/addons/bbcode_edit.editor/bbcode_edit.gd +++ b/addons/bbcode_edit/doc_comment.editor/bbcode_edit.gd @@ -15,8 +15,8 @@ enum CompletionKind { } -const Completions = preload("res://addons/bbcode_edit.editor/completions_db/completions.gd") -const Scraper = preload("res://addons/bbcode_edit.editor/editor_interface_scraper.gd") +const Completions = preload("res://addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd") +const Scraper = preload("res://addons/bbcode_edit/doc_comment.editor/editor_interface_scraper.gd") ## @deprecated: Superseded by Tag Toggler const ACTION_TOGGLE_BOLD = &"bbcode_edit/toggle_bold" @@ -35,7 +35,7 @@ const TOGGLING_ACTIONS = { ACTION_TOGGLE_STRIKE: "s", } -const BBCODE_COMPLETION_ICON = preload("res://addons/bbcode_edit.editor/bbcode_completion_icon.svg") +const BBCODE_COMPLETION_ICON = preload("res://addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg") const COLOR_PICKER_CONTAINER_PATH = ^"_BBCodeEditColorPicker" const COLOR_PICKER_PATH = ^"_BBCodeEditColorPicker/ColorPicker" @@ -669,7 +669,7 @@ func add_enums(enums: PackedStringArray) -> void: ) -## @deprecated: Superseded by bbedit/tag_toggler sub-plugin +## @deprecated: Superseded by bbcode_edit/tag_toggler sub-plugin func toggle_tag(tag: String) -> void: var prefix: String = "[" + tag + "]" var prefix_len: int = prefix.length() @@ -776,7 +776,7 @@ func _confirm_code_completion(replace: bool = false) -> void: match parts[0]: _COMMAND_COLOR_PICKER: if not has_node(^"BBCODE_EDIT_COLOR_PICKER"): - add_child(preload("res://addons/bbcode_edit.editor/color_picker.tscn").instantiate()) + add_child(preload("res://addons/bbcode_edit/doc_comment.editor/color_picker.tscn").instantiate()) var container: PopupPanel = get_node(COLOR_PICKER_CONTAINER_PATH) var picker: ColorPicker = get_node(COLOR_PICKER_PATH) diff --git a/addons/bbcode_edit.editor/bbcode_edit.gd.uid b/addons/bbcode_edit/doc_comment.editor/bbcode_edit.gd.uid similarity index 100% rename from addons/bbcode_edit.editor/bbcode_edit.gd.uid rename to addons/bbcode_edit/doc_comment.editor/bbcode_edit.gd.uid diff --git a/addons/bbcode_edit.editor/bbcode_edit_main.gd b/addons/bbcode_edit/doc_comment.editor/bbcode_edit_main.gd similarity index 95% rename from addons/bbcode_edit.editor/bbcode_edit_main.gd rename to addons/bbcode_edit/doc_comment.editor/bbcode_edit_main.gd index bc1de3c..6608591 100644 --- a/addons/bbcode_edit.editor/bbcode_edit_main.gd +++ b/addons/bbcode_edit/doc_comment.editor/bbcode_edit_main.gd @@ -2,9 +2,9 @@ extends EditorPlugin -const BBCodeEdit: GDScript = preload("res://addons/bbcode_edit.editor/bbcode_edit.gd") -const Completions = preload("res://addons/bbcode_edit.editor/completions_db/completions.gd") -const Scraper = preload("res://addons/bbcode_edit.editor/editor_interface_scraper.gd") +const BBCodeEdit: GDScript = preload("res://addons/bbcode_edit/doc_comment.editor/bbcode_edit.gd") +const Completions = preload("res://addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd") +const Scraper = preload("res://addons/bbcode_edit/doc_comment.editor/editor_interface_scraper.gd") const ADDON_NAME = "BBCode Editor" diff --git a/addons/bbcode_edit.editor/bbcode_edit_main.gd.uid b/addons/bbcode_edit/doc_comment.editor/bbcode_edit_main.gd.uid similarity index 100% rename from addons/bbcode_edit.editor/bbcode_edit_main.gd.uid rename to addons/bbcode_edit/doc_comment.editor/bbcode_edit_main.gd.uid diff --git a/addons/bbcode_edit.editor/color_picker.tscn b/addons/bbcode_edit/doc_comment.editor/color_picker.tscn similarity index 100% rename from addons/bbcode_edit.editor/color_picker.tscn rename to addons/bbcode_edit/doc_comment.editor/color_picker.tscn diff --git a/addons/bbcode_edit.editor/completions_db/builtin_classes_4.3.txt b/addons/bbcode_edit/doc_comment.editor/completions_db/builtin_classes_4.3.txt similarity index 100% rename from addons/bbcode_edit.editor/completions_db/builtin_classes_4.3.txt rename to addons/bbcode_edit/doc_comment.editor/completions_db/builtin_classes_4.3.txt diff --git a/addons/bbcode_edit.editor/completions_db/builtin_classes_4.4.txt b/addons/bbcode_edit/doc_comment.editor/completions_db/builtin_classes_4.4.txt similarity index 100% rename from addons/bbcode_edit.editor/completions_db/builtin_classes_4.4.txt rename to addons/bbcode_edit/doc_comment.editor/completions_db/builtin_classes_4.4.txt diff --git a/addons/bbcode_edit.editor/completions_db/builtin_classes_4.5.txt b/addons/bbcode_edit/doc_comment.editor/completions_db/builtin_classes_4.5.txt similarity index 100% rename from addons/bbcode_edit.editor/completions_db/builtin_classes_4.5.txt rename to addons/bbcode_edit/doc_comment.editor/completions_db/builtin_classes_4.5.txt diff --git a/addons/bbcode_edit.editor/completions_db/completions.gd b/addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd similarity index 95% rename from addons/bbcode_edit.editor/completions_db/completions.gd rename to addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd index 4e25b84..43b454e 100644 --- a/addons/bbcode_edit.editor/completions_db/completions.gd +++ b/addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd @@ -1,10 +1,10 @@ extends Object -const GodotVersion = preload("res://addons/bbcode_edit.editor/completions_db/godot_version.gd") -const Scraper = preload("res://addons/bbcode_edit.editor/editor_interface_scraper.gd") +const GodotVersion = preload("res://addons/bbcode_edit/doc_comment.editor/completions_db/godot_version.gd") +const Scraper = preload("res://addons/bbcode_edit/doc_comment.editor/editor_interface_scraper.gd") -const _BUILTIN_COMPLETIONS_PATH_BEGINING = "res://addons/bbcode_edit.editor/completions_db/builtin_classes_" +const _BUILTIN_COMPLETIONS_PATH_BEGINING = "res://addons/bbcode_edit/doc_comment.editor/completions_db/builtin_classes_" const DONT_ASK_TO_FETCH_SETTING_PATH = "addons/bbcode_edit/editor/dont_ask_to_fetch_builtin_classes" const equivalent_versions: Dictionary = { @@ -309,7 +309,7 @@ static func get_class_completions() -> ClassCompletions: static func fetch_builtin_classes() -> void: - EditorInterface.play_custom_scene("res://addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.tscn") + EditorInterface.play_custom_scene("res://addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.tscn") while EditorInterface.is_playing_scene(): await EditorInterface.get_base_control().get_tree().create_timer(0.1, true, false, true).timeout diff --git a/addons/bbcode_edit.editor/completions_db/completions.gd.uid b/addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd.uid similarity index 100% rename from addons/bbcode_edit.editor/completions_db/completions.gd.uid rename to addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd.uid diff --git a/addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.gd b/addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.gd similarity index 85% rename from addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.gd rename to addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.gd index 14aac01..b0173a6 100644 --- a/addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.gd +++ b/addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.gd @@ -4,7 +4,7 @@ extends Node ## This has to be a scene. ## (In an EditorScript, editor specifc classes would polute the result) -const Completions = preload("res://addons/bbcode_edit.editor/completions_db/completions.gd") +const Completions = preload("res://addons/bbcode_edit/doc_comment.editor/completions_db/completions.gd") func _ready() -> void: diff --git a/addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.gd.uid b/addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.gd.uid similarity index 100% rename from addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.gd.uid rename to addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.gd.uid diff --git a/addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.tscn b/addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.tscn similarity index 67% rename from addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.tscn rename to addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.tscn index 7907fde..ec1d672 100644 --- a/addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.tscn +++ b/addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://blcco0wsttyck"] -[ext_resource type="Script" uid="uid://cociwvr6oq38v" path="res://addons/bbcode_edit.editor/completions_db/fetch_builtin_classes.gd" id="1_tk0nj"] +[ext_resource type="Script" uid="uid://cociwvr6oq38v" path="res://addons/bbcode_edit/doc_comment.editor/completions_db/fetch_builtin_classes.gd" id="1_tk0nj"] [node name="FetchClassDB" type="Node"] script = ExtResource("1_tk0nj") diff --git a/addons/bbcode_edit.editor/completions_db/godot_version.gd b/addons/bbcode_edit/doc_comment.editor/completions_db/godot_version.gd similarity index 100% rename from addons/bbcode_edit.editor/completions_db/godot_version.gd rename to addons/bbcode_edit/doc_comment.editor/completions_db/godot_version.gd diff --git a/addons/bbcode_edit.editor/completions_db/godot_version.gd.uid b/addons/bbcode_edit/doc_comment.editor/completions_db/godot_version.gd.uid similarity index 100% rename from addons/bbcode_edit.editor/completions_db/godot_version.gd.uid rename to addons/bbcode_edit/doc_comment.editor/completions_db/godot_version.gd.uid diff --git a/addons/bbcode_edit.editor/editor_interface_scraper.gd b/addons/bbcode_edit/doc_comment.editor/editor_interface_scraper.gd similarity index 100% rename from addons/bbcode_edit.editor/editor_interface_scraper.gd rename to addons/bbcode_edit/doc_comment.editor/editor_interface_scraper.gd diff --git a/addons/bbcode_edit.editor/editor_interface_scraper.gd.uid b/addons/bbcode_edit/doc_comment.editor/editor_interface_scraper.gd.uid similarity index 100% rename from addons/bbcode_edit.editor/editor_interface_scraper.gd.uid rename to addons/bbcode_edit/doc_comment.editor/editor_interface_scraper.gd.uid diff --git a/addons/bbcode_edit/doc_comment.editor/plugin.cfg b/addons/bbcode_edit/doc_comment.editor/plugin.cfg new file mode 100644 index 0000000..a3890a8 --- /dev/null +++ b/addons/bbcode_edit/doc_comment.editor/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="BBCodeEdit: Documentation comment completion" +description="A Godot addon that brings BBCode completion and QOL tools to the script editor in order to help formatting documentation comments." +author="Patou" +version="1.2.1" +script="bbcode_edit_main.gd" diff --git a/addons/bbcode_edit/tag_toggler/LICENCE.txt b/addons/bbcode_edit/tag_toggler/LICENCE.txt new file mode 100644 index 0000000..3e37514 --- /dev/null +++ b/addons/bbcode_edit/tag_toggler/LICENCE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Patou + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/addons/bbedit/tag_toggler/plugin.cfg b/addons/bbcode_edit/tag_toggler/plugin.cfg similarity index 79% rename from addons/bbedit/tag_toggler/plugin.cfg rename to addons/bbcode_edit/tag_toggler/plugin.cfg index d6c1611..d70b20f 100644 --- a/addons/bbedit/tag_toggler/plugin.cfg +++ b/addons/bbcode_edit/tag_toggler/plugin.cfg @@ -1,6 +1,6 @@ [plugin] -name="BBEdit Tag Toggler" +name="BBCodeEdit: Tag Toggler" description="Allow toggling BBCode tags everywhere." author="Patou" version="1.0" diff --git a/addons/bbedit/tag_toggler/tag_toggler.gd b/addons/bbcode_edit/tag_toggler/tag_toggler.gd similarity index 100% rename from addons/bbedit/tag_toggler/tag_toggler.gd rename to addons/bbcode_edit/tag_toggler/tag_toggler.gd diff --git a/addons/bbedit/tag_toggler/tag_toggler.gd.uid b/addons/bbcode_edit/tag_toggler/tag_toggler.gd.uid similarity index 100% rename from addons/bbedit/tag_toggler/tag_toggler.gd.uid rename to addons/bbcode_edit/tag_toggler/tag_toggler.gd.uid diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd b/addons/bbcode_edit/tag_toggler/tag_toggler_auto_load.gd similarity index 97% rename from addons/bbedit/tag_toggler/tag_toggler_auto_load.gd rename to addons/bbcode_edit/tag_toggler/tag_toggler_auto_load.gd index 9bc138f..bd0d777 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd +++ b/addons/bbcode_edit/tag_toggler/tag_toggler_auto_load.gd @@ -1,7 +1,7 @@ @tool extends Node -const TagToggler = preload("res://addons/bbedit/tag_toggler/tag_toggler.gd") +const TagToggler = preload("res://addons/bbcode_edit/tag_toggler/tag_toggler.gd") const ACTION_TOGGLE_BOLD = &"bbcode_edit/toggle_bold" const ACTION_TOGGLE_ITALIC = &"bbcode_edit/toggle_italic" diff --git a/addons/bbedit/tag_toggler/tag_toggler_auto_load.gd.uid b/addons/bbcode_edit/tag_toggler/tag_toggler_auto_load.gd.uid similarity index 100% rename from addons/bbedit/tag_toggler/tag_toggler_auto_load.gd.uid rename to addons/bbcode_edit/tag_toggler/tag_toggler_auto_load.gd.uid diff --git a/addons/bbedit/tag_toggler/tag_toggler_main.gd b/addons/bbcode_edit/tag_toggler/tag_toggler_main.gd similarity index 64% rename from addons/bbedit/tag_toggler/tag_toggler_main.gd rename to addons/bbcode_edit/tag_toggler/tag_toggler_main.gd index d25c254..577bb33 100644 --- a/addons/bbedit/tag_toggler/tag_toggler_main.gd +++ b/addons/bbcode_edit/tag_toggler/tag_toggler_main.gd @@ -3,7 +3,7 @@ extends EditorPlugin -const ADDON_NAME = "BBEdit: Tag Toggler" +const ADDON_NAME = "BBCodeEdit: Tag Toggler" @@ -12,7 +12,7 @@ const ADDON_NAME = "BBEdit: Tag Toggler" func _enable_plugin() -> void: print("Enabling ", ADDON_NAME) - add_autoload_singleton("TagToggler", "res://addons/bbedit/tag_toggler/tag_toggler_auto_load.gd") + add_autoload_singleton("TagToggler", "res://addons/bbcode_edit/tag_toggler/tag_toggler_auto_load.gd") print("Enabled ", ADDON_NAME) diff --git a/addons/bbedit/tag_toggler/tag_toggler_main.gd.uid b/addons/bbcode_edit/tag_toggler/tag_toggler_main.gd.uid similarity index 100% rename from addons/bbedit/tag_toggler/tag_toggler_main.gd.uid rename to addons/bbcode_edit/tag_toggler/tag_toggler_main.gd.uid diff --git a/project.godot b/project.godot index 39c3c8d..c0b3646 100644 --- a/project.godot +++ b/project.godot @@ -18,11 +18,11 @@ config/icon="res://icon.png" [autoload] -TagToggler="*res://addons/bbedit/tag_toggler/tag_toggler_auto_load.gd" +TagToggler="*res://addons/bbcode_edit/tag_toggler/tag_toggler_auto_load.gd" [editor_plugins] -enabled=PackedStringArray("res://addons/bbcode_edit.editor/plugin.cfg", "res://addons/bbedit/tag_toggler/plugin.cfg", "res://addons/explore-editor-theme/plugin.cfg") +enabled=PackedStringArray("res://addons/bbcode_edit/doc_comment.editor/plugin.cfg", "res://addons/bbcode_edit/tag_toggler/plugin.cfg", "res://addons/explore-editor-theme/plugin.cfg") [input] diff --git a/test_open_doc_named.gd b/test_open_doc_named.gd index 40b5970..432bcc4 100644 --- a/test_open_doc_named.gd +++ b/test_open_doc_named.gd @@ -1,4 +1,4 @@ -@icon("res://addons/bbcode_edit.editor/bbcode_completion_icon.svg") +@icon("res://addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg") class_name Named extends Node @@ -36,7 +36,7 @@ enum {OH, NO} const CONTANT_STRING = "ah" const CONTANT_INT = 5 ## [constant BbcodeEdit] -const BbcodeEdit = preload("res://addons/bbcode_edit.editor/bbcode_edit.gd") +const BbcodeEdit = preload("res://addons/bbcode_edit/doc_comment.editor/bbcode_edit.gd") ## Press [color= red ## ]Ctrl + C oh no[/color]. @@ -69,7 +69,7 @@ var obj: Node = Node.new() ## [member auto_translate_mode] [method add_child] ## Testazeiln,azlekj,azUPDATE3[color=aqua]azejnzaekj[/color] -## aaa[img width=32 height=10 color=red region=0,0,10,10 tootip=hello]res://addons/bbcode_edit.editor/bbcode_completion_icon.svg[/img]bbb +## aaa[img width=32 height=10 color=red region=0,0,10,10 tootip=hello]res://addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg[/img]bbb func doc_test()-> void: pass diff --git a/test_param.gd b/test_param.gd index 573aa81..5795796 100644 --- a/test_param.gd +++ b/test_param.gd @@ -1,4 +1,4 @@ -@icon("res://addons/bbcode_edit.editor/bbcode_completion_icon.svg") +@icon("res://addons/bbcode_edit/doc_comment.editor/bbcode_completion_icon.svg") extends Node From 4a9ff54a0d98bcd81aabb7ce500eba6540187d7a Mon Sep 17 00:00:00 2001 From: Patou <75997617+xorblo-doitus@users.noreply.github.com> Date: Thu, 2 Oct 2025 07:49:24 +0200 Subject: [PATCH 9/9] Remove the attempt of having a way to enable all sub-plugins at once --- addons/bbcode_edit/bbcode_edit_main.gd | 33 ------------------- addons/bbcode_edit/bbcode_edit_main.gd.uid | 1 - .../bbcode_edit/{.plugin.cfg => plugin.cfg} | 0 3 files changed, 34 deletions(-) delete mode 100644 addons/bbcode_edit/bbcode_edit_main.gd delete mode 100644 addons/bbcode_edit/bbcode_edit_main.gd.uid rename addons/bbcode_edit/{.plugin.cfg => plugin.cfg} (100%) diff --git a/addons/bbcode_edit/bbcode_edit_main.gd b/addons/bbcode_edit/bbcode_edit_main.gd deleted file mode 100644 index be6f160..0000000 --- a/addons/bbcode_edit/bbcode_edit_main.gd +++ /dev/null @@ -1,33 +0,0 @@ -@tool -extends EditorPlugin - - - -#const ADDON_NAME = "BBCodeEdit" -# -# -#const SUB_PLUGINS: Array[String] = [ - #"doc_comment.editor", - #"tag_toggler", -#] -# -# -#func _enable_plugin() -> void: - #print("Enabling ", ADDON_NAME) - #set_sub_plugins_enabled(true) - #print("Enabled ", ADDON_NAME) -# -# -#func _disable_plugin() -> void: - #print("Disabling ", ADDON_NAME) - #set_sub_plugins_enabled(false) - #print("Disabled ", ADDON_NAME) -# -# -#func set_sub_plugins_enabled(enabled: bool) -> void: - #for sub_plugin in SUB_PLUGINS: - #if DirAccess.dir_exists_absolute("res://addons/bbcode_edit".path_join(sub_plugin)): - #EditorInterface.set_plugin_enabled( - #"bbcode_edit".path_join(sub_plugin), - #true - #) diff --git a/addons/bbcode_edit/bbcode_edit_main.gd.uid b/addons/bbcode_edit/bbcode_edit_main.gd.uid deleted file mode 100644 index fda4195..0000000 --- a/addons/bbcode_edit/bbcode_edit_main.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://ctmw73yoaxrks diff --git a/addons/bbcode_edit/.plugin.cfg b/addons/bbcode_edit/plugin.cfg similarity index 100% rename from addons/bbcode_edit/.plugin.cfg rename to addons/bbcode_edit/plugin.cfg