@@ -98,7 +98,7 @@ pub fn make_notification_enum(
98
98
/// Makes it easier to keep an overview all possible notification variants for a given class, including
99
99
/// notifications defined in base classes.
100
100
///
101
- /// Contains the [`Unknown`] variant for forward compatibility.
101
+ /// Contains the [`Unknown`][Self::Unknown] variant for forward compatibility.
102
102
#[ derive( Copy , Clone , Eq , PartialEq , Ord , PartialOrd , Hash , Debug ) ]
103
103
#[ repr( i32 ) ]
104
104
#[ allow( non_camel_case_types) ]
@@ -110,6 +110,9 @@ pub fn make_notification_enum(
110
110
111
111
/// Since Godot represents notifications as integers, it's always possible that a notification outside the known types
112
112
/// is received. For example, the user can manually issue notifications through `Object::notify()`.
113
+ ///
114
+ /// This is also necessary if you develop an extension on a Godot version and want to be forward-compatible with newer
115
+ /// versions. If Godot adds new notifications, they will be unknown to your extension, but you can still handle them.
113
116
Unknown ( i32 ) ,
114
117
}
115
118
@@ -153,16 +156,9 @@ pub fn try_to_notification(constant: &JsonClassConstant) -> Option<Ident> {
153
156
/// Godot has a collision for two notification constants (DRAW, NODE_CACHE_REQUESTED) in the same inheritance branch (as of 4.0.2).
154
157
/// This cannot be represented in a Rust enum, so we merge the two constants into a single enumerator.
155
158
fn workaround_constant_collision ( all_constants : & mut Vec < ( Ident , i32 ) > ) {
159
+ // This constant has never been used by the engine.
156
160
#[ cfg( before_api = "4.2" ) ]
157
- for first in [ "Draw" , "VisibilityChanged" ] {
158
- if let Some ( index_of_draw) = all_constants
159
- . iter ( )
160
- . position ( |( constant_name, _) | constant_name == first)
161
- {
162
- all_constants[ index_of_draw] . 0 = quote:: format_ident!( "{first}OrNodeRecacheRequested" ) ;
163
- all_constants. retain ( |( constant_name, _) | constant_name != "NodeRecacheRequested" ) ;
164
- }
165
- }
161
+ all_constants. retain ( |( constant_name, _) | constant_name != "NODE_RECACHE_REQUESTED" ) ;
166
162
167
163
let _ = & all_constants; // unused warning
168
164
}
0 commit comments