diff options
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r-- | editor/editor_properties.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index b992b90758..fdbf5bda9f 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -1959,16 +1959,26 @@ void EditorPropertyResource::_file_selected(const String &p_path) { List<PropertyInfo> prop_list; get_edited_object()->get_property_list(&prop_list); - String type; + String property_types; for (List<PropertyInfo>::Element *E = prop_list.front(); E; E = E->next()) { if (E->get().name == get_edited_property() && (E->get().hint & PROPERTY_HINT_RESOURCE_TYPE)) { - type = E->get().hint_string; + property_types = E->get().hint_string; } } + if (!property_types.empty()) { + bool any_type_matches = false; + const Vector<String> split_property_types = property_types.split(","); + for (int i = 0; i < split_property_types.size(); ++i) { + if (res->is_class(split_property_types[i])) { + any_type_matches = true; + break; + } + } - if (!type.empty() && !res->is_class(type)) - EditorNode::get_singleton()->show_warning(vformat(TTR("The selected resource (%s) does not match the type expected for this property (%s)."), res->get_class(), type)); + if (!any_type_matches) + EditorNode::get_singleton()->show_warning(vformat(TTR("The selected resource (%s) does not match any type expected for this property (%s)."), res->get_class(), property_types)); + } emit_signal("property_changed", get_edited_property(), res); update_property(); |