Various UI code would store the `AssetHandle` in a way that turns out to be unsafe. The file-data is part of the file browser caching system that releases file-data when a certain maximum of items is in the cache. So even while just iterating over the assets, earlier iterated asset handles may become invalid. Now asset handles are really treated as volatile, short lived objects. For the asset-view, the fix was more involved. There we need an RNA collection of asset-handles, because the UI list code requires that. So we create a dummy collection and get the asset handles as needed by index. This again meant that I had to keep the index of the collection and the asset-list in sync, so all filtering had to be moved to the UI list. I tried duplicating the file-data out of the cache instead, but that caused problems with managing the memory/ownership of the preview images. `AssetHandle` should be removed and replaced by `AssetRepresentation`, but this would be an even more disruptive change (breaking API compatibility too). Fixes #104305, #105535. Pull Request: #105773
40 lines
931 B
C++
40 lines
931 B
C++
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup editors
|
|
*
|
|
* The public API for assets is defined in dedicated headers. This is a utility file that just
|
|
* includes all of these.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Barely anything here. Just general editor level functions. Actual asset level code is in
|
|
* dedicated headers. */
|
|
|
|
void ED_operatortypes_asset(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#include "../asset/ED_asset_catalog.h"
|
|
#include "../asset/ED_asset_filter.h"
|
|
#include "../asset/ED_asset_handle.h"
|
|
#include "../asset/ED_asset_import.h"
|
|
#include "../asset/ED_asset_library.h"
|
|
#include "../asset/ED_asset_list.h"
|
|
#include "../asset/ED_asset_mark_clear.h"
|
|
#include "../asset/ED_asset_temp_id_consumer.h"
|
|
#include "../asset/ED_asset_type.h"
|
|
|
|
/* C++ only headers. */
|
|
#ifdef __cplusplus
|
|
# include "../asset/ED_asset_catalog.hh"
|
|
# include "../asset/ED_asset_list.hh"
|
|
#endif
|