diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-27 06:09:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-27 06:11:36 +0300 |
commit | 523bc981cfeecead5050e7af44bbe252c166d718 (patch) | |
tree | 170e8c6f719684add1dcdf805366bebd9ebd2718 /source | |
parent | 61f9274d07087770e7b4dffc557d66b9bf3c34ec (diff) |
Fix loading packed fonts for sequencer strips
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/sequencer/intern/effects.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index 9235da366f4..37bac523645 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -39,6 +39,7 @@ #include "BLI_utildefines.h" #include "DNA_anim_types.h" +#include "DNA_packedFile_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_space_types.h" @@ -3782,12 +3783,23 @@ void SEQ_effect_text_font_load(TextVars *data, const bool do_id_user) id_us_plus(&vfont->id); } - char path[FILE_MAX]; - STRNCPY(path, vfont->filepath); - BLI_assert(BLI_thread_is_main()); - BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + if (vfont->packedfile != NULL) { + PackedFile *pf = vfont->packedfile; + /* Create a name that's unique between library data-blocks to avoid loading + * a font per strip which will load fonts many times. */ + char name[MAX_ID_FULL_NAME]; + BKE_id_full_name_get(name, &vfont->id, 0); - data->text_blf_id = BLF_load(path); + data->text_blf_id = BLF_load_mem(name, pf->data, pf->size); + } + else { + char path[FILE_MAX]; + STRNCPY(path, vfont->filepath); + BLI_assert(BLI_thread_is_main()); + BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + + data->text_blf_id = BLF_load(path); + } } static void free_text_effect(Sequence *seq, const bool do_id_user) |