diff --git a/godot-core/src/builtin/array.rs b/godot-core/src/builtin/array.rs index da4225a8e..e51d58171 100644 --- a/godot-core/src/builtin/array.rs +++ b/godot-core/src/builtin/array.rs @@ -834,7 +834,11 @@ impl TypeStringHint for Array { impl TypeStringHint for VariantArray { fn type_string() -> String { - format!("{}:Array", VariantType::Array as i32) + if sys::GdextBuild::since_api("4.3") { + format!("{}:", VariantType::Array as i32) + } else { + format!("{}:Array", VariantType::Array as i32) + } } } diff --git a/godot-core/src/builtin/dictionary.rs b/godot-core/src/builtin/dictionary.rs index a5f79f41b..2bc72a11f 100644 --- a/godot-core/src/builtin/dictionary.rs +++ b/godot-core/src/builtin/dictionary.rs @@ -330,7 +330,11 @@ impl Var for Dictionary { impl TypeStringHint for Dictionary { fn type_string() -> String { - format!("{}:Dictionary", sys::VariantType::Dictionary as i32) + if sys::GdextBuild::since_api("4.3") { + format!("{}:", sys::VariantType::Dictionary as i32) + } else { + format!("{}:Dictionary", sys::VariantType::Dictionary as i32) + } } } diff --git a/godot-core/src/property.rs b/godot-core/src/property.rs index 81a34f63c..e467c0235 100644 --- a/godot-core/src/property.rs +++ b/godot-core/src/property.rs @@ -7,6 +7,8 @@ //! Registration support for property types. +use godot_ffi as sys; + use crate::builtin::meta::{FromGodot, GodotConvert, ToGodot}; use crate::builtin::GString; use crate::engine::global::PropertyHint; @@ -117,14 +119,20 @@ pub struct PropertyHintInfo { } impl PropertyHintInfo { - /// Create a new `PropertyHintInfo` with a property hint of - /// [`PROPERTY_HINT_NONE`](PropertyHint::NONE). + /// Create a new `PropertyHintInfo` with a property hint of [`PROPERTY_HINT_NONE`](PropertyHint::NONE). /// - /// Usually Godot expects this to be combined with a `hint_string` containing the name of the type. + /// Starting with Godot version 4.3, the hint string will always be the empty string. Before that, the hint string is set to + /// be `type_name`. pub fn with_hint_none>(type_name: S) -> Self { + let hint_string = if sys::GdextBuild::since_api("4.3") { + "".into() + } else { + type_name.into() + }; + Self { hint: PropertyHint::NONE, - hint_string: type_name.into(), + hint_string, } } } @@ -367,8 +375,13 @@ mod export_impls { fn type_string() -> String { use sys::GodotFfi as _; let variant_type = <$Ty as $crate::builtin::meta::GodotType>::Ffi::variant_type(); - let type_name = <$Ty as $crate::builtin::meta::GodotType>::godot_type_name(); - format!("{}:{}", variant_type as i32, type_name) + + if sys::GdextBuild::since_api("4.3") { + format!("{}:", variant_type as i32) + } else { + let type_name = <$Ty as $crate::builtin::meta::GodotType>::godot_type_name(); + format!("{}:{}", variant_type as i32, type_name) + } } } }