mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
Duplicate registers the new resource
This commit is contained in:
@@ -449,8 +449,14 @@ impl AssetItemContextMenu {
|
||||
|
||||
match File::create(&final_copy_path) {
|
||||
Ok(mut file) => {
|
||||
Log::verify(file.write_all(&data_source.bytes));
|
||||
|
||||
let result = file.write_all(&data_source.bytes);
|
||||
drop(file);
|
||||
if result.is_ok() {
|
||||
engine
|
||||
.resource_manager
|
||||
.request_untyped(&final_copy_path);
|
||||
}
|
||||
Log::verify(result);
|
||||
sender
|
||||
.send(Message::ShowInAssetBrowser(final_copy_path));
|
||||
}
|
||||
@@ -472,7 +478,11 @@ impl AssetItemContextMenu {
|
||||
let ext = ext.to_string_lossy().to_string();
|
||||
let final_copy_path =
|
||||
asset::make_unique_path(parent, &stem, &ext);
|
||||
Log::verify(std::fs::copy(canonical_path, final_copy_path));
|
||||
let result = std::fs::copy(canonical_path, &final_copy_path);
|
||||
if result.is_ok() {
|
||||
engine.resource_manager.request_untyped(final_copy_path);
|
||||
}
|
||||
Log::verify(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2967,6 +2967,15 @@ impl Editor {
|
||||
self.engine.destroy_graphics_context().unwrap();
|
||||
}
|
||||
|
||||
fn on_focus_changed(&mut self) {
|
||||
if self.focused {
|
||||
self.engine
|
||||
.resource_manager
|
||||
.state()
|
||||
.process_filesystem_events();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(mut self, event_loop: EventLoop<()>) {
|
||||
Log::info("Initializing resource registry.");
|
||||
self.engine.resource_manager.update_or_load_registry();
|
||||
@@ -3047,6 +3056,7 @@ impl Editor {
|
||||
}
|
||||
WindowEvent::Focused(focused) => {
|
||||
self.focused = *focused;
|
||||
self.on_focus_changed();
|
||||
}
|
||||
WindowEvent::Moved(new_position) => {
|
||||
// Allow the window to go outside the screen bounds by a little. This
|
||||
|
||||
@@ -1297,7 +1297,6 @@ impl ResourceManagerState {
|
||||
true
|
||||
}
|
||||
});
|
||||
self.process_filesystem_events();
|
||||
}
|
||||
|
||||
fn add_resource_and_notify(&mut self, resource: UntypedResource) {
|
||||
|
||||
Reference in New Issue
Block a user