diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-06-23 02:54:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-23 04:29:36 +0300 |
commit | 716a8241d387180fd8ad69cdec33633bc7a0f963 (patch) | |
tree | d4674969beacfa6f9d50726f5943e050a373f2b5 /source/blender/blenkernel/intern/image.c | |
parent | a573d7e8a14ce5e49b8c05ff762a00e181e905aa (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 38 |
1 files changed, 19 insertions, 19 deletions
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); |