mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
GDScript: check for underscore prefix when type-checking
Some classes are represented internally with an underscore prefix, so we need to make sure we match this representation when type-checking, otherwise the check might fail on a valid scenario.
This commit is contained in:
parent
4f72c6be8a
commit
31433ae8e4
1 changed files with 8 additions and 2 deletions
|
@ -74,8 +74,14 @@ struct GDScriptDataType {
|
|||
return false;
|
||||
}
|
||||
Object *obj = p_variant.operator Object *();
|
||||
if (obj && !ClassDB::is_parent_class(obj->get_class_name(), native_type)) {
|
||||
return false;
|
||||
if (obj) {
|
||||
if (!ClassDB::is_parent_class(obj->get_class_name(), native_type)) {
|
||||
// Try with underscore prefix
|
||||
StringName underscore_native_type = "_" + native_type;
|
||||
if (!ClassDB::is_parent_class(obj->get_class_name(), underscore_native_type)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue