[Bf-blender-cvs] [0151d846e8b] master: Fix MSVC warnings from recent asset system changes

Julian Eisel noreply at git.blender.org
Fri Nov 18 15:30:15 CET 2022


Commit: 0151d846e8b057f92d749de51ec53fcb8cb2890b
Author: Julian Eisel
Date:   Fri Nov 18 15:12:45 2022 +0100
Branches: master
https://developer.blender.org/rB0151d846e8b057f92d749de51ec53fcb8cb2890b

Fix MSVC warnings from recent asset system changes

* Mismatching class vs struct forward declaration (one forward
  declaration wasn't needed anymore)
* Unused member warning (`on_load_callback_store_`)

===================================================================

M	source/blender/asset_system/AS_asset_representation.hh
M	source/blender/asset_system/intern/asset_library_service.cc
M	source/blender/editors/space_file/file_intern.h

===================================================================

diff --git a/source/blender/asset_system/AS_asset_representation.hh b/source/blender/asset_system/AS_asset_representation.hh
index b53d85119a6..853222c8dc7 100644
--- a/source/blender/asset_system/AS_asset_representation.hh
+++ b/source/blender/asset_system/AS_asset_representation.hh
@@ -36,7 +36,6 @@ class AssetRepresentation {
     ID *local_asset_id_ = nullptr; /* Non-owning. */
   };
 
-  friend struct AssetLibrary;
   friend class AssetStorage;
 
  public:
diff --git a/source/blender/asset_system/intern/asset_library_service.cc b/source/blender/asset_system/intern/asset_library_service.cc
index 44c7f27af80..9bd2eecd468 100644
--- a/source/blender/asset_system/intern/asset_library_service.cc
+++ b/source/blender/asset_system/intern/asset_library_service.cc
@@ -146,19 +146,18 @@ void AssetLibraryService::allocate_service_instance()
   }
 }
 
-#ifdef WITH_DESTROY_VIA_LOAD_HANDLER
 static void on_blendfile_load(struct Main * /*bMain*/,
                               struct PointerRNA ** /*pointers*/,
                               const int /*num_pointers*/,
                               void * /*arg*/)
 {
+#ifdef WITH_DESTROY_VIA_LOAD_HANDLER
   AssetLibraryService::destroy();
-}
 #endif
+}
 
 void AssetLibraryService::app_handler_register()
 {
-#ifdef WITH_DESTROY_VIA_LOAD_HANDLER
   /* The callback system doesn't own `on_load_callback_store_`. */
   on_load_callback_store_.alloc = false;
 
@@ -166,16 +165,13 @@ void AssetLibraryService::app_handler_register()
   on_load_callback_store_.arg = this;
 
   BKE_callback_add(&on_load_callback_store_, BKE_CB_EVT_LOAD_PRE);
-#endif
 }
 
 void AssetLibraryService::app_handler_unregister()
 {
-#ifdef WITH_DESTROY_VIA_LOAD_HANDLER
   BKE_callback_remove(&on_load_callback_store_, BKE_CB_EVT_LOAD_PRE);
   on_load_callback_store_.func = nullptr;
   on_load_callback_store_.arg = nullptr;
-#endif
 }
 
 bool AssetLibraryService::has_any_unsaved_catalogs() const
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index f4577b960d3..ec9c8be42e3 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -226,7 +226,7 @@ void file_create_asset_catalog_tree_view_in_layout(struct AssetLibrary *asset_li
 #ifdef __cplusplus
 
 namespace blender::asset_system {
-struct AssetLibrary;
+class AssetLibrary;
 }
 
 FileAssetCatalogFilterSettingsHandle *file_create_asset_catalog_filter_settings(void);



More information about the Bf-blender-cvs mailing list