Blender  V3.3
Classes | Namespaces
asset_list.cc File Reference
#include <optional>
#include <string>
#include "BKE_context.h"
#include "BLI_map.hh"
#include "BLI_path_util.h"
#include "BLI_utility_mixins.hh"
#include "DNA_space_types.h"
#include "BKE_preferences.h"
#include "ED_fileselect.h"
#include "WM_api.h"
#include "../space_file/file_indexer.h"
#include "../space_file/filelist.h"
#include "ED_asset_handle.h"
#include "ED_asset_indexer.h"
#include "ED_asset_list.h"
#include "ED_asset_list.hh"
#include "asset_library_reference.hh"

Go to the source code of this file.

Classes

class  blender::ed::asset::FileListWrapper
 
class  blender::ed::asset::PreviewTimer
 
class  blender::ed::asset::AssetList
 
class  blender::ed::asset::AssetListStorage
 

Namespaces

 blender
 
 blender::ed
 
 blender::ed::asset
 

Functions

C-API
void ED_assetlist_storage_fetch (const AssetLibraryReference *library_reference, const bContext *C)
 
void ED_assetlist_ensure_previews_job (const AssetLibraryReference *library_reference, bContext *C)
 
void ED_assetlist_clear (const AssetLibraryReference *library_reference, bContext *C)
 
bool ED_assetlist_storage_has_list_for_library (const AssetLibraryReference *library_reference)
 
void ED_assetlist_iterate (const AssetLibraryReference &library_reference, AssetListIterFn fn)
 
static const char * assetlist_library_path_from_sfile_get_hack (const bContext *C)
 
std::string ED_assetlist_asset_filepath_get (const bContext *C, const AssetLibraryReference &library_reference, const AssetHandle &asset_handle)
 
ImBufED_assetlist_asset_image_get (const AssetHandle *asset_handle)
 
const char * ED_assetlist_library_path (const AssetLibraryReference *library_reference)
 
bool ED_assetlist_listen (const AssetLibraryReference *library_reference, const wmNotifier *notifier)
 
int ED_assetlist_size (const AssetLibraryReference *library_reference)
 
void ED_assetlist_storage_tag_main_data_dirty ()
 
void ED_assetlist_storage_id_remap (ID *id_old, ID *id_new)
 
void ED_assetlist_storage_exit ()
 

Detailed Description

Abstractions to manage runtime asset lists with a global cache for multiple UI elements to access. Internally this uses the FileList API and structures from filelist.c. This is just because it contains most necessary logic already and there's not much time for a more long-term solution.

Definition in file asset_list.cc.

Function Documentation

◆ assetlist_library_path_from_sfile_get_hack()

static const char* assetlist_library_path_from_sfile_get_hack ( const bContext C)
static

◆ ED_assetlist_asset_filepath_get()

std::string ED_assetlist_asset_filepath_get ( const bContext C,
const AssetLibraryReference library_reference,
const AssetHandle asset_handle 
)

◆ ED_assetlist_asset_image_get()

ImBuf* ED_assetlist_asset_image_get ( const AssetHandle asset_handle)

◆ ED_assetlist_clear()

void ED_assetlist_clear ( const AssetLibraryReference library_reference,
bContext C 
)

◆ ED_assetlist_ensure_previews_job()

void ED_assetlist_ensure_previews_job ( const AssetLibraryReference library_reference,
bContext C 
)

◆ ED_assetlist_iterate()

void ED_assetlist_iterate ( const AssetLibraryReference library_reference,
AssetListIterFn  fn 
)

◆ ED_assetlist_library_path()

const char* ED_assetlist_library_path ( const AssetLibraryReference library_reference)

◆ ED_assetlist_listen()

bool ED_assetlist_listen ( const AssetLibraryReference library_reference,
const wmNotifier notifier 
)

◆ ED_assetlist_size()

int ED_assetlist_size ( const AssetLibraryReference library_reference)

◆ ED_assetlist_storage_exit()

void ED_assetlist_storage_exit ( void  )

Can't wait for static deallocation to run. There's nested data allocated with our guarded allocator, it will complain about unfreed memory on exit.

Definition at line 543 of file asset_list.cc.

References blender::ed::asset::AssetListStorage::destruct().

Referenced by WM_exit_ex().

◆ ED_assetlist_storage_fetch()

void ED_assetlist_storage_fetch ( const AssetLibraryReference library_reference,
const bContext C 
)

Definition at line 420 of file asset_list.cc.

References C, and blender::ed::asset::AssetListStorage::fetch_library().

◆ ED_assetlist_storage_has_list_for_library()

bool ED_assetlist_storage_has_list_for_library ( const AssetLibraryReference library_reference)

◆ ED_assetlist_storage_id_remap()

void ED_assetlist_storage_id_remap ( struct ID id_old,
struct ID id_new 
)

Remapping of ID pointers within the asset lists. Typically called when an ID is deleted to clear all references to it (id_new is null then).

Definition at line 538 of file asset_list.cc.

References blender::ed::asset::AssetListStorage::remapID().

Referenced by wm_main_remap_assetlist().

◆ ED_assetlist_storage_tag_main_data_dirty()

void ED_assetlist_storage_tag_main_data_dirty ( void  )

Tag all asset lists in the storage that show main data as needing an update (re-fetch).

This only tags the data. If the asset list is visible on screen, the space is still responsible for ensuring the necessary redraw. It can use ED_assetlist_listen() to check if the asset-list needs a redraw for a given notifier.

Definition at line 533 of file asset_list.cc.

References blender::ed::asset::AssetListStorage::tagMainDataDirty().

Referenced by asset_view_listener(), ED_asset_clear_id(), ED_asset_mark_id(), ED_editors_init(), ed_undo_step_post(), lib_id_generate_preview_exec(), and lib_id_generate_preview_from_object_exec().