From 12b621059a6f1337e8ae8fdd9533e7808225e71e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 19 Mar 2020 19:37:00 +0100 Subject: 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`... --- source/blender/editors/animation/keyframing.c | 8 ++++---- .../editors/interface/interface_eyedropper_datablock.c | 4 ++-- source/blender/editors/interface/interface_templates.c | 6 +++--- source/blender/editors/object/object_transform.c | 14 +++++++------- source/blender/editors/space_file/filelist.c | 6 +++--- source/blender/editors/space_outliner/outliner_draw.c | 4 ++-- source/blender/editors/space_outliner/outliner_edit.c | 6 +++--- source/blender/editors/space_outliner/outliner_tree.c | 4 ++-- 8 files changed, 26 insertions(+), 26 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index a560192195f..96b834492dd 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -50,7 +50,7 @@ #include "BKE_context.h" #include "BKE_fcurve.h" #include "BKE_global.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_key.h" #include "BKE_main.h" #include "BKE_material.h" @@ -1657,7 +1657,7 @@ int delete_keyframe(Main *bmain, RPT_WARNING, "Not deleting keyframe for locked F-Curve '%s' for %s '%s'", fcu->rna_path, - BKE_idcode_to_name(GS(id->name)), + BKE_idtype_idcode_to_name(GS(id->name)), id->name + 2); continue; } @@ -1761,7 +1761,7 @@ static int clear_keyframe(Main *bmain, RPT_WARNING, "Not clearing all keyframes from locked F-Curve '%s' for %s '%s'", fcu->rna_path, - BKE_idcode_to_name(GS(id->name)), + BKE_idtype_idcode_to_name(GS(id->name)), id->name + 2); continue; } @@ -2567,7 +2567,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) RPT_WARNING, "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'", strip->name, - BKE_idcode_to_name(GS(id->name)), + BKE_idtype_idcode_to_name(GS(id->name)), id->name + 2); } else { diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c index 46164ebac69..93599b8727a 100644 --- a/source/blender/editors/interface/interface_eyedropper_datablock.c +++ b/source/blender/editors/interface/interface_eyedropper_datablock.c @@ -37,7 +37,7 @@ #include "BLT_translation.h" #include "BKE_context.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_report.h" #include "BKE_screen.h" @@ -115,7 +115,7 @@ static int datadropper_init(bContext *C, wmOperator *op) BLI_assert(ddr->idcode != 0); /* Note we can translate here (instead of on draw time), * because this struct has very short lifetime. */ - ddr->idcode_name = TIP_(BKE_idcode_to_name(ddr->idcode)); + ddr->idcode_name = TIP_(BKE_idtype_idcode_to_name(ddr->idcode)); PointerRNA ptr = RNA_property_pointer_get(&ddr->ptr, ddr->prop); ddr->init_id = ptr.owner_id; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a1a4c15bdf6..4489dcda989 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -59,7 +59,7 @@ #include "BKE_curveprofile.h" #include "BKE_global.h" #include "BKE_gpencil_modifier.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_idprop.h" #include "BKE_layer.h" #include "BKE_lib_id.h" @@ -687,7 +687,7 @@ static const char *template_id_browse_tip(const StructRNA *type) static const char *template_id_context(StructRNA *type) { if (type) { - return BKE_idcode_to_translation_context(RNA_type_to_ID_code(type)); + return BKE_idtype_idcode_to_translation_context(RNA_type_to_ID_code(type)); } return BLT_I18NCONTEXT_DEFAULT; } @@ -2779,7 +2779,7 @@ void uiTemplatePreview(uiLayout *layout, if (!preview_id || (preview_id[0] == '\0')) { /* If no identifier given, generate one from ID type. */ - BLI_snprintf(_preview_id, UI_MAX_NAME_STR, "uiPreview_%s", BKE_idcode_to_name(GS(id->name))); + BLI_snprintf(_preview_id, UI_MAX_NAME_STR, "uiPreview_%s", BKE_idtype_idcode_to_name(GS(id->name))); preview_id = _preview_id; } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 0eab9c72227..28bb28a0298 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -46,7 +46,7 @@ #include "BKE_editmesh.h" #include "BKE_gpencil.h" #include "BKE_gpencil_geom.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_lattice.h" #include "BKE_layer.h" #include "BKE_lib_id.h" @@ -639,7 +639,7 @@ static int apply_objects_internal(bContext *C, RPT_ERROR, "Cannot apply to a multi user: Object \"%s\", %s \"%s\", aborting", ob->id.name + 2, - BKE_idcode_to_name(GS(obdata->name)), + BKE_idtype_idcode_to_name(GS(obdata->name)), obdata->name + 2); changed = false; } @@ -649,7 +649,7 @@ static int apply_objects_internal(bContext *C, RPT_ERROR, "Cannot apply to library data: Object \"%s\", %s \"%s\", aborting", ob->id.name + 2, - BKE_idcode_to_name(GS(obdata->name)), + BKE_idtype_idcode_to_name(GS(obdata->name)), obdata->name + 2); changed = false; } @@ -667,7 +667,7 @@ static int apply_objects_internal(bContext *C, RPT_ERROR, "Rotation/Location can't apply to a 2D curve: Object \"%s\", %s \"%s\", aborting", ob->id.name + 2, - BKE_idcode_to_name(GS(obdata->name)), + BKE_idtype_idcode_to_name(GS(obdata->name)), obdata->name + 2); changed = false; } @@ -676,7 +676,7 @@ static int apply_objects_internal(bContext *C, RPT_ERROR, "Can't apply to a curve with shape-keys: Object \"%s\", %s \"%s\", aborting", ob->id.name + 2, - BKE_idcode_to_name(GS(obdata->name)), + BKE_idtype_idcode_to_name(GS(obdata->name)), obdata->name + 2); changed = false; } @@ -712,7 +712,7 @@ static int apply_objects_internal(bContext *C, "Can't apply to a GP datablock where all layers are parented: Object " "\"%s\", %s \"%s\", aborting", ob->id.name + 2, - BKE_idcode_to_name(ID_GD), + BKE_idtype_idcode_to_name(ID_GD), gpd->id.name + 2); changed = false; } @@ -724,7 +724,7 @@ static int apply_objects_internal(bContext *C, RPT_ERROR, "Can't apply to GP datablock with no layers: Object \"%s\", %s \"%s\", aborting", ob->id.name + 2, - BKE_idcode_to_name(ID_GD), + BKE_idtype_idcode_to_name(ID_GD), gpd->id.name + 2); } } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 6bbe54e2f5c..cb062cc212a 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -56,7 +56,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_icons.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_main.h" #include "BLO_readfile.h" @@ -2454,14 +2454,14 @@ static int groupname_to_code(const char *group) lslash[0] = '\0'; } - return buf[0] ? BKE_idcode_from_name(buf) : 0; + return buf[0] ? BKE_idtype_idcode_from_name(buf) : 0; } static uint64_t groupname_to_filter_id(const char *group) { int id_code = groupname_to_code(group); - return BKE_idcode_to_idfilter(id_code); + return BKE_idtype_idcode_to_idfilter(id_code); } /** diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index dcef1c9db6a..3c569a71e93 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -46,7 +46,7 @@ #include "BKE_deform.h" #include "BKE_fcurve.h" #include "BKE_gpencil.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_library.h" @@ -2827,7 +2827,7 @@ int tree_element_id_type_to_index(TreeElement *te) { TreeStoreElem *tselem = TREESTORE(te); - const int id_index = tselem->type == 0 ? BKE_idcode_to_index(te->idcode) : INDEX_ID_GR; + const int id_index = tselem->type == 0 ? BKE_idtype_idcode_to_index(te->idcode) : INDEX_ID_GR; if (id_index < INDEX_ID_OB) { return id_index; } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index f2a3bad03b4..57bf34f1e18 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -44,7 +44,7 @@ #include "BKE_blender_copybuffer.h" #include "BKE_collection.h" #include "BKE_context.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" @@ -2194,7 +2194,7 @@ static void outliner_orphans_purge_tag(ID *id, int *num_tagged) if (id->us == 0) { id->tag |= LIB_TAG_DOIT; num_tagged[INDEX_ID_NULL]++; - num_tagged[BKE_idcode_to_index(GS(id->name))]++; + num_tagged[BKE_idtype_idcode_to_index(GS(id->name))]++; } else { id->tag &= ~LIB_TAG_DOIT; @@ -2233,7 +2233,7 @@ static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEv BLI_dynstr_appendf(dyn_str, "%d %s", num_tagged[i], - TIP_(BKE_idcode_to_name_plural(BKE_idcode_from_index(i)))); + TIP_(BKE_idtype_idcode_to_name_plural(BKE_idtype_idcode_from_index(i)))); } } BLI_dynstr_append(dyn_str, TIP_("). Click here to proceed...")); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 2787ab5cc52..d89a755f1c6 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -59,7 +59,7 @@ #include "BLT_translation.h" #include "BKE_fcurve.h" -#include "BKE_idcode.h" +#include "BKE_idtype.h" #include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_main.h" @@ -1237,7 +1237,7 @@ static void outliner_add_seq_dup(SpaceOutliner *soops, Sequence *seq, TreeElemen static const char *outliner_idcode_to_plural(short idcode) { - const char *propname = BKE_idcode_to_name_plural(idcode); + const char *propname = BKE_idtype_idcode_to_name_plural(idcode); PropertyRNA *prop = RNA_struct_type_find_property(&RNA_BlendData, propname); return (prop) ? RNA_property_ui_name(prop) : "UNKNOWN"; } -- cgit v1.2.3