From b0dcabdf6547e837e91cbcdc465bb029df01d9dc Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 6 Nov 2020 18:41:03 +0100 Subject: Cleanup: fix naming and remove unnecessary code --- source/blender/blenkernel/BKE_screen.h | 2 +- source/blender/blenkernel/intern/screen.c | 2 +- source/blender/blenloader/intern/readfile.c | 97 ++-------------------------- source/blender/blenloader/intern/writefile.c | 54 ---------------- 4 files changed, 6 insertions(+), 149 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 7de276bb5fc..fd5339940dd 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -465,7 +465,7 @@ void BKE_screen_view3d_do_versions_250(struct View3D *v3d, ListBase *regions); void BKE_screen_area_blend_read_lib(struct BlendLibReader *reader, struct ID *parent_id, struct ScrArea *area); -bool BKE_screen_blend_read_lib(struct BlendDataReader *reader, struct bScreen *screen); +bool BKE_screen_blend_read_data(struct BlendDataReader *reader, struct bScreen *screen); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index d23dcfbb00a..568c0c6f567 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -255,7 +255,7 @@ static void screen_blend_write(BlendWriter *writer, ID *id, const void *id_addre } /* Cannot use IDTypeInfo callback yet, because of the return value. */ -bool BKE_screen_blend_read_lib(BlendDataReader *reader, bScreen *screen) +bool BKE_screen_blend_read_data(BlendDataReader *reader, bScreen *screen) { bool success = true; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 7c3baae5af5..605860f1057 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3286,49 +3286,12 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID * switch (GS(id->name)) { case ID_SCR: - success = BKE_screen_blend_read_lib(&reader, (bScreen *)id); + success = BKE_screen_blend_read_data(&reader, (bScreen *)id); break; case ID_LI: direct_link_library(fd, (Library *)id, main); break; - case ID_IP: - case ID_OB: - case ID_SCE: - case ID_WM: - case ID_WS: - case ID_PA: - case ID_GR: - case ID_ME: - case ID_LT: - case ID_AC: - case ID_NT: - case ID_LS: - case ID_TXT: - case ID_VF: - case ID_MC: - case ID_PAL: - case ID_PC: - case ID_BR: - case ID_IM: - case ID_LA: - case ID_MA: - case ID_MB: - case ID_CU: - case ID_CA: - case ID_WO: - case ID_MSK: - case ID_SPK: - case ID_AR: - case ID_LP: - case ID_KE: - case ID_TE: - case ID_GD: - case ID_HA: - case ID_PT: - case ID_VO: - case ID_SIM: - case ID_SO: - case ID_CF: + default: /* Do nothing. Handled by IDTypeInfo callback. */ break; } @@ -3904,55 +3867,8 @@ static void lib_link_all(FileData *fd, Main *bmain) id_type->blend_read_lib(&reader, id); } - /* Note: ID types are processed in reverse order as defined by INDEX_ID_XXX enums in DNA_ID.h. - * This ensures handling of most dependencies in proper order, as elsewhere in code. - * Please keep order of entries in that switch matching that order, it's easier to quickly see - * whether something is wrong then. */ - switch (GS(id->name)) { - case ID_LI: - lib_link_library(&reader, (Library *)id); /* Only init users. */ - break; - case ID_IP: - case ID_OB: - case ID_SCE: - case ID_WM: - case ID_WS: - case ID_SCR: - case ID_PA: - case ID_GR: - case ID_ME: - case ID_LT: - case ID_AC: - case ID_NT: - case ID_LS: - case ID_TXT: - case ID_VF: - case ID_MC: - case ID_PAL: - case ID_PC: - case ID_BR: - case ID_IM: - case ID_LA: - case ID_MA: - case ID_MB: - case ID_CU: - case ID_CA: - case ID_WO: - case ID_MSK: - case ID_SPK: - case ID_AR: - case ID_LP: - case ID_KE: - case ID_TE: - case ID_GD: - case ID_HA: - case ID_PT: - case ID_VO: - case ID_SIM: - case ID_SO: - case ID_CF: - /* Do nothing. Handled by IDTypeInfo callback. */ - break; + if (GS(id->name) == ID_LI) { + lib_link_library(&reader, (Library *)id); /* Only init users. */ } id->tag &= ~LIB_TAG_NEED_LINK; @@ -4606,11 +4522,6 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) id_type->blend_read_expand(&expander, id); } - switch (GS(id->name)) { - default: - break; - } - do_it = true; id->tag &= ~LIB_TAG_NEED_EXPAND; } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c062175aff6..72c82c6c652 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1068,60 +1068,6 @@ static bool write_file_handle(Main *mainvar, id_type->blend_write(&writer, (ID *)id_buffer, id); } - switch ((ID_Type)GS(id->name)) { - case ID_OB: - case ID_SCE: - case ID_WM: - case ID_WS: - case ID_SCR: - case ID_PA: - case ID_GR: - case ID_ME: - case ID_LT: - case ID_AC: - case ID_NT: - case ID_LS: - case ID_TXT: - case ID_VF: - case ID_MC: - case ID_PC: - case ID_PAL: - case ID_BR: - case ID_IM: - case ID_LA: - case ID_MA: - case ID_MB: - case ID_CU: - case ID_CA: - case ID_WO: - case ID_MSK: - case ID_SPK: - case ID_AR: - case ID_LP: - case ID_KE: - case ID_TE: - case ID_GD: - case ID_HA: - case ID_PT: - case ID_VO: - case ID_SIM: - case ID_SO: - case ID_CF: - /* Do nothing, handled in IDTypeInfo callback. */ - break; - case ID_LI: - /* Do nothing, handled below - and should never be reached. */ - BLI_assert(0); - break; - case ID_IP: - /* Do nothing, deprecated. */ - break; - default: - /* Should never be reached. */ - BLI_assert(0); - break; - } - if (do_override) { BKE_lib_override_library_operations_store_end(override_storage, id); } -- cgit v1.2.3