You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-23 15:16:17 +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:
@@ -74,9 +74,15 @@ struct GDScriptDataType {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Object *obj = p_variant.operator Object *();
|
Object *obj = p_variant.operator Object *();
|
||||||
if (obj && !ClassDB::is_parent_class(obj->get_class_name(), native_type)) {
|
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 false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case SCRIPT:
|
case SCRIPT:
|
||||||
|
|||||||
Reference in New Issue
Block a user