Skip to content

Commit 396b0fc

Browse files
authored
Godot 4.3 no longer has the internal editor toast API (#62)
In Godot 4.2 and earlier, there was an internal undocumented editor toast API that allowed to show a toast message to the user. Such a message was used to indicate that editing rust scripts from inside the Godot editor is not available. Unfortunately, this API was removed in Godot 4.3, but then was turned in a proper public API with Godot 4.4. For now, the toast message has been replaced with an error log message. Once gdext support for the Godot 4.4 API is released, we will show a toast from 4.4 onwards.
1 parent 46b151f commit 396b0fc

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

rust-script/src/editor_ui_hacks.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impl ToGodot for EditorToasterSeverity {
3636
}
3737
}
3838

39+
#[expect(dead_code)]
3940
pub fn show_editor_toast(message: &str, severity: EditorToasterSeverity) {
4041
if !Engine::singleton().is_editor_hint() {
4142
return;

rust-script/src/runtime/rust_script_language.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use godot::classes::native::ScriptLanguageExtensionProfilingInfo;
1010
#[cfg(since_api = "4.3")]
1111
use godot::classes::script_language::ScriptNameCasing;
1212
use godot::classes::{Engine, FileAccess, IScriptLanguageExtension, ProjectSettings, Script};
13-
use godot::global;
13+
use godot::global::{self, godot_error};
1414
use godot::obj::Base;
1515
use godot::prelude::{
1616
godot_api, Array, Dictionary, GString, Gd, GodotClass, Object, PackedStringArray, StringName,
@@ -19,7 +19,6 @@ use godot::prelude::{
1919
use itertools::Itertools;
2020

2121
use crate::apply::Apply;
22-
use crate::editor_ui_hacks::{show_editor_toast, EditorToasterSeverity};
2322
use crate::static_script_registry::RustScriptMetaData;
2423

2524
use super::{rust_script::RustScript, SCRIPT_REGISTRY};
@@ -204,10 +203,8 @@ impl IScriptLanguageExtension for RustScriptLanguage {
204203
_line: i32,
205204
_col: i32,
206205
) -> global::Error {
207-
show_editor_toast(
208-
"Editing rust scripts from inside Godot is currently not supported.",
209-
EditorToasterSeverity::Warning,
210-
);
206+
// TODO: From Godot 4.4 we can show an editor toast here. Just waiting for a new gdext release.
207+
godot_error!("Editing rust scripts from inside Godot is currently not supported.");
211208

212209
global::Error::OK
213210
}

0 commit comments

Comments
 (0)