Skip to content

Commit 9f60c2e

Browse files
authored
Merge pull request #1160 from godot-rust/qol/remove-deprecated-v0.3
Remove deprecated symbols for v0.3
2 parents 48b634a + 7e92288 commit 9f60c2e

File tree

23 files changed

+90
-282
lines changed

23 files changed

+90
-282
lines changed

godot-codegen/src/models/domain_mapping.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ impl UtilityFunction {
546546
if special_cases::is_utility_function_deleted(function, ctx) {
547547
return None;
548548
}
549+
let is_private = special_cases::is_utility_function_private(function);
549550

550551
// Some vararg functions like print() or str() are declared with a single argument "arg1: Variant", but that seems
551552
// to be a mistake. We change their parameter list by removing that.
@@ -571,7 +572,7 @@ impl UtilityFunction {
571572
parameters,
572573
return_value: FnReturn::new(&return_value, ctx),
573574
is_vararg: function.is_vararg,
574-
is_private: false,
575+
is_private,
575576
is_virtual_required: false,
576577
direction: FnDirection::Outbound {
577578
hash: function.hash,

godot-codegen/src/special_cases/special_cases.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,25 @@ pub fn is_builtin_type_scalar(name: &str) -> bool {
549549

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

555556
=> true, _ => false
556557
};
557558

558-
hardcoded ||*/ codegen_special_cases::is_utility_function_excluded(function, ctx)
559+
hardcoded || codegen_special_cases::is_utility_function_excluded(function, ctx)
560+
}
561+
562+
#[rustfmt::skip]
563+
pub fn is_utility_function_private(function: &JsonUtilityFunction) -> bool {
564+
match function.name.as_str() {
565+
// Removed from public interface in v0.3, but available as dedicated APIs.
566+
| "is_instance_valid" // used in Variant::is_object_alive().
567+
| "is_instance_id_valid" // used in InstanceId::lookup_validity().
568+
569+
=> true, _ => false
570+
}
559571
}
560572

561573
pub fn maybe_rename_class_method<'m>(class_name: &TyName, godot_method_name: &'m str) -> &'m str {

godot-core/src/builtin/aabb.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,12 @@ impl Aabb {
147147
&& point.z < self.size.z
148148
}
149149

150-
#[inline]
151-
#[deprecated = "Renamed to `contains_point()`, for consistency with `Rect2i`"]
152-
pub fn has_point(self, point: Vector3) -> bool {
153-
self.contains_point(point)
154-
}
155-
156150
/// Returns if this bounding box has a surface or a length, i.e. at least one component of [`Self::size`] is greater than 0.
157151
#[inline]
158152
pub fn has_surface(self) -> bool {
159153
(self.size.x > 0.0) || (self.size.y > 0.0) || (self.size.z > 0.0)
160154
}
161155

162-
/// Returns true if at least one of the size's components (X, Y, Z) is greater than 0.
163-
#[inline]
164-
#[deprecated = "Replaced with `has_surface()`, which has different semantics"]
165-
pub fn has_area(self) -> bool {
166-
((self.size.x > 0.0) as u8 + (self.size.y > 0.0) as u8 + (self.size.z > 0.0) as u8) >= 2
167-
}
168-
169156
/// Returns true if the AABB has a volume, and false if the AABB is flat, linear, empty, or has a negative size.
170157
#[inline]
171158
pub fn has_volume(self) -> bool {
@@ -194,11 +181,6 @@ impl Aabb {
194181
Some(rect)
195182
}
196183

197-
#[deprecated = "Renamed to `intersect()`"]
198-
pub fn intersection(self, b: Aabb) -> Option<Self> {
199-
self.intersect(b)
200-
}
201-
202184
/// Returns `true` if this AABB is finite, by calling `@GlobalScope.is_finite` on each component.
203185
#[inline]
204186
pub fn is_finite(self) -> bool {

godot-core/src/builtin/basis.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ impl Basis {
128128
RMat3::from_quat(quat.to_glam()).to_front()
129129
}
130130

131-
#[deprecated = "Renamed to `from_quaternion()`"]
132-
pub fn from_quat(quat: Quaternion) -> Self {
133-
Self::from_quaternion(quat)
134-
}
135-
136131
/// Create a `Basis` from three angles `a`, `b`, and `c` interpreted
137132
/// as Euler angles according to the given `EulerOrder`.
138133
///
@@ -171,11 +166,6 @@ impl Basis {
171166
super::inner::InnerBasis::looking_at(target, up, use_model_front)
172167
}
173168

174-
#[deprecated = "Renamed to `looking_at()`"]
175-
pub fn new_looking_at(target: Vector3, up: Vector3, use_model_front: bool) -> Self {
176-
Self::looking_at(target, up, use_model_front)
177-
}
178-
179169
/// Creates a `[Vector3; 3]` with the columns of the `Basis`.
180170
pub fn to_cols(&self) -> [Vector3; 3] {
181171
self.transposed().rows
@@ -206,11 +196,6 @@ impl Basis {
206196
RQuat::from_mat3(&self.orthonormalized().to_glam()).to_front()
207197
}
208198

209-
#[deprecated = "Renamed to `get_quaternion()`"]
210-
pub fn to_quat(&self) -> Quaternion {
211-
self.get_quaternion()
212-
}
213-
214199
/// Returns the scale of the matrix.
215200
///
216201
/// _Godot equivalent: `Basis.get_scale()`_
@@ -226,11 +211,6 @@ impl Basis {
226211
) * det_sign
227212
}
228213

229-
#[deprecated = "Renamed to `get_scale()`"]
230-
pub fn scale(&self) -> Vector3 {
231-
self.get_scale()
232-
}
233-
234214
/// Returns the rotation of the matrix in euler angles, with the order `YXZ`.
235215
///
236216
/// See [`get_euler_with()`](Self::get_euler_with) for custom angle orders.
@@ -303,11 +283,6 @@ impl Basis {
303283
.to_front()
304284
}
305285

306-
#[deprecated = "Renamed to `get_euler()` + `get_euler_with()`"]
307-
pub fn to_euler(&self, order: EulerOrder) -> Vector3 {
308-
self.get_euler_with(order)
309-
}
310-
311286
fn is_between_neg1_1(f: real) -> Ordering {
312287
if f >= (1.0 - real::CMP_EPSILON) {
313288
Ordering::Greater

godot-core/src/builtin/callable.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -208,21 +208,6 @@ impl Callable {
208208
})
209209
}
210210

211-
#[deprecated = "Now split into from_local_fn (single-threaded) and from_sync_fn (multi-threaded)."]
212-
#[cfg(since_api = "4.2")]
213-
pub fn from_fn<F, S>(name: S, rust_function: F) -> Self
214-
where
215-
F: 'static + Send + Sync + FnMut(&[&Variant]) -> Result<Variant, ()>,
216-
S: Into<GString>,
217-
{
218-
// Do not call from_sync_fn() since that is feature-gated, but this isn't due to compatibility.
219-
Self::from_fn_wrapper(FnWrapper {
220-
rust_function,
221-
name: name.into(),
222-
thread_id: None,
223-
})
224-
}
225-
226211
/// Create a highly configurable callable from Rust.
227212
///
228213
/// See [`RustCallable`] for requirements on the type.

godot-core/src/builtin/quaternion.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ impl Quaternion {
107107
}
108108
}
109109

110-
#[deprecated = "Renamed to `Quaternion::exp()`"]
111-
pub fn to_exp(self) -> Self {
112-
self.exp()
113-
}
114-
115110
pub fn from_euler(euler: Vector3) -> Self {
116111
let half_a1 = euler.y * 0.5;
117112
let half_a2 = euler.x * 0.5;
@@ -163,11 +158,6 @@ impl Quaternion {
163158
Basis::from_quaternion(self).get_euler_with(order)
164159
}
165160

166-
#[deprecated = "Renamed to `get_euler()` + `get_euler_with()`"]
167-
pub fn to_euler(self, order: EulerOrder) -> Vector3 {
168-
self.get_euler_with(order)
169-
}
170-
171161
pub fn inverse(self) -> Self {
172162
Self::new(-self.x, -self.y, -self.z, self.w)
173163
}

godot-core/src/builtin/rect2.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ impl Rect2 {
6565
}
6666
}
6767

68-
#[deprecated = "Moved to `Rect2i::cast_float()`"]
69-
#[inline]
70-
pub const fn from_rect2i(rect: Rect2i) -> Self {
71-
rect.cast_float()
72-
}
73-
7468
/// Create a new `Rect2i` from a `Rect2`, using `as` for `real` to `i32` conversions.
7569
///
7670
/// _Godot equivalent: `Rect2i(Rect2 from)`_
@@ -190,12 +184,6 @@ impl Rect2 {
190184
point.abs() == point && point.x < self.size.x && point.y < self.size.y
191185
}
192186

193-
#[inline]
194-
#[deprecated = "Renamed to `contains_point()`, for consistency with `Rect2i`"]
195-
pub fn has_point(self, point: Vector2) -> bool {
196-
self.contains_point(point)
197-
}
198-
199187
/// Returns the intersection of this Rect2 and `b`. If the rectangles do not intersect, an empty Rect2 is returned.
200188
#[inline]
201189
pub fn intersect(self, b: Self) -> Option<Self> {
@@ -213,11 +201,6 @@ impl Rect2 {
213201
Some(rect)
214202
}
215203

216-
#[deprecated = "Renamed to `intersect()`"]
217-
pub fn intersection(self, b: Rect2) -> Option<Self> {
218-
self.intersect(b)
219-
}
220-
221204
/// Checks whether two rectangles have at least one point in common.
222205
///
223206
/// Also returns `true` if the rects only touch each other (share a point/edge).

godot-core/src/builtin/rect2i.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ impl Rect2i {
7171
}
7272
}
7373

74-
#[deprecated = "Moved to `Rect2::cast_int()`"]
75-
#[inline]
76-
pub const fn from_rect2(rect: Rect2) -> Self {
77-
rect.cast_int()
78-
}
79-
8074
/// Create a new `Rect2` from a `Rect2i`, using `as` for `i32` to `real` conversions.
8175
///
8276
/// _Godot equivalent: `Rect2(Rect2i from)`_
@@ -243,11 +237,6 @@ impl Rect2i {
243237
Some(Self::from_corners(new_pos, new_end))
244238
}
245239

246-
#[deprecated = "Renamed to `intersect()`"]
247-
pub fn intersection(self, b: Self) -> Option<Self> {
248-
self.intersect(b)
249-
}
250-
251240
/// Returns `true` if the `Rect2i` overlaps with `b` (i.e. they have at least one
252241
/// point in common)
253242
#[inline]

godot-core/src/builtin/variant/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl Variant {
274274
pub(crate) fn is_object_alive(&self) -> bool {
275275
debug_assert_eq!(self.get_type(), VariantType::OBJECT);
276276

277-
crate::gen::utilities::is_instance_valid(self)
277+
crate::global::is_instance_valid(self)
278278

279279
// In case there are ever problems with this approach, alternative implementation:
280280
// self.stringify() != "<Freed Object>".into()

godot-core/src/builtin/vectors/vector2.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ impl_vector_fns!(Vector2, RVec2, real, (x, y));
7171

7272
/// # Specialized `Vector2` functions
7373
impl Vector2 {
74-
#[deprecated = "Moved to `Vector2i::cast_float()`"]
75-
#[inline]
76-
pub const fn from_vector2i(v: Vector2i) -> Self {
77-
v.cast_float()
78-
}
79-
8074
/// Creates a unit Vector2 rotated to the given `angle` in radians. This is equivalent to doing `Vector2::new(angle.cos(), angle.sin())`
8175
/// or `Vector2::RIGHT.rotated(angle)`.
8276
///

godot-core/src/builtin/vectors/vector2i.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ impl Vector2i {
6969
impl Vector2i {
7070
inline_impl_integer_vector_fns!(Vector2, x, y);
7171

72-
#[deprecated = "Moved to `Vector2::cast_int()`"]
73-
#[inline]
74-
pub const fn from_vector2(v: Vector2) -> Self {
75-
v.cast_int()
76-
}
77-
7872
/// Converts `self` to the corresponding [`real`] `glam` type.
7973
#[doc(hidden)]
8074
#[inline]

godot-core/src/builtin/vectors/vector3.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,6 @@ impl_vector_fns!(Vector3, RVec3, real, (x, y, z));
9393

9494
/// # Specialized `Vector3` functions
9595
impl Vector3 {
96-
#[deprecated = "Moved to `Vector3i::cast_float()`"]
97-
#[inline]
98-
pub const fn from_vector3i(v: Vector3i) -> Self {
99-
v.cast_float()
100-
}
101-
10296
#[doc(hidden)]
10397
#[inline]
10498
pub fn as_inner(&self) -> inner::InnerVector3 {

godot-core/src/builtin/vectors/vector3i.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ impl_vector_fns!(Vector3i, glam::IVec3, i32, (x, y, z));
7272

7373
/// # Specialized `Vector3i` functions
7474
impl Vector3i {
75-
#[deprecated = "Moved to `Vector3::cast_int()`"]
76-
#[inline]
77-
pub const fn from_vector3(v: Vector3) -> Self {
78-
v.cast_int()
79-
}
80-
8175
inline_impl_integer_vector_fns!(Vector3, x, y, z);
8276

8377
/// Converts `self` to the corresponding [`real`] `glam` type.

godot-core/src/builtin/vectors/vector4.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ impl_vector_fns!(Vector4, RVec4, real, (x, y, z, w));
7272

7373
/// # Specialized `Vector4` functions
7474
impl Vector4 {
75-
#[deprecated = "Moved to `Vector4i::cast_float()`"]
76-
pub const fn from_vector4i(v: Vector4i) -> Self {
77-
v.cast_float()
78-
}
79-
8075
#[doc(hidden)]
8176
#[inline]
8277
pub fn as_inner(&self) -> inner::InnerVector4 {

godot-core/src/builtin/vectors/vector4i.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ impl_vector_fns!(Vector4i, glam::IVec4, i32, (x, y, z, w));
7373
impl Vector4i {
7474
inline_impl_integer_vector_fns!(Vector4, x, y, z, w);
7575

76-
#[deprecated = "Moved to `Vector4::cast_int()`"]
77-
#[inline]
78-
pub const fn from_vector4(v: Vector4) -> Self {
79-
v.cast_int()
80-
}
81-
8276
/// Converts `self` to the corresponding [`real`] `glam` type.
8377
#[doc(hidden)]
8478
#[inline]

godot-core/src/deprecated.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,7 @@ macro_rules! emit_deprecated_warning {
3535
pub use crate::emit_deprecated_warning;
3636

3737
// ----------------------------------------------------------------------------------------------------------------------------------------------
38-
// Library-side deprecations
39-
40-
#[deprecated = "\nThe attribute key #[init(val = ...)] replaces #[init(default = ...)].\n\
41-
More information on https://github.com/godot-rust/gdext/pull/844"]
42-
pub const fn init_default() {}
43-
44-
#[deprecated = "\nThe attribute key #[class(editor_plugin)] is now implied by #[class(base = EditorPlugin)]. It is ignored.\n\
45-
More information on https://github.com/godot-rust/gdext/pull/884"]
46-
pub const fn class_editor_plugin() {}
47-
48-
#[deprecated = "\nThe attribute key #[class(hidden)] has been renamed to #[class(internal)], following Godot terminology.\n\
49-
More information on https://github.com/godot-rust/gdext/pull/884"]
50-
pub const fn class_hidden() {}
51-
52-
#[deprecated = "\nThe attribute key #[gdextension(entry_point)] has been renamed to #[gdextension(entry_symbol)], for consistency \
53-
with the configuration key in the .gdextension file.\n\
54-
More information on https://github.com/godot-rust/gdext/pull/959"]
55-
pub const fn gdextension_entry_point() {}
38+
// Library-side deprecations -- see usage description above.
5639

5740
// ----------------------------------------------------------------------------------------------------------------------------------------------
5841
// Godot-side deprecations

0 commit comments

Comments
 (0)