Cleanup: Avoid unnecessary/annoying type alias in asset system
A `using FooPtr = std::unique_ptr<Foo>` isn't that useful usually, just saves a few character stokes. It obfuscates the underlying type, which is usually relevant information. Plus, `Ptr` for a unique pointer is misleading (should be `UPtr` or similar).
This commit is contained in:
parent
61d0f77810
commit
d5c8d3e661
|
@ -98,7 +98,8 @@ AssetLibrary *AssetLibraryService::get_asset_library_on_disk(StringRefNull top_l
|
|||
|
||||
std::string top_dir_trailing_slash = normalize_directory_path(top_level_directory);
|
||||
|
||||
AssetLibraryPtr *lib_uptr_ptr = on_disk_libraries_.lookup_ptr(top_dir_trailing_slash);
|
||||
std::unique_ptr<AssetLibrary> *lib_uptr_ptr = on_disk_libraries_.lookup_ptr(
|
||||
top_dir_trailing_slash);
|
||||
if (lib_uptr_ptr != nullptr) {
|
||||
CLOG_INFO(&LOG, 2, "get \"%s\" (cached)", top_dir_trailing_slash.c_str());
|
||||
AssetLibrary *lib = lib_uptr_ptr->get();
|
||||
|
@ -106,7 +107,7 @@ AssetLibrary *AssetLibraryService::get_asset_library_on_disk(StringRefNull top_l
|
|||
return lib;
|
||||
}
|
||||
|
||||
AssetLibraryPtr lib_uptr = std::make_unique<AssetLibrary>();
|
||||
std::unique_ptr lib_uptr = std::make_unique<AssetLibrary>();
|
||||
AssetLibrary *lib = lib_uptr.get();
|
||||
|
||||
lib->on_blend_save_handler_register();
|
||||
|
|
|
@ -31,16 +31,14 @@ namespace blender::asset_system {
|
|||
* loaded from a file on disk).
|
||||
*/
|
||||
class AssetLibraryService {
|
||||
using AssetLibraryPtr = std::unique_ptr<AssetLibrary>;
|
||||
|
||||
static std::unique_ptr<AssetLibraryService> instance_;
|
||||
|
||||
/* Mapping absolute path of the library's top-level directory to the AssetLibrary instance. */
|
||||
Map<std::string, AssetLibraryPtr> on_disk_libraries_;
|
||||
Map<std::string, std::unique_ptr<AssetLibrary>> on_disk_libraries_;
|
||||
/** Library without a known path, i.e. the "Current File" library if the file isn't saved yet. If
|
||||
* the file was saved, a valid path for the library can be determined and #on_disk_libraries_
|
||||
* above should be used. */
|
||||
AssetLibraryPtr current_file_library_;
|
||||
std::unique_ptr<AssetLibrary> current_file_library_;
|
||||
|
||||
/* Handlers for managing the life cycle of the AssetLibraryService instance. */
|
||||
bCallbackFuncStore on_load_callback_store_;
|
||||
|
|
Loading…
Reference in New Issue