Blender
V3.3
|
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_utildefines.h"
#include "CLG_log.h"
#include "BLT_translation.h"
#include "DNA_ID.h"
#include "DNA_collection_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_idtype.h"
Go to the source code of this file.
Macros | |
#define | INIT_TYPE(_id_code) |
#define | CASE_IDFILTER(_id) |
#define | CASE_IDFILTER_NONE(_id) |
#define | CASE_IDFILTER(_id) |
#define | CASE_IDFILTER_NONE(_id) (void)0 |
#define | CASE_IDINDEX(_id) |
#define | CASE_IDCODE(_id) |
Variables | |
static IDTypeInfo * | id_types [INDEX_ID_MAX] = {NULL} |
#define CASE_IDCODE | ( | _id | ) |
#define CASE_IDFILTER | ( | _id | ) |
#define CASE_IDFILTER | ( | _id | ) |
#define CASE_IDFILTER_NONE | ( | _id | ) |
#define CASE_IDINDEX | ( | _id | ) |
#define INIT_TYPE | ( | _id_code | ) |
Definition at line 39 of file idtype.c.
References IDCacheKey::id_session_uuid, and IDCacheKey::offset_in_ID.
Referenced by blo_cache_storage_init().
Definition at line 31 of file idtype.c.
References BLI_ghashutil_combine_hash(), BLI_ghashutil_uinthash(), hash, IDCacheKey::id_session_uuid, and IDCacheKey::offset_in_ID.
Referenced by blo_cache_storage_init().
const IDTypeInfo* BKE_idtype_get_info_from_id | ( | const ID * | id | ) |
Definition at line 124 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), GS, id, and ID::name.
Referenced by BKE_idtype_id_foreach_cache().
const IDTypeInfo* BKE_idtype_get_info_from_idcode | ( | const short | id_code | ) |
Definition at line 112 of file idtype.c.
References ARRAY_SIZE, BKE_idtype_idcode_to_index(), id_types, and NULL.
Referenced by BKE_idtype_get_info_from_id(), BKE_idtype_id_foreach_cache(), BKE_idtype_idcode_append_is_reusable(), BKE_idtype_idcode_is_linkable(), BKE_idtype_idcode_is_only_appendable(), BKE_idtype_idcode_is_valid(), BKE_idtype_idcode_to_name(), BKE_idtype_idcode_to_name_plural(), BKE_idtype_idcode_to_translation_context(), BKE_libblock_get_alloc_info(), and id_type_can_have_animdata().
void BKE_idtype_id_foreach_cache | ( | struct ID * | id, |
IDTypeForeachCacheFunctionCallback | function_callback, | ||
void * | user_data | ||
) |
Wrapper around IDTypeInfo foreach_cache that also handles embedded IDs.
Definition at line 447 of file idtype.c.
References BKE_idtype_get_info_from_id(), BKE_idtype_get_info_from_idcode(), IDTypeInfo::foreach_cache, GS, id, Collection::id, bNodeTree::id, ID_NT, ID_SCE, Scene::master_collection, ID::name, ntreeFromID(), NULL, scene, and user_data.
Referenced by blo_cache_storage_init(), blo_cache_storage_old_bmain_clear(), and direct_link_id().
bool BKE_idtype_idcode_append_is_reusable | ( | short | idcode | ) |
Check if an ID type can try to reuse and existing matching local one when being appended again.
idcode | The IDType code to check. |
Definition at line 194 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::flags, IDTYPE_FLAGS_APPEND_IS_REUSABLE, IDTYPE_FLAGS_NO_LIBLINKING, and NULL.
Referenced by BKE_blendfile_append(), BKE_main_library_weak_reference_add_item(), and BKE_main_library_weak_reference_create().
short BKE_idtype_idcode_from_idfilter | ( | uint64_t | idfilter | ) |
Convert an idfilter into an idcode (e.g. FILTER_ID_OB -> ID_OB).
Definition at line 266 of file idtype.c.
References BLI_assert_unreachable, BR, CASE_IDFILTER, CASE_IDFILTER_NONE, CV, and LT.
short BKE_idtype_idcode_from_index | ( | int | index | ) |
Get an idcode from an index (e.g. INDEX_ID_OB -> ID_OB).
Definition at line 383 of file idtype.c.
References BR, CASE_IDCODE, CV, ID_LINK_PLACEHOLDER, INDEX_ID_NULL, and LT.
Referenced by BKE_idtype_idcode_iter_step(), and outliner_orphans_purge_invoke().
short BKE_idtype_idcode_from_name | ( | const char * | idtype_name | ) |
Convert an ID-type name into an idcode (ie. ID_SCE)
idtype_name | The ID-type's "user visible name" to convert. |
Definition at line 163 of file idtype.c.
References BLI_assert, IDTypeInfo::id_code, idtype_get_info_from_name(), and NULL.
Referenced by groupname_to_code(), imb_thumb_load_from_blend_id(), wm_link_append_exec(), and wm_link_append_item_poll().
bool BKE_idtype_idcode_is_linkable | ( | short | idcode | ) |
Check if an ID type is linkable.
idcode | The IDType code to check. |
Definition at line 175 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::flags, IDTYPE_FLAGS_NO_LIBLINKING, and NULL.
Referenced by BKE_blendfile_library_relocate(), BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_id_can_be_asset(), BKE_lib_override_library_create_from_tag(), BKE_library_make_local(), BKE_main_library_weak_reference_create(), BLO_blendhandle_get_linkable_groups(), bpy_lib_enter(), bpy_lib_exit(), foreach_libblock_link_append_callback(), id_lib_extern(), id_lib_indirect_weak_link(), id_override_library_create_hierarchy_pre_process_fn(), lib_id_expand_local_cb(), link_named_part(), read_file_bhead_idname_map_create(), read_library_linked_id(), wm_link_append_item_poll(), and write_libraries().
bool BKE_idtype_idcode_is_only_appendable | ( | short | idcode | ) |
Check if an ID type is only appendable.
idcode | The IDType code to check. |
Definition at line 182 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::flags, IDTYPE_FLAGS_NO_LIBLINKING, IDTYPE_FLAGS_ONLY_APPEND, and NULL.
Referenced by wm_link_append_item_poll().
bool BKE_idtype_idcode_is_valid | ( | short | idcode | ) |
Return if the ID code is a valid ID code.
idcode | The code to check. |
Definition at line 170 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), and NULL.
Referenced by blo_bhead_is_id_valid_type(), BLO_blendhandle_get_linkable_groups(), and link_named_part().
short BKE_idtype_idcode_iter_step | ( | int * | index | ) |
Return an ID code and steps the index forward 1.
index | start as 0. |
Definition at line 442 of file idtype.c.
References ARRAY_SIZE, BKE_idtype_idcode_from_index(), and id_types.
Referenced by BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_main_idmap_create(), bpy_lib_enter(), bpy_lib_exit(), and main_namemap_validate_and_fix().
uint64_t BKE_idtype_idcode_to_idfilter | ( | short | idcode | ) |
Convert an idcode into an idfilter (e.g. ID_OB -> FILTER_ID_OB).
Definition at line 206 of file idtype.c.
References BLI_assert_unreachable, BR, CASE_IDFILTER, CASE_IDFILTER_NONE, CV, and LT.
Referenced by blender::bke::id::remapper::IDRemapper::add(), BKE_blendfile_link_append_context_item_idtypes_from_library_add(), BKE_library_id_can_use_idtype(), ED_asset_filter_matches_asset(), groupname_to_filter_id(), and previews_clear_exec().
int BKE_idtype_idcode_to_index | ( | short | idcode | ) |
Convert an idcode into an index (e.g. ID_OB -> INDEX_ID_OB).
Definition at line 324 of file idtype.c.
References BR, CASE_IDINDEX, CV, ID_LINK_PLACEHOLDER, INDEX_ID_NULL, and LT.
Referenced by blender::deg::Depsgraph::add_id_node(), BKE_idtype_get_info_from_idcode(), BKE_lib_query_unused_ids_tag(), DEG_graph_id_type_tag(), DEG_id_type_any_exists(), DEG_id_type_updated(), UniqueName_Map::find_by_type(), lib_query_unused_ids_tag_recurse(), and tree_element_id_type_to_index().
const char* BKE_idtype_idcode_to_name | ( | short | idcode | ) |
Convert an idcode into a name.
idcode | The code to convert. |
Definition at line 142 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::name, and NULL.
Referenced by apply_objects_internal(), BKE_id_new(), BKE_id_new_name_validate(), BKE_id_new_nomain(), BKE_mesh_new_nomain(), BKE_pointcloud_new_nomain(), BLO_blendhandle_get_linkable_groups(), clear_keyframe(), blender::ed::space_node::create_inspection_string_for_generic_value(), datadropper_init(), delete_key_button_exec(), delete_keyframe(), filelist_readjob_list_lib_add_from_indexer_entries(), filelist_readjob_main_assets_add_items(), pydriver_error(), pyrna_struct_keyframe_delete(), read_library_linked_id(), rna_id_write_error(), uiTemplatePreview(), and WM_operator_drop_load_path().
const char* BKE_idtype_idcode_to_name_plural | ( | short | idcode | ) |
Convert an idcode into a name (plural).
idcode | The code to convert. |
Definition at line 149 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), BLI_assert, IDTypeInfo::name_plural, and NULL.
Referenced by bpy_lib_enter(), bpy_lib_exit(), bpy_lib_exit_lapp_context_items_cb(), idp_repr_fn_recursive(), outliner_idcode_to_plural(), outliner_orphans_purge_invoke(), pyrna_prop_repr_ex(), pyrna_struct_repr(), RNA_path_full_ID_py(), and WM_drag_get_item_name().
const char* BKE_idtype_idcode_to_translation_context | ( | short | idcode | ) |
Convert an idcode into its translations' context.
idcode | The code to convert. |
Definition at line 156 of file idtype.c.
References BKE_idtype_get_info_from_idcode(), BLI_assert, BLT_I18NCONTEXT_DEFAULT, NULL, and IDTypeInfo::translation_context.
Definition at line 106 of file idtype.c.
References id_type_init().
Referenced by blender::bke::tests::Context< TestData >::Context(), blender::bke::tests::LibIDMainSortTestContext::LibIDMainSortTestContext(), main(), blender::bke::image::partial_update::ImagePartialUpdateTest::SetUp(), BlendfileLoadingBaseTest::SetUpTestCase(), blender::bke::tests::BPathTest::SetUpTestSuite(), and blender::bke::tests::TEST().
Definition at line 49 of file idtype.c.
References BLI_assert, ID_AC, ID_AR, ID_BR, ID_CA, ID_CF, ID_CU_LEGACY, ID_CV, ID_GD, ID_GR, ID_IM, ID_IP, ID_KE, ID_LA, ID_LI, ID_LP, ID_LS, ID_LT, ID_MA, ID_MB, ID_MC, ID_ME, ID_MSK, ID_NT, ID_OB, ID_PA, ID_PAL, ID_PC, ID_PT, ID_SCE, ID_SCR, ID_SIM, ID_SO, ID_SPK, ID_TE, ID_TXT, id_types, ID_VF, ID_VO, ID_WM, ID_WO, ID_WS, IDType_ID_LINK_PLACEHOLDER, INDEX_ID_NULL, INIT_TYPE, and IDTypeInfo::main_listbase_index.
Referenced by BKE_idtype_init().
|
static |
Definition at line 129 of file idtype.c.
References ARRAY_SIZE, id_types, NULL, and STREQ.
Referenced by BKE_idtype_idcode_from_name().
|
static |
Definition at line 47 of file idtype.c.
Referenced by BKE_idtype_get_info_from_idcode(), BKE_idtype_idcode_iter_step(), id_type_init(), and idtype_get_info_from_name().