From d617a6c85b4874a81d86568d00b56f2bda11c4b4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 12 Jun 2018 15:03:51 +0200 Subject: Cleanup/simplify G.main usages. Using G.main only to get main bled filepath, or built-in fonts, is OK. So now using the 'valid' G_MAIN macro here instead. --- source/blender/blenkernel/intern/font.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'source/blender/blenkernel/intern/font.c') diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 39be0f67c93..73199cebe36 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -153,7 +153,7 @@ static PackedFile *get_builtin_packedfile(void) } } -static VFontData *vfont_get_data(Main *bmain, VFont *vfont) +static VFontData *vfont_get_data(VFont *vfont) { if (vfont == NULL) { return NULL; @@ -188,10 +188,10 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont) } } else { - pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); + pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); if (vfont->temp_pf == NULL) { - vfont->temp_pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); + vfont->temp_pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); } } if (!pf) { @@ -349,13 +349,13 @@ VFont *BKE_vfont_builtin_get(void) { VFont *vfont; - for (vfont = G.main->vfont.first; vfont; vfont = vfont->id.next) { + for (vfont = G_MAIN->vfont.first; vfont; vfont = vfont->id.next) { if (BKE_vfont_is_builtin(vfont)) { return vfont; } } - return BKE_vfont_load(G.main, FO_BUILTIN_NAME); + return BKE_vfont_load(G_MAIN, FO_BUILTIN_NAME); } static VChar *find_vfont_char(VFontData *vfd, unsigned int character) @@ -423,7 +423,7 @@ static void build_underline(Curve *cu, ListBase *nubase, const rctf *rect, mul_v2_fl(bp[3].vec, cu->fsize); } -static void buildchar(Main *bmain, Curve *cu, ListBase *nubase, unsigned int character, CharInfo *info, +static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx) { BezTriple *bezt1, *bezt2; @@ -433,7 +433,7 @@ static void buildchar(Main *bmain, Curve *cu, ListBase *nubase, unsigned int cha VChar *che = NULL; int i; - vfd = vfont_get_data(bmain, which_vfont(cu, info)); + vfd = vfont_get_data(which_vfont(cu, info)); if (!vfd) return; #if 0 @@ -635,7 +635,7 @@ struct TempLineInfo { int wspace_nr; /* number of whitespaces of line */ }; -bool BKE_vfont_to_curve_ex(Main *bmain, Object *ob, Curve *cu, int mode, ListBase *r_nubase, +bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, int mode, ListBase *r_nubase, const wchar_t **r_text, int *r_text_len, bool *r_text_free, struct CharTrans **r_chartransdata) { @@ -677,7 +677,7 @@ bool BKE_vfont_to_curve_ex(Main *bmain, Object *ob, Curve *cu, int mode, ListBas if (cu->str == NULL) return ok; if (vfont == NULL) return ok; - vfd = vfont_get_data(bmain, vfont); + vfd = vfont_get_data(vfont); /* The VFont Data can not be found */ if (!vfd) return ok; @@ -770,7 +770,7 @@ makebreak: if (vfont == NULL) break; if (vfont != oldvfont) { - vfd = vfont_get_data(bmain, vfont); + vfd = vfont_get_data(vfont); oldvfont = vfont; } @@ -1274,7 +1274,7 @@ makebreak: } /* We do not want to see any character for \n or \r */ if (cha != '\n') - buildchar(bmain, cu, r_nubase, cha, info, ct->xof, ct->yof, ct->rot, i); + buildchar(cu, r_nubase, cha, info, ct->xof, ct->yof, ct->rot, i); if ((info->flag & CU_CHINFO_UNDERLINE) && (cha != '\n')) { float ulwidth, uloverlap = 0.0f; @@ -1340,19 +1340,19 @@ finally: } -bool BKE_vfont_to_curve_nubase(Main *bmain, Object *ob, int mode, ListBase *r_nubase) +bool BKE_vfont_to_curve_nubase(Object *ob, int mode, ListBase *r_nubase) { BLI_assert(ob->type == OB_FONT); - return BKE_vfont_to_curve_ex(bmain, ob, ob->data, mode, r_nubase, + return BKE_vfont_to_curve_ex(ob, ob->data, mode, r_nubase, NULL, NULL, NULL, NULL); } -bool BKE_vfont_to_curve(Main *bmain, Object *ob, int mode) +bool BKE_vfont_to_curve(Object *ob, int mode) { Curve *cu = ob->data; - return BKE_vfont_to_curve_ex(bmain, ob, ob->data, mode, &cu->nurb, NULL, NULL, NULL, NULL); + return BKE_vfont_to_curve_ex(ob, ob->data, mode, &cu->nurb, NULL, NULL, NULL, NULL); } -- cgit v1.2.3