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/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 ++++++ 7 files changed, 19 insertions(+), 12 deletions(-) (limited to 'source/blender/makesdna') 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) -- cgit v1.2.3