use newly added ID_BLEND_PATH() in more places.
This commit is contained in:
		@@ -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)
 | 
					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_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)
 | 
					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_stringdec(name, head, tail, &numlen);
 | 
				
			||||||
	BLI_stringenc(name, head, tail, numlen, frame);
 | 
						BLI_stringenc(name, head, tail, numlen, frame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(ima->id.lib)
 | 
						BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id));
 | 
				
			||||||
		BLI_path_abs(name, ima->id.lib->filepath);
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		BLI_path_abs(name, G.main->name);
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	flag= IB_rect|IB_multilayer;
 | 
						flag= IB_rect|IB_multilayer;
 | 
				
			||||||
	if(ima->flag & IMA_DO_PREMUL)
 | 
						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];
 | 
							char str[FILE_MAX];
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		BLI_strncpy(str, ima->name, FILE_MAX);
 | 
							BLI_strncpy(str, ima->name, FILE_MAX);
 | 
				
			||||||
		if(ima->id.lib)
 | 
							BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
 | 
				
			||||||
			BLI_path_abs(str, ima->id.lib->filepath);
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			BLI_path_abs(str, G.main->name);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* FIXME: make several stream accessible in image editor, too*/
 | 
							/* FIXME: make several stream accessible in image editor, too*/
 | 
				
			||||||
		ima->anim = openanim(str, IB_rect, 0);
 | 
							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 */
 | 
							/* get the right string */
 | 
				
			||||||
		BLI_strncpy(str, ima->name, sizeof(str));
 | 
							BLI_strncpy(str, ima->name, sizeof(str));
 | 
				
			||||||
		if(ima->id.lib)
 | 
							BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
 | 
				
			||||||
			BLI_path_abs(str, ima->id.lib->filepath);
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			BLI_path_abs(str, G.main->name);
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		/* read ibuf */
 | 
							/* read ibuf */
 | 
				
			||||||
		ibuf = IMB_loadiffname(str, flag);
 | 
							ibuf = IMB_loadiffname(str, flag);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -340,20 +340,13 @@ void sound_load(struct Main *bmain, struct bSound* sound)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			char fullpath[FILE_MAX];
 | 
								char fullpath[FILE_MAX];
 | 
				
			||||||
			char *path;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* load sound */
 | 
								/* load sound */
 | 
				
			||||||
			PackedFile* pf = sound->packedfile;
 | 
								PackedFile* pf = sound->packedfile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* dont modify soundact->sound->name, only change a copy */
 | 
								/* dont modify soundact->sound->name, only change a copy */
 | 
				
			||||||
			BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
 | 
								BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
 | 
				
			||||||
 | 
								BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
 | 
				
			||||||
			if(sound->id.lib)
 | 
					 | 
				
			||||||
				path = sound->id.lib->filepath;
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
				path = bmain->name;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			BLI_path_abs(fullpath, path);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* but we need a packed file then */
 | 
								/* but we need a packed file then */
 | 
				
			||||||
			if (pf)
 | 
								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 */
 | 
					/* 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)
 | 
					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)
 | 
					PyObject *bpy_text_import(Text *text)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user