Skip to content

Commit 0d6541e

Browse files
committed
Update all use sites to new SHOUT_CASE convention
1 parent 0557617 commit 0d6541e

32 files changed

+116
-97
lines changed

godot-codegen/src/generator/central_files.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub fn make_sys_central_code(api: &ExtensionApi) -> TokenStream {
5454
pub fn make_core_central_code(api: &ExtensionApi, ctx: &mut Context) -> TokenStream {
5555
let VariantEnums {
5656
variant_ty_enumerators_pascal,
57+
variant_ty_enumerators_shout,
5758
variant_ty_enumerators_rust,
5859
..
5960
} = make_variant_enums(api, ctx);
@@ -83,9 +84,9 @@ pub fn make_core_central_code(api: &ExtensionApi, ctx: &mut Context) -> TokenStr
8384
impl VariantDispatch {
8485
pub fn from_variant(variant: &Variant) -> Self {
8586
match variant.get_type() {
86-
VariantType::Nil => Self::Nil,
87+
VariantType::NIL => Self::Nil,
8788
#(
88-
VariantType::#variant_ty_enumerators_pascal
89+
VariantType::#variant_ty_enumerators_shout
8990
=> Self::#variant_ty_enumerators_pascal(variant.to::<#variant_ty_enumerators_rust>()),
9091
)*
9192

@@ -124,6 +125,7 @@ pub fn make_core_central_code(api: &ExtensionApi, ctx: &mut Context) -> TokenStr
124125

125126
struct VariantEnums {
126127
variant_ty_enumerators_pascal: Vec<Ident>,
128+
variant_ty_enumerators_shout: Vec<Ident>,
127129
variant_ty_enumerators_rust: Vec<TokenStream>,
128130
}
129131

@@ -158,18 +160,21 @@ fn make_variant_enums(api: &ExtensionApi, ctx: &mut Context) -> VariantEnums {
158160

159161
let mut result = VariantEnums {
160162
variant_ty_enumerators_pascal: Vec::with_capacity(len),
163+
variant_ty_enumerators_shout: Vec::with_capacity(len),
161164
variant_ty_enumerators_rust: Vec::with_capacity(len),
162165
};
163166

164167
// Note: NIL is not part of this iteration, it will be added manually.
165168
for builtin in api.builtins.iter() {
166169
let original_name = builtin.godot_original_name();
170+
let shout_case = builtin.godot_shout_name();
167171
let rust_ty = conv::to_rust_type(original_name, None, ctx);
168172
let pascal_case = conv::to_pascal_case(original_name);
169173

170174
result
171175
.variant_ty_enumerators_pascal
172176
.push(ident(&pascal_case));
177+
result.variant_ty_enumerators_shout.push(ident(shout_case));
173178
result
174179
.variant_ty_enumerators_rust
175180
.push(rust_ty.to_token_stream());

godot-core/src/builtin/aabb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl std::fmt::Display for Aabb {
400400
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
401401
unsafe impl GodotFfi for Aabb {
402402
fn variant_type() -> sys::VariantType {
403-
sys::VariantType::Aabb
403+
sys::VariantType::AABB
404404
}
405405

406406
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ impl<T: ArrayElement> Var for Array<T> {
865865

866866
#[cfg(since_api = "4.2")]
867867
fn property_hint() -> PropertyHintInfo {
868-
if T::Ffi::variant_type() == VariantType::Nil {
868+
if T::Ffi::variant_type() == VariantType::NIL {
869869
return PropertyHintInfo::with_hint_none("");
870870
}
871871

@@ -1196,7 +1196,7 @@ impl TypeInfo {
11961196
}
11971197

11981198
pub fn is_typed(&self) -> bool {
1199-
self.variant_type != VariantType::Nil
1199+
self.variant_type != VariantType::NIL
12001200
}
12011201

12021202
pub fn variant_type(&self) -> VariantType {

godot-core/src/builtin/basis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ impl Mul<Vector3> for Basis {
598598
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
599599
unsafe impl GodotFfi for Basis {
600600
fn variant_type() -> sys::VariantType {
601-
sys::VariantType::Basis
601+
sys::VariantType::BASIS
602602
}
603603

604604
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/callable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl_builtin_traits! {
291291
// beyond what is done in `from_opaque` and `drop`. So using `*mut Opaque` is safe.
292292
unsafe impl GodotFfi for Callable {
293293
fn variant_type() -> sys::VariantType {
294-
sys::VariantType::Callable
294+
sys::VariantType::CALLABLE
295295
}
296296

297297
ffi_methods! { type sys::GDExtensionTypePtr = *mut Opaque;

godot-core/src/builtin/color.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl Color {
350350
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
351351
unsafe impl GodotFfi for Color {
352352
fn variant_type() -> sys::VariantType {
353-
sys::VariantType::Color
353+
sys::VariantType::COLOR
354354
}
355355

356356
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/dictionary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl Dictionary {
288288
// `std::mem::forget(dictionary.clone())`.
289289
unsafe impl GodotFfi for Dictionary {
290290
fn variant_type() -> sys::VariantType {
291-
sys::VariantType::Dictionary
291+
sys::VariantType::DICTIONARY
292292
}
293293

294294
ffi_methods! { type sys::GDExtensionTypePtr = *mut Opaque; .. }

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ pub trait GodotType:
156156
variant_type: Self::Ffi::variant_type(),
157157
class_name: Self::class_name(),
158158
property_name: StringName::from(property_name),
159-
hint: global::PropertyHint::NONE,
159+
hint: PropertyHint::NONE,
160160
hint_string: GString::new(),
161-
usage: global::PropertyUsageFlags::DEFAULT,
161+
usage: PropertyUsageFlags::DEFAULT,
162162
}
163163
}
164164

@@ -272,9 +272,9 @@ pub trait ArrayElement: GodotType {}
272272
pub struct PropertyInfo {
273273
/// Which type this property has.
274274
///
275-
/// For objects this should be set to [`VariantType::Object`], and the `class_name` field to the actual name of the class.
275+
/// For objects this should be set to [`VariantType::OBJECT`], and the `class_name` field to the actual name of the class.
276276
///
277-
/// For [`Variant`] this should be set to [`VariantType::Nil`].
277+
/// For [`Variant`] this should be set to [`VariantType::NIL`].
278278
pub variant_type: VariantType,
279279

280280
/// Which class this property is.
@@ -289,15 +289,15 @@ pub struct PropertyInfo {
289289
/// How the property is meant to be edited. See also [`PropertyHint`] in the Godot docs.
290290
///
291291
/// [`PropertyHint`]: https://docs.godotengine.org/en/latest/classes/class_%40globalscope.html#enum-globalscope-propertyhint
292-
pub hint: global::PropertyHint,
292+
pub hint: PropertyHint,
293293

294294
/// Extra information passed to Godot for this property, what this means depends on the `hint` value.
295295
pub hint_string: GString,
296296

297297
/// How this property should be used. See [`PropertyUsageFlags`] in Godot for the meaning.
298298
///
299299
/// [`PropertyUsageFlags`]: https://docs.godotengine.org/en/latest/classes/class_%40globalscope.html#enum-globalscope-propertyusageflags
300-
pub usage: global::PropertyUsageFlags,
300+
pub usage: PropertyUsageFlags,
301301
}
302302

303303
impl PropertyInfo {
@@ -359,7 +359,7 @@ impl PropertyInfo {
359359
/// more information.
360360
pub fn new_group(group_name: &str, group_prefix: &str) -> Self {
361361
Self {
362-
variant_type: VariantType::Nil,
362+
variant_type: VariantType::NIL,
363363
class_name: ClassName::none(),
364364
property_name: group_name.into(),
365365
hint: PropertyHint::NONE,
@@ -374,7 +374,7 @@ impl PropertyInfo {
374374
/// more information.
375375
pub fn new_subgroup(subgroup_name: &str, subgroup_prefix: &str) -> Self {
376376
Self {
377-
variant_type: VariantType::Nil,
377+
variant_type: VariantType::NIL,
378378
class_name: ClassName::none(),
379379
property_name: subgroup_name.into(),
380380
hint: PropertyHint::NONE,
@@ -403,12 +403,12 @@ impl PropertyInfo {
403403
use crate::obj::EngineEnum as _;
404404

405405
sys::GDExtensionPropertyInfo {
406-
type_: VariantType::Nil.sys(),
406+
type_: VariantType::NIL.sys(),
407407
name: std::ptr::null_mut(),
408408
class_name: std::ptr::null_mut(),
409-
hint: global::PropertyHint::NONE.ord() as u32,
409+
hint: PropertyHint::NONE.ord() as u32,
410410
hint_string: std::ptr::null_mut(),
411-
usage: global::PropertyUsageFlags::NONE.ord() as u32,
411+
usage: PropertyUsageFlags::NONE.ord() as u32,
412412
}
413413
}
414414

godot-core/src/builtin/packed_array.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ macro_rules! impl_packed_array {
2626
(
2727
// Name of the type to define, e.g. `PackedByteArray`.
2828
type_name: $PackedArray:ident,
29+
// Name of the VariantType constant, e.g. `PACKED_BYTE_ARRAY`.
30+
variant_type: $VariantType:ident,
2931
// Type of elements contained in the array, e.g. `u8`.
3032
element_type: $Element:ty,
3133
// Name of wrapped opaque type, e.g. `OpaquePackedByteArray`.
@@ -499,7 +501,7 @@ macro_rules! impl_packed_array {
499501

500502
unsafe impl GodotFfi for $PackedArray {
501503
fn variant_type() -> sys::VariantType {
502-
sys::VariantType::$PackedArray
504+
sys::VariantType::$VariantType
503505
}
504506

505507
ffi_methods! { type sys::GDExtensionTypePtr = *mut Opaque; .. }
@@ -574,6 +576,7 @@ macro_rules! impl_specific_packed_array_functions {
574576

575577
impl_packed_array!(
576578
type_name: PackedByteArray,
579+
variant_type: PACKED_BYTE_ARRAY,
577580
element_type: u8,
578581
opaque_type: OpaquePackedByteArray,
579582
inner_type: InnerPackedByteArray,
@@ -592,6 +595,7 @@ impl_packed_array!(
592595

593596
impl_packed_array!(
594597
type_name: PackedInt32Array,
598+
variant_type: PACKED_INT32_ARRAY,
595599
element_type: i32,
596600
opaque_type: OpaquePackedInt32Array,
597601
inner_type: InnerPackedInt32Array,
@@ -610,6 +614,7 @@ impl_packed_array!(
610614

611615
impl_packed_array!(
612616
type_name: PackedInt64Array,
617+
variant_type: PACKED_INT64_ARRAY,
613618
element_type: i64,
614619
opaque_type: OpaquePackedInt64Array,
615620
inner_type: InnerPackedInt64Array,
@@ -628,6 +633,7 @@ impl_packed_array!(
628633

629634
impl_packed_array!(
630635
type_name: PackedFloat32Array,
636+
variant_type: PACKED_FLOAT32_ARRAY,
631637
element_type: f32,
632638
opaque_type: OpaquePackedFloat32Array,
633639
inner_type: InnerPackedFloat32Array,
@@ -646,6 +652,7 @@ impl_packed_array!(
646652

647653
impl_packed_array!(
648654
type_name: PackedFloat64Array,
655+
variant_type: PACKED_FLOAT64_ARRAY,
649656
element_type: f64,
650657
opaque_type: OpaquePackedFloat64Array,
651658
inner_type: InnerPackedFloat64Array,
@@ -664,6 +671,7 @@ impl_packed_array!(
664671

665672
impl_packed_array!(
666673
type_name: PackedStringArray,
674+
variant_type: PACKED_STRING_ARRAY,
667675
element_type: GString,
668676
opaque_type: OpaquePackedStringArray,
669677
inner_type: InnerPackedStringArray,
@@ -682,6 +690,7 @@ impl_packed_array!(
682690

683691
impl_packed_array!(
684692
type_name: PackedVector2Array,
693+
variant_type: PACKED_VECTOR2_ARRAY,
685694
element_type: Vector2,
686695
opaque_type: OpaquePackedVector2Array,
687696
inner_type: InnerPackedVector2Array,
@@ -700,6 +709,7 @@ impl_packed_array!(
700709

701710
impl_packed_array!(
702711
type_name: PackedVector3Array,
712+
variant_type: PACKED_VECTOR3_ARRAY,
703713
element_type: Vector3,
704714
opaque_type: OpaquePackedVector3Array,
705715
inner_type: InnerPackedVector3Array,
@@ -719,6 +729,7 @@ impl_packed_array!(
719729
#[cfg(since_api = "4.3")]
720730
impl_packed_array!(
721731
type_name: PackedVector4Array,
732+
variant_type: PACKED_VECTOR4_ARRAY,
722733
element_type: Vector4,
723734
opaque_type: OpaquePackedVector4Array,
724735
inner_type: InnerPackedVector4Array,
@@ -737,6 +748,7 @@ impl_packed_array!(
737748

738749
impl_packed_array!(
739750
type_name: PackedColorArray,
751+
variant_type: PACKED_COLOR_ARRAY,
740752
element_type: Color,
741753
opaque_type: OpaquePackedColorArray,
742754
inner_type: InnerPackedColorArray,

godot-core/src/builtin/plane.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl Neg for Plane {
264264
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
265265
unsafe impl GodotFfi for Plane {
266266
fn variant_type() -> sys::VariantType {
267-
sys::VariantType::Plane
267+
sys::VariantType::PLANE
268268
}
269269

270270
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self;

godot-core/src/builtin/projection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ impl GlamConv for Projection {
530530
// SAFETY: This type is represented as `Self` in Godot, so `*mut Self` is sound.
531531
unsafe impl GodotFfi for Projection {
532532
fn variant_type() -> sys::VariantType {
533-
sys::VariantType::Projection
533+
sys::VariantType::PROJECTION
534534
}
535535

536536
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/quaternion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl Mul<Quaternion> for Quaternion {
281281
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
282282
unsafe impl GodotFfi for Quaternion {
283283
fn variant_type() -> sys::VariantType {
284-
sys::VariantType::Quaternion
284+
sys::VariantType::QUATERNION
285285
}
286286

287287
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/rect2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl Rect2 {
258258
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
259259
unsafe impl GodotFfi for Rect2 {
260260
fn variant_type() -> sys::VariantType {
261-
sys::VariantType::Rect2
261+
sys::VariantType::RECT2
262262
}
263263

264264
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/rect2i.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl Rect2i {
268268
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
269269
unsafe impl GodotFfi for Rect2i {
270270
fn variant_type() -> sys::VariantType {
271-
sys::VariantType::Rect2i
271+
sys::VariantType::RECT2I
272272
}
273273

274274
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/rid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl std::fmt::Display for Rid {
120120
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
121121
unsafe impl GodotFfi for Rid {
122122
fn variant_type() -> sys::VariantType {
123-
sys::VariantType::Rid
123+
sys::VariantType::RID
124124
}
125125

126126
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self;

godot-core/src/builtin/signal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl Signal {
158158
// beyond what is done in `from_opaque` and `drop`. So using `*mut Opaque` is safe.
159159
unsafe impl GodotFfi for Signal {
160160
fn variant_type() -> sys::VariantType {
161-
sys::VariantType::Signal
161+
sys::VariantType::SIGNAL
162162
}
163163

164164
ffi_methods! { type sys::GDExtensionTypePtr = *mut Opaque;

godot-core/src/builtin/string/gstring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl GString {
210210
// `std::mem::forget(string.clone())`.
211211
unsafe impl GodotFfi for GString {
212212
fn variant_type() -> sys::VariantType {
213-
sys::VariantType::String
213+
sys::VariantType::STRING
214214
}
215215

216216
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/string/node_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl NodePath {
5959
// `std::mem::forget(node_path.clone())`.
6060
unsafe impl GodotFfi for NodePath {
6161
fn variant_type() -> sys::VariantType {
62-
sys::VariantType::NodePath
62+
sys::VariantType::NODE_PATH
6363
}
6464

6565
ffi_methods! { type sys::GDExtensionTypePtr = *mut Opaque; .. }

godot-core/src/builtin/string/string_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl StringName {
176176
// `std::mem::forget(string_name.clone())`.
177177
unsafe impl GodotFfi for StringName {
178178
fn variant_type() -> sys::VariantType {
179-
sys::VariantType::StringName
179+
sys::VariantType::STRING_NAME
180180
}
181181

182182
ffi_methods! { type sys::GDExtensionTypePtr = *mut Opaque; .. }

godot-core/src/builtin/transform2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl GlamConv for Transform2D {
379379
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
380380
unsafe impl GodotFfi for Transform2D {
381381
fn variant_type() -> sys::VariantType {
382-
sys::VariantType::Transform2D
382+
sys::VariantType::TRANSFORM2D
383383
}
384384

385385
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

godot-core/src/builtin/transform3d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl GlamConv for Transform3D {
386386
// This type is represented as `Self` in Godot, so `*mut Self` is sound.
387387
unsafe impl GodotFfi for Transform3D {
388388
fn variant_type() -> sys::VariantType {
389-
sys::VariantType::Transform3D
389+
sys::VariantType::TRANSFORM3D
390390
}
391391

392392
ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. }

0 commit comments

Comments
 (0)