Fix loading packed fonts for sequencer strips
This commit is contained in:
parent
61f9274d07
commit
523bc981cf
Notes:
blender-bot
2023-02-14 11:25:11 +01:00
Referenced by issue #99872, Regression: Crashes when using packed text font in VSE
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue