From 716a8241d387180fd8ad69cdec33633bc7a0f963 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Jun 2020 09:54:14 +1000 Subject: Cleanup: rename 'name' to 'filepath' for DNA types Using 'name' for the full path of a file reads badly, especially when id.name is used in related code. --- source/blender/blenkernel/intern/bpath.c | 18 ++++---- source/blender/blenkernel/intern/font.c | 16 +++---- source/blender/blenkernel/intern/image.c | 38 ++++++++-------- source/blender/blenkernel/intern/image_save.c | 6 +-- source/blender/blenkernel/intern/library.c | 6 +-- source/blender/blenkernel/intern/movieclip.c | 26 +++++------ source/blender/blenkernel/intern/packedFile.c | 26 +++++------ source/blender/blenkernel/intern/scene.c | 3 +- source/blender/blenkernel/intern/seqeffects.c | 4 +- source/blender/blenkernel/intern/sequencer.c | 9 ++-- source/blender/blenkernel/intern/sound.c | 8 ++-- source/blender/blenkernel/intern/text.c | 28 ++++++------ source/blender/blenloader/intern/blend_validate.c | 10 ++--- source/blender/blenloader/intern/readfile.c | 50 +++++++++++----------- source/blender/blenloader/intern/versioning_270.c | 2 +- .../blender/blenloader/intern/versioning_legacy.c | 8 ++-- source/blender/blenloader/intern/writefile.c | 6 +-- .../draw/engines/workbench/workbench_materials.c | 2 +- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/interface/interface_ops.c | 2 +- .../editors/interface/interface_region_tooltip.c | 2 +- source/blender/editors/sound/sound_ops.c | 5 ++- source/blender/editors/space_clip/clip_ops.c | 2 +- source/blender/editors/space_file/filelist.c | 2 +- source/blender/editors/space_image/image_ops.c | 30 +++++++------ .../blender/editors/space_outliner/outliner_draw.c | 8 ++-- .../blender/editors/space_outliner/outliner_edit.c | 5 ++- .../blender/editors/space_outliner/outliner_tree.c | 4 +- .../editors/space_sequencer/sequencer_draw.c | 3 +- .../editors/space_sequencer/sequencer_edit.c | 2 +- source/blender/editors/space_text/text_ops.c | 24 +++++------ .../intern/blender_interface/BlenderFileLoader.cpp | 2 +- .../intern/blender_interface/FRS_freestyle.cpp | 4 +- source/blender/makesdna/DNA_ID.h | 15 ++++--- source/blender/makesdna/DNA_image_types.h | 2 +- source/blender/makesdna/DNA_movieclip_types.h | 2 +- source/blender/makesdna/DNA_sound_types.h | 2 +- source/blender/makesdna/DNA_text_types.h | 2 +- source/blender/makesdna/DNA_vfont_types.h | 2 +- source/blender/makesdna/intern/dna_rename_defs.h | 6 +++ source/blender/makesrna/intern/rna_ID.c | 2 +- source/blender/makesrna/intern/rna_image.c | 4 +- source/blender/makesrna/intern/rna_image_api.c | 4 +- source/blender/makesrna/intern/rna_movieclip.c | 2 +- source/blender/makesrna/intern/rna_nodetree.c | 8 ++-- source/blender/makesrna/intern/rna_sequencer_api.c | 5 ++- source/blender/makesrna/intern/rna_sound.c | 2 +- source/blender/makesrna/intern/rna_sound_api.c | 3 +- source/blender/makesrna/intern/rna_text.c | 14 +++--- source/blender/makesrna/intern/rna_vfont.c | 2 +- source/blender/makesrna/intern/rna_vfont_api.c | 3 +- source/blender/python/intern/bpy_rna.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 2 +- 53 files changed, 233 insertions(+), 214 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index f0e23ddad41..10783c741b6 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -564,8 +564,8 @@ void BKE_bpath_traverse_id( * don't make sense to add directories to until the image has been saved * once to give it a meaningful value. */ if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE, IMA_SRC_TILED) && - ima->name[0]) { - if (rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data)) { + ima->filepath[0]) { + if (rewrite_path_fixed(ima->filepath, visit_cb, absbase, bpath_user_data)) { if (flag & BKE_BPATH_TRAVERSE_RELOAD_EDITED) { if (!BKE_image_has_packedfile(ima) && /* image may have been painted onto (and not saved, T44543) */ @@ -643,7 +643,7 @@ void BKE_bpath_traverse_id( case ID_SO: { bSound *sound = (bSound *)id; if (sound->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) { - rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data); + rewrite_path_fixed(sound->filepath, visit_cb, absbase, bpath_user_data); } break; } @@ -655,15 +655,15 @@ void BKE_bpath_traverse_id( break; } case ID_TXT: - if (((Text *)id)->name) { - rewrite_path_alloc(&((Text *)id)->name, visit_cb, absbase, bpath_user_data); + if (((Text *)id)->filepath) { + rewrite_path_alloc(&((Text *)id)->filepath, visit_cb, absbase, bpath_user_data); } break; case ID_VF: { VFont *vfont = (VFont *)id; if (vfont->packedfile == NULL || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) { if (BKE_vfont_is_builtin(vfont) == false) { - rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data); + rewrite_path_fixed(((VFont *)id)->filepath, visit_cb, absbase, bpath_user_data); } } break; @@ -756,15 +756,15 @@ void BKE_bpath_traverse_id( Library *lib = (Library *)id; /* keep packedfile paths always relative to the blend */ if (lib->packedfile == NULL) { - if (rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) { - BKE_library_filepath_set(bmain, lib, lib->name); + if (rewrite_path_fixed(lib->filepath, visit_cb, absbase, bpath_user_data)) { + BKE_library_filepath_set(bmain, lib, lib->filepath); } } break; } case ID_MC: { MovieClip *clip = (MovieClip *)id; - rewrite_path_fixed(clip->name, visit_cb, absbase, bpath_user_data); + rewrite_path_fixed(clip->filepath, visit_cb, absbase, bpath_user_data); break; } case ID_CF: { diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 5771eb053f7..dfa5ff6975f 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -78,7 +78,7 @@ static void vfont_init_data(ID *id) if (vfd) { vfont->data = vfd; - BLI_strncpy(vfont->name, FO_BUILTIN_NAME, sizeof(vfont->name)); + BLI_strncpy(vfont->filepath, FO_BUILTIN_NAME, sizeof(vfont->filepath)); } /* Free the packed file */ @@ -177,7 +177,7 @@ static int builtin_font_size = 0; bool BKE_vfont_is_builtin(struct VFont *vfont) { - return STREQ(vfont->name, FO_BUILTIN_NAME); + return STREQ(vfont->filepath, FO_BUILTIN_NAME); } void BKE_vfont_builtin_register(void *mem, int size) @@ -237,20 +237,20 @@ static VFontData *vfont_get_data(VFont *vfont) } } else { - pf = BKE_packedfile_new(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + pf = BKE_packedfile_new(NULL, vfont->filepath, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); if (vfont->temp_pf == NULL) { vfont->temp_pf = BKE_packedfile_new( - NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + NULL, vfont->filepath, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); } } if (!pf) { - CLOG_WARN(&LOG, "Font file doesn't exist: %s", vfont->name); + CLOG_WARN(&LOG, "Font file doesn't exist: %s", vfont->filepath); /* DON'T DO THIS * missing file shouldn't modify path! - campbell */ #if 0 - strcpy(vfont->name, FO_BUILTIN_NAME); + strcpy(vfont->filepath, FO_BUILTIN_NAME); #endif pf = get_builtin_packedfile(); } @@ -301,7 +301,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) if (vfd->name[0] != '\0') { BLI_strncpy(vfont->id.name + 2, vfd->name, sizeof(vfont->id.name) - 2); } - BLI_strncpy(vfont->name, filepath, sizeof(vfont->name)); + BLI_strncpy(vfont->filepath, filepath, sizeof(vfont->filepath)); /* if autopack is on store the packedfile in de font structure */ if (!is_builtin && (G.fileflags & G_FILE_AUTOPACK)) { @@ -333,7 +333,7 @@ VFont *BKE_vfont_load_exists_ex(struct Main *bmain, const char *filepath, bool * /* first search an identical filepath */ for (vfont = bmain->fonts.first; vfont; vfont = vfont->id.next) { - BLI_strncpy(strtest, vfont->name, sizeof(vfont->name)); + BLI_strncpy(strtest, vfont->filepath, sizeof(vfont->filepath)); BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &vfont->id)); if (BLI_path_cmp(strtest, str) == 0) { diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index b4a3f249c63..24d175511c7 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -648,7 +648,7 @@ char BKE_image_alpha_mode_from_extension_ex(const char *filepath) void BKE_image_alpha_mode_from_extension(Image *image) { - image->alpha_mode = BKE_image_alpha_mode_from_extension_ex(image->name); + image->alpha_mode = BKE_image_alpha_mode_from_extension_ex(image->filepath); } Image *BKE_image_load(Main *bmain, const char *filepath) @@ -668,7 +668,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath) close(file); ima = image_alloc(bmain, BLI_path_basename(filepath), IMA_SRC_FILE, IMA_TYPE_IMAGE); - STRNCPY(ima->name, filepath); + STRNCPY(ima->filepath, filepath); if (BLI_path_extension_check_array(filepath, imb_ext_movie)) { ima->source = IMA_SRC_MOVIE; @@ -694,7 +694,7 @@ Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exist /* first search an identical filepath */ for (ima = bmain->images.first; ima; ima = ima->id.next) { if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) { - STRNCPY(strtest, ima->name); + STRNCPY(strtest, ima->filepath); BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &ima->id)); if (BLI_path_cmp(strtest, str) == 0) { @@ -830,7 +830,7 @@ Image *BKE_image_add_generated(Main *bmain, int view_id; const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; - /* STRNCPY(ima->name, name); */ /* don't do this, this writes in ain invalid filepath! */ + /* STRNCPY(ima->filepath, name); */ /* don't do this, this writes in ain invalid filepath! */ ima->gen_x = width; ima->gen_y = height; ima->gen_type = gen_type; @@ -846,7 +846,7 @@ Image *BKE_image_add_generated(Main *bmain, for (view_id = 0; view_id < 2; view_id++) { ImBuf *ibuf; ibuf = add_ibuf_size( - width, height, ima->name, depth, floatbuf, gen_type, color, &ima->colorspace_settings); + width, height, ima->filepath, depth, floatbuf, gen_type, color, &ima->colorspace_settings); int index = tiled ? 0 : IMA_NO_INDEX; int entry = tiled ? 1001 : 0; image_assign_ibuf(ima, ibuf, stereo3d ? view_id : index, entry); @@ -881,7 +881,7 @@ Image *BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name) ima = image_alloc(bmain, name, IMA_SRC_FILE, IMA_TYPE_IMAGE); if (ima) { - STRNCPY(ima->name, ibuf->name); + STRNCPY(ima->filepath, ibuf->name); image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); ImageTile *tile = BKE_image_get_tile(ima, 0); tile->ok = IMA_OK_LOADED; @@ -981,9 +981,9 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath) if (totfiles == 1) { ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image packed file"); BLI_addtail(&ima->packedfiles, imapf); - imapf->packedfile = BKE_packedfile_new(reports, ima->name, basepath); + imapf->packedfile = BKE_packedfile_new(reports, ima->filepath, basepath); if (imapf->packedfile) { - STRNCPY(imapf->filepath, ima->name); + STRNCPY(imapf->filepath, ima->filepath); } else { BLI_freelinkN(&ima->packedfiles, imapf); @@ -1020,7 +1020,7 @@ void BKE_image_packfiles_from_mem(ReportList *reports, ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), __func__); BLI_addtail(&ima->packedfiles, imapf); imapf->packedfile = BKE_packedfile_new_from_memory(data, data_len); - STRNCPY(imapf->filepath, ima->name); + STRNCPY(imapf->filepath, ima->filepath); } } @@ -3385,7 +3385,7 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal) * Here we ensure original image path wouldn't be used when saving * generated image. */ - ima->name[0] = '\0'; + ima->filepath[0] = '\0'; } if (ima->source != IMA_SRC_TILED) { @@ -3643,7 +3643,7 @@ bool BKE_image_fill_tile(struct Image *ima, image_free_tile(ima, tile); ImBuf *tile_ibuf = add_ibuf_size( - width, height, ima->name, planes, is_float, gen_type, color, &ima->colorspace_settings); + width, height, ima->filepath, planes, is_float, gen_type, color, &ima->colorspace_settings); if (tile_ibuf != NULL) { image_assign_ibuf(ima, tile_ibuf, 0, tile->tile_number); @@ -3807,7 +3807,7 @@ bool BKE_image_is_openexr(struct Image *ima) { #ifdef WITH_OPENEXR if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_TILED)) { - return BLI_path_extension_check(ima->name, ".exr"); + return BLI_path_extension_check(ima->filepath, ".exr"); } #else UNUSED_VARS(ima); @@ -4893,7 +4893,7 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock) } ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, - ima->name, + ima->filepath, ima->gen_depth, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type, @@ -5300,11 +5300,11 @@ void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath) BLI_strncpy(filepath, iv->filepath, FILE_MAX); } else { - BLI_strncpy(filepath, ima->name, FILE_MAX); + BLI_strncpy(filepath, ima->filepath, FILE_MAX); } } else { - BLI_strncpy(filepath, ima->name, FILE_MAX); + BLI_strncpy(filepath, ima->filepath, FILE_MAX); } if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_TILED)) { @@ -5461,7 +5461,7 @@ float *BKE_image_get_float_pixels_for_frame(struct Image *image, int frame, int int BKE_image_sequence_guess_offset(Image *image) { - return BLI_path_sequence_decode(image->name, NULL, NULL, NULL); + return BLI_path_sequence_decode(image->filepath, NULL, NULL, NULL); } bool BKE_image_has_anim(Image *ima) @@ -5478,7 +5478,7 @@ bool BKE_image_has_filepath(Image *ima) { /* This could be improved to detect cases like //../../, currently path * remapping empty file paths empty. */ - return ima->name[0] != '\0'; + return ima->filepath[0] != '\0'; } /* Checks the image buffer changes with time (not keyframed values). */ @@ -5653,14 +5653,14 @@ static void image_update_views_format(Image *ima, ImageUser *iuser) const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; for (i = 0; i < 2; i++) { - image_add_view(ima, names[i], ima->name); + image_add_view(ima, names[i], ima->filepath); } return; } else { /* R_IMF_VIEWS_INDIVIDUAL */ char prefix[FILE_MAX] = {'\0'}; - char *name = ima->name; + char *name = ima->filepath; const char *ext = NULL; BKE_scene_multiview_view_prefix_get(scene, name, prefix, &ext); diff --git a/source/blender/blenkernel/intern/image_save.c b/source/blender/blenkernel/intern/image_save.c index c034fe895a6..19eb3380b8e 100644 --- a/source/blender/blenkernel/intern/image_save.c +++ b/source/blender/blenkernel/intern/image_save.c @@ -73,7 +73,7 @@ static void image_save_post(ReportList *reports, if (opts->do_newpath) { BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name)); - BLI_strncpy(ima->name, filepath, sizeof(ima->name)); + BLI_strncpy(ima->filepath, filepath, sizeof(ima->filepath)); } ibuf->userflags &= ~IB_BITMAPDIRTY; @@ -106,7 +106,7 @@ static void image_save_post(ReportList *reports, /* only image path, never ibuf */ if (opts->relative) { const char *relbase = ID_BLEND_PATH(opts->bmain, &ima->id); - BLI_path_rel(ima->name, relbase); /* only after saving */ + BLI_path_rel(ima->filepath, relbase); /* only after saving */ } ColorManagedColorspaceSettings old_colorspace_settings; @@ -135,7 +135,7 @@ static void imbuf_save_post(ImBuf *ibuf, ImBuf *colormanaged_ibuf) /** * \return success. - * \note ``ima->name`` and ``ibuf->name`` should end up the same. + * \note ``ima->filepath`` and ``ibuf->name`` should end up the same. * \note for multiview the first ``ibuf`` is important to get the settings. */ static bool image_save_single(ReportList *reports, diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index f9432eaab3f..48c98be626d 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -81,8 +81,8 @@ void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath) { /* in some cases this is used to update the absolute path from the * relative */ - if (lib->name != filepath) { - BLI_strncpy(lib->name, filepath, sizeof(lib->name)); + if (lib->filepath != filepath) { + BLI_strncpy(lib->filepath, filepath, sizeof(lib->filepath)); } BLI_strncpy(lib->filepath_abs, filepath, sizeof(lib->filepath_abs)); @@ -96,7 +96,7 @@ void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath) * since making local could cause this to be directly linked - campbell */ /* Never make paths relative to parent lib - reading code (blenloader) always set *all* - * lib->name relative to current main, not to their parent for indirectly linked ones. */ + * `lib->filepath` relative to current main, not to their parent for indirectly linked ones. */ const char *basepath = BKE_main_blendfile_path(bmain); BLI_path_abs(lib->filepath_abs, basepath); } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index fe7c2055aef..f0efc9b8c50 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -220,19 +220,19 @@ static void get_sequence_fname(const MovieClip *clip, const int framenr, char *n char head[FILE_MAX], tail[FILE_MAX]; int offset; - BLI_strncpy(name, clip->name, sizeof(clip->name)); + BLI_strncpy(name, clip->filepath, sizeof(clip->filepath)); BLI_path_sequence_decode(name, head, tail, &numlen); /* Movie-clips always points to first image from sequence, auto-guess offset for now. * Could be something smarter in the future. */ - offset = sequence_guess_offset(clip->name, strlen(head), numlen); + offset = sequence_guess_offset(clip->filepath, strlen(head), numlen); if (numlen) { BLI_path_sequence_encode( name, head, tail, numlen, offset + framenr - clip->start_frame + clip->frame_offset); } else { - BLI_strncpy(name, clip->name, sizeof(clip->name)); + BLI_strncpy(name, clip->filepath, sizeof(clip->filepath)); } BLI_path_abs(name, ID_BLEND_PATH_FROM_GLOBAL(&clip->id)); @@ -246,7 +246,7 @@ static void get_proxy_fname( char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX]; int proxynr = framenr - clip->start_frame + 1 + clip->frame_offset; - BLI_split_dirfile(clip->name, clipdir, clipfile, FILE_MAX, FILE_MAX); + BLI_split_dirfile(clip->filepath, clipdir, clipfile, FILE_MAX, FILE_MAX); if (clip->flag & MCLIP_USE_PROXY_CUSTOM_DIR) { BLI_strncpy(dir, clip->proxy.dir, sizeof(dir)); @@ -395,7 +395,7 @@ static void movieclip_open_anim_file(MovieClip *clip) char str[FILE_MAX]; if (!clip->anim) { - BLI_strncpy(str, clip->name, FILE_MAX); + BLI_strncpy(str, clip->filepath, FILE_MAX); BLI_path_abs(str, ID_BLEND_PATH_FROM_GLOBAL(&clip->id)); /* FIXME: make several stream accessible in image editor, too */ @@ -445,7 +445,7 @@ static void movieclip_calc_length(MovieClip *clip) unsigned short numlen; char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX]; - BLI_path_sequence_decode(clip->name, head, tail, &numlen); + BLI_path_sequence_decode(clip->filepath, head, tail, &numlen); if (numlen == 0) { /* there's no number group in file name, assume it's single framed sequence */ @@ -531,10 +531,10 @@ static int user_frame_to_cache_frame(MovieClip *clip, int framenr) unsigned short numlen; char head[FILE_MAX], tail[FILE_MAX]; - BLI_path_sequence_decode(clip->name, head, tail, &numlen); + BLI_path_sequence_decode(clip->filepath, head, tail, &numlen); /* see comment in get_sequence_fname */ - clip->cache->sequence_offset = sequence_guess_offset(clip->name, strlen(head), numlen); + clip->cache->sequence_offset = sequence_guess_offset(clip->filepath, strlen(head), numlen); } index += clip->cache->sequence_offset; @@ -674,7 +674,7 @@ static bool put_imbuf_cache( clip->cache->sequence_offset = -1; if (clip->source == MCLIP_SRC_SEQUENCE) { unsigned short numlen; - BLI_path_sequence_decode(clip->name, NULL, NULL, &numlen); + BLI_path_sequence_decode(clip->filepath, NULL, NULL, &numlen); clip->cache->is_still_sequence = (numlen == 0); } } @@ -758,7 +758,7 @@ static void detect_clip_source(Main *bmain, MovieClip *clip) ImBuf *ibuf; char name[FILE_MAX]; - BLI_strncpy(name, clip->name, sizeof(name)); + BLI_strncpy(name, clip->filepath, sizeof(name)); BLI_path_abs(name, BKE_main_blendfile_path(bmain)); ibuf = IMB_testiffname(name, IB_rect | IB_multilayer); @@ -795,7 +795,7 @@ MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name) /* create a short library name */ clip = movieclip_alloc(bmain, BLI_path_basename(name)); - BLI_strncpy(clip->name, name, sizeof(clip->name)); + BLI_strncpy(clip->filepath, name, sizeof(clip->filepath)); detect_clip_source(bmain, clip); @@ -821,7 +821,7 @@ MovieClip *BKE_movieclip_file_add_exists_ex(Main *bmain, const char *filepath, b /* first search an identical filepath */ for (clip = bmain->movieclips.first; clip; clip = clip->id.next) { - BLI_strncpy(strtest, clip->name, sizeof(clip->name)); + BLI_strncpy(strtest, clip->filepath, sizeof(clip->filepath)); BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &clip->id)); if (BLI_path_cmp(strtest, str) == 0) { @@ -1739,7 +1739,7 @@ void BKE_movieclip_filename_for_frame(MovieClip *clip, MovieClipUser *user, char } } else { - BLI_strncpy(name, clip->name, FILE_MAX); + BLI_strncpy(name, clip->filepath, FILE_MAX); BLI_path_abs(name, ID_BLEND_PATH_FROM_GLOBAL(&clip->id)); } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 476d1a3a91f..2cd5588ccb8 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -264,14 +264,16 @@ void BKE_packedfile_pack_all(Main *bmain, ReportList *reports, bool verbose) for (vfont = bmain->fonts.first; vfont; vfont = vfont->id.next) { if (vfont->packedfile == NULL && !ID_IS_LINKED(vfont) && BKE_vfont_is_builtin(vfont) == false) { - vfont->packedfile = BKE_packedfile_new(reports, vfont->name, BKE_main_blendfile_path(bmain)); + vfont->packedfile = BKE_packedfile_new( + reports, vfont->filepath, BKE_main_blendfile_path(bmain)); tot++; } } for (sound = bmain->sounds.first; sound; sound = sound->id.next) { if (sound->packedfile == NULL && !ID_IS_LINKED(sound)) { - sound->packedfile = BKE_packedfile_new(reports, sound->name, BKE_main_blendfile_path(bmain)); + sound->packedfile = BKE_packedfile_new( + reports, sound->filepath, BKE_main_blendfile_path(bmain)); tot++; } } @@ -566,14 +568,14 @@ int BKE_packedfile_unpack_vfont(Main *bmain, if (vfont != NULL) { unpack_generate_paths( - vfont->name, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname)); + vfont->filepath, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname)); newname = BKE_packedfile_unpack_to_file( reports, BKE_main_blendfile_path(bmain), absname, localname, vfont->packedfile, how); if (newname != NULL) { ret_value = RET_OK; BKE_packedfile_free(vfont->packedfile); vfont->packedfile = NULL; - BLI_strncpy(vfont->name, newname, sizeof(vfont->name)); + BLI_strncpy(vfont->filepath, newname, sizeof(vfont->filepath)); MEM_freeN(newname); } } @@ -592,11 +594,11 @@ int BKE_packedfile_unpack_sound(Main *bmain, if (sound != NULL) { unpack_generate_paths( - sound->name, (ID *)sound, absname, localname, sizeof(absname), sizeof(localname)); + sound->filepath, (ID *)sound, absname, localname, sizeof(absname), sizeof(localname)); newname = BKE_packedfile_unpack_to_file( reports, BKE_main_blendfile_path(bmain), absname, localname, sound->packedfile, how); if (newname != NULL) { - BLI_strncpy(sound->name, newname, sizeof(sound->name)); + BLI_strncpy(sound->filepath, newname, sizeof(sound->filepath)); MEM_freeN(newname); BKE_packedfile_free(sound->packedfile); @@ -644,7 +646,7 @@ int BKE_packedfile_unpack_image(Main *bmain, /* keep the new name in the image for non-pack specific reasons */ if (how != PF_REMOVE) { - BLI_strncpy(ima->name, newname, sizeof(imapf->filepath)); + BLI_strncpy(ima->filepath, newname, sizeof(imapf->filepath)); } MEM_freeN(newname); } @@ -701,7 +703,7 @@ int BKE_packedfile_unpack_all_libraries(Main *bmain, ReportList *reports) int ret_value = RET_ERROR; for (lib = bmain->libraries.first; lib; lib = lib->id.next) { - if (lib->packedfile && lib->name[0]) { + if (lib->packedfile && lib->filepath[0]) { newname = BKE_packedfile_unpack_to_file(reports, BKE_main_blendfile_path(bmain), @@ -731,19 +733,19 @@ void BKE_packedfile_pack_all_libraries(Main *bmain, ReportList *reports) /* test for relativenss */ for (lib = bmain->libraries.first; lib; lib = lib->id.next) { - if (!BLI_path_is_rel(lib->name)) { + if (!BLI_path_is_rel(lib->filepath)) { break; } } if (lib) { - BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->name); + BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->filepath); return; } for (lib = bmain->libraries.first; lib; lib = lib->id.next) { if (lib->packedfile == NULL) { - lib->packedfile = BKE_packedfile_new(reports, lib->name, BKE_main_blendfile_path(bmain)); + lib->packedfile = BKE_packedfile_new(reports, lib->filepath, BKE_main_blendfile_path(bmain)); } } } @@ -844,7 +846,7 @@ void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF } case ID_LI: { Library *li = (Library *)id; - BKE_reportf(reports, RPT_ERROR, "Cannot unpack individual Library file, '%s'", li->name); + BKE_reportf(reports, RPT_ERROR, "Cannot unpack individual Library file, '%s'", li->filepath); break; } default: diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 0537f1a65ad..b0faa555f29 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -2293,7 +2293,8 @@ static char *scene_undo_depsgraph_gen_key(Scene *scene, ViewLayer *view_layer, c size_t key_full_offset = BLI_strncpy_rlen(key_full, scene->id.name, MAX_ID_NAME); if (scene->id.lib != NULL) { - key_full_offset += BLI_strncpy_rlen(key_full + key_full_offset, scene->id.lib->name, FILE_MAX); + key_full_offset += BLI_strncpy_rlen( + key_full + key_full_offset, scene->id.lib->filepath, FILE_MAX); } key_full_offset += BLI_strncpy_rlen(key_full + key_full_offset, view_layer->name, MAX_NAME); BLI_assert(key_full_offset < MAX_ID_NAME + FILE_MAX + MAX_NAME); diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 5527a4aabdd..de233a8d473 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -3821,7 +3821,7 @@ void BKE_sequencer_text_font_load(TextVars *data, const bool do_id_user) } char path[FILE_MAX]; - STRNCPY(path, data->text_font->name); + STRNCPY(path, data->text_font->filepath); BLI_assert(BLI_thread_is_main()); BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&data->text_font->id)); @@ -3895,7 +3895,7 @@ static ImBuf *do_text_effect(const SeqRenderData *context, data->text_blf_id = -1; if (data->text_font) { - data->text_blf_id = BLF_load(data->text_font->name); + data->text_blf_id = BLF_load(data->text_font->filepath); } } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 5da6435436d..096f6fa6bc6 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -406,17 +406,18 @@ static void seqclipboard_ptr_restore(Main *bmain, ID **id_pt) /* check for a data with the same filename */ switch (GS(ID_PT->name)) { case ID_SO: { - id_restore = BLI_findstring(lb, ((bSound *)ID_PT)->name, offsetof(bSound, name)); + id_restore = BLI_findstring(lb, ((bSound *)ID_PT)->filepath, offsetof(bSound, filepath)); if (id_restore == NULL) { - id_restore = BKE_sound_new_file(bmain, ((bSound *)ID_PT)->name); + id_restore = BKE_sound_new_file(bmain, ((bSound *)ID_PT)->filepath); (ID_PT)->newid = id_restore; /* reuse next time */ } break; } case ID_MC: { - id_restore = BLI_findstring(lb, ((MovieClip *)ID_PT)->name, offsetof(MovieClip, name)); + id_restore = BLI_findstring( + lb, ((MovieClip *)ID_PT)->filepath, offsetof(MovieClip, filepath)); if (id_restore == NULL) { - id_restore = BKE_movieclip_file_add(bmain, ((MovieClip *)ID_PT)->name); + id_restore = BKE_movieclip_file_add(bmain, ((MovieClip *)ID_PT)->filepath); (ID_PT)->newid = id_restore; /* reuse next time */ } break; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index e8f31594cc0..a293bc55073 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -172,7 +172,7 @@ bSound *BKE_sound_new_file(Main *bmain, const char *filepath) BLI_path_abs(str, path); sound = BKE_libblock_alloc(bmain, ID_SO, BLI_path_basename(filepath), 0); - BLI_strncpy(sound->name, filepath, FILE_MAX); + BLI_strncpy(sound->filepath, filepath, FILE_MAX); /* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */ sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock"); @@ -193,7 +193,7 @@ bSound *BKE_sound_new_file_exists_ex(Main *bmain, const char *filepath, bool *r_ /* first search an identical filepath */ for (sound = bmain->sounds.first; sound; sound = sound->id.next) { - BLI_strncpy(strtest, sound->name, sizeof(sound->name)); + BLI_strncpy(strtest, sound->filepath, sizeof(sound->filepath)); BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &sound->id)); if (BLI_path_cmp(strtest, str) == 0) { @@ -452,8 +452,8 @@ static void sound_load_audio(Main *bmain, bSound *sound, bool free_waveform) /* load sound */ PackedFile *pf = sound->packedfile; - /* don't modify soundact->sound->name, only change a copy */ - BLI_strncpy(fullpath, sound->name, sizeof(fullpath)); + /* don't modify soundact->sound->filepath, only change a copy */ + BLI_strncpy(fullpath, sound->filepath, sizeof(fullpath)); BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id)); /* but we need a packed file then */ diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index bce2266f3e9..b7a7b09a11d 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -63,14 +63,14 @@ * How Texts should work * -- * A text should relate to a file as follows - - * (Text *)->name should be the place where the + * (Text *)->filepath should be the place where the * file will or has been saved. * * (Text *)->flags has the following bits * TXT_ISDIRTY - should always be set if the file in mem. differs from * the file on disk, or if there is no file on disk. * TXT_ISMEM - should always be set if the Text has not been mapped to - * a file, in which case (Text *)->name may be NULL or garbage. + * a file, in which case (Text *)->filepath may be NULL or garbage. * TXT_ISEXT - should always be set if the Text is not to be written into * the .blend * TXT_ISSCRIPT - should be set if the user has designated the text @@ -110,7 +110,7 @@ static void text_init_data(ID *id) BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(text, id)); - text->name = NULL; + text->filepath = NULL; text->nlines = 1; text->flags = TXT_ISDIRTY | TXT_ISMEM; @@ -157,8 +157,8 @@ static void text_copy_data(Main *UNUSED(bmain), const Text *text_src = (Text *)id_src; /* File name can be NULL. */ - if (text_src->name) { - text_dst->name = BLI_strdup(text_src->name); + if (text_src->filepath) { + text_dst->filepath = BLI_strdup(text_src->filepath); } text_dst->flags |= TXT_ISDIRTY; @@ -190,7 +190,7 @@ static void text_free_data(ID *id) BKE_text_free_lines(text); - MEM_SAFE_FREE(text->name); + MEM_SAFE_FREE(text->filepath); #ifdef WITH_PYTHON BPY_text_free_code(text); #endif @@ -384,11 +384,11 @@ bool BKE_text_reload(Text *text) char filepath_abs[FILE_MAX]; BLI_stat_t st; - if (!text->name) { + if (!text->filepath) { return false; } - BLI_strncpy(filepath_abs, text->name, FILE_MAX); + BLI_strncpy(filepath_abs, text->filepath, FILE_MAX); BLI_path_abs(filepath_abs, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len); @@ -444,8 +444,8 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const } if (is_internal == false) { - ta->name = MEM_mallocN(strlen(file) + 1, "text_name"); - strcpy(ta->name, file); + ta->filepath = MEM_mallocN(strlen(file) + 1, "text_name"); + strcpy(ta->filepath, file); } else { ta->flags |= TXT_ISMEM | TXT_ISDIRTY; @@ -503,11 +503,11 @@ int BKE_text_file_modified_check(Text *text) int result; char file[FILE_MAX]; - if (!text->name) { + if (!text->filepath) { return 0; } - BLI_strncpy(file, text->name, FILE_MAX); + BLI_strncpy(file, text->filepath, FILE_MAX); BLI_path_abs(file, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); if (!BLI_exists(file)) { @@ -537,11 +537,11 @@ void BKE_text_file_modified_ignore(Text *text) int result; char file[FILE_MAX]; - if (!text->name) { + if (!text->filepath) { return; } - BLI_strncpy(file, text->name, FILE_MAX); + BLI_strncpy(file, text->filepath, FILE_MAX); BLI_path_abs(file, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); if (!BLI_exists(file)) { diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c index 133811bdc01..0a5d8d332aa 100644 --- a/source/blender/blenloader/intern/blend_validate.c +++ b/source/blender/blenloader/intern/blend_validate.c @@ -70,7 +70,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) RPT_ERROR, "ID %s is in local database while being linked from library %s!", id->name, - id->lib->name); + id->lib->filepath); } } } @@ -82,7 +82,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) continue; } - BKE_library_filepath_set(bmain, curlib, curlib->name); + BKE_library_filepath_set(bmain, curlib, curlib->filepath); BlendHandle *bh = BLO_blendhandle_from_file(curlib->filepath_abs, reports); if (bh == NULL) { @@ -107,7 +107,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) RPT_ERROR, "Library ID %s in library %s, this should not happen!", id->name, - curlib->name); + curlib->filepath); continue; } @@ -120,7 +120,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) RPT_ERROR, "ID %s has NULL lib pointer while being in library %s!", id->name, - curlib->name); + curlib->filepath); continue; } if (id->lib != curlib) { @@ -143,7 +143,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) RPT_ERROR, "ID %s not found in library %s anymore!", id->name, - id->lib->name); + id->lib->filepath); continue; } } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 872c2bf23e8..b46ee660a08 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -696,7 +696,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab /* Matches direct_link_library(). */ id_us_ensure_real(&lib->id); - BLI_strncpy(lib->name, filepath, sizeof(lib->name)); + BLI_strncpy(lib->filepath, filepath, sizeof(lib->filepath)); BLI_strncpy(lib->filepath_abs, name1, sizeof(lib->filepath_abs)); m->curlib = lib; @@ -4242,7 +4242,7 @@ static void direct_link_text(BlendDataReader *reader, Text *text) { TextLine *ln; - BLO_read_data_address(reader, &text->name); + BLO_read_data_address(reader, &text->filepath); text->compiled = NULL; @@ -5206,7 +5206,7 @@ static void lib_link_object(FileData *fd, Main *bmain, Object *ob) ob->proxy = NULL; if (ob->id.lib) { - printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->name); + printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath); } else { printf("Proxy lost from object %s lib \n", ob->id.name + 2); @@ -5224,7 +5224,7 @@ static void lib_link_object(FileData *fd, Main *bmain, Object *ob) if (ob->data == NULL && poin != NULL) { if (ob->id.lib) { - printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->name); + printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath); } else { printf("Object %s lost data.\n", ob->id.name + 2); @@ -8360,7 +8360,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("Library '%s', '%s' had multiple instances, save and reload!"), - lib->name, + lib->filepath, lib->filepath_abs); change_link_placeholder_to_real_ID_pointer(fd->mainlist, fd, lib, newmain->curlib); @@ -8384,11 +8384,11 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) } /* Make sure we have full path in lib->filepath_abs */ - BLI_strncpy(lib->filepath_abs, lib->name, sizeof(lib->name)); + BLI_strncpy(lib->filepath_abs, lib->filepath, sizeof(lib->filepath)); BLI_path_normalize(fd->relabase, lib->filepath_abs); - // printf("direct_link_library: name %s\n", lib->name); - // printf("direct_link_library: filepath %s\n", lib->filepath_abs); + // printf("direct_link_library: filepath %s\n", lib->filepath); + // printf("direct_link_library: filepath_abs %s\n", lib->filepath_abs); BlendDataReader reader = {fd}; lib->packedfile = direct_link_packedfile(&reader, lib->packedfile); @@ -8420,8 +8420,8 @@ static void fix_relpaths_library(const char *basepath, Main *main) * it absolute. This can happen when appending an object with a relative * link into an unsaved blend file. See [#27405]. * The remap relative option will make it relative again on save - campbell */ - if (BLI_path_is_rel(lib->name)) { - BLI_strncpy(lib->name, lib->filepath_abs, sizeof(lib->name)); + if (BLI_path_is_rel(lib->filepath)) { + BLI_strncpy(lib->filepath, lib->filepath_abs, sizeof(lib->filepath)); } } } @@ -8430,9 +8430,9 @@ static void fix_relpaths_library(const char *basepath, Main *main) /* Libraries store both relative and abs paths, recreate relative paths, * relative to the blend file since indirectly linked libs will be * relative to their direct linked library. */ - if (BLI_path_is_rel(lib->name)) { /* if this is relative to begin with? */ - BLI_strncpy(lib->name, lib->filepath_abs, sizeof(lib->name)); - BLI_path_rel(lib->name, basepath); + if (BLI_path_is_rel(lib->filepath)) { /* if this is relative to begin with? */ + BLI_strncpy(lib->filepath, lib->filepath_abs, sizeof(lib->filepath)); + BLI_path_rel(lib->filepath, basepath); } } } @@ -9448,7 +9448,7 @@ static bool read_libblock_undo_restore_linked(FileData *fd, Main *main, const ID DEBUG_PRINTF("UNDO: restore linked datablock %s\n", id->name); DEBUG_PRINTF(" from %s (%s): ", main->curlib ? main->curlib->id.name : "", - main->curlib ? main->curlib->name : ""); + main->curlib ? main->curlib->filepath : ""); ID *id_old = BKE_libblock_find_name(main, GS(id->name), id->name + 2); if (id_old != NULL) { @@ -9885,8 +9885,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) static void do_versions_after_linking(Main *main, ReportList *reports) { - // printf("%s for %s (%s), %d.%d\n", __func__, main->curlib ? main->curlib->name : main->name, - // main->curlib ? "LIB" : "MAIN", main->versionfile, main->subversionfile); + // printf("%s for %s (%s), %d.%d\n", __func__, main->curlib ? main->curlib->filepath : + // main->name, main->curlib ? "LIB" : "MAIN", main->versionfile, main->subversionfile); /* Don't allow versioning to create new data-blocks. */ main->is_locked_for_linking = true; @@ -10536,7 +10536,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) } Library *lib = read_struct(fd, bheadlib, "Library"); - Main *libmain = blo_find_main(fd, lib->name, fd->relabase); + Main *libmain = blo_find_main(fd, lib->filepath, fd->relabase); if (libmain->curlib == NULL) { const char *idname = blo_bhead_id_name(fd, bhead); @@ -10556,7 +10556,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) * library it belongs to, so that it will be read later. */ read_libblock(fd, libmain, bhead, LIB_TAG_INDIRECT, false, NULL); // commented because this can print way too much - // if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name); + // if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->filepath); /* for outliner dependency only */ libmain->curlib->parent = mainvar->curlib; @@ -10593,7 +10593,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) /* Commented because this can print way too much. */ #if 0 if (G.debug & G_DEBUG) { - printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name); + printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->filepath); } #endif } @@ -12044,7 +12044,7 @@ static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepa * \param mainvar: The current main database, e.g. #G_MAIN or #CTX_data_main(C). * \param bh: A blender file handle as returned by * #BLO_blendhandle_from_file or #BLO_blendhandle_from_memory. - * \param filepath: Used for relative linking, copied to the \a lib->name. + * \param filepath: Used for relative linking, copied to the `lib->filepath`. * \return the library Main, to be passed to #BLO_library_append_named_part as \a mainl. */ Main *BLO_library_link_begin(Main *mainvar, BlendHandle **bh, const char *filepath) @@ -12105,10 +12105,10 @@ static void library_link_end(Main *mainl, /* make the lib path relative if required */ if (flag & FILE_RELPATH) { /* use the full path, this could have been read by other library even */ - BLI_strncpy(curlib->name, curlib->filepath_abs, sizeof(curlib->name)); + BLI_strncpy(curlib->filepath, curlib->filepath_abs, sizeof(curlib->filepath)); /* uses current .blend file as reference */ - BLI_path_rel(curlib->name, BKE_main_blendfile_path_from_global()); + BLI_path_rel(curlib->filepath, BKE_main_blendfile_path_from_global()); } blo_join_main((*fd)->mainlist); @@ -12376,7 +12376,7 @@ static FileData *read_library_file_data(FileData *basefd, blo_reportf_wrap(basefd->reports, RPT_INFO, TIP_("Read packed library: '%s', parent '%s'"), - mainptr->curlib->name, + mainptr->curlib->filepath, library_parent_filepath(mainptr->curlib)); fd = blo_filedata_from_memory(pf->data, pf->size, basefd->reports); @@ -12389,7 +12389,7 @@ static FileData *read_library_file_data(FileData *basefd, RPT_INFO, TIP_("Read library: '%s', '%s', parent '%s'"), mainptr->curlib->filepath_abs, - mainptr->curlib->name, + mainptr->curlib->filepath, library_parent_filepath(mainptr->curlib)); fd = blo_filedata_from_file(mainptr->curlib->filepath_abs, basefd->reports); } @@ -12460,7 +12460,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) #if 0 printf("Reading linked data-blocks from %s (%s)\n", mainptr->curlib->id.name, - mainptr->curlib->name); + mainptr->curlib->filepath); #endif /* Open file if it has not been done yet. */ diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 2a468026ac5..496c8353f85 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -981,7 +981,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) BLI_addtail(&ima->packedfiles, imapf); imapf->packedfile = ima->packedfile; - BLI_strncpy(imapf->filepath, ima->name, FILE_MAX); + BLI_strncpy(imapf->filepath, ima->filepath, FILE_MAX); ima->packedfile = NULL; } } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 2cc811e213f..ce472a97337 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -856,8 +856,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile <= 223) { VFont *vf; for (vf = bmain->fonts.first; vf; vf = vf->id.next) { - if (STREQ(vf->name + strlen(vf->name) - 6, ".Bfont")) { - strcpy(vf->name, FO_BUILTIN_NAME); + if (STREQ(vf->filepath + strlen(vf->filepath) - 6, ".Bfont")) { + strcpy(vf->filepath, FO_BUILTIN_NAME); } } } @@ -1643,9 +1643,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) if (bmain->versionfile == 241) { Image *ima; for (ima = bmain->images.first; ima; ima = ima->id.next) { - if (STREQ(ima->name, "Compositor")) { + if (STREQ(ima->filepath, "Compositor")) { strcpy(ima->id.name + 2, "Viewer Node"); - strcpy(ima->name, "Viewer Node"); + strcpy(ima->filepath, "Viewer Node"); } } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 2402afbccd5..0c57621e742 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -3206,8 +3206,8 @@ static void write_text(BlendWriter *writer, Text *text, const void *id_address) BLO_write_id_struct(writer, Text, id_address, &text->id); write_iddata(writer, &text->id); - if (text->name) { - BLO_write_string(writer, text->name); + if (text->filepath) { + BLO_write_string(writer, text->filepath); } if (!(text->flags & TXT_ISEXT)) { @@ -3974,7 +3974,7 @@ static void write_libraries(WriteData *wd, Main *main) writestruct(wd, DATA, PackedFile, 1, pf); writedata(wd, DATA, pf->size, pf->data); if (wd->use_memfile == false) { - printf("write packed .blend: %s\n", main->curlib->name); + printf("write packed .blend: %s\n", main->curlib->filepath); } } diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 0b2d508fee5..d6d3ff8610b 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -57,7 +57,7 @@ void workbench_material_ubo_data(WORKBENCH_PrivateData *wpd, case V3D_SHADING_RANDOM_COLOR: { uint hash = BLI_ghashutil_strhash_p_murmur(ob->id.name); if (ob->id.lib) { - hash = (hash * 13) ^ BLI_ghashutil_strhash_p_murmur(ob->id.lib->name); + hash = (hash * 13) ^ BLI_ghashutil_strhash_p_murmur(ob->id.lib->filepath); } float hue = BLI_hash_int_01(hash); float hsv[3] = {hue, HSV_SATURATION, HSV_VALUE}; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 000b05e7a31..1bbd4b4a5bc 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -2133,7 +2133,7 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) vfont = (VFont *)idptr.owner_id; } - path = (vfont && !BKE_vfont_is_builtin(vfont)) ? vfont->name : U.fontdir; + path = (vfont && !BKE_vfont_is_builtin(vfont)) ? vfont->filepath : U.fontdir; if (RNA_struct_property_is_set(op->ptr, "filepath")) { return font_open_exec(C, op); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 41c89d2d832..d7f7f02c535 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1309,7 +1309,7 @@ static int editsource_text_edit(bContext *C, printf("%s:%d\n", filepath, line); for (text = bmain->texts.first; text; text = text->id.next) { - if (text->name && BLI_path_cmp(text->name, filepath) == 0) { + if (text->filepath && BLI_path_cmp(text->filepath, filepath) == 0) { break; } } diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index b64f080d9cc..9fed98ffda2 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -923,7 +923,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but) .style = UI_TIP_STYLE_NORMAL, .color_id = UI_TIP_LC_NORMAL, }); - field->text = BLI_sprintfN(TIP_("Library: %s"), id->lib->name); + field->text = BLI_sprintfN(TIP_("Library: %s"), id->lib->filepath); } } } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 81ac8a16d8a..2e52f3aa8a8 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -771,7 +771,7 @@ static int sound_pack_exec(bContext *C, wmOperator *op) } sound->packedfile = BKE_packedfile_new( - op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id)); + op->reports, sound->filepath, ID_BLEND_PATH(bmain, &sound->id)); BKE_sound_load(bmain, sound); return OPERATOR_FINISHED; @@ -847,7 +847,8 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE "AutoPack is enabled, so image will be packed again on file save"); } - unpack_menu(C, "SOUND_OT_unpack", sound->id.name + 2, sound->name, "sounds", sound->packedfile); + unpack_menu( + C, "SOUND_OT_unpack", sound->id.name + 2, sound->filepath, "sounds", sound->packedfile); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 984aa0a63ad..22707b97afa 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -283,7 +283,7 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) } if (clip) { - BLI_strncpy(path, clip->name, sizeof(path)); + BLI_strncpy(path, clip->filepath, sizeof(path)); BLI_path_abs(path, CTX_data_main(C)->name); BLI_path_parent_dir(path); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index d8d7ef01a2e..f60ef2b6aed 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2740,7 +2740,7 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) } else { char relname[FILE_MAX + (MAX_ID_NAME - 2) + 3]; - BLI_snprintf(relname, sizeof(relname), "%s | %s", id->lib->name, id->name + 2); + BLI_snprintf(relname, sizeof(relname), "%s | %s", id->lib->filepath, id->name + 2); files->entry->relpath = BLI_strdup(relname); } // files->type |= S_IFREG; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 8cb85ce9800..f71c92b4c1f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1237,7 +1237,7 @@ static Image *image_open_single(Main *bmain, if (!exists) { /* only image path after save, never ibuf */ if (is_relative_path) { - BLI_path_rel(ima->name, relbase); + BLI_path_rel(ima->filepath, relbase); } /* handle multiview images */ @@ -1417,7 +1417,7 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( } if (ima) { - path = ima->name; + path = ima->filepath; } if (RNA_struct_property_is_set(op->ptr, "filepath")) { @@ -1577,7 +1577,7 @@ static int image_replace_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); /* we cant do much if the str is longer then FILE_MAX :/ */ - BLI_strncpy(sima->image->name, str, sizeof(sima->image->name)); + BLI_strncpy(sima->image->filepath, str, sizeof(sima->image->filepath)); if (sima->image->source == IMA_SRC_GENERATED) { sima->image->source = IMA_SRC_FILE; @@ -1614,10 +1614,10 @@ static int image_replace_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS } if (!RNA_struct_property_is_set(op->ptr, "relative_path")) { - RNA_boolean_set(op->ptr, "relative_path", BLI_path_is_rel(sima->image->name)); + RNA_boolean_set(op->ptr, "relative_path", BLI_path_is_rel(sima->image->filepath)); } - image_filesel(C, op, sima->image->name); + image_filesel(C, op, sima->image->filepath); return OPERATOR_RUNNING_MODAL; } @@ -1777,7 +1777,7 @@ static int image_save_options_init(Main *bmain, /* append UDIM numbering if not present */ if (ima->source == IMA_SRC_TILED && - (BLI_path_sequence_decode(ima->name, NULL, NULL, NULL) != 1001)) { + (BLI_path_sequence_decode(ima->filepath, NULL, NULL, NULL) != 1001)) { int len = strlen(opts->filepath); STR_CONCAT(opts->filepath, len, ".1001"); } @@ -2301,7 +2301,7 @@ static bool image_should_be_saved(Image *ima, bool *is_format_writable) static bool image_has_valid_path(Image *ima) { - return strchr(ima->name, '\\') || strchr(ima->name, '/'); + return strchr(ima->filepath, '\\') || strchr(ima->filepath, '/'); } bool ED_image_should_save_modified(const Main *bmain) @@ -2336,7 +2336,7 @@ int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports) RPT_WARNING, "Packed library image can't be saved: \"%s\" from \"%s\"", ima->id.name + 2, - ima->id.lib->name); + ima->id.lib->filepath); } } else if (!is_format_writable) { @@ -2348,19 +2348,21 @@ int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports) else { if (image_has_valid_path(ima)) { num_saveable_images++; - if (BLI_gset_haskey(unique_paths, ima->name)) { + if (BLI_gset_haskey(unique_paths, ima->filepath)) { BKE_reportf(reports, RPT_WARNING, "Multiple images can't be saved to an identical path: \"%s\"", - ima->name); + ima->filepath); } else { - BLI_gset_insert(unique_paths, BLI_strdup(ima->name)); + BLI_gset_insert(unique_paths, BLI_strdup(ima->filepath)); } } else { - BKE_reportf( - reports, RPT_WARNING, "Image can't be saved, no valid file path: \"%s\"", ima->name); + BKE_reportf(reports, + RPT_WARNING, + "Image can't be saved, no valid file path: \"%s\"", + ima->filepath); } } } @@ -3044,7 +3046,7 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE unpack_menu(C, "IMAGE_OT_unpack", ima->id.name + 2, - ima->name, + ima->filepath, "textures", BKE_image_has_packedfile(ima) ? ((ImagePackedFile *)ima->packedfiles.first)->packedfile : diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 93c7a4f4ed4..7009d416e91 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -709,9 +709,9 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) Library *lib = (Library *)tselem->id; char expanded[FILE_MAX]; - BKE_library_filepath_set(bmain, lib, lib->name); + BKE_library_filepath_set(bmain, lib, lib->filepath); - BLI_strncpy(expanded, lib->name, sizeof(expanded)); + BLI_strncpy(expanded, lib->filepath, sizeof(expanded)); BLI_path_abs(expanded, BKE_main_blendfile_path(bmain)); if (!BLI_exists(expanded)) { BKE_reportf(CTX_wm_reports(C), @@ -1842,7 +1842,7 @@ static void outliner_buttons(const bContext *C, len = sizeof(((ModifierData *)0)->name); } else if (tselem->id && GS(tselem->id->name) == ID_LI) { - len = sizeof(((Library *)0)->name); + len = sizeof(((Library *)0)->filepath); } else { len = MAX_ID_NAME - 2; @@ -2681,7 +2681,7 @@ static void tselem_draw_icon(uiBlock *block, 0.0, 1.0, alpha, - (data.drag_id && ID_IS_LINKED(data.drag_id)) ? data.drag_id->lib->name : ""); + (data.drag_id && ID_IS_LINKED(data.drag_id)) ? data.drag_id->lib->filepath : ""); } } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 73323563cde..bee8b28e658 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -915,8 +915,9 @@ static int lib_relocate( printf("%s, %s\n", tselem->id->name, lib->filepath_abs); - /* We assume if both paths in lib are not the same then lib->name was relative... */ - RNA_boolean_set(&op_props, "relative_path", BLI_path_cmp(lib->filepath_abs, lib->name) != 0); + /* We assume if both paths in lib are not the same then `lib->filepath` was relative. */ + RNA_boolean_set( + &op_props, "relative_path", BLI_path_cmp(lib->filepath_abs, lib->filepath) != 0); RNA_string_set(&op_props, "directory", dir); RNA_string_set(&op_props, "filename", filename); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 7d685be107c..f07bb800eca 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -549,7 +549,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops, /* expand specific data always */ switch (GS(id->name)) { case ID_LI: { - te->name = ((Library *)id)->name; + te->name = ((Library *)id)->filepath; break; } case ID_SCE: { @@ -870,7 +870,7 @@ static TreeElement *outliner_add_element( else { /* do here too, for blend file viewer, own ID_LI then shows file name */ if (GS(id->name) == ID_LI) { - te->name = ((Library *)id)->name; + te->name = ((Library *)id)->filepath; } else { te->name = id->name + 2; // default, can be overridden by Library or non-ID data diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 433abe1ade7..070ae72d789 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -697,7 +697,8 @@ static void draw_seq_text(View2D *v2d, str_len = 0; } else if (seq->sound) { - str_len = BLI_snprintf(str, sizeof(str), "%s: %s | %d", name, seq->sound->name, seq->len); + str_len = BLI_snprintf( + str, sizeof(str), "%s: %s | %d", name, seq->sound->filepath, seq->len); } else { str_len = BLI_snprintf(str, sizeof(str), "%s | %d", name, seq->len); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index dc1fcfca8b4..60d98407025 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3945,7 +3945,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) } char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); - BLI_strncpy(sound->name, filepath, sizeof(sound->name)); + BLI_strncpy(sound->filepath, filepath, sizeof(sound->filepath)); BKE_sound_load(bmain, sound); } else { diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 797459984e7..670804d039e 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -370,7 +370,7 @@ static int text_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e { Main *bmain = CTX_data_main(C); Text *text = CTX_data_edit_text(C); - const char *path = (text && text->name) ? text->name : BKE_main_blendfile_path(bmain); + const char *path = (text && text->filepath) ? text->filepath : BKE_main_blendfile_path(bmain); if (RNA_struct_property_is_set(op->ptr, "filepath")) { return text_open_exec(C, op); @@ -430,7 +430,7 @@ static int text_reload_exec(bContext *C, wmOperator *op) /* Don't make this part of 'poll', since 'Alt-R' will type 'R', * if poll checks for the filename. */ - if (text->name == NULL) { + if (text->filepath == NULL) { BKE_report(op->reports, RPT_ERROR, "This text has not been saved"); return OPERATOR_CANCELLED; } @@ -543,9 +543,9 @@ static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op)) text->flags |= TXT_ISMEM | TXT_ISDIRTY; - if (text->name) { - MEM_freeN(text->name); - text->name = NULL; + if (text->filepath) { + MEM_freeN(text->filepath); + text->filepath = NULL; } text_update_cursor_moved(C); @@ -583,7 +583,7 @@ static bool text_save_poll(bContext *C) return 0; } - return (text->name != NULL && !(text->flags & TXT_ISMEM)); + return (text->filepath != NULL && !(text->flags & TXT_ISMEM)); } static void txt_write_file(Main *bmain, Text *text, ReportList *reports) @@ -593,7 +593,7 @@ static void txt_write_file(Main *bmain, Text *text, ReportList *reports) BLI_stat_t st; char filepath[FILE_MAX]; - BLI_strncpy(filepath, text->name, FILE_MAX); + BLI_strncpy(filepath, text->filepath, FILE_MAX); BLI_path_abs(filepath, BKE_main_blendfile_path(bmain)); fp = BLI_fopen(filepath, "w"); @@ -676,10 +676,10 @@ static int text_save_as_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); - if (text->name) { - MEM_freeN(text->name); + if (text->filepath) { + MEM_freeN(text->filepath); } - text->name = BLI_strdup(str); + text->filepath = BLI_strdup(str); text->flags &= ~TXT_ISMEM; txt_write_file(bmain, text, op->reports); @@ -700,8 +700,8 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE return text_save_as_exec(C, op); } - if (text->name) { - str = text->name; + if (text->filepath) { + str = text->filepath; } else if (text->flags & TXT_ISMEM) { str = text->id.name + 2; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 7bceb036846..996906826e9 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -795,7 +795,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // sets the id of the rep rep->setId(Id(id, 0)); rep->setName(ob->id.name + 2); - rep->setLibraryPath(ob->id.lib ? ob->id.lib->name : ""); + rep->setLibraryPath(ob->id.lib ? ob->id.lib->filepath : ""); const BBox bbox = BBox(Vec3r(ls.minBBox[0], ls.minBBox[1], ls.minBBox[2]), Vec3r(ls.maxBBox[0], ls.maxBBox[1], ls.maxBBox[2])); diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 0f4263162a6..26070a88e5d 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -341,8 +341,8 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph) const char *id_name = module_conf->script->id.name + 2; if (G.debug & G_DEBUG_FREESTYLE) { cout << " " << layer_count + 1 << ": " << id_name; - if (module_conf->script->name) { - cout << " (" << module_conf->script->name << ")"; + if (module_conf->script->filepath) { + cout << " (" << module_conf->script->filepath << ")"; } cout << endl; } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index d0c210961bb..138bbcf7ff2 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -302,15 +302,16 @@ typedef struct Library { ID id; struct FileData *filedata; /** Path name used for reading, can be relative and edited in the outliner. */ - char name[1024]; + char filepath[1024]; /** - * Absolute filepath, this is only for convenience, - * 'name' is the real path used on file read but in - * some cases its useful to access the absolute one. - * This is set on file read. - * Use BKE_library_filepath_set() rather than setting 'name' - * directly and it will be kept in sync - campbell */ + * Run-time only, absolute file-path (set on read). + * This is only for convenience, `filepath` is the real path + * used on file read but in some cases its useful to access the absolute one. + * + * Use #BKE_library_filepath_set() rather than setting `filepath` + * directly and it will be kept in sync - campbell + */ char filepath_abs[1024]; /** Set for indirectly linked libs, used in the outliner and while reading. */ diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 11a6a937e92..0ffb6c8a76a 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -129,7 +129,7 @@ typedef struct Image { ID id; /** File path, 1024 = FILE_MAX. */ - char name[1024]; + char filepath[1024]; /** Not written in file. */ struct MovieCache *cache; diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h index 94d11095108..d750a7f3148 100644 --- a/source/blender/makesdna/DNA_movieclip_types.h +++ b/source/blender/makesdna/DNA_movieclip_types.h @@ -78,7 +78,7 @@ typedef struct MovieClip { struct AnimData *adt; /** File path, 1024 = FILE_MAX. */ - char name[1024]; + char filepath[1024]; /** Sequence or movie. */ int source; diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index 04ac9d4e5be..35ff3a658ba 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -36,7 +36,7 @@ typedef struct bSound { * The path to the sound file. */ /** 1024 = FILE_MAX. */ - char name[1024]; + char filepath[1024]; /** * The packed file. diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index dbd5def74d4..1102207b11c 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -43,7 +43,7 @@ typedef struct TextLine { typedef struct Text { ID id; - char *name; + char *filepath; void *compiled; int flags, nlines; diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h index 295552635fe..086fb2bc905 100644 --- a/source/blender/makesdna/DNA_vfont_types.h +++ b/source/blender/makesdna/DNA_vfont_types.h @@ -36,7 +36,7 @@ typedef struct VFont { ID id; /** 1024 = FILE_MAX. */ - char name[1024]; + char filepath[1024]; struct VFontData *data; struct PackedFile *packedfile; diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index aabc16c4111..f2cf72843bd 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -77,6 +77,9 @@ DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_parent, guide_parent) DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_source, guide_source) DNA_STRUCT_RENAME_ELEM(FluidDomainSettings, guiding_vel_factor, guide_vel_factor) DNA_STRUCT_RENAME_ELEM(FluidEffectorSettings, guiding_mode, guide_mode) +DNA_STRUCT_RENAME_ELEM(Image, name, filepath) +DNA_STRUCT_RENAME_ELEM(Library, name, filepath) +DNA_STRUCT_RENAME_ELEM(MovieClip, name, filepath) DNA_STRUCT_RENAME_ELEM(Object, col, color) DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection) DNA_STRUCT_RENAME_ELEM(Object, dupfacesca, instance_faces_scale) @@ -84,8 +87,10 @@ DNA_STRUCT_RENAME_ELEM(Object, size, scale) DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection) DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object) DNA_STRUCT_RENAME_ELEM(ParticleSettings, dupliweights, instance_weights) +DNA_STRUCT_RENAME_ELEM(Text, name, filepath) DNA_STRUCT_RENAME_ELEM(ThemeSpace, scrubbing_background, time_scrub_background) DNA_STRUCT_RENAME_ELEM(ThemeSpace, show_back_grad, background_type) +DNA_STRUCT_RENAME_ELEM(VFont, name, filepath) DNA_STRUCT_RENAME_ELEM(View3D, far, clip_end) DNA_STRUCT_RENAME_ELEM(View3D, near, clip_start) DNA_STRUCT_RENAME_ELEM(View3D, ob_centre, ob_center) @@ -100,6 +105,7 @@ DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveOutY, curve_out_y) DNA_STRUCT_RENAME_ELEM(bPoseChannel, scaleIn, scale_in_x) DNA_STRUCT_RENAME_ELEM(bPoseChannel, scaleOut, scale_out_x) DNA_STRUCT_RENAME_ELEM(bSameVolumeConstraint, flag, free_axis) +DNA_STRUCT_RENAME_ELEM(bSound, name, filepath) DNA_STRUCT_RENAME_ELEM(bTheme, tact, space_action) DNA_STRUCT_RENAME_ELEM(bTheme, tbuts, space_properties) DNA_STRUCT_RENAME_ELEM(bTheme, tclip, space_clip) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 9a7a27dc8ae..c56c3d0b5fc 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -1657,7 +1657,7 @@ static void rna_def_library(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_string_sdna(prop, NULL, "filepath"); RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set"); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index cbc376c863f..887bded8540 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -915,13 +915,13 @@ static void rna_def_image(BlenderRNA *brna) prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); - RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_string_sdna(prop, NULL, "filepath"); RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update"); /* eek. this is horrible but needed so we can save to a new name without blanking the data :( */ prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_string_sdna(prop, NULL, "filepath"); RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)"); prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index fe3ef21d15e..41c0e724234 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -116,7 +116,7 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, &lock); if (ibuf) { char filename[FILE_MAX]; - BLI_strncpy(filename, image->name, sizeof(filename)); + BLI_strncpy(filename, image->filepath, sizeof(filename)); BLI_path_abs(filename, ID_BLEND_PATH(bmain, &image->id)); /* note, we purposefully ignore packed files here, @@ -138,7 +138,7 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r RPT_ERROR, "Image '%s' could not be saved to '%s'", image->id.name + 2, - image->name); + image->filepath); } } else { diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index f55d44e7bad..f3c73e75434 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -329,7 +329,7 @@ static void rna_def_movieclip(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_SEQUENCE); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_string_sdna(prop, NULL, "filepath"); RNA_def_property_ui_text(prop, "File Path", "Filename of the movie or sequence file"); RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 13dee92c1cb..f17e7fe39e0 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3629,8 +3629,8 @@ static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value) if (node->id) { Text *text = (Text *)node->id; - if (value == NODE_IES_EXTERNAL && text->name) { - BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath)); + if (value == NODE_IES_EXTERNAL && text->filepath) { + BLI_strncpy(nss->filepath, text->filepath, sizeof(nss->filepath)); BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global()); } @@ -3654,8 +3654,8 @@ static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value) if (node->id) { Text *text = (Text *)node->id; - if (value == NODE_SCRIPT_EXTERNAL && text->name) { - BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath)); + if (value == NODE_SCRIPT_EXTERNAL && text->filepath) { + BLI_strncpy(nss->filepath, text->filepath, sizeof(nss->filepath)); BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global()); } diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 29a8f281d22..28603132c77 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -114,7 +114,7 @@ static Sequence *rna_Sequences_new_clip(ID *id, Scene *scene = (Scene *)id; Sequence *seq; - seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIECLIP, clip->name); + seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIECLIP, clip->filepath); seq->clip = clip; seq->len = BKE_movieclip_get_duration(clip); id_us_plus((ID *)clip); @@ -265,7 +265,8 @@ static Sequence *rna_Sequences_new_sound(ID *id, BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file"); return NULL; } - seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->name); + seq = alloc_generic_sequence( + ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->filepath); seq->sound = sound; seq->len = ceil((double)info.length * FPS); diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 28a1c0f3cca..2fb50c2e89e 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -62,7 +62,7 @@ static void rna_def_sound(BlenderRNA *brna) /*rna_def_ipo_common(srna); */ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_string_sdna(prop, NULL, "filepath"); RNA_def_property_ui_text(prop, "File Path", "Sound sample file used by this Sound data-block"); RNA_def_property_update(prop, 0, "rna_Sound_update"); diff --git a/source/blender/makesrna/intern/rna_sound_api.c b/source/blender/makesrna/intern/rna_sound_api.c index 418205426d2..82da0adf0fe 100644 --- a/source/blender/makesrna/intern/rna_sound_api.c +++ b/source/blender/makesrna/intern/rna_sound_api.c @@ -34,7 +34,8 @@ static void rna_Sound_pack(bSound *sound, Main *bmain, ReportList *reports) { - sound->packedfile = BKE_packedfile_new(reports, sound->name, ID_BLEND_PATH(bmain, &sound->id)); + sound->packedfile = BKE_packedfile_new( + reports, sound->filepath, ID_BLEND_PATH(bmain, &sound->id)); } static void rna_Sound_unpack(bSound *sound, Main *bmain, ReportList *reports, int method) diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index c8797a8bc74..1351c027004 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -43,8 +43,8 @@ static void rna_Text_filename_get(PointerRNA *ptr, char *value) { Text *text = (Text *)ptr->data; - if (text->name) { - strcpy(value, text->name); + if (text->filepath) { + strcpy(value, text->filepath); } else { value[0] = '\0'; @@ -54,22 +54,22 @@ static void rna_Text_filename_get(PointerRNA *ptr, char *value) static int rna_Text_filename_length(PointerRNA *ptr) { Text *text = (Text *)ptr->data; - return (text->name) ? strlen(text->name) : 0; + return (text->filepath) ? strlen(text->filepath) : 0; } static void rna_Text_filename_set(PointerRNA *ptr, const char *value) { Text *text = (Text *)ptr->data; - if (text->name) { - MEM_freeN(text->name); + if (text->filepath) { + MEM_freeN(text->filepath); } if (value[0]) { - text->name = BLI_strdup(value); + text->filepath = BLI_strdup(value); } else { - text->name = NULL; + text->filepath = NULL; } } diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c index 3e96b5816e5..a98a52c2252 100644 --- a/source/blender/makesrna/intern/rna_vfont.c +++ b/source/blender/makesrna/intern/rna_vfont.c @@ -72,7 +72,7 @@ void RNA_def_vfont(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_FILE_FONT); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); - RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_string_sdna(prop, NULL, "filepath"); RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable"); RNA_def_property_ui_text(prop, "File Path", ""); RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update"); diff --git a/source/blender/makesrna/intern/rna_vfont_api.c b/source/blender/makesrna/intern/rna_vfont_api.c index 1bf61db4871..80e0511caf9 100644 --- a/source/blender/makesrna/intern/rna_vfont_api.c +++ b/source/blender/makesrna/intern/rna_vfont_api.c @@ -34,7 +34,8 @@ static void rna_VectorFont_pack(VFont *vfont, Main *bmain, ReportList *reports) { - vfont->packedfile = BKE_packedfile_new(reports, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); + vfont->packedfile = BKE_packedfile_new( + reports, vfont->filepath, ID_BLEND_PATH(bmain, &vfont->id)); } static void rna_VectorFont_unpack(VFont *vfont, Main *bmain, ReportList *reports, int method) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 179daad2f60..ebbbc8f3140 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2498,7 +2498,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *sel else if (PyUnicode_Check(keylib)) { Main *bmain = self->ptr.data; const char *keylib_str = _PyUnicode_AsString(keylib); - lib = BLI_findstring(&bmain->libraries, keylib_str, offsetof(Library, name)); + lib = BLI_findstring(&bmain->libraries, keylib_str, offsetof(Library, filepath)); if (lib == NULL) { if (err_not_found) { PyErr_Format(PyExc_KeyError, diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 6fb1e3e251d..525f96329b7 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1269,7 +1269,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i if (is_relative_path) { if (exists == false) { if (idcode == ID_IM) { - BLI_path_rel(((Image *)id)->name, BKE_main_blendfile_path(bmain)); + BLI_path_rel(((Image *)id)->filepath, BKE_main_blendfile_path(bmain)); } else { BLI_assert(0); -- cgit v1.2.3