File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -883,12 +883,7 @@ struct TypeInfo {
883
883
impl TypeInfo {
884
884
fn new < T : VariantMetadata > ( ) -> Self {
885
885
let variant_type = T :: variant_type ( ) ;
886
- let class_name = match variant_type {
887
- VariantType :: Object => StringName :: from ( T :: class_name ( ) ) ,
888
- // TODO for variant types other than Object, class_name() returns "(no base)"; just
889
- // make it return "" instead?
890
- _ => StringName :: default ( ) ,
891
- } ;
886
+ let class_name: StringName = T :: class_name ( ) . into ( ) ;
892
887
Self {
893
888
variant_type,
894
889
class_name,
Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ pub struct ClassName {
19
19
}
20
20
21
21
impl ClassName {
22
+ /// In Godot, an empty `StringName` in a place that expects a class name, means that there is no class.
23
+ pub fn none ( ) -> Self {
24
+ Self {
25
+ backing : StringName :: default ( ) ,
26
+ }
27
+ }
28
+
22
29
pub fn of < T : GodotClass > ( ) -> Self {
23
30
Self {
24
31
backing : StringName :: from ( T :: CLASS_NAME ) ,
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ pub trait VariantMetadata {
23
23
fn variant_type ( ) -> VariantType ;
24
24
25
25
fn class_name ( ) -> ClassName {
26
- ClassName :: of :: < ( ) > ( ) // FIXME Option or so
26
+ // If we use `ClassName::of::<()>()` then this type shows up as `(no base)` in documentation.
27
+ ClassName :: none ( )
27
28
}
28
29
29
30
fn property_info ( property_name : & str ) -> PropertyInfo {
You can’t perform that action at this time.
0 commit comments