Refactor asset loading in EditorManager to iterate over active editors; streamline loading process for better scalability and maintainability.
This commit is contained in:
@@ -551,8 +551,9 @@ absl::Status EditorManager::LoadAssets() {
|
|||||||
auto &sheet_manager = GraphicsSheetManager::GetInstance();
|
auto &sheet_manager = GraphicsSheetManager::GetInstance();
|
||||||
ASSIGN_OR_RETURN(*sheet_manager.mutable_gfx_sheets(),
|
ASSIGN_OR_RETURN(*sheet_manager.mutable_gfx_sheets(),
|
||||||
LoadAllGraphicsData(*current_rom_));
|
LoadAllGraphicsData(*current_rom_));
|
||||||
RETURN_IF_ERROR(current_editor_set_->overworld_editor_.Load());
|
for (auto &editor : current_editor_set_->active_editors_) {
|
||||||
RETURN_IF_ERROR(current_editor_set_->dungeon_editor_.Load());
|
RETURN_IF_ERROR(editor->Load());
|
||||||
|
}
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,14 +140,6 @@ class EditorSet {
|
|||||||
MemoryEditorWithDiffChecker memory_editor_;
|
MemoryEditorWithDiffChecker memory_editor_;
|
||||||
|
|
||||||
std::vector<Editor*> active_editors_;
|
std::vector<Editor*> active_editors_;
|
||||||
|
|
||||||
void CleanupUnusedTextures(uint64_t current_time, uint64_t timeout) {
|
|
||||||
if (active_editors_.size() > 0) {
|
|
||||||
for (auto editor : active_editors_) {
|
|
||||||
editor->CleanupUnusedTextures(current_time, timeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
|
|||||||
Reference in New Issue
Block a user