|
@@ -1956,6 +1956,20 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
|
|
void EditorPropertyResource::_file_selected(const String &p_path) {
|
|
void EditorPropertyResource::_file_selected(const String &p_path) {
|
|
|
|
|
|
RES res = ResourceLoader::load(p_path);
|
|
RES res = ResourceLoader::load(p_path);
|
|
|
|
+
|
|
|
|
+ List<PropertyInfo> prop_list;
|
|
|
|
+ get_edited_object()->get_property_list(&prop_list);
|
|
|
|
+ String type;
|
|
|
|
+
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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));
|
|
|
|
+
|
|
emit_signal("property_changed", get_edited_property(), res);
|
|
emit_signal("property_changed", get_edited_property(), res);
|
|
update_property();
|
|
update_property();
|
|
}
|
|
}
|