diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-10-09 14:44:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-09 14:44:10 +0200 |
commit | 5f7f73c6ae766342ed6a6d596f599ba63c826d7e (patch) | |
tree | b72eb345d7175deb0f9eabfbc7e5a85b46186b9d /modules/gdscript | |
parent | 8711523c9867ca06e68cf53e937b21738876fef7 (diff) | |
parent | ee7df2c89ab0608c84f8c9390e1ed888dc1f805d (diff) |
Merge pull request #6730 from Faless/fix_export_crash_error
Throw an error when exporting a resource class
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 2ec27507c2..3c01f469f9 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -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 |