mirror of
https://github.com/godotengine/godot.git
synced 2024-11-28 23:22:38 +00:00
Merge pull request #6730 from Faless/fix_export_crash_error
Throw an error when exporting a resource class
This commit is contained in:
commit
5f7f73c6ae
@ -3109,6 +3109,16 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
||||
}
|
||||
member._export.type=cn->value.get_type();
|
||||
member._export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
|
||||
if (cn->value.get_type()==Variant::OBJECT) {
|
||||
Object *obj = cn->value;
|
||||
Resource *res = obj->cast_to<Resource>();
|
||||
if(res==NULL) {
|
||||
_set_error("Exported constant not a type or resource.");
|
||||
return;
|
||||
}
|
||||
member._export.hint=PROPERTY_HINT_RESOURCE_TYPE;
|
||||
member._export.hint_string=res->get_type();
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
Loading…
Reference in New Issue
Block a user