You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Throw an error when exporting a resource class
"export var tex = Texture" will now throw an error to avoid crashing the editor: "Exported constant not a type or resource" Fixes #6719 . Closes #6729
This commit is contained in:
@@ -3101,6 +3101,16 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|||||||
}
|
}
|
||||||
member._export.type=cn->value.get_type();
|
member._export.type=cn->value.get_type();
|
||||||
member._export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
|
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
|
#ifdef TOOLS_ENABLED
|
||||||
|
|||||||
Reference in New Issue
Block a user