forked from bartvdbraak/blender
use newly added ID_BLEND_PATH() in more places.
This commit is contained in:
parent
011a3645bf
commit
21eb8b92a0
@ -2383,10 +2383,8 @@ int CustomData_verify_versions(struct CustomData *data, int index)
|
||||
|
||||
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
|
||||
{
|
||||
char *path = (id->lib)? id->lib->filepath: G.main->name;
|
||||
|
||||
BLI_strncpy(filename, external->filename, FILE_MAX);
|
||||
BLI_path_abs(filename, path);
|
||||
BLI_path_abs(filename, ID_BLEND_PATH(G.main, id));
|
||||
}
|
||||
|
||||
void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem)
|
||||
|
@ -1653,10 +1653,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
|
||||
BLI_stringdec(name, head, tail, &numlen);
|
||||
BLI_stringenc(name, head, tail, numlen, frame);
|
||||
|
||||
if(ima->id.lib)
|
||||
BLI_path_abs(name, ima->id.lib->filepath);
|
||||
else
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id));
|
||||
|
||||
flag= IB_rect|IB_multilayer;
|
||||
if(ima->flag & IMA_DO_PREMUL)
|
||||
@ -1768,10 +1765,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
|
||||
char str[FILE_MAX];
|
||||
|
||||
BLI_strncpy(str, ima->name, FILE_MAX);
|
||||
if(ima->id.lib)
|
||||
BLI_path_abs(str, ima->id.lib->filepath);
|
||||
else
|
||||
BLI_path_abs(str, G.main->name);
|
||||
BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
|
||||
|
||||
/* FIXME: make several stream accessible in image editor, too*/
|
||||
ima->anim = openanim(str, IB_rect, 0);
|
||||
@ -1834,10 +1828,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
||||
|
||||
/* get the right string */
|
||||
BLI_strncpy(str, ima->name, sizeof(str));
|
||||
if(ima->id.lib)
|
||||
BLI_path_abs(str, ima->id.lib->filepath);
|
||||
else
|
||||
BLI_path_abs(str, G.main->name);
|
||||
BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
|
||||
|
||||
/* read ibuf */
|
||||
ibuf = IMB_loadiffname(str, flag);
|
||||
|
@ -340,20 +340,13 @@ void sound_load(struct Main *bmain, struct bSound* sound)
|
||||
#endif
|
||||
{
|
||||
char fullpath[FILE_MAX];
|
||||
char *path;
|
||||
|
||||
/* load sound */
|
||||
PackedFile* pf = sound->packedfile;
|
||||
|
||||
/* dont modify soundact->sound->name, only change a copy */
|
||||
BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
|
||||
|
||||
if(sound->id.lib)
|
||||
path = sound->id.lib->filepath;
|
||||
else
|
||||
path = bmain->name;
|
||||
|
||||
BLI_path_abs(fullpath, path);
|
||||
BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
|
||||
|
||||
/* but we need a packed file then */
|
||||
if (pf)
|
||||
|
@ -93,7 +93,7 @@ void bpy_import_main_set(struct Main *maggie)
|
||||
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
|
||||
void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
|
||||
{
|
||||
BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : bpy_import_main->name, SEP, text->id.name+2);
|
||||
BLI_snprintf(fn, fn_len, "%s%c%s", ID_BLEND_PATH(bpy_import_main, &text->id), SEP, text->id.name+2);
|
||||
}
|
||||
|
||||
PyObject *bpy_text_import(Text *text)
|
||||
|
Loading…
Reference in New Issue
Block a user