Skip to content

Commit c2a59a7

Browse files
committed
Move ScriptInstance to godot::extras
1 parent 510eef2 commit c2a59a7

File tree

7 files changed

+26
-15
lines changed

7 files changed

+26
-15
lines changed

godot-core/src/engine/mod.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ use crate::obj::{bounds, Bounds, Gd, GodotClass, InstanceId};
1313
// Re-exports of generated symbols
1414

1515
pub use crate::gen::classes::*;
16-
pub use script_instance::{create_script_instance, ScriptInstance, SiMut};
1716

1817
use crate::builtin::meta::CallContext;
1918
use crate::sys;
2019

2120
mod manual_extensions;
22-
mod script_instance;
23-
pub mod translate;
2421

2522
#[cfg(debug_assertions)]
2623
use crate::builtin::meta::ClassName;
@@ -50,6 +47,20 @@ pub mod utilities {
5047
pub use crate::global::*;
5148
}
5249

50+
#[deprecated = "`godot::engine::translate` has been moved to `godot::extras`."]
51+
pub mod translate {
52+
pub use crate::extras::{tr, tr_n};
53+
}
54+
55+
#[deprecated = "`create_script_instance` has been moved to `godot::extras`."]
56+
pub use crate::extras::create_script_instance;
57+
58+
#[deprecated = "`ScriptInstance` has been moved to `godot::extras`."]
59+
pub use crate::extras::ScriptInstance;
60+
61+
#[deprecated = "`SiMut` has been moved to `godot::extras`."]
62+
pub use crate::extras::SiMut;
63+
5364
#[deprecated = "`GFile` has been moved to `godot::extras`."]
5465
pub use crate::extras::GFile;
5566

godot-core/src/extras/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
mod gfile;
99
mod io_error;
10+
mod script_instance;
11+
mod translate;
1012

1113
pub use gfile::*;
1214
pub use io_error::*;
15+
pub use script_instance::*;
16+
pub use translate::*;

godot-core/src/engine/script_instance.rs renamed to godot-core/src/extras/script_instance.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ use godot_cell::{GdCell, MutGuard};
1515

1616
use crate::builtin::meta::{MethodInfo, PropertyInfo};
1717
use crate::builtin::{GString, StringName, Variant, VariantType};
18+
use crate::engine::{Script, ScriptLanguage};
1819
use crate::obj::{Base, Gd, GodotClass, ScriptBaseMut, ScriptBaseRef};
1920
use crate::sys;
2021

21-
use super::{Script, ScriptLanguage};
22-
2322
/// Implement custom scripts that can be attached to objects in Godot.
2423
///
2524
/// To use script instances, implement this trait for your own type.

godot-core/src/engine/translate.rs renamed to godot-core/src/extras/translate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub use crate::{tr, tr_n};
2222
/// # let a = Vector2i { x: 0, y: 0 };
2323
/// # let b = Vector2i { x: 0, y: 0 };
2424
/// # let context = "context";
25-
/// use godot::engine::translate::tr;
25+
/// use godot::extras::tr;
2626
///
2727
/// // Good.
2828
/// tr!(context; "{a} is a {b}"); // inlined, with context
@@ -65,7 +65,7 @@ macro_rules! tr {
6565
/// # let b = Vector2i { x: 0, y: 0 };
6666
/// # let context = "context";
6767
/// # let n = 2;
68-
/// use godot::engine::translate::tr_n;
68+
/// use godot::extras::tr_n;
6969
///
7070
/// // Good.
7171
/// tr_n!(n, context; "{a} is a {b}", "{a}s are {b}s"); // inlined, with context

godot-core/src/obj/guards.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ use godot_ffi::out;
1111
use std::fmt::Debug;
1212
use std::ops::{Deref, DerefMut};
1313

14-
use crate::engine::ScriptInstance;
15-
16-
use super::{Gd, GodotClass};
14+
use crate::extras::ScriptInstance;
15+
use crate::obj::{Gd, GodotClass};
1716

1817
/// Immutably/shared bound reference guard for a [`Gd`][crate::obj::Gd] smart pointer.
1918
///

itest/rust/src/builtin_tests/script/script_instance_tests.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ use std::ffi::c_void;
99

1010
use godot::builtin::meta::{ClassName, FromGodot, MethodInfo, PropertyInfo, ToGodot};
1111
use godot::builtin::{GString, StringName, Variant, VariantType};
12-
use godot::engine::{
13-
create_script_instance, IScriptExtension, Object, Script, ScriptExtension, ScriptInstance,
14-
ScriptLanguage, SiMut,
15-
};
12+
use godot::engine::{IScriptExtension, Object, Script, ScriptExtension, ScriptLanguage};
13+
use godot::extras::{create_script_instance, ScriptInstance, SiMut};
1614
use godot::global::{MethodFlags, PropertyHint, PropertyUsageFlags};
1715
use godot::obj::{Base, Gd, WithBaseField};
1816
use godot::register::{godot_api, GodotClass};

itest/rust/src/engine_tests/translate_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use crate::framework::itest;
99
use godot::builtin::Vector2;
10-
use godot::engine::translate::{tr, tr_n};
10+
use godot::extras::{tr, tr_n};
1111

1212
#[itest]
1313
fn tr_macro_format() {

0 commit comments

Comments
 (0)