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 | |
parent | 9a51266f3569eebca06c18d1af4ed8151d93aca7 (diff) |
fix [#28846] Relative paths on linked scene fails
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/font.c | 28 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 10 |
5 files changed, 23 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 824bbb8f70d..3accceb5464 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1514,7 +1514,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i /* in par the family name is stored, use this to find the other objects */ - chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI); + chartransdata= BKE_text_to_curve(G.main, scene, par, FO_DUPLI); if(chartransdata==NULL) return; cu= par->data; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index acc900d0b71..6704d06be52 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1207,7 +1207,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba if(cu->path) free_path(cu->path); cu->path= NULL; - if(ob->type==OB_FONT) BKE_text_to_curve(scene, ob, 0); + if(ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0); if(!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts); 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; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d764826cd47..834961bf6e7 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1480,7 +1480,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) /* try to repack file */ if(ima->packedfile) { PackedFile *pf; - pf = newPackedFile(NULL, ima->name); + pf = newPackedFile(NULL, ima->name, ID_BLEND_PATH(G.main, &ima->id)); if (pf) { freePackedFile(ima->packedfile); ima->packedfile = pf; @@ -1860,7 +1860,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) /* make packed file for autopack */ if ((ima->packedfile == NULL) && (G.fileflags & G_AUTOPACK)) - ima->packedfile = newPackedFile(NULL, str); + ima->packedfile = newPackedFile(NULL, str, ID_BLEND_PATH(G.main, &ima->id)); } } else diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index ed729d819b7..4bc40bde949 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -168,7 +168,7 @@ PackedFile *newPackedFileMemory(void *mem, int memlen) return pf; } -PackedFile *newPackedFile(ReportList *reports, const char *filename) +PackedFile *newPackedFile(ReportList *reports, const char *filename, const char *basepath) { PackedFile *pf = NULL; int file, filelen; @@ -185,7 +185,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename) // convert relative filenames to absolute filenames strcpy(name, filename); - BLI_path_abs(name, G.main->name); + BLI_path_abs(name, basepath); // open the file // and create a PackedFile structure @@ -224,7 +224,7 @@ void packAll(Main *bmain, ReportList *reports) for(ima=bmain->image.first; ima; ima=ima->id.next) { if(ima->packedfile == NULL && ima->id.lib==NULL) { if(ima->source==IMA_SRC_FILE) { - ima->packedfile = newPackedFile(reports, ima->name); + ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id)); } else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2); @@ -234,11 +234,11 @@ void packAll(Main *bmain, ReportList *reports) for(vf=bmain->vfont.first; vf; vf=vf->id.next) if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0) - vf->packedfile = newPackedFile(reports, vf->name); + vf->packedfile = newPackedFile(reports, vf->name, bmain->name); for(sound=bmain->sound.first; sound; sound=sound->id.next) if(sound->packedfile == NULL && sound->id.lib==NULL) - sound->packedfile = newPackedFile(reports, sound->name); + sound->packedfile = newPackedFile(reports, sound->name, bmain->name); } |