Skip to content

Commit bd3df80

Browse files
committed
Fix Resource doesn't update when overwritten in editor
1 parent 4e6ac9b commit bd3df80

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

editor/editor_node.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,11 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
15851585
return;
15861586
}
15871587

1588-
((Resource *)p_resource.ptr())->set_path(path);
1588+
Ref<Resource> prev_resource = ResourceCache::get_ref(p_path);
1589+
p_resource->set_path(path, true);
1590+
if (prev_resource != p_resource) {
1591+
replace_resources_in_scenes({ prev_resource }, { p_resource });
1592+
}
15891593
saving_resources_in_path.erase(p_resource);
15901594

15911595
_resource_saved(p_resource, path);

editor/gui/editor_quick_open_dialog.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,15 +525,13 @@ void QuickOpenResultContainer::_use_default_candidates() {
525525
if (history) {
526526
candidates.append_array(*history);
527527
}
528-
int count = candidates.size();
529528
candidates.resize(MIN(max_total_results, filepaths.size()));
529+
int i = 0;
530530
for (const String &filepath : filepaths) {
531-
if (count >= max_total_results) {
531+
if (i >= candidates.size()) {
532532
break;
533533
}
534-
if (!history || !history_set.has(filepath)) {
535-
_setup_candidate(candidates.write[count++], filepath);
536-
}
534+
_setup_candidate(candidates.write[i++], filepath);
537535
}
538536
}
539537

0 commit comments

Comments
 (0)