| 1157 | } |
| 1158 | |
| 1159 | void EditorNode::_resources_changed(const Vector<String> &p_resources) { |
| 1160 | List<Ref<Resource>> changed; |
| 1161 | |
| 1162 | int rc = p_resources.size(); |
| 1163 | for (int i = 0; i < rc; i++) { |
| 1164 | Ref<Resource> res = ResourceCache::get_ref(p_resources.get(i)); |
| 1165 | if (res.is_null()) { |
| 1166 | continue; |
| 1167 | } |
| 1168 | |
| 1169 | if (!res->editor_can_reload_from_file()) { |
| 1170 | continue; |
| 1171 | } |
| 1172 | if (!res->get_path().is_resource_file() && !res->get_path().is_absolute_path()) { |
| 1173 | continue; |
| 1174 | } |
| 1175 | if (!FileAccess::exists(res->get_path())) { |
| 1176 | continue; |
| 1177 | } |
| 1178 | |
| 1179 | if (!res->get_import_path().is_empty()) { |
| 1180 | // This is an imported resource, will be reloaded if reimported via the _resources_reimported() callback. |
| 1181 | continue; |
| 1182 | } |
| 1183 | |
| 1184 | changed.push_back(res); |
| 1185 | } |
| 1186 | |
| 1187 | if (changed.size()) { |
| 1188 | for (Ref<Resource> &res : changed) { |
| 1189 | res->reload_from_file(); |
| 1190 | } |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | void EditorNode::_fs_changed() { |
| 1195 | for (FileDialog *E : file_dialogs) { |
nothing calls this directly
no test coverage detected