[Bf-blender-cvs] [523bc981cfe] master: Fix loading packed fonts for sequencer strips
Campbell Barton
noreply at git.blender.org
Fri Aug 27 05:13:26 CEST 2021
Commit: 523bc981cfeecead5050e7af44bbe252c166d718
Author: Campbell Barton
Date: Fri Aug 27 13:09:33 2021 +1000
Branches: master
https://developer.blender.org/rB523bc981cfeecead5050e7af44bbe252c166d718
Fix loading packed fonts for sequencer strips
===================================================================
M source/blender/sequencer/intern/effects.c
===================================================================
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)
More information about the Bf-blender-cvs
mailing list