Skip to content

Remove deprecated symbols for v0.3 #1160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion godot-codegen/src/models/domain_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ impl UtilityFunction {
if special_cases::is_utility_function_deleted(function, ctx) {
return None;
}
let is_private = special_cases::is_utility_function_private(function);

// Some vararg functions like print() or str() are declared with a single argument "arg1: Variant", but that seems
// to be a mistake. We change their parameter list by removing that.
Expand All @@ -571,7 +572,7 @@ impl UtilityFunction {
parameters,
return_value: FnReturn::new(&return_value, ctx),
is_vararg: function.is_vararg,
is_private: false,
is_private,
is_virtual_required: false,
direction: FnDirection::Outbound {
hash: function.hash,
Expand Down
18 changes: 15 additions & 3 deletions godot-codegen/src/special_cases/special_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,25 @@ pub fn is_builtin_type_scalar(name: &str) -> bool {

#[rustfmt::skip]
pub fn is_utility_function_deleted(function: &JsonUtilityFunction, ctx: &mut Context) -> bool {
/*let hardcoded = match function.name.as_str() {
| "..."
let hardcoded = match function.name.as_str() {
// Removed in v0.3, but available as dedicated APIs.
| "instance_from_id"

=> true, _ => false
};

hardcoded ||*/ codegen_special_cases::is_utility_function_excluded(function, ctx)
hardcoded || codegen_special_cases::is_utility_function_excluded(function, ctx)
}

#[rustfmt::skip]
pub fn is_utility_function_private(function: &JsonUtilityFunction) -> bool {
match function.name.as_str() {
// Removed from public interface in v0.3, but available as dedicated APIs.
| "is_instance_valid" // used in Variant::is_object_alive().
| "is_instance_id_valid" // used in InstanceId::lookup_validity().

=> true, _ => false
}
}

pub fn maybe_rename_class_method<'m>(class_name: &TyName, godot_method_name: &'m str) -> &'m str {
Expand Down
18 changes: 0 additions & 18 deletions godot-core/src/builtin/aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,12 @@ impl Aabb {
&& point.z < self.size.z
}

#[inline]
#[deprecated = "Renamed to `contains_point()`, for consistency with `Rect2i`"]
pub fn has_point(self, point: Vector3) -> bool {
self.contains_point(point)
}

/// Returns if this bounding box has a surface or a length, i.e. at least one component of [`Self::size`] is greater than 0.
#[inline]
pub fn has_surface(self) -> bool {
(self.size.x > 0.0) || (self.size.y > 0.0) || (self.size.z > 0.0)
}

/// Returns true if at least one of the size's components (X, Y, Z) is greater than 0.
#[inline]
#[deprecated = "Replaced with `has_surface()`, which has different semantics"]
pub fn has_area(self) -> bool {
((self.size.x > 0.0) as u8 + (self.size.y > 0.0) as u8 + (self.size.z > 0.0) as u8) >= 2
}

/// Returns true if the AABB has a volume, and false if the AABB is flat, linear, empty, or has a negative size.
#[inline]
pub fn has_volume(self) -> bool {
Expand Down Expand Up @@ -194,11 +181,6 @@ impl Aabb {
Some(rect)
}

#[deprecated = "Renamed to `intersect()`"]
pub fn intersection(self, b: Aabb) -> Option<Self> {
self.intersect(b)
}

/// Returns `true` if this AABB is finite, by calling `@GlobalScope.is_finite` on each component.
#[inline]
pub fn is_finite(self) -> bool {
Expand Down
25 changes: 0 additions & 25 deletions godot-core/src/builtin/basis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ impl Basis {
RMat3::from_quat(quat.to_glam()).to_front()
}

#[deprecated = "Renamed to `from_quaternion()`"]
pub fn from_quat(quat: Quaternion) -> Self {
Self::from_quaternion(quat)
}

/// Create a `Basis` from three angles `a`, `b`, and `c` interpreted
/// as Euler angles according to the given `EulerOrder`.
///
Expand Down Expand Up @@ -171,11 +166,6 @@ impl Basis {
super::inner::InnerBasis::looking_at(target, up, use_model_front)
}

#[deprecated = "Renamed to `looking_at()`"]
pub fn new_looking_at(target: Vector3, up: Vector3, use_model_front: bool) -> Self {
Self::looking_at(target, up, use_model_front)
}

/// Creates a `[Vector3; 3]` with the columns of the `Basis`.
pub fn to_cols(&self) -> [Vector3; 3] {
self.transposed().rows
Expand Down Expand Up @@ -206,11 +196,6 @@ impl Basis {
RQuat::from_mat3(&self.orthonormalized().to_glam()).to_front()
}

#[deprecated = "Renamed to `get_quaternion()`"]
pub fn to_quat(&self) -> Quaternion {
self.get_quaternion()
}

/// Returns the scale of the matrix.
///
/// _Godot equivalent: `Basis.get_scale()`_
Expand All @@ -226,11 +211,6 @@ impl Basis {
) * det_sign
}

#[deprecated = "Renamed to `get_scale()`"]
pub fn scale(&self) -> Vector3 {
self.get_scale()
}

/// Returns the rotation of the matrix in euler angles, with the order `YXZ`.
///
/// See [`get_euler_with()`](Self::get_euler_with) for custom angle orders.
Expand Down Expand Up @@ -303,11 +283,6 @@ impl Basis {
.to_front()
}

#[deprecated = "Renamed to `get_euler()` + `get_euler_with()`"]
pub fn to_euler(&self, order: EulerOrder) -> Vector3 {
self.get_euler_with(order)
}

fn is_between_neg1_1(f: real) -> Ordering {
if f >= (1.0 - real::CMP_EPSILON) {
Ordering::Greater
Expand Down
15 changes: 0 additions & 15 deletions godot-core/src/builtin/callable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,6 @@ impl Callable {
})
}

#[deprecated = "Now split into from_local_fn (single-threaded) and from_sync_fn (multi-threaded)."]
#[cfg(since_api = "4.2")]
pub fn from_fn<F, S>(name: S, rust_function: F) -> Self
where
F: 'static + Send + Sync + FnMut(&[&Variant]) -> Result<Variant, ()>,
S: Into<GString>,
{
// Do not call from_sync_fn() since that is feature-gated, but this isn't due to compatibility.
Self::from_fn_wrapper(FnWrapper {
rust_function,
name: name.into(),
thread_id: None,
})
}

/// Create a highly configurable callable from Rust.
///
/// See [`RustCallable`] for requirements on the type.
Expand Down
10 changes: 0 additions & 10 deletions godot-core/src/builtin/quaternion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ impl Quaternion {
}
}

#[deprecated = "Renamed to `Quaternion::exp()`"]
pub fn to_exp(self) -> Self {
self.exp()
}

pub fn from_euler(euler: Vector3) -> Self {
let half_a1 = euler.y * 0.5;
let half_a2 = euler.x * 0.5;
Expand Down Expand Up @@ -163,11 +158,6 @@ impl Quaternion {
Basis::from_quaternion(self).get_euler_with(order)
}

#[deprecated = "Renamed to `get_euler()` + `get_euler_with()`"]
pub fn to_euler(self, order: EulerOrder) -> Vector3 {
self.get_euler_with(order)
}

pub fn inverse(self) -> Self {
Self::new(-self.x, -self.y, -self.z, self.w)
}
Expand Down
17 changes: 0 additions & 17 deletions godot-core/src/builtin/rect2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ impl Rect2 {
}
}

#[deprecated = "Moved to `Rect2i::cast_float()`"]
#[inline]
pub const fn from_rect2i(rect: Rect2i) -> Self {
rect.cast_float()
}

/// Create a new `Rect2i` from a `Rect2`, using `as` for `real` to `i32` conversions.
///
/// _Godot equivalent: `Rect2i(Rect2 from)`_
Expand Down Expand Up @@ -190,12 +184,6 @@ impl Rect2 {
point.abs() == point && point.x < self.size.x && point.y < self.size.y
}

#[inline]
#[deprecated = "Renamed to `contains_point()`, for consistency with `Rect2i`"]
pub fn has_point(self, point: Vector2) -> bool {
self.contains_point(point)
}

/// Returns the intersection of this Rect2 and `b`. If the rectangles do not intersect, an empty Rect2 is returned.
#[inline]
pub fn intersect(self, b: Self) -> Option<Self> {
Expand All @@ -213,11 +201,6 @@ impl Rect2 {
Some(rect)
}

#[deprecated = "Renamed to `intersect()`"]
pub fn intersection(self, b: Rect2) -> Option<Self> {
self.intersect(b)
}

/// Checks whether two rectangles have at least one point in common.
///
/// Also returns `true` if the rects only touch each other (share a point/edge).
Expand Down
11 changes: 0 additions & 11 deletions godot-core/src/builtin/rect2i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ impl Rect2i {
}
}

#[deprecated = "Moved to `Rect2::cast_int()`"]
#[inline]
pub const fn from_rect2(rect: Rect2) -> Self {
rect.cast_int()
}

/// Create a new `Rect2` from a `Rect2i`, using `as` for `i32` to `real` conversions.
///
/// _Godot equivalent: `Rect2(Rect2i from)`_
Expand Down Expand Up @@ -243,11 +237,6 @@ impl Rect2i {
Some(Self::from_corners(new_pos, new_end))
}

#[deprecated = "Renamed to `intersect()`"]
pub fn intersection(self, b: Self) -> Option<Self> {
self.intersect(b)
}

/// Returns `true` if the `Rect2i` overlaps with `b` (i.e. they have at least one
/// point in common)
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion godot-core/src/builtin/variant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl Variant {
pub(crate) fn is_object_alive(&self) -> bool {
debug_assert_eq!(self.get_type(), VariantType::OBJECT);

crate::gen::utilities::is_instance_valid(self)
crate::global::is_instance_valid(self)

// In case there are ever problems with this approach, alternative implementation:
// self.stringify() != "<Freed Object>".into()
Expand Down
6 changes: 0 additions & 6 deletions godot-core/src/builtin/vectors/vector2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ impl_vector_fns!(Vector2, RVec2, real, (x, y));

/// # Specialized `Vector2` functions
impl Vector2 {
#[deprecated = "Moved to `Vector2i::cast_float()`"]
#[inline]
pub const fn from_vector2i(v: Vector2i) -> Self {
v.cast_float()
}

/// Creates a unit Vector2 rotated to the given `angle` in radians. This is equivalent to doing `Vector2::new(angle.cos(), angle.sin())`
/// or `Vector2::RIGHT.rotated(angle)`.
///
Expand Down
6 changes: 0 additions & 6 deletions godot-core/src/builtin/vectors/vector2i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ impl Vector2i {
impl Vector2i {
inline_impl_integer_vector_fns!(Vector2, x, y);

#[deprecated = "Moved to `Vector2::cast_int()`"]
#[inline]
pub const fn from_vector2(v: Vector2) -> Self {
v.cast_int()
}

/// Converts `self` to the corresponding [`real`] `glam` type.
#[doc(hidden)]
#[inline]
Expand Down
6 changes: 0 additions & 6 deletions godot-core/src/builtin/vectors/vector3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ impl_vector_fns!(Vector3, RVec3, real, (x, y, z));

/// # Specialized `Vector3` functions
impl Vector3 {
#[deprecated = "Moved to `Vector3i::cast_float()`"]
#[inline]
pub const fn from_vector3i(v: Vector3i) -> Self {
v.cast_float()
}

#[doc(hidden)]
#[inline]
pub fn as_inner(&self) -> inner::InnerVector3 {
Expand Down
6 changes: 0 additions & 6 deletions godot-core/src/builtin/vectors/vector3i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ impl_vector_fns!(Vector3i, glam::IVec3, i32, (x, y, z));

/// # Specialized `Vector3i` functions
impl Vector3i {
#[deprecated = "Moved to `Vector3::cast_int()`"]
#[inline]
pub const fn from_vector3(v: Vector3) -> Self {
v.cast_int()
}

inline_impl_integer_vector_fns!(Vector3, x, y, z);

/// Converts `self` to the corresponding [`real`] `glam` type.
Expand Down
5 changes: 0 additions & 5 deletions godot-core/src/builtin/vectors/vector4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ impl_vector_fns!(Vector4, RVec4, real, (x, y, z, w));

/// # Specialized `Vector4` functions
impl Vector4 {
#[deprecated = "Moved to `Vector4i::cast_float()`"]
pub const fn from_vector4i(v: Vector4i) -> Self {
v.cast_float()
}

#[doc(hidden)]
#[inline]
pub fn as_inner(&self) -> inner::InnerVector4 {
Expand Down
6 changes: 0 additions & 6 deletions godot-core/src/builtin/vectors/vector4i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ impl_vector_fns!(Vector4i, glam::IVec4, i32, (x, y, z, w));
impl Vector4i {
inline_impl_integer_vector_fns!(Vector4, x, y, z, w);

#[deprecated = "Moved to `Vector4::cast_int()`"]
#[inline]
pub const fn from_vector4(v: Vector4) -> Self {
v.cast_int()
}

/// Converts `self` to the corresponding [`real`] `glam` type.
#[doc(hidden)]
#[inline]
Expand Down
19 changes: 1 addition & 18 deletions godot-core/src/deprecated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,7 @@ macro_rules! emit_deprecated_warning {
pub use crate::emit_deprecated_warning;

// ----------------------------------------------------------------------------------------------------------------------------------------------
// Library-side deprecations

#[deprecated = "\nThe attribute key #[init(val = ...)] replaces #[init(default = ...)].\n\
More information on https://github.com/godot-rust/gdext/pull/844"]
pub const fn init_default() {}

#[deprecated = "\nThe attribute key #[class(editor_plugin)] is now implied by #[class(base = EditorPlugin)]. It is ignored.\n\
More information on https://github.com/godot-rust/gdext/pull/884"]
pub const fn class_editor_plugin() {}

#[deprecated = "\nThe attribute key #[class(hidden)] has been renamed to #[class(internal)], following Godot terminology.\n\
More information on https://github.com/godot-rust/gdext/pull/884"]
pub const fn class_hidden() {}

#[deprecated = "\nThe attribute key #[gdextension(entry_point)] has been renamed to #[gdextension(entry_symbol)], for consistency \
with the configuration key in the .gdextension file.\n\
More information on https://github.com/godot-rust/gdext/pull/959"]
pub const fn gdextension_entry_point() {}
// Library-side deprecations -- see usage description above.

// ----------------------------------------------------------------------------------------------------------------------------------------------
// Godot-side deprecations
Expand Down
Loading
Loading