Skip to content

Commit 4239865

Browse files
authored
Upgrade to gdext 0.3 #72 (#73)
Upgrades the gdext dependency to 0.3. This is a breaking change, rust script is now no longer compatible with gdext 0.2
1 parent 22d7e12 commit 4239865

File tree

12 files changed

+59
-86
lines changed

12 files changed

+59
-86
lines changed

Cargo.lock

Lines changed: 34 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ version = "0.1.0"
1010
edition = "2021"
1111

1212
[workspace.dependencies]
13-
godot = { version = "0.2", features = ["experimental-threads"] }
14-
godot-cell = "0.2"
15-
godot-bindings = "0.2"
13+
godot = { version = "0.3", features = ["experimental-threads"] }
14+
godot-cell = "0.3"
15+
godot-bindings = "0.3"
1616
itertools = "0.10"
1717
rand = "0.8"
1818
darling = { version = "0.20" }

derive/src/impl_attribute.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ pub fn godot_script_impl(
6060
let arg_rust_type = arg.ty.as_ref();
6161
let arg_type = rust_to_variant_type(arg.ty.as_ref()).unwrap();
6262

63-
is_context_type(arg.ty.as_ref()).then(|| {
63+
if is_context_type(arg.ty.as_ref()) {
6464
(
6565
quote!(),
6666

6767
quote_spanned!(arg.span() => ctx,)
6868
)
69-
}).unwrap_or_else(|| {
69+
} else {
7070
(
7171
quote_spanned! {
7272
arg.span() =>
@@ -91,7 +91,7 @@ pub fn godot_script_impl(
9191
})?,
9292
}
9393
)
94-
})
94+
}
9595
})
9696
.collect();
9797

derive/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn rust_to_variant_type(ty: &syn::Type) -> Result<TokenStream, TokenStream> {
184184
use #godot_types::sys::GodotFfi;
185185
use #godot_types::meta::GodotType;
186186

187-
<<#path as #godot_types::meta::GodotConvert>::Via as GodotType>::Ffi::variant_type()
187+
<<#path as #godot_types::meta::GodotConvert>::Via as GodotType>::Ffi::VARIANT_TYPE
188188
}
189189
}),
190190
T::Verbatim(_) => Err(syn::Error::new(
@@ -206,7 +206,7 @@ fn rust_to_variant_type(ty: &syn::Type) -> Result<TokenStream, TokenStream> {
206206
use #godot_types::sys::GodotFfi;
207207
use #godot_types::meta::GodotType;
208208

209-
<<#tuple as #godot_types::meta::GodotConvert>::Via as GodotType>::Ffi::variant_type()
209+
<<#tuple as #godot_types::meta::GodotConvert>::Via as GodotType>::Ffi::VARIANT_TYPE
210210
}
211211
})
212212
}

rust-script/src/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ macro_rules! define_script_root {
204204
use $crate::godot::obj::EngineEnum;
205205
use $crate::private_export::*;
206206

207-
let lock = $crate::private_export::__godot_rust_plugin_SCRIPT_REGISTRY
207+
let lock = $crate::private_export::SCRIPT_REGISTRY
208208
.lock()
209209
.expect("unable to aquire mutex lock");
210210

rust-script/src/interface/export.rs

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

9696
impl<T: ArrayElement + GodotScriptExport + GodotType> GodotScriptExport for Array<T> {
9797
fn hint_string(custom_hint: Option<PropertyHint>, custom_string: Option<String>) -> String {
98-
let element_type = <<T as GodotType>::Ffi as GodotFfi>::variant_type().ord();
98+
let element_type = <<T as GodotType>::Ffi as GodotFfi>::VARIANT_TYPE.ord();
9999
let element_hint = <T as GodotScriptExport>::hint(custom_hint).ord();
100100
let element_hint_string = <T as GodotScriptExport>::hint_string(custom_hint, custom_string);
101101

rust-script/src/interface/signals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ macro_rules! signal_argument_desc {
123123
($name:literal, $type:ty) => {
124124
RustScriptPropDesc {
125125
name: $name,
126-
ty: <<<$type as GodotConvert>::Via as GodotType>::Ffi as godot::sys::GodotFfi>::variant_type(),
126+
ty: <<<$type as GodotConvert>::Via as GodotType>::Ffi as godot::sys::GodotFfi>::VARIANT_TYPE,
127127
class_name: <<$type as GodotConvert>::Via as GodotType>::class_name(),
128128
exported: false,
129129
hint: PropertyHint::NONE,

rust-script/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ pub use runtime::RustScriptExtensionLayer;
1818
#[doc(hidden)]
1919
pub mod private_export {
2020
pub use crate::static_script_registry::{
21-
RustScriptMetaData, __godot_rust_plugin_SCRIPT_REGISTRY, assemble_metadata,
22-
create_default_data_struct, RegistryItem, RustScriptEntry, RustScriptEntryMethods,
23-
RustScriptMethodDesc, RustScriptPropDesc, RustScriptSignalDesc,
21+
assemble_metadata, create_default_data_struct, RegistryItem, RustScriptEntry,
22+
RustScriptEntryMethods, RustScriptMetaData, RustScriptMethodDesc, RustScriptPropDesc,
23+
RustScriptSignalDesc, SCRIPT_REGISTRY,
2424
};
2525
pub use const_str::{concat, replace, strip_prefix, unwrap};
2626
pub use godot::sys::{plugin_add, plugin_registry};

rust-script/src/runtime/rust_script.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use godot::classes::{
1313
use godot::global::{godot_error, godot_print, godot_warn, PropertyUsageFlags};
1414
use godot::meta::{MethodInfo, PropertyInfo, ToGodot};
1515
use godot::obj::script::create_script_instance;
16-
use godot::obj::{EngineBitfield, EngineEnum, InstanceId, WithBaseField};
16+
use godot::obj::{EngineBitfield, InstanceId, WithBaseField};
1717
use godot::prelude::{
1818
godot_api, Array, Base, Callable, Dictionary, GString, Gd, GodotClass, StringName, Variant,
1919
VariantArray,
@@ -183,7 +183,7 @@ impl IScriptExtension for RustScript {
183183
false
184184
}
185185

186-
unsafe fn instance_create(&self, mut for_object: Gd<Object>) -> *mut c_void {
186+
unsafe fn instance_create_rawptr(&self, mut for_object: Gd<Object>) -> *mut c_void {
187187
self.owners.borrow_mut().insert(for_object.instance_id());
188188

189189
let data = self.create_remote_instance(for_object.clone());
@@ -203,7 +203,7 @@ impl IScriptExtension for RustScript {
203203
create_script_instance(instance, for_object)
204204
}
205205

206-
unsafe fn placeholder_instance_create(&self, for_object: Gd<Object>) -> *mut c_void {
206+
unsafe fn placeholder_instance_create_rawptr(&self, for_object: Gd<Object>) -> *mut c_void {
207207
self.owners.borrow_mut().insert(for_object.instance_id());
208208

209209
let placeholder = RustScriptPlaceholder::new(self.to_gd());

rust-script/src/runtime/rust_script_language.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl IScriptLanguageExtension for RustScriptLanguage {
357357
}
358358

359359
#[expect(unused_variables)]
360-
unsafe fn debug_get_stack_level_instance(&mut self, level: i32) -> *mut c_void {
360+
unsafe fn debug_get_stack_level_instance_rawptr(&mut self, level: i32) -> *mut c_void {
361361
unimplemented!("debugging is not implemented!");
362362
}
363363

@@ -391,7 +391,7 @@ impl IScriptLanguageExtension for RustScriptLanguage {
391391
fn profiling_set_save_native_calls(&mut self, enable: bool) {}
392392

393393
#[expect(unused_variables)]
394-
unsafe fn profiling_get_accumulated_data(
394+
unsafe fn profiling_get_accumulated_data_rawptr(
395395
&mut self,
396396
info_array: *mut ScriptLanguageExtensionProfilingInfo,
397397
info_max: i32,
@@ -400,7 +400,7 @@ impl IScriptLanguageExtension for RustScriptLanguage {
400400
}
401401

402402
#[expect(unused_variables)]
403-
unsafe fn profiling_get_frame_data(
403+
unsafe fn profiling_get_frame_data_rawptr(
404404
&mut self,
405405
info_array: *mut ScriptLanguageExtensionProfilingInfo,
406406
info_max: i32,

0 commit comments

Comments
 (0)