Cleanup: Remove unnecessary AssetLibrary C wrapper type
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "BKE_callbacks.h"
|
||||
|
||||
struct AssetLibrary;
|
||||
struct IDRemapper;
|
||||
struct Main;
|
||||
|
||||
@@ -232,9 +231,9 @@ std::string AS_asset_library_find_suitable_root_path_from_path(blender::StringRe
|
||||
std::string AS_asset_library_find_suitable_root_path_from_main(const Main *bmain);
|
||||
|
||||
blender::asset_system::AssetCatalogService *AS_asset_library_get_catalog_service(
|
||||
const ::AssetLibrary *library);
|
||||
const blender::asset_system::AssetLibrary *library);
|
||||
blender::asset_system::AssetCatalogTree *AS_asset_library_get_catalog_tree(
|
||||
const ::AssetLibrary *library);
|
||||
const blender::asset_system::AssetLibrary *library);
|
||||
|
||||
/**
|
||||
* Force clearing of all asset library data. After calling this, new asset libraries can be loaded
|
||||
@@ -251,11 +250,12 @@ void AS_asset_libraries_exit();
|
||||
*
|
||||
* To get the in-memory-only "current file" asset library, pass an empty path.
|
||||
*/
|
||||
::AssetLibrary *AS_asset_library_load(const char *name, const char *library_dirpath);
|
||||
blender::asset_system::AssetLibrary *AS_asset_library_load(const char *name,
|
||||
const char *library_dirpath);
|
||||
|
||||
/** Look up the asset's catalog and copy its simple name into #asset_data. */
|
||||
void AS_asset_library_refresh_catalog_simplename(::AssetLibrary *asset_library,
|
||||
AssetMetaData *asset_data);
|
||||
void AS_asset_library_refresh_catalog_simplename(
|
||||
blender::asset_system::AssetLibrary *asset_library, AssetMetaData *asset_data);
|
||||
|
||||
/** Return whether any loaded AssetLibrary has unsaved changes to its catalogs. */
|
||||
bool AS_asset_library_has_any_unsaved_catalogs(void);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
using namespace blender;
|
||||
using namespace blender::asset_system;
|
||||
|
||||
bool asset_system::AssetLibrary::save_catalogs_when_file_is_saved = true;
|
||||
bool AssetLibrary::save_catalogs_when_file_is_saved = true;
|
||||
|
||||
void AS_asset_libraries_exit()
|
||||
{
|
||||
@@ -39,27 +39,27 @@ void AS_asset_libraries_exit()
|
||||
AssetLibraryService::destroy();
|
||||
}
|
||||
|
||||
asset_system::AssetLibrary *AS_asset_library_load(const Main *bmain,
|
||||
const AssetLibraryReference &library_reference)
|
||||
AssetLibrary *AS_asset_library_load(const Main *bmain,
|
||||
const AssetLibraryReference &library_reference)
|
||||
{
|
||||
AssetLibraryService *service = AssetLibraryService::get();
|
||||
return service->get_asset_library(bmain, library_reference);
|
||||
}
|
||||
|
||||
::AssetLibrary *AS_asset_library_load(const char *name, const char *library_dirpath)
|
||||
AssetLibrary *AS_asset_library_load(const char *name, const char *library_dirpath)
|
||||
{
|
||||
/* NOTE: Loading an asset library at this point only means loading the catalogs.
|
||||
* Later on this should invoke reading of asset representations too. */
|
||||
|
||||
AssetLibraryService *service = AssetLibraryService::get();
|
||||
asset_system::AssetLibrary *lib;
|
||||
AssetLibrary *lib;
|
||||
if (library_dirpath == nullptr || library_dirpath[0] == '\0') {
|
||||
lib = service->get_asset_library_current_file();
|
||||
}
|
||||
else {
|
||||
lib = service->get_asset_library_on_disk_custom(name, library_dirpath);
|
||||
}
|
||||
return reinterpret_cast<::AssetLibrary *>(lib);
|
||||
return lib;
|
||||
}
|
||||
|
||||
bool AS_asset_library_has_any_unsaved_catalogs()
|
||||
@@ -93,18 +93,15 @@ std::string AS_asset_library_find_suitable_root_path_from_main(const Main *bmain
|
||||
return AS_asset_library_find_suitable_root_path_from_path(bmain->filepath);
|
||||
}
|
||||
|
||||
AssetCatalogService *AS_asset_library_get_catalog_service(const ::AssetLibrary *library_c)
|
||||
AssetCatalogService *AS_asset_library_get_catalog_service(const AssetLibrary *library)
|
||||
{
|
||||
if (library_c == nullptr) {
|
||||
if (library == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const asset_system::AssetLibrary &library = reinterpret_cast<const asset_system::AssetLibrary &>(
|
||||
*library_c);
|
||||
return library.catalog_service.get();
|
||||
return library->catalog_service.get();
|
||||
}
|
||||
|
||||
AssetCatalogTree *AS_asset_library_get_catalog_tree(const ::AssetLibrary *library)
|
||||
AssetCatalogTree *AS_asset_library_get_catalog_tree(const AssetLibrary *library)
|
||||
{
|
||||
AssetCatalogService *catalog_service = AS_asset_library_get_catalog_service(library);
|
||||
if (catalog_service == nullptr) {
|
||||
@@ -114,20 +111,17 @@ AssetCatalogTree *AS_asset_library_get_catalog_tree(const ::AssetLibrary *librar
|
||||
return catalog_service->get_catalog_tree();
|
||||
}
|
||||
|
||||
void AS_asset_library_refresh_catalog_simplename(::AssetLibrary *asset_library,
|
||||
void AS_asset_library_refresh_catalog_simplename(AssetLibrary *asset_library,
|
||||
AssetMetaData *asset_data)
|
||||
{
|
||||
asset_system::AssetLibrary *lib = reinterpret_cast<asset_system::AssetLibrary *>(asset_library);
|
||||
lib->refresh_catalog_simplename(asset_data);
|
||||
asset_library->refresh_catalog_simplename(asset_data);
|
||||
}
|
||||
|
||||
void AS_asset_library_remap_ids(const IDRemapper *mappings)
|
||||
{
|
||||
AssetLibraryService *service = AssetLibraryService::get();
|
||||
service->foreach_loaded_asset_library(
|
||||
[mappings](asset_system::AssetLibrary &library) {
|
||||
library.remap_ids_and_remove_invalid(*mappings);
|
||||
},
|
||||
[mappings](AssetLibrary &library) { library.remap_ids_and_remove_invalid(*mappings); },
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "AS_asset_catalog.hh"
|
||||
#include "AS_asset_library.hh"
|
||||
#include "AS_asset_library.hh"
|
||||
|
||||
#include "BKE_callbacks.h"
|
||||
|
||||
@@ -44,13 +43,11 @@ TEST_F(AssetLibraryTest, AS_asset_library_load)
|
||||
|
||||
/* Load the asset library. */
|
||||
const std::string library_dirpath = test_files_dir + "/" + "asset_library";
|
||||
::AssetLibrary *library_c_ptr = AS_asset_library_load(__func__, library_dirpath.data());
|
||||
ASSERT_NE(nullptr, library_c_ptr);
|
||||
AssetLibrary *library = AS_asset_library_load(__func__, library_dirpath.data());
|
||||
ASSERT_NE(nullptr, library);
|
||||
|
||||
/* Check that it can be cast to the C++ type and has a Catalog Service. */
|
||||
asset_system::AssetLibrary *library_cpp_ptr = reinterpret_cast<asset_system::AssetLibrary *>(
|
||||
library_c_ptr);
|
||||
AssetCatalogService *service = library_cpp_ptr->catalog_service.get();
|
||||
AssetCatalogService *service = library->catalog_service.get();
|
||||
ASSERT_NE(nullptr, service);
|
||||
|
||||
/* Check that the catalogs defined in the library are actually loaded. This just tests one single
|
||||
@@ -72,13 +69,11 @@ TEST_F(AssetLibraryTest, load_nonexistent_directory)
|
||||
/* Load the asset library. */
|
||||
const std::string library_dirpath = test_files_dir + "/" +
|
||||
"asset_library/this/subdir/does/not/exist";
|
||||
::AssetLibrary *library_c_ptr = AS_asset_library_load(__func__, library_dirpath.data());
|
||||
ASSERT_NE(nullptr, library_c_ptr);
|
||||
AssetLibrary *library = AS_asset_library_load(__func__, library_dirpath.data());
|
||||
ASSERT_NE(nullptr, library);
|
||||
|
||||
/* Check that it can be cast to the C++ type and has a Catalog Service. */
|
||||
asset_system::AssetLibrary *library_cpp_ptr = reinterpret_cast<asset_system::AssetLibrary *>(
|
||||
library_c_ptr);
|
||||
AssetCatalogService *service = library_cpp_ptr->catalog_service.get();
|
||||
AssetCatalogService *service = library->catalog_service.get();
|
||||
ASSERT_NE(nullptr, service);
|
||||
|
||||
/* Check that the catalog service doesn't have any catalogs. */
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
struct AssetLibrary;
|
||||
struct bScreen;
|
||||
|
||||
void ED_asset_catalogs_save_from_main_path(::AssetLibrary *library, const Main *bmain);
|
||||
void ED_asset_catalogs_save_from_main_path(blender::asset_system::AssetLibrary *library,
|
||||
const Main *bmain);
|
||||
|
||||
/**
|
||||
* Saving catalog edits when the file is saved is a global option shared for each asset library,
|
||||
@@ -39,16 +39,16 @@ bool ED_asset_catalogs_get_save_catalogs_when_file_is_saved(void);
|
||||
* Returns if the catalogs of \a library are allowed to be editable, or if the UI should forbid
|
||||
* edits.
|
||||
*/
|
||||
[[nodiscard]] bool ED_asset_catalogs_read_only(const ::AssetLibrary &library);
|
||||
[[nodiscard]] bool ED_asset_catalogs_read_only(const blender::asset_system::AssetLibrary &library);
|
||||
|
||||
blender::asset_system::AssetCatalog *ED_asset_catalog_add(
|
||||
::AssetLibrary *library,
|
||||
blender::asset_system::AssetLibrary *library,
|
||||
blender::StringRefNull name,
|
||||
blender::StringRef parent_path = nullptr);
|
||||
void ED_asset_catalog_remove(::AssetLibrary *library,
|
||||
void ED_asset_catalog_remove(blender::asset_system::AssetLibrary *library,
|
||||
const blender::asset_system::CatalogID &catalog_id);
|
||||
|
||||
void ED_asset_catalog_rename(::AssetLibrary *library,
|
||||
void ED_asset_catalog_rename(blender::asset_system::AssetLibrary *library,
|
||||
blender::asset_system::CatalogID catalog_id,
|
||||
blender::StringRefNull new_name);
|
||||
/**
|
||||
@@ -63,6 +63,6 @@ void ED_asset_catalog_rename(::AssetLibrary *library,
|
||||
* Nothing is done (debug builds run into an assert) if the given catalog IDs can't be identified.
|
||||
*/
|
||||
void ED_asset_catalog_move(
|
||||
::AssetLibrary *library,
|
||||
blender::asset_system::AssetLibrary *library,
|
||||
blender::asset_system::CatalogID src_catalog_id,
|
||||
std::optional<blender::asset_system::CatalogID> dst_parent_catalog_id = std::nullopt);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_prototypes.h"
|
||||
|
||||
#include "ED_asset_catalog.hh"
|
||||
#include "ED_asset_catalog.hh"
|
||||
|
||||
#include "WM_api.hh"
|
||||
@@ -26,7 +25,7 @@
|
||||
using namespace blender;
|
||||
using namespace blender::asset_system;
|
||||
|
||||
bool ED_asset_catalogs_read_only(const ::AssetLibrary &library)
|
||||
bool ED_asset_catalogs_read_only(const AssetLibrary &library)
|
||||
{
|
||||
asset_system::AssetCatalogService *catalog_service = AS_asset_library_get_catalog_service(
|
||||
&library);
|
||||
@@ -58,7 +57,7 @@ static std::string catalog_name_ensure_unique(AssetCatalogService &catalog_servi
|
||||
return unique_name;
|
||||
}
|
||||
|
||||
asset_system::AssetCatalog *ED_asset_catalog_add(::AssetLibrary *library,
|
||||
asset_system::AssetCatalog *ED_asset_catalog_add(AssetLibrary *library,
|
||||
StringRefNull name,
|
||||
StringRef parent_path)
|
||||
{
|
||||
@@ -85,7 +84,7 @@ asset_system::AssetCatalog *ED_asset_catalog_add(::AssetLibrary *library,
|
||||
return new_catalog;
|
||||
}
|
||||
|
||||
void ED_asset_catalog_remove(::AssetLibrary *library, const CatalogID &catalog_id)
|
||||
void ED_asset_catalog_remove(AssetLibrary *library, const CatalogID &catalog_id)
|
||||
{
|
||||
asset_system::AssetCatalogService *catalog_service = AS_asset_library_get_catalog_service(
|
||||
library);
|
||||
@@ -103,7 +102,7 @@ void ED_asset_catalog_remove(::AssetLibrary *library, const CatalogID &catalog_i
|
||||
WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr);
|
||||
}
|
||||
|
||||
void ED_asset_catalog_rename(::AssetLibrary *library,
|
||||
void ED_asset_catalog_rename(AssetLibrary *library,
|
||||
const CatalogID catalog_id,
|
||||
const StringRefNull new_name)
|
||||
{
|
||||
@@ -133,7 +132,7 @@ void ED_asset_catalog_rename(::AssetLibrary *library,
|
||||
WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr);
|
||||
}
|
||||
|
||||
void ED_asset_catalog_move(::AssetLibrary *library,
|
||||
void ED_asset_catalog_move(AssetLibrary *library,
|
||||
const CatalogID src_catalog_id,
|
||||
const std::optional<CatalogID> dst_parent_catalog_id)
|
||||
{
|
||||
@@ -179,7 +178,7 @@ void ED_asset_catalog_move(::AssetLibrary *library,
|
||||
WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr);
|
||||
}
|
||||
|
||||
void ED_asset_catalogs_save_from_main_path(::AssetLibrary *library, const Main *bmain)
|
||||
void ED_asset_catalogs_save_from_main_path(AssetLibrary *library, const Main *bmain)
|
||||
{
|
||||
asset_system::AssetCatalogService *catalog_service = AS_asset_library_get_catalog_service(
|
||||
library);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* \ingroup edasset
|
||||
*/
|
||||
|
||||
#include "AS_asset_library.hh"
|
||||
#include "AS_asset_library.hh"
|
||||
#include "AS_asset_representation.hh"
|
||||
|
||||
@@ -501,7 +500,8 @@ static bool asset_catalog_operator_poll(bContext *C)
|
||||
if (!sfile) {
|
||||
return false;
|
||||
}
|
||||
const AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(sfile);
|
||||
const blender::asset_system::AssetLibrary *asset_library =
|
||||
ED_fileselect_active_asset_library_get(sfile);
|
||||
if (!asset_library) {
|
||||
return false;
|
||||
}
|
||||
@@ -515,7 +515,8 @@ static bool asset_catalog_operator_poll(bContext *C)
|
||||
static int asset_catalog_new_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(sfile);
|
||||
blender::asset_system::AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(
|
||||
sfile);
|
||||
char *parent_path = RNA_string_get_alloc(op->ptr, "parent_path", nullptr, 0, nullptr);
|
||||
|
||||
blender::asset_system::AssetCatalog *new_catalog = ED_asset_catalog_add(
|
||||
@@ -555,7 +556,8 @@ static void ASSET_OT_catalog_new(wmOperatorType *ot)
|
||||
static int asset_catalog_delete_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(sfile);
|
||||
blender::asset_system::AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(
|
||||
sfile);
|
||||
char *catalog_id_str = RNA_string_get_alloc(op->ptr, "catalog_id", nullptr, 0, nullptr);
|
||||
asset_system::CatalogID catalog_id;
|
||||
if (!BLI_uuid_parse_string(&catalog_id, catalog_id_str)) {
|
||||
@@ -595,7 +597,7 @@ static asset_system::AssetCatalogService *get_catalog_service(bContext *C)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AssetLibrary *asset_lib = ED_fileselect_active_asset_library_get(sfile);
|
||||
blender::asset_system::AssetLibrary *asset_lib = ED_fileselect_active_asset_library_get(sfile);
|
||||
return AS_asset_library_get_catalog_service(asset_lib);
|
||||
}
|
||||
|
||||
@@ -715,7 +717,8 @@ static bool asset_catalogs_save_poll(bContext *C)
|
||||
static int asset_catalogs_save_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
const SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
::AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(sfile);
|
||||
blender::asset_system::AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(
|
||||
sfile);
|
||||
|
||||
ED_asset_catalogs_save_from_main_path(asset_library, CTX_data_main(C));
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "ED_asset_handle.hh"
|
||||
#include "ED_asset_list.hh"
|
||||
#include "ED_asset_list.hh"
|
||||
#include "ED_asset_shelf.hh"
|
||||
|
||||
#include "UI_grid_view.hh"
|
||||
@@ -171,7 +170,7 @@ static std::optional<asset_system::AssetCatalogFilter> catalog_filter_from_shelf
|
||||
return {};
|
||||
}
|
||||
|
||||
asset_system ::AssetCatalog *active_catalog = library.catalog_service->find_catalog_by_path(
|
||||
asset_system::AssetCatalog *active_catalog = library.catalog_service->find_catalog_by_path(
|
||||
shelf_settings.active_catalog_path);
|
||||
if (!active_catalog) {
|
||||
return {};
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "RNA_types.hh"
|
||||
|
||||
struct AssetLibrary;
|
||||
struct bScreen;
|
||||
struct uiLayout;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "DNA_uuid_types.h"
|
||||
|
||||
struct ARegion;
|
||||
struct AssetLibrary;
|
||||
struct FileAssetSelectParams;
|
||||
struct FileDirEntry;
|
||||
struct FileSelectParams;
|
||||
@@ -28,6 +27,9 @@ struct wmWindow;
|
||||
struct wmWindowManager;
|
||||
struct View2D;
|
||||
struct rcti;
|
||||
namespace blender::asset_system {
|
||||
class AssetLibrary;
|
||||
}
|
||||
|
||||
#define FILE_LAYOUT_HOR 1
|
||||
#define FILE_LAYOUT_VER 2
|
||||
@@ -140,7 +142,8 @@ void ED_fileselect_exit(wmWindowManager *wm, SpaceFile *sfile);
|
||||
|
||||
bool ED_fileselect_is_file_browser(const SpaceFile *sfile);
|
||||
bool ED_fileselect_is_asset_browser(const SpaceFile *sfile);
|
||||
AssetLibrary *ED_fileselect_active_asset_library_get(const SpaceFile *sfile);
|
||||
blender::asset_system::AssetLibrary *ED_fileselect_active_asset_library_get(
|
||||
const SpaceFile *sfile);
|
||||
ID *ED_fileselect_active_asset_get(const SpaceFile *sfile);
|
||||
|
||||
void ED_fileselect_activate_asset_catalog(const SpaceFile *sfile, bUUID catalog_id);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace blender::ed::asset_browser {
|
||||
class AssetCatalogTreeViewAllItem;
|
||||
|
||||
class AssetCatalogTreeView : public ui::AbstractTreeView {
|
||||
::AssetLibrary *asset_library_;
|
||||
asset_system::AssetLibrary *asset_library_;
|
||||
/** The asset catalog tree this tree-view represents. */
|
||||
asset_system::AssetCatalogTree *catalog_tree_;
|
||||
FileAssetSelectParams *params_;
|
||||
@@ -55,7 +55,7 @@ class AssetCatalogTreeView : public ui::AbstractTreeView {
|
||||
friend class AssetCatalogTreeViewAllItem;
|
||||
|
||||
public:
|
||||
AssetCatalogTreeView(::AssetLibrary *library,
|
||||
AssetCatalogTreeView(asset_system::AssetLibrary *library,
|
||||
FileAssetSelectParams *params,
|
||||
SpaceFile &space_file);
|
||||
|
||||
@@ -117,11 +117,12 @@ class AssetCatalogDropTarget : public ui::TreeViewItemDropTarget {
|
||||
std::string drop_tooltip(const ui::DragInfo &drag_info) const override;
|
||||
bool on_drop(bContext *C, const ui::DragInfo &drag_info) const override;
|
||||
|
||||
::AssetLibrary &get_asset_library() const;
|
||||
asset_system::AssetLibrary &get_asset_library() const;
|
||||
|
||||
static AssetCatalog *get_drag_catalog(const wmDrag &drag, const ::AssetLibrary &asset_library);
|
||||
static AssetCatalog *get_drag_catalog(const wmDrag &drag,
|
||||
const asset_system::AssetLibrary &asset_library);
|
||||
static bool has_droppable_asset(const wmDrag &drag, const char **r_disabled_hint);
|
||||
static bool can_modify_catalogs(const ::AssetLibrary &asset_library,
|
||||
static bool can_modify_catalogs(const asset_system::AssetLibrary &asset_library,
|
||||
const char **r_disabled_hint);
|
||||
static bool drop_assets_into_catalog(bContext *C,
|
||||
const AssetCatalogTreeView &tree_view,
|
||||
@@ -177,7 +178,7 @@ class AssetCatalogTreeViewUnassignedItem : public ui::BasicTreeViewItem {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
AssetCatalogTreeView::AssetCatalogTreeView(::AssetLibrary *library,
|
||||
AssetCatalogTreeView::AssetCatalogTreeView(asset_system::AssetLibrary *library,
|
||||
FileAssetSelectParams *params,
|
||||
SpaceFile &space_file)
|
||||
: asset_library_(library),
|
||||
@@ -366,7 +367,7 @@ AssetCatalogDropTarget::AssetCatalogDropTarget(AssetCatalogTreeViewItem &item,
|
||||
bool AssetCatalogDropTarget::can_drop(const wmDrag &drag, const char **r_disabled_hint) const
|
||||
{
|
||||
if (drag.type == WM_DRAG_ASSET_CATALOG) {
|
||||
const ::AssetLibrary &library = get_asset_library();
|
||||
const asset_system::AssetLibrary &library = get_asset_library();
|
||||
if (!can_modify_catalogs(library, r_disabled_hint)) {
|
||||
return false;
|
||||
}
|
||||
@@ -496,8 +497,8 @@ bool AssetCatalogDropTarget::drop_assets_into_catalog(bContext *C,
|
||||
return true;
|
||||
}
|
||||
|
||||
AssetCatalog *AssetCatalogDropTarget::get_drag_catalog(const wmDrag &drag,
|
||||
const ::AssetLibrary &asset_library)
|
||||
AssetCatalog *AssetCatalogDropTarget::get_drag_catalog(
|
||||
const wmDrag &drag, const asset_system::AssetLibrary &asset_library)
|
||||
{
|
||||
if (drag.type != WM_DRAG_ASSET_CATALOG) {
|
||||
return nullptr;
|
||||
@@ -525,7 +526,7 @@ bool AssetCatalogDropTarget::has_droppable_asset(const wmDrag &drag, const char
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AssetCatalogDropTarget::can_modify_catalogs(const ::AssetLibrary &library,
|
||||
bool AssetCatalogDropTarget::can_modify_catalogs(const asset_system::AssetLibrary &library,
|
||||
const char **r_disabled_hint)
|
||||
{
|
||||
if (ED_asset_catalogs_read_only(library)) {
|
||||
@@ -535,7 +536,7 @@ bool AssetCatalogDropTarget::can_modify_catalogs(const ::AssetLibrary &library,
|
||||
return true;
|
||||
}
|
||||
|
||||
::AssetLibrary &AssetCatalogDropTarget::get_asset_library() const
|
||||
asset_system::AssetLibrary &AssetCatalogDropTarget::get_asset_library() const
|
||||
{
|
||||
return *get_view<AssetCatalogTreeView>().asset_library_;
|
||||
}
|
||||
@@ -600,7 +601,7 @@ bool AssetCatalogTreeViewAllItem::DropTarget::can_drop(const wmDrag &drag,
|
||||
if (drag.type != WM_DRAG_ASSET_CATALOG) {
|
||||
return false;
|
||||
}
|
||||
::AssetLibrary &library = *get_view<AssetCatalogTreeView>().asset_library_;
|
||||
asset_system::AssetLibrary &library = *get_view<AssetCatalogTreeView>().asset_library_;
|
||||
if (!AssetCatalogDropTarget::can_modify_catalogs(library, r_disabled_hint)) {
|
||||
return false;
|
||||
}
|
||||
@@ -771,7 +772,7 @@ bool file_is_asset_visible_in_catalog_filter_settings(
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void file_create_asset_catalog_tree_view_in_layout(::AssetLibrary *asset_library,
|
||||
void file_create_asset_catalog_tree_view_in_layout(asset_system::AssetLibrary *asset_library,
|
||||
uiLayout *layout,
|
||||
SpaceFile *space_file,
|
||||
FileAssetSelectParams *params)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
struct ARegion;
|
||||
struct ARegionType;
|
||||
struct AssetLibrary;
|
||||
struct bContextDataResult;
|
||||
struct FileAssetSelectParams;
|
||||
struct FileSelectParams;
|
||||
@@ -228,10 +227,11 @@ void file_path_to_ui_path(const char *path, char *r_pathi, int max_size);
|
||||
/* C-handle for #ed::asset_browser::AssetCatalogFilterSettings. */
|
||||
struct FileAssetCatalogFilterSettingsHandle;
|
||||
|
||||
void file_create_asset_catalog_tree_view_in_layout(::AssetLibrary *asset_library,
|
||||
uiLayout *layout,
|
||||
SpaceFile *space_file,
|
||||
FileAssetSelectParams *params);
|
||||
void file_create_asset_catalog_tree_view_in_layout(
|
||||
blender::asset_system::AssetLibrary *asset_library,
|
||||
uiLayout *layout,
|
||||
SpaceFile *space_file,
|
||||
FileAssetSelectParams *params);
|
||||
|
||||
namespace blender::asset_system {
|
||||
class AssetLibrary;
|
||||
|
||||
@@ -225,7 +225,7 @@ static void file_panel_asset_catalog_buttons_draw(const bContext *C, Panel *pane
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
/* May be null if the library wasn't loaded yet. */
|
||||
AssetLibrary *asset_library = filelist_asset_library(sfile->files);
|
||||
blender::asset_system::AssetLibrary *asset_library = filelist_asset_library(sfile->files);
|
||||
FileAssetSelectParams *params = ED_fileselect_get_asset_params(sfile);
|
||||
BLI_assert(params != nullptr);
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#include "AS_asset_library.hh"
|
||||
#include "AS_asset_library.hh"
|
||||
#include "AS_asset_representation.hh"
|
||||
|
||||
@@ -1948,9 +1947,9 @@ void filelist_free(FileList *filelist)
|
||||
filelist->flags &= ~(FL_NEED_SORTING | FL_NEED_FILTERING);
|
||||
}
|
||||
|
||||
AssetLibrary *filelist_asset_library(FileList *filelist)
|
||||
blender::asset_system::AssetLibrary *filelist_asset_library(FileList *filelist)
|
||||
{
|
||||
return reinterpret_cast<::AssetLibrary *>(filelist->asset_library);
|
||||
return filelist->asset_library;
|
||||
}
|
||||
|
||||
void filelist_freelib(FileList *filelist)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
struct AssetLibrary;
|
||||
struct AssetLibraryReference;
|
||||
struct bContext;
|
||||
struct BlendHandle;
|
||||
@@ -19,6 +18,9 @@ struct ID;
|
||||
struct ImBuf;
|
||||
struct bUUID;
|
||||
struct wmWindowManager;
|
||||
namespace blender::asset_system {
|
||||
class AssetLibrary;
|
||||
}
|
||||
|
||||
struct FileDirEntry;
|
||||
|
||||
@@ -197,7 +199,7 @@ void filelist_entry_parent_select_set(FileList *filelist,
|
||||
|
||||
void filelist_setrecursion(FileList *filelist, int recursion_level);
|
||||
|
||||
AssetLibrary *filelist_asset_library(FileList *filelist);
|
||||
blender::asset_system::AssetLibrary *filelist_asset_library(FileList *filelist);
|
||||
|
||||
BlendHandle *filelist_lib(FileList *filelist);
|
||||
/**
|
||||
|
||||
@@ -469,7 +469,7 @@ bool ED_fileselect_is_asset_browser(const SpaceFile *sfile)
|
||||
return (sfile->browse_mode == FILE_BROWSE_MODE_ASSETS);
|
||||
}
|
||||
|
||||
AssetLibrary *ED_fileselect_active_asset_library_get(const SpaceFile *sfile)
|
||||
blender::asset_system::AssetLibrary *ED_fileselect_active_asset_library_get(const SpaceFile *sfile)
|
||||
{
|
||||
if (!ED_fileselect_is_asset_browser(sfile) || !sfile->files) {
|
||||
return nullptr;
|
||||
|
||||
@@ -355,7 +355,8 @@ void rna_AssetMetaData_catalog_id_update(bContext *C, PointerRNA *ptr)
|
||||
return;
|
||||
}
|
||||
|
||||
::AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(sfile);
|
||||
blender::asset_system::AssetLibrary *asset_library = ED_fileselect_active_asset_library_get(
|
||||
sfile);
|
||||
if (asset_library == nullptr) {
|
||||
/* The SpaceFile may not be an asset browser but a regular file browser. */
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user