diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-08 15:02:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-08 15:02:58 +0400 |
commit | 011a3645bf1d587101ec7cb9bf6a0a0d1421802a (patch) | |
tree | 08376565f4176dec29c893af8bbd56b843333dd9 /source/blender/blenkernel/intern/font.c | |
parent | 9a51266f3569eebca06c18d1af4ed8151d93aca7 (diff) |
fix [#28846] Relative paths on linked scene fails
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r-- | source/blender/blenkernel/intern/font.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 6898615c753..c82aa855a7b 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -284,7 +284,7 @@ struct TmpFont *vfont_find_tmpfont(VFont *vfont) return tmpfnt; } -static VFontData *vfont_get_data(VFont *vfont) +static VFontData *vfont_get_data(Main *bmain, VFont *vfont) { struct TmpFont *tmpfnt = NULL; PackedFile *tpf; @@ -319,11 +319,11 @@ static VFontData *vfont_get_data(VFont *vfont) BLI_addtail(&ttfdata, tmpfnt); } } else { - pf= newPackedFile(NULL, vfont->name); + pf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); if(!tmpfnt) { - tpf= newPackedFile(NULL, vfont->name); + tpf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); // Add temporary packed file to globals tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font"); @@ -351,7 +351,7 @@ static VFontData *vfont_get_data(VFont *vfont) return vfont->data; } -VFont *load_vfont(const char *name) +VFont *load_vfont(Main *bmain, const char *name) { char filename[FILE_MAXFILE]; VFont *vfont= NULL; @@ -371,8 +371,8 @@ VFont *load_vfont(const char *name) BLI_strncpy(dir, name, sizeof(dir)); BLI_splitdirstring(dir, filename); - pf= newPackedFile(NULL, name); - tpf= newPackedFile(NULL, name); + pf= newPackedFile(NULL, name, bmain->name); + tpf= newPackedFile(NULL, name, bmain->name); is_builtin= 0; } @@ -382,7 +382,7 @@ VFont *load_vfont(const char *name) vfd= BLI_vfontdata_from_freetypefont(pf); if (vfd) { - vfont = alloc_libblock(&G.main->vfont, ID_VF, filename); + vfont = alloc_libblock(&bmain->vfont, ID_VF, filename); vfont->data = vfd; /* if there's a font name, use it for the ID name */ @@ -439,7 +439,7 @@ VFont *get_builtin_font(void) if (strcmp(vf->name, FO_BUILTIN_NAME)==0) return vf; - return load_vfont(FO_BUILTIN_NAME); + return load_vfont(G.main, FO_BUILTIN_NAME); } static VChar *find_vfont_char(VFontData *vfd, intptr_t character) @@ -500,7 +500,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i } -static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx) +static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx) { BezTriple *bezt1, *bezt2; Nurb *nu1 = NULL, *nu2 = NULL; @@ -509,7 +509,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float VChar *che = NULL; int i; - vfd= vfont_get_data(which_vfont(cu, info)); + vfd= vfont_get_data(bmain, which_vfont(cu, info)); if (!vfd) return; /* @@ -662,7 +662,7 @@ static float char_width(Curve *cu, VChar *che, CharInfo *info) } } -struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) +struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int mode) { VFont *vfont, *oldvfont; VFontData *vfd= NULL; @@ -714,7 +714,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if (cu->tb==NULL) cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "TextBox compat"); - vfd= vfont_get_data(vfont); + vfd= vfont_get_data(bmain, vfont); /* The VFont Data can not be found */ if(!vfd) { @@ -792,7 +792,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) } if (vfont != oldvfont) { - vfd= vfont_get_data(vfont); + vfd= vfont_get_data(bmain, vfont); oldvfont = vfont; } @@ -1157,7 +1157,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) } // We do not want to see any character for \n or \r if(cha != '\n' && cha != '\r') - buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i); + buildchar(bmain, cu, cha, info, ct->xof, ct->yof, ct->rot, i); if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) { float ulwidth, uloverlap= 0.0f; |