diff --git a/addons/rider-plugin/CONTRIBUTING.md b/addons/rider-plugin/CONTRIBUTING.md new file mode 100644 index 0000000..45f104b --- /dev/null +++ b/addons/rider-plugin/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# Contribution + +Hello, thanks for taking time and helping out with the addon! + +Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. Please sign the CLA before sending the PR: https://www.jetbrains.com/agreements/cla/. + +#### Local setup + +Open the `godot-editor-addon/CMakeLists.txt` in Rider 2026.1+, select `rider-gdextension` target in the run configuration selector. +There are some more fixes coming in 2026.2, which will allow working on gdscript and cpp files within the same workspace. + +#### Signing the binaries + +Plugin binaries need to be signed to comply with modern operating system security requirements. Unsigned dynamic libraries may fail to load or trigger security warnings: + +- **macOS**: Requires code signing (and often notarization) for `.dylib` files. Unsigned libraries may simply fail to load. +- **Windows**: SmartScreen may block unsigned binaries, and corporate environments often enforce signed code only. +- **Linux**: Generally allows unsigned `.so` files, but some sandboxed environments (Flatpak, Snap) impose restrictions. + +**How signing is implemented:** + +1. **TeamCity Configuration**: [ijplatform_master_Net_Deploy_Plugins_Public_Godot](https://buildserver.labs.intellij.net/buildConfiguration/ijplatform_master_Net_Deploy_Plugins_Public_Godot) (internal JetBrains link) + - Note: The automatic trigger on new tags is currently not working, so manual triggering is required. + +2. **Release Process**: + - First, use your GitHub Action to prepare a **pre-release** with a tag + - Manually trigger the TeamCity configuration on the necessary branch/tag + - The configuration will download assets, sign them, and upload them back (removing the pre-release flag) + - The pre-release flag is required at the start; otherwise, the signing configuration will skip the release (protection against double signing) + +3. **Signing existing releases**: + - You can run signing on already existing old releases/tags + - Mark them as pre-release first, then run the configuration on the necessary tag diff --git a/addons/rider-plugin/LICENCE b/addons/rider-plugin/LICENCE new file mode 100644 index 0000000..f1f8c07 --- /dev/null +++ b/addons/rider-plugin/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 JetBrains + +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. \ No newline at end of file diff --git a/addons/rider-plugin/README.md b/addons/rider-plugin/README.md new file mode 100644 index 0000000..51b6fb3 --- /dev/null +++ b/addons/rider-plugin/README.md @@ -0,0 +1,51 @@ +# JetBrains Rider Integration – Godot addon + +This addon currently provides two features: +1. Finds all Rider installations in the system and provides a selector on the `Text Editor` -> `External` tab in the settings to select one. +2. Provides the "Use Rider" toggle in the Godot toolbar and, when enabled, applies a set of editor settings recommended for working with JetBrains Rider. The goal is to make it trivial to switch between Rider‑optimized settings and stock Godot settings with a single click. + +## Quick start + +Requirements: +- Godot 4.5+ + +Install: +1. Inside the Godot editor, it can be installed from the AssetLib view or [downloaded](https://godotengine.org/asset-library/asset/4576) +2. [Optional] Change the initial value of `active` in the plugin.cfg +3. [Optional] Change the initial values in the presets.json file. +4. Enable "JetBrains Rider External Editor" plugin in the Project → Project Settings… → Plugins tab. + +Use: +- A toolbar toggle named "Use Rider" will appear. Click it to turn the preset On/Off. + +Screenshot: +![Toolbar toggle](screenshots/Toolbar.png) + +## What the toggle changes + +The preset values live in `presets.json`. + +When ON: +- Write the values from the "on" preset into the Editor Settings. + +When OFF: +- Write the values from the "off" preset into the Editor Settings. + +Note: The plugin does not currently auto‑set Rider’s executable path or flags. See Plans below. + +## Setting Rider to be the external editor + +The plugin automatically detects installed Rider versions on your system and provides a convenient dropdown menu to +select which installation to use as your external editor. + +- The plugin scans common installation locations for Rider on Windows, macOS, and Linux. +- Detected installations appear in the "Select Rider" dropdown in the toolbar. +- When you select a Rider installation, the plugin automatically updates the `dotnet/editor/external_editor_path` editor + setting. + +## License +See `addons/rider-plugin/LICENCE`. + +## Acknowledgements +Created by JetBrains to streamline using Rider with Godot. +Initial idea https://github.com/sszigeti/toggle_external_editor diff --git a/addons/rider-plugin/bin/linux/librider-gdextension.linux.editor.arm64.so b/addons/rider-plugin/bin/linux/librider-gdextension.linux.editor.arm64.so new file mode 100644 index 0000000..97fa7fd --- /dev/null +++ b/addons/rider-plugin/bin/linux/librider-gdextension.linux.editor.arm64.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75d14f05d65a2102f34fd13d79c7e682518fa913c1b9e9d0ab1c274029c254e4 +size 2135968 diff --git a/addons/rider-plugin/bin/linux/librider-gdextension.linux.editor.x86_64.so b/addons/rider-plugin/bin/linux/librider-gdextension.linux.editor.x86_64.so new file mode 100644 index 0000000..2709ffc --- /dev/null +++ b/addons/rider-plugin/bin/linux/librider-gdextension.linux.editor.x86_64.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ea10931b8cb79ab0417975eef4fafb23a5f1b484c426ac9ab12b20de8bac3ef +size 2127800 diff --git a/addons/rider-plugin/bin/macos/librider-gdextension.macos.editor.dylib b/addons/rider-plugin/bin/macos/librider-gdextension.macos.editor.dylib new file mode 100644 index 0000000..604f726 Binary files /dev/null and b/addons/rider-plugin/bin/macos/librider-gdextension.macos.editor.dylib differ diff --git a/addons/rider-plugin/bin/rider-plugin.gdextension b/addons/rider-plugin/bin/rider-plugin.gdextension new file mode 100644 index 0000000..57755d8 --- /dev/null +++ b/addons/rider-plugin/bin/rider-plugin.gdextension @@ -0,0 +1,16 @@ +[configuration] + +entry_symbol = "rider_library_init" +compatibility_minimum = "4.5.0" + +[libraries] + +macos.single.debug = "./macos/librider-gdextension.macos.editor.dylib" + +windows.arm64.single.debug = "./windows/rider-gdextension.windows.editor.arm64.dll" + +windows.x86_64.single.debug = "./windows/rider-gdextension.windows.editor.x86_64.dll" + +linux.x86_64.single.debug = "./linux/librider-gdextension.linux.editor.x86_64.so" + +linux.arm64.single.debug = "./linux/librider-gdextension.linux.editor.arm64.so" \ No newline at end of file diff --git a/addons/rider-plugin/bin/rider-plugin.gdextension.uid b/addons/rider-plugin/bin/rider-plugin.gdextension.uid new file mode 100644 index 0000000..e69de29 diff --git a/addons/rider-plugin/bin/windows/rider-gdextension.windows.editor.x86_64.dll b/addons/rider-plugin/bin/windows/rider-gdextension.windows.editor.x86_64.dll new file mode 100644 index 0000000..3410d57 --- /dev/null +++ b/addons/rider-plugin/bin/windows/rider-gdextension.windows.editor.x86_64.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0f5e468a49cd74f2e8f6347a8b6dcddb10514f5d5cb55bfa994b9becb6e03d7 +size 1837480 diff --git a/addons/rider-plugin/icons/icon.svg b/addons/rider-plugin/icons/icon.svg new file mode 100644 index 0000000..04cb843 --- /dev/null +++ b/addons/rider-plugin/icons/icon.svg @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/rider-plugin/icons/icon.svg.import b/addons/rider-plugin/icons/icon.svg.import new file mode 100644 index 0000000..05cbbf5 --- /dev/null +++ b/addons/rider-plugin/icons/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://wrdrj6wednn8" +path="res://.godot/imported/icon.svg-45c914cff7482ba9564963fe65b548e4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rider-plugin/icons/icon.svg" +dest_files=["res://.godot/imported/icon.svg-45c914cff7482ba9564963fe65b548e4.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 +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 +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/rider-plugin/plugin.cfg b/addons/rider-plugin/plugin.cfg new file mode 100644 index 0000000..5a4ada1 --- /dev/null +++ b/addons/rider-plugin/plugin.cfg @@ -0,0 +1,12 @@ +[plugin] + +name="JetBrains Rider External Editor" +description="Provides a toolbar toggle, to switch a set of settings on and off. Default set of settings helps to enable/disable the following settings recommended by the Rider documentation https://www.jetbrains.com/help/rider/Godot.html#optimize-godot-editor-for-rider" +author="JetBrains" +version="v1.3.0" +script="rider-plugin.gd" + +[presets] + +active="on" +presets="presets.json" diff --git a/addons/rider-plugin/presets.json b/addons/rider-plugin/presets.json new file mode 100644 index 0000000..5e38bf3 --- /dev/null +++ b/addons/rider-plugin/presets.json @@ -0,0 +1,15 @@ +{ + "on": { + "text_editor/external/use_external_editor": true, + "interface/editor/import_resources_when_unfocused": true, + "interface/editor/save_on_focus_loss": true, + "text_editor/behavior/files/auto_reload_scripts_on_external_change": true, + "run/window_placement/game_embed_mode": -1 + }, + "off": { + "text_editor/external/use_external_editor": false, + "interface/editor/import_resources_when_unfocused": false, + "interface/editor/save_on_focus_loss": false, + "text_editor/behavior/files/auto_reload_scripts_on_external_change": false + } +} diff --git a/addons/rider-plugin/rider-plugin.gd b/addons/rider-plugin/rider-plugin.gd new file mode 100644 index 0000000..f2587dd --- /dev/null +++ b/addons/rider-plugin/rider-plugin.gd @@ -0,0 +1,78 @@ +@tool +extends EditorPlugin + +var editor_settings: EditorSettings +var checkbutton: CheckButton +var _preset_applier: PresetApplier +var _locator_service: RiderLocatorService +var _plugin_cfg_path: String +var _presets_json_path: String + +func _enter_tree() -> void: + editor_settings = EditorInterface.get_editor_settings() + var script_path := (get_script() as Script).resource_path + var plugin_dir := script_path.get_base_dir() + _plugin_cfg_path = plugin_dir + "/plugin.cfg" + + _write_godot_editor_cfg() + + var cfg := ConfigFile.new() + var err := cfg.load(_plugin_cfg_path) + if err != OK: + push_warning("Failed to load plugin.cfg: %s" % [err]) + return + var active_str := str(cfg.get_value("presets", "active", "on")) + var is_active := active_str == "on" + var presets_rel_path := str(cfg.get_value("presets", "presets", "presets.json")) + _presets_json_path = plugin_dir + "/" + presets_rel_path + + # Build UI + checkbutton = CheckButton.new() + checkbutton.text = "Use Rider" + checkbutton.tooltip_text = "Shortcut for setting recommended settings" + checkbutton.button_pressed = is_active + checkbutton.pressed.connect(_on_checkbutton_pressed) + add_control_to_container(EditorPlugin.CONTAINER_TOOLBAR, checkbutton) + + # Initialize services and panel + _locator_service = RiderLocatorService.new() + _preset_applier = PresetApplier.new(_presets_json_path) + + _locator_service.start_search() + + # Ensure settings reflect current state on startup + _preset_applier.apply_preset(editor_settings, is_active) + +func _on_checkbutton_pressed() -> void: + var cfg := ConfigFile.new() + if cfg.load(_plugin_cfg_path) != OK: + push_warning("Failed to load plugin.cfg to update state") + return + var is_active := checkbutton.button_pressed + var key := _preset_applier.get_preset_key(is_active) + cfg.set_value("presets", "active", key) + var save_err := cfg.save(_plugin_cfg_path) + if save_err != OK: + push_warning("Failed to save plugin.cfg: %s" % [save_err]) + # Apply selected preset to editor settings + _preset_applier.apply_preset(editor_settings, is_active) + +func _exit_tree() -> void: + EditorSettingsUtil.erase_rider_external_editor_setting() + if checkbutton != null: + remove_control_from_container(EditorPlugin.CONTAINER_TOOLBAR, checkbutton) + checkbutton.queue_free() + + var args := OS.get_cmdline_args() + if "--rider-addon-tests" in args: + print("==== rider-addon-tests finished ====") + +func _write_godot_editor_cfg() -> void: + var settings_dir := EditorInterface.get_editor_paths().get_project_settings_dir() + var cfg_path := settings_dir.path_join("rider_addon_godot_editor.cfg") + var cfg := ConfigFile.new() + cfg.set_value("editor_metadata", "process_id", OS.get_process_id()) + cfg.set_value("editor_metadata", "executable_path", OS.get_executable_path()) + var err := cfg.save(cfg_path) + if err != OK: + push_warning("Failed to save rider_addon_godot_editor.cfg: %s" % [err]) diff --git a/addons/rider-plugin/rider-plugin.gd.uid b/addons/rider-plugin/rider-plugin.gd.uid new file mode 100644 index 0000000..80edc2b --- /dev/null +++ b/addons/rider-plugin/rider-plugin.gd.uid @@ -0,0 +1 @@ +uid://c1x58xm2w1n20 diff --git a/addons/rider-plugin/screenshots/Toolbar.png b/addons/rider-plugin/screenshots/Toolbar.png new file mode 100644 index 0000000..482b925 --- /dev/null +++ b/addons/rider-plugin/screenshots/Toolbar.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bfac26f06f5ec6f33eaf81cd24e4b8472123f989a27191c006078269b74faf8 +size 47400 diff --git a/addons/rider-plugin/screenshots/Toolbar.png.import b/addons/rider-plugin/screenshots/Toolbar.png.import new file mode 100644 index 0000000..1e48cd4 --- /dev/null +++ b/addons/rider-plugin/screenshots/Toolbar.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://br0dr51k2irct" +path="res://.godot/imported/Toolbar.png-a521e2493bd3c08a829245b3129bb58f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/rider-plugin/screenshots/Toolbar.png" +dest_files=["res://.godot/imported/Toolbar.png-a521e2493bd3c08a829245b3129bb58f.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 +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 +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/addons/rider-plugin/scripts/editor_settings_util.gd b/addons/rider-plugin/scripts/editor_settings_util.gd new file mode 100644 index 0000000..0af18fb --- /dev/null +++ b/addons/rider-plugin/scripts/editor_settings_util.gd @@ -0,0 +1,66 @@ +@tool +class_name EditorSettingsUtil + +# this is rider own setting, not a part of Godot settings +const EXTERNAL_EDITOR_SETTING: String = "text_editor/external/editor" +# this is Godot setting +const EXEC_PATH_SETTING: String = "text_editor/external/exec_path" + + +static func set_external_editor_path(path: String) -> void: + var editor_settings := EditorInterface.get_editor_settings() + editor_settings.set_setting(EXEC_PATH_SETTING, path) + +static func get_external_editor_path() -> String: + var editor_settings := EditorInterface.get_editor_settings() + if editor_settings.has_setting(EXEC_PATH_SETTING): + return editor_settings.get_setting(EXEC_PATH_SETTING) + else: + return "" + +# Returns the current dropdown index, 0 if the setting doesn't exist. +static func get_rider_selector_index() -> int: + var editor_settings := EditorInterface.get_editor_settings() + if not editor_settings.has_setting(EXTERNAL_EDITOR_SETTING): + return 0 + return editor_settings.get_setting(EXTERNAL_EDITOR_SETTING) + +static func erase_rider_external_editor_setting() -> void: + var editor_settings := EditorInterface.get_editor_settings() + if editor_settings.has_setting(EXTERNAL_EDITOR_SETTING): + editor_settings.erase(EXTERNAL_EDITOR_SETTING) + +# Register a single-entry enum so the persisted int doesn't render as a raw +# number while async detection is in progress. register_rider_installations +# replaces this once detection finishes. +static func show_rider_searching_state() -> void: + # Order matters: `set` must come before `add_property_info` — the latter + # errors with `!props.has(pinfo.name)` if the property isn't in `props` yet. + var editor_settings := EditorInterface.get_editor_settings() + editor_settings.set(EXTERNAL_EDITOR_SETTING, 0) + editor_settings.add_property_info({ + "name": EXTERNAL_EDITOR_SETTING, + "type": TYPE_INT, + "hint": PROPERTY_HINT_ENUM, + "hint_string": "Searching — reopen Settings to see the update", + }) + +# Register the dropdown with one entry per detected installation (plus a "-" +# placeholder at index 0) and select the given index. +static func register_rider_installations(installations: Array, selected_index: int) -> void: + var editor_settings := EditorInterface.get_editor_settings() + var entries: Array = ["-"] + for element in installations: + var display_name: String = element.get("display", "") + entries.append(_escape_enum_label(display_name)) + editor_settings.set(EXTERNAL_EDITOR_SETTING, selected_index) + editor_settings.add_property_info({ + "name": EXTERNAL_EDITOR_SETTING, + "type": TYPE_INT, + "hint": PROPERTY_HINT_ENUM, + "hint_string": ",".join(entries), + }) + +# Comma is the enum delimiter, colon introduces explicit value assignment. +static func _escape_enum_label(s: String) -> String: + return s.replace(",", " •").replace(":", " -") \ No newline at end of file diff --git a/addons/rider-plugin/scripts/editor_settings_util.gd.uid b/addons/rider-plugin/scripts/editor_settings_util.gd.uid new file mode 100644 index 0000000..3f50ddc --- /dev/null +++ b/addons/rider-plugin/scripts/editor_settings_util.gd.uid @@ -0,0 +1 @@ +uid://bdiu78ot0rrkc diff --git a/addons/rider-plugin/scripts/json_utils.gd b/addons/rider-plugin/scripts/json_utils.gd new file mode 100644 index 0000000..660086b --- /dev/null +++ b/addons/rider-plugin/scripts/json_utils.gd @@ -0,0 +1,23 @@ +@tool +## Simple JSON helpers for editor/runtime use. +## Keeps file and JSON parsing concerns out of feature code. +class_name JsonUtils + +static func load_from_file(path: String) -> Variant: + # Returns parsed JSON value (Dictionary/Array/etc.) or null on error. + var file := FileAccess.open(path, FileAccess.READ) + if file == null: + push_warning("JsonUtils: Failed to open file: %s" % path) + return null + var text := file.get_as_text() + file.close() + var data: Variant = JSON.parse_string(text) + if data == null: + push_warning("JsonUtils: Invalid JSON in file: %s" % path) + return null + return data + +static func load_dict_from_file(path: String) -> Dictionary: + # Returns Dictionary or empty {} on error. + var data := load_from_file(path) as Dictionary + return data diff --git a/addons/rider-plugin/scripts/json_utils.gd.uid b/addons/rider-plugin/scripts/json_utils.gd.uid new file mode 100644 index 0000000..e780a44 --- /dev/null +++ b/addons/rider-plugin/scripts/json_utils.gd.uid @@ -0,0 +1 @@ +uid://bci4kmk7h4j6a diff --git a/addons/rider-plugin/scripts/locator/rider_locator_service.gd b/addons/rider-plugin/scripts/locator/rider_locator_service.gd new file mode 100644 index 0000000..45c1187 --- /dev/null +++ b/addons/rider-plugin/scripts/locator/rider_locator_service.gd @@ -0,0 +1,68 @@ +@tool +extends RefCounted +class_name RiderLocatorService + +var _installations_found: Array = [] +# we can keep a reference, it will be freed automatically, when the editor is closed +var _rider_locator: RefCounted = null + +# Last value we wrote to / observed for the Rider selector dropdown +var _last_selected_index: int = 0 + +func start_search() -> void: + # use ClassDB to somehow still work without GDExtension part (in older Godot versions) + if not ClassDB.class_exists("RiderLocator"): + return + + EditorSettingsUtil.show_rider_searching_state() + if _rider_locator == null: + _rider_locator = ClassDB.instantiate("RiderLocator") + _rider_locator.connect("installations_loaded", _on_installations_loaded) + _rider_locator.start_search() + +func _on_installations_loaded(array: Array) -> void: + _installations_found = array + _update_selector() + +func _update_selector() -> void: + if _installations_found.is_empty(): + EditorSettingsUtil.erase_rider_external_editor_setting() + return + + var index := _index_for_exec_path(_installations_found) + # Set _last_selected_index BEFORE register_rider_installations so the + # synchronous settings_changed handler sees a match and skips its work. + _last_selected_index = index + EditorSettingsUtil.register_rider_installations(_installations_found, index) + + var settings_changed := EditorInterface.get_editor_settings().settings_changed + if not settings_changed.is_connected(_on_selection_changed): + settings_changed.connect(_on_selection_changed) + +func _index_for_exec_path(installations: Array) -> int: + var current := EditorSettingsUtil.get_external_editor_path() + if current.is_empty(): + return 0 + for i in installations.size(): + if installations[i].get("path", "") == current: + return i + 1 + return 0 + +func _on_selection_changed() -> void: + var selected_index := EditorSettingsUtil.get_rider_selector_index() + + # settings_changed fires for every editor setting, this helps to avoid updating on every other changes + if selected_index == _last_selected_index: + return + _last_selected_index = selected_index + + # Index 0 is the placeholder, so the path is left untouched. + if selected_index == 0: + return + + var installation_index := selected_index - 1 + if installation_index >= 0 and installation_index < _installations_found.size(): + var installation = _installations_found[installation_index] + var new_path: String = installation.get("path", "") + if not new_path.is_empty(): + EditorSettingsUtil.set_external_editor_path(new_path) diff --git a/addons/rider-plugin/scripts/locator/rider_locator_service.gd.uid b/addons/rider-plugin/scripts/locator/rider_locator_service.gd.uid new file mode 100644 index 0000000..f7fcdaf --- /dev/null +++ b/addons/rider-plugin/scripts/locator/rider_locator_service.gd.uid @@ -0,0 +1 @@ +uid://cfsu1rbg0ypem diff --git a/addons/rider-plugin/scripts/presets/preset_applier.gd b/addons/rider-plugin/scripts/presets/preset_applier.gd new file mode 100644 index 0000000..b09d025 --- /dev/null +++ b/addons/rider-plugin/scripts/presets/preset_applier.gd @@ -0,0 +1,35 @@ +@tool +extends RefCounted +class_name PresetApplier + +var presets_path: String + +func _init(p_path: String) -> void: + presets_path = p_path + +func get_preset_key(is_active: bool) -> String: + return "on" if is_active else "off" + +func apply_preset(editor_settings: EditorSettings, is_active: bool) -> void: + var data: Dictionary = JsonUtils.load_dict_from_file(presets_path) + if data.is_empty(): + push_warning("Failed to load presets: %s" % presets_path) + return + + var new_preset_key := get_preset_key(is_active) + var previous_preset_key := get_preset_key(not is_active) + + if not data.has(new_preset_key): + push_warning("Preset '%s' not found in presets.json" % new_preset_key) + return + + var new_preset := data[new_preset_key] as Dictionary + # Reset keys from previous preset that are missing in the new preset + if data.has(previous_preset_key): + var previous_preset := data[previous_preset_key] as Dictionary + for key in previous_preset: + if not new_preset.has(key): + editor_settings.set_setting(str(key), editor_settings.property_get_revert(str(key))) + # Apply the new preset + for key in new_preset: + editor_settings.set_setting(str(key), new_preset[key]) diff --git a/addons/rider-plugin/scripts/presets/preset_applier.gd.uid b/addons/rider-plugin/scripts/presets/preset_applier.gd.uid new file mode 100644 index 0000000..af4fdde --- /dev/null +++ b/addons/rider-plugin/scripts/presets/preset_applier.gd.uid @@ -0,0 +1 @@ +uid://bjiaycxso8h8u diff --git a/project.godot b/project.godot index 195630f..488f5c4 100644 --- a/project.godot +++ b/project.godot @@ -34,7 +34,7 @@ project/assembly_name="Dancer" [editor_plugins] -enabled=PackedStringArray("res://addons/AsepriteWizard/plugin.cfg", "res://addons/BehaviorDebug/plugin.cfg", "res://addons/TileMapDual/plugin.cfg") +enabled=PackedStringArray("res://addons/AsepriteWizard/plugin.cfg", "res://addons/BehaviorDebug/plugin.cfg", "res://addons/TileMapDual/plugin.cfg", "res://addons/rider-plugin/plugin.cfg") [input] diff --git a/src/player/Player.cs b/src/player/Player.cs index 605aff5..28777af 100644 --- a/src/player/Player.cs +++ b/src/player/Player.cs @@ -125,7 +125,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, // Water movement if (_isInWater) { - velocity += _currentDirection * WaterAccel * deltaF; + velocity += _currentDirection.Normalized() * WaterAccel * deltaF; } // Walking on the floor else if (IsOnFloor()) @@ -147,7 +147,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, // Air control else { - velocity.X += _currentDirection.X * AirAccel * deltaF; + velocity.X += Mathf.Sign(_currentDirection.X) * AirAccel * deltaF; } // Move up while holding jump @@ -190,6 +190,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, { CollisionMask = 0b0100_0001; } + MoveAndSlide(); JumpAllowedTime = Mathf.Max(0, JumpAllowedTime - deltaF); @@ -334,15 +335,26 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, _playback.Travel("front_kick"); } + private bool IsAtWaterSurface() + { + throw new NotImplementedException(); + } + + private void WaterExitJump() + { + throw new NotImplementedException(); + } + private bool IsInputVecDown(Vector2 vec) { return Mathf.Abs(vec.AngleTo(Vector2.Down)) < DownInputAngle && vec.Length() > 0.01f; } + private bool IsInputVecSide(Vector2 vec) { return vec.Length() > 0.01f - && (Mathf.Abs(vec.AngleTo(Vector2.Left)) < SideInputAngle - || Mathf.Abs(vec.AngleTo(Vector2.Right)) < SideInputAngle) ; + && (Mathf.Abs(vec.AngleTo(Vector2.Left)) < SideInputAngle + || Mathf.Abs(vec.AngleTo(Vector2.Right)) < SideInputAngle); } private void OnEnemyHit(Hitbox hitbox, Node2D enemy) @@ -402,6 +414,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, throw new NotImplementedException(); } } + [Meta] public sealed partial record Airborne : Root, IGet { @@ -410,6 +423,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner, throw new NotImplementedException(); } } + [Meta] public sealed partial record Diving : Root, IGet {