summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-12-30 19:48:41 +0100
committerGitHub <noreply@github.com>2018-12-30 19:48:41 +0100
commit6d05ace735f70b545a5e7f9a5078b06c4ea5828b (patch)
treec215689074809bfcaef00265231ae0ffb7e5713b
parentfb9085ab54913c60046a7be773dbd872ff7de882 (diff)
parent131001a4fb10a202e9cbe1df8e98095d1b35789b (diff)
Merge pull request #24670 from SoIAS/property_resource_warning_24562
Fixed a property warning when loading a correct resource type
-rw-r--r--editor/editor_properties.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index b992b90758..9bc4a6d2e4 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -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();