Cleanup: Move asset filter settings out of DNA #118285
|
@ -17,7 +17,6 @@
|
|||
#include "AS_asset_catalog_path.hh"
|
||||
#include "AS_asset_catalog_tree.hh"
|
||||
|
||||
struct AssetFilterSettings;
|
||||
struct AssetLibraryReference;
|
||||
struct bContext;
|
||||
|
||||
|
@ -28,6 +27,13 @@ class AssetRepresentation;
|
|||
|
||||
namespace blender::ed::asset {
|
||||
|
||||
struct AssetFilterSettings {
|
||||
/** Tags to match against. These are newly allocated, and compared against the
|
||||
* #AssetMetaData.tags. */
|
||||
ListBase tags; /* AssetTag */
|
||||
uint64_t id_types; /* rna_enum_id_type_filter_items */
|
||||
};
|
||||
|
||||
/**
|
||||
* Compare \a asset against the settings of \a filter.
|
||||
*
|
||||
|
|
|
@ -769,7 +769,7 @@ void clear_operator_asset_trees()
|
|||
|
||||
static asset::AssetItemTree build_catalog_tree(const bContext &C, const Object &active_object)
|
||||
{
|
||||
AssetFilterSettings type_filter{};
|
||||
asset::AssetFilterSettings type_filter{};
|
||||
type_filter.id_types = FILTER_ID_NT;
|
||||
const GeometryNodeAssetTraitFlag flag = asset_flag_for_context(active_object);
|
||||
auto meta_data_filter = [&](const AssetMetaData &meta_data) {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
/* Struct Declarations */
|
||||
|
||||
struct ARegion;
|
||||
struct AssetFilterSettings;
|
||||
struct AutoComplete;
|
||||
struct EnumPropertyItem;
|
||||
struct FileSelectParams;
|
||||
|
@ -68,6 +67,9 @@ struct wmOperator;
|
|||
struct wmOperatorType;
|
||||
struct wmRegionListenerParams;
|
||||
struct wmWindow;
|
||||
namespace blender::ed::asset {
|
||||
struct AssetFilterSettings;
|
||||
}
|
||||
|
||||
struct uiBlock;
|
||||
struct uiBut;
|
||||
|
@ -2697,7 +2699,7 @@ void uiTemplateAssetView(uiLayout *layout,
|
|||
const char *assets_propname,
|
||||
PointerRNA *active_dataptr,
|
||||
const char *active_propname,
|
||||
const AssetFilterSettings *filter_settings,
|
||||
const blender::ed::asset::AssetFilterSettings *filter_settings,
|
||||
int display_flags,
|
||||
const char *activate_opname,
|
||||
PointerRNA *r_activate_op_properties,
|
||||
|
|
|
@ -35,7 +35,7 @@ using namespace blender::ed;
|
|||
|
||||
struct AssetViewListData {
|
||||
AssetLibraryReference asset_library_ref;
|
||||
AssetFilterSettings filter_settings;
|
||||
asset::AssetFilterSettings filter_settings;
|
||||
bScreen *screen;
|
||||
bool show_names;
|
||||
};
|
||||
|
@ -118,7 +118,7 @@ static void asset_view_filter_items(uiList *ui_list,
|
|||
const char *propname)
|
||||
{
|
||||
AssetViewListData *list_data = (AssetViewListData *)ui_list->dyn_data->customdata;
|
||||
AssetFilterSettings &filter_settings = list_data->filter_settings;
|
||||
asset::AssetFilterSettings &filter_settings = list_data->filter_settings;
|
||||
|
||||
uiListNameFilter name_filter(*ui_list);
|
||||
|
||||
|
@ -219,7 +219,7 @@ void uiTemplateAssetView(uiLayout *layout,
|
|||
const char *assets_propname,
|
||||
PointerRNA *active_dataptr,
|
||||
const char *active_propname,
|
||||
const AssetFilterSettings *filter_settings,
|
||||
const asset::AssetFilterSettings *filter_settings,
|
||||
const int display_flags,
|
||||
const char *activate_opname,
|
||||
PointerRNA *r_activate_op_properties,
|
||||
|
|
|
@ -50,7 +50,7 @@ static bool all_loading_finished()
|
|||
|
||||
static asset::AssetItemTree build_catalog_tree(const bContext &C)
|
||||
{
|
||||
AssetFilterSettings type_filter{};
|
||||
asset::AssetFilterSettings type_filter{};
|
||||
type_filter.id_types = FILTER_ID_NT;
|
||||
auto meta_data_filter = [&](const AssetMetaData &meta_data) {
|
||||
const IDProperty *tree_type = BKE_asset_metadata_idprop_find(&meta_data, "type");
|
||||
|
|
|
@ -41,7 +41,7 @@ static bool all_loading_finished()
|
|||
|
||||
static asset::AssetItemTree build_catalog_tree(const bContext &C, const bNodeTree &node_tree)
|
||||
{
|
||||
AssetFilterSettings type_filter{};
|
||||
asset::AssetFilterSettings type_filter{};
|
||||
type_filter.id_types = FILTER_ID_NT;
|
||||
auto meta_data_filter = [&](const AssetMetaData &meta_data) {
|
||||
const IDProperty *tree_type = BKE_asset_metadata_idprop_find(&meta_data, "type");
|
||||
|
|
|
@ -233,7 +233,7 @@ static void gather_search_link_ops_for_asset_library(const bContext &C,
|
|||
const bool skip_local,
|
||||
Vector<SocketLinkOperation> &search_link_ops)
|
||||
{
|
||||
AssetFilterSettings filter_settings{};
|
||||
asset::AssetFilterSettings filter_settings{};
|
||||
filter_settings.id_types = FILTER_ID_NT;
|
||||
|
||||
asset::list::storage_fetch(&library_ref, &C);
|
||||
|
|
|
@ -32,15 +32,6 @@ typedef struct AssetTag {
|
|||
char name[64]; /* MAX_NAME */
|
||||
} AssetTag;
|
||||
|
||||
#
|
||||
#
|
||||
typedef struct AssetFilterSettings {
|
||||
/** Tags to match against. These are newly allocated, and compared against the
|
||||
* #AssetMetaData.tags. */
|
||||
ListBase tags; /* AssetTag */
|
||||
uint64_t id_types; /* rna_enum_id_type_filter_items */
|
||||
} AssetFilterSettings;
|
||||
|
||||
/**
|
||||
* \brief The meta-data of an asset.
|
||||
* By creating and giving this for a data-block (#ID.asset_data), the data-block becomes an asset.
|
||||
|
|
|
@ -37,6 +37,7 @@ const EnumPropertyItem rna_enum_icon_items[] = {
|
|||
|
||||
# include "DNA_asset_types.h"
|
||||
|
||||
# include "ED_asset_filter.hh"
|
||||
# include "ED_geometry.hh"
|
||||
# include "ED_node.hh"
|
||||
# include "ED_object.hh"
|
||||
|
@ -720,7 +721,7 @@ static void rna_uiTemplateAssetView(uiLayout *layout,
|
|||
const char *drag_opname,
|
||||
PointerRNA *r_drag_op_properties)
|
||||
{
|
||||
AssetFilterSettings filter_settings{};
|
||||
blender::ed::asset::AssetFilterSettings filter_settings{};
|
||||
filter_settings.id_types = filter_id_types ? filter_id_types : FILTER_ID_ALL;
|
||||
|
||||
uiTemplateAssetView(layout,
|
||||
|
|
Loading…
Reference in New Issue