67 prv->
runtime->deferred_loading_data =
68 std::make_unique<blender::bke::PreviewDeferredLoadingData>();
69 prv->
runtime->deferred_loading_data->filepath = filepath;
70 prv->
runtime->deferred_loading_data->source = source;
83 prv->
runtime = MEM_new<blender::bke::PreviewImageRuntime>(__func__);
91 if ((*prv)->rect[
i]) {
94 if ((*prv)->runtime->gputexture[
i]) {
99 MEM_delete((*prv)->runtime);
155 *prv_img = blender::dna::shallow_copy(*prv);
156 prv_img->
runtime = MEM_new<blender::bke::PreviewImageRuntime>(__func__, *prv->
runtime);
162 prv_img->
runtime->gputexture[
i] =
nullptr;
173 if (old_prv_p && *old_prv_p) {
174 BLI_assert(new_prv_p !=
nullptr &&
ELEM(*new_prv_p,
nullptr, *old_prv_p));
181 new_id->
icon_id = (*new_prv_p)->runtime->icon_id = 0;
188#define ID_PRV_CASE(id_code, id_struct) \
190 return &((id_struct *)id)->preview; \
216 return prv_p ? *prv_p :
nullptr;
234 if (*prv_p ==
nullptr) {
294 void **key_p, **prv_p;
307 const char *filepath,
324 if (prv && force_update) {
325 if (prv->
runtime->deferred_loading_data &&
326 (prv->
runtime->deferred_loading_data->source == source) &&
327 (prv->
runtime->deferred_loading_data->filepath == filepath))
369 if (!prv->
runtime->deferred_loading_data) {
376 if (!(do_icon || do_preview)) {
382 *prv->
runtime->deferred_loading_data;
400 if (thumb->
x > thumb->
y) {
402 icon_h = (thumb->
y * icon_w) / thumb->
x + 1;
404 else if (thumb->
x < thumb->
y) {
406 icon_w = (thumb->
x * icon_h) / thumb->
y + 1;
423 if (!prv->
runtime->deferred_loading_data) {
427 return prv->
runtime->deferred_loading_data->filepath.c_str();
432 if (!prv->
runtime->deferred_loading_data) {
436 return prv->
runtime->deferred_loading_data->source;
445 ImBuf *ima =
nullptr;
447 if (
w > 0 && h > 0 && rect) {
478 if (prv ==
nullptr) {
482 PreviewImage prv_copy = blender::dna::shallow_copy(*prv);
485 if (prv_copy.
rect[0]) {
488 if (prv_copy.
rect[1]) {
495 if (prv ==
nullptr) {
499 prv->
runtime = MEM_new<blender::bke::PreviewImageRuntime>(__func__);
bool BKE_icon_delete(int icon_id)
#define ICON_RENDER_DEFAULT_HEIGHT
void BKE_previewimg_deferred_release(PreviewImage *prv)
ImBuf * BKE_previewimg_to_imbuf(const PreviewImage *prv, int size)
PreviewImage * BKE_previewimg_id_get(const ID *id)
void BKE_previewimg_blend_write(BlendWriter *writer, const PreviewImage *prv)
void BKE_previewimg_ensure(PreviewImage *prv, int size)
bool BKE_previewimg_is_finished(const PreviewImage *prv, int size)
PreviewImage * BKE_previewimg_cached_thumbnail_read(const char *name, const char *filepath, int source, bool force_update)
std::optional< int > BKE_previewimg_deferred_thumb_source_get(const PreviewImage *prv)
void BKE_previewimg_cached_release(const char *name)
PreviewImage * BKE_previewimg_create()
bool BKE_previewimg_id_supports_jobs(const ID *id)
void BKE_preview_images_init()
PreviewImage * BKE_previewimg_id_ensure(ID *id)
void BKE_previewimg_freefunc(void *link)
PreviewImage ** BKE_previewimg_id_get_p(const ID *id)
void BKE_previewimg_clear_single(PreviewImage *prv, enum eIconSizes size)
const char * BKE_previewimg_deferred_filepath_get(const PreviewImage *prv)
bool BKE_previewimg_is_invalid(const PreviewImage *prv)
void BKE_preview_images_free()
void BKE_previewimg_free(PreviewImage **prv)
PreviewImage * BKE_previewimg_copy(const PreviewImage *prv)
PreviewImage * BKE_previewimg_cached_get(const char *name)
void BKE_previewimg_blend_read(BlendDataReader *reader, PreviewImage *prv)
void BKE_previewimg_id_custom_set(ID *id, const char *filepath)
void BKE_previewimg_id_copy(ID *new_id, const ID *old_id)
PreviewImage * BKE_previewimg_cached_ensure(const char *name)
void BKE_previewimg_finish(PreviewImage *prv, int size)
void BKE_previewimg_clear(PreviewImage *prv)
void BKE_previewimg_id_free(ID *id)
void ** BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_popkey(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp) ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
bool BLI_ghash_ensure_p_ex(GHash *gh, const void *key, void ***r_key, void ***r_val) ATTR_WARN_UNUSED_RESULT
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
int BLI_thread_is_main(void)
void BLO_read_uint32_array(BlendDataReader *reader, int64_t array_size, uint32_t **ptr_p)
bool BLO_read_data_is_undo(BlendDataReader *reader)
void BLO_write_uint32_array(BlendWriter *writer, int64_t num, const uint32_t *data_ptr)
#define BLO_write_struct_at_address(writer, struct_name, address, data_ptr)
ID and Library types, which are fundamental for SDNA.
@ PRV_TAG_DEFFERED_DELETE
@ PRV_TAG_DEFFERED_RENDERING
@ PRV_TAG_DEFFERED_INVALID
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
void GPU_texture_free(blender::gpu::Texture *texture)
void IMB_premultiply_alpha(ImBuf *ibuf)
void IMB_freeImBuf(ImBuf *ibuf)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
bool IMB_scale(ImBuf *ibuf, unsigned int newx, unsigned int newy, IMBScaleFilter filter, bool threaded=true)
ImBuf * IMB_thumb_manage(const char *file_or_lib_path, ThumbSize size, ThumbSource source)
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void * MEM_mallocN(size_t len, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
static GHash * gCachedPreviews
static PreviewImage * previewimg_deferred_create(const char *filepath, ThumbSource source)
#define ID_PRV_CASE(id_code, id_struct)
ImBufByteBuffer byte_buffer
PreviewImageRuntimeHandle * runtime
short changed_timestamp[2]
std::unique_ptr< PreviewDeferredLoadingData > deferred_loading_data