diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-03-19 21:37:00 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-03-19 21:39:23 +0300 |
commit | 12b621059a6f1337e8ae8fdd9533e7808225e71e (patch) | |
tree | d04a2fddc28152235191e2d93884f4d143410d85 /source/blender/windowmanager | |
parent | 0b7854323d41f3a1a55a40ddf76a90e2017a0784 (diff) |
Cleanup/refactor: remove BKE_idcode, in favour of BKE_idtype.
Mpving utils from idcode to idtype proved to be somewhat painful for
some reasons, but now all looks good.
Had to add a fake/empty shell for the special snowflake too,
`ID_LINK_PLACEHOLDER/INDEX_ID_NULL`...
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_dragdrop.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files_link.c | 13 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 12 |
3 files changed, 15 insertions, 14 deletions
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 728bd7d1227..6fcd757eba2 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -37,7 +37,7 @@ #include "BIF_glutil.h" #include "BKE_context.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "GPU_glew.h" #include "GPU_shader.h" @@ -357,7 +357,7 @@ static const char *wm_drag_name(wmDrag *drag) return id->name + 2; } else if (id) { - return BKE_idcode_to_name_plural(GS(id->name)); + return BKE_idtype_idcode_to_name_plural(GS(id->name)); } break; } diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 58eb194c7f7..c2c3b24469e 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -56,7 +56,7 @@ #include "BKE_main.h" #include "BKE_report.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -304,11 +304,11 @@ static bool wm_link_append_item_poll(ReportList *reports, return false; } - idcode = BKE_idcode_from_name(group); + idcode = BKE_idtype_idcode_from_name(group); /* XXX For now, we do a nasty exception for workspace, forbid linking them. * Not nice, ultimately should be solved! */ - if (!BKE_idcode_is_linkable(idcode) && (do_append || idcode != ID_WS)) { + if (!BKE_idtype_idcode_is_linkable(idcode) && (do_append || idcode != ID_WS)) { if (reports) { if (do_append) { BKE_reportf(reports, @@ -444,7 +444,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) lib_idx = POINTER_AS_INT(BLI_ghash_lookup(libraries, libname)); - item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL); + item = wm_link_append_data_item_add( + lapp_data, name, BKE_idtype_idcode_from_name(group), NULL); BLI_BITMAP_ENABLE(item->libraries, lib_idx); } } @@ -456,7 +457,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) WMLinkAppendDataItem *item; wm_link_append_data_library_add(lapp_data, libname); - item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL); + item = wm_link_append_data_item_add(lapp_data, name, BKE_idtype_idcode_from_name(group), NULL); BLI_BITMAP_ENABLE(item->libraries, 0); } @@ -703,7 +704,7 @@ static void lib_relocate_do(Main *bmain, ID *id = lbarray[lba_idx]->first; const short idcode = id ? GS(id->name) : 0; - if (!id || !BKE_idcode_is_linkable(idcode)) { + if (!id || !BKE_idtype_idcode_is_linkable(idcode)) { /* No need to reload non-linkable datatypes, * those will get relinked with their 'users ID'. */ continue; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 625e7878b07..0695479d9fb 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -74,7 +74,7 @@ #include "BKE_screen.h" /* BKE_ST_MAXNAME */ #include "BKE_unit.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BLF_api.h" @@ -1256,7 +1256,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i BKE_reportf(op->reports, RPT_ERROR, "Cannot read %s '%s': %s", - BKE_idcode_to_name(idcode), + BKE_idtype_idcode_to_name(idcode), path, errno ? strerror(errno) : TIP_("unsupported format")); return NULL; @@ -1278,7 +1278,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i RNA_string_get(op->ptr, "name", name); id = BKE_libblock_find_name(bmain, idcode, name); if (!id) { - BKE_reportf(op->reports, RPT_ERROR, "%s '%s' not found", BKE_idcode_to_name(idcode), name); + BKE_reportf(op->reports, RPT_ERROR, "%s '%s' not found", BKE_idtype_idcode_to_name(idcode), name); return NULL; } id_us_plus(id); @@ -3511,12 +3511,12 @@ static int previews_clear_exec(bContext *C, wmOperator *op) printf("%s: %d, %d, %d -> %d\n", id->name, GS(id->name), - BKE_idcode_to_idfilter(GS(id->name)), + BKE_idtype_idcode_to_idfilter(GS(id->name)), id_filters, - BKE_idcode_to_idfilter(GS(id->name)) & id_filters); + BKE_idtype_idcode_to_idfilter(GS(id->name)) & id_filters); #endif - if (!(BKE_idcode_to_idfilter(GS(id->name)) & id_filters)) { + if (!(BKE_idtype_idcode_to_idfilter(GS(id->name)) & id_filters)) { continue; } |