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/makesrna | |
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/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_movieclip.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer_api.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sound.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sound_api.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_text.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_vfont.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_vfont_api.c | 3 |
11 files changed, 26 insertions, 23 deletions
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) |