mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
do not change resource uuid when moving it in the editor
This commit is contained in:
@@ -650,7 +650,7 @@ impl ResourceManagerState {
|
||||
}
|
||||
}
|
||||
}
|
||||
notify::EventKind::Create(_) => {
|
||||
notify::EventKind::Create(_) if !registry.is_registered(&relative_path) => {
|
||||
let uuid = Uuid::new_v4();
|
||||
match registry.modify().write_metadata(uuid, &relative_path) {
|
||||
Ok(old_path) => {
|
||||
|
||||
@@ -426,6 +426,11 @@ impl ResourceRegistry {
|
||||
.find_map(|(k, v)| if v == path { Some(*k) } else { None })
|
||||
}
|
||||
|
||||
/// Checks if the path is registered in the resource registry.
|
||||
pub fn is_registered(&self, path: &Path) -> bool {
|
||||
self.path_to_uuid(path).is_some()
|
||||
}
|
||||
|
||||
/// Searches for supported resources starting from the given path and builds a mapping `UUID -> Path`.
|
||||
/// If a supported resource does not have a metadata file besides it, this method will automatically
|
||||
/// add it with a new UUID and add the resource to the registry.
|
||||
|
||||
Reference in New Issue
Block a user