|
Blender V4.3
|
#include <Python.h>#include <cstddef>#include "MEM_guardedalloc.h"#include "BLI_bitmap.h"#include "BLI_utildefines.h"#include "BKE_global.hh"#include "BKE_lib_id.hh"#include "BKE_lib_query.hh"#include "BKE_main.hh"#include "DNA_ID.h"#include "WM_api.hh"#include "WM_types.hh"#include "bpy_rna_id_collection.hh"#include "../generic/py_capi_rna.hh"#include "../generic/py_capi_utils.hh"#include "../generic/python_compat.hh"#include "RNA_enum_types.hh"#include "bpy_rna.hh"Go to the source code of this file.
Classes | |
| struct | IDUserMapData |
Functions | |
| static int | id_code_as_index (const short idcode) |
| static bool | id_check_type (const ID *id, const BLI_bitmap *types_bitmap) |
| static int | foreach_libblock_id_user_map_callback (LibraryIDLinkCallbackData *cb_data) |
| PyDoc_STRVAR (bpy_user_map_doc, ".. method:: user_map(subset, key_types, value_types)\n" "\n" " Returns a mapping of all ID data-blocks in current ``bpy.data`` to a set of all " "data-blocks using them.\n" "\n" " For list of valid set members for key_types & value_types, see: " ":class:`bpy.types.KeyingSetPath.id_type`.\n" "\n" " :arg subset: When passed, only these data-blocks and their users will be " "included as keys/values in the map.\n" " :type subset: Sequence[:class:`bpy.types.ID`]\n" " :arg key_types: Filter the keys mapped by ID types.\n" " :type key_types: set[str]\n" " :arg value_types: Filter the values in the set by ID types.\n" " :type value_types: set[str]\n" " :return: dictionary that maps data-blocks ID's to their users.\n" " :rtype: dict[:class:`bpy.types.ID`, set[:class:`bpy.types.ID`]]\n") | |
| static PyObject * | bpy_user_map (PyObject *, PyObject *args, PyObject *kwds) |
| PyDoc_STRVAR (bpy_batch_remove_doc, ".. method:: batch_remove(ids)\n" "\n" " Remove (delete) several IDs at once.\n" "\n" " WARNING: Considered experimental feature currently.\n" "\n" " Note that this function is quicker than individual calls to :func:`remove()` " "(from :class:`bpy.types.BlendData`\n" " ID collections), but less safe/versatile (it can break Blender, e.g. by removing " "all scenes...).\n" "\n" " :arg ids: Sequence of IDs (types can be mixed).\n" " :type ids: Sequence[:class:`bpy.types.ID`]\n") | |
| static PyObject * | bpy_batch_remove (PyObject *, PyObject *args, PyObject *kwds) |
| PyDoc_STRVAR (bpy_orphans_purge_doc, ".. method:: orphans_purge()\n" "\n" " Remove (delete) all IDs with no user.\n" "\n" " :arg do_local_ids: Include unused local IDs in the deletion, defaults to True\n" " :type do_local_ids: bool, optional\n" " :arg do_linked_ids: Include unused linked IDs in the deletion, defaults to True\n" " :type do_linked_ids: bool, optional\n" " :arg do_recursive: Recursively check for unused IDs, ensuring no orphaned one " "remain after a single run of that function, defaults to False\n" " :type do_recursive: bool, optional\n" " :return: The number of deleted IDs.\n") | |
| static PyObject * | bpy_orphans_purge (PyObject *, PyObject *args, PyObject *kwds) |
Variables | |
| PyMethodDef | BPY_rna_id_collection_user_map_method_def |
| PyMethodDef | BPY_rna_id_collection_batch_remove_method_def |
| PyMethodDef | BPY_rna_id_collection_orphans_purge_method_def |
This file adds some helpers related to ID/Main handling, that cannot fit well in RNA itself.
Definition in file bpy_rna_id_collection.cc.
|
static |
Definition at line 291 of file bpy_rna_id_collection.cc.
References BKE_id_multi_tagged_delete(), BKE_main_id_tag_all(), PointerRNA::data, error(), G_MAIN, ID_TAG_DOIT, NC_WINDOW, BPy_StructRNA::ptr, PY_ARG_PARSER_HEAD_COMPAT, pyrna_id_FromPyObject(), ret, self, and WM_main_add_notifier().
|
static |
Definition at line 370 of file bpy_rna_id_collection.cc.
References BKE_id_multi_tagged_delete(), BKE_lib_query_unused_ids_tag(), PointerRNA::data, LibQueryUnusedIDsData::do_linked_ids, LibQueryUnusedIDsData::do_local_ids, LibQueryUnusedIDsData::do_recursive, G_MAIN, ID_TAG_DOIT, INDEX_ID_NULL, NC_WINDOW, LibQueryUnusedIDsData::num_total, BPy_StructRNA::ptr, PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseBool(), self, and WM_main_add_notifier().
|
static |
Definition at line 136 of file bpy_rna_id_collection.cc.
References BKE_library_foreach_ID_link(), PointerRNA::data, error(), foreach_libblock_id_user_map_callback(), FOREACH_MAIN_LISTBASE_BEGIN, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, G_MAIN, id_check_type(), IDUserMapData::id_curr, IDWALK_CB_NOP, IDUserMapData::is_subset, MEM_freeN(), BPy_StructRNA::ptr, PY_ARG_PARSER_HEAD_COMPAT, IDUserMapData::py_id_curr, pyrna_enum_bitmap_from_set(), pyrna_id_CreatePyObject(), ret, rna_enum_id_type_items, self, set(), IDUserMapData::types_bitmap, and IDUserMapData::user_map.
|
static |
Definition at line 65 of file bpy_rna_id_collection.cc.
References LibraryIDLinkCallbackData::cb_flag, id_check_type(), LibraryIDLinkCallbackData::id_pointer, IDWALK_CB_EMBEDDED, IDWALK_CB_EMBEDDED_NOT_OWNING, IDWALK_CB_LOOPBACK, IDWALK_RET_NOP, pyrna_id_CreatePyObject(), set(), and LibraryIDLinkCallbackData::user_data.
Referenced by bpy_user_map().
|
static |
Definition at line 60 of file bpy_rna_id_collection.cc.
References BLI_BITMAP_TEST_BOOL, GS, and id_code_as_index().
Referenced by bpy_user_map(), and foreach_libblock_id_user_map_callback().
|
static |
Definition at line 55 of file bpy_rna_id_collection.cc.
References int.
Referenced by id_check_type().
| PyDoc_STRVAR | ( | bpy_batch_remove_doc | , |
| ".. method:: | batch_removeids)\n" "\n" " Remove (delete) several IDs at once.\n" "\n" " WARNING: Considered experimental feature currently.\n" "\n" " Note that this function is quicker than individual calls to :func:`remove()` " "(from :class:`bpy.types.BlendData`\n" " ID collections, | ||
| but less safe/versatile(it can break Blender, e.g. by removing " "all scenes...).\n" "\n" " :arg ids:Sequence of IDs(types can be mixed).\n" " :type ids:Sequence\n" | [:class:`bpy.types.ID`] ) |
| PyDoc_STRVAR | ( | bpy_orphans_purge_doc | , |
| ".. method:: orphans_purge()\n" "\n" " Remove (delete) all IDs with no user.\n" "\n" " :arg do_local_ids: Include unused local IDs in the | deletion, | ||
| defaults to True\n" " :type do_local_ids:bool | , | ||
| optional\n" " :arg do_linked_ids:Include unused linked IDs in the | deletion, | ||
| defaults to True\n" " :type do_linked_ids:bool | , | ||
| optional\n" " :arg do_recursive:Recursively check for unused | IDs, | ||
| ensuring no orphaned one " "remain after a single run of that | function, | ||
| defaults to False\n" " :type do_recursive:bool | , | ||
| optional\n" " :return:The number of deleted IDs.\n" | ) |
| PyDoc_STRVAR | ( | bpy_user_map_doc | , |
| ".. method:: user_map(subset, key_types, value_types)\n" "\n" " Returns a mapping of all ID data-blocks in current ``bpy.data`` to a set of all " "data-blocks using them.\n" "\n" " For list of valid set members for key_types & | value_types, | ||
| see:" ":class:`bpy.types.KeyingSetPath.id_type`.\n" "\n" " :arg subset:When | passed, | ||
| only these data-blocks and their users will be " "included as keys/values in the map.\n" " :type subset:Sequence\n" " :arg key_types:Filter the keys mapped by ID types.\n" " :type key_types:set\n" " :arg value_types:Filter the values in the set by ID types.\n" " :type value_types:set\n" " :return:dictionary that maps data-blocks ID 's to their users.\n" " :rtype:dict]\n" | [:class:`bpy.types.ID`][str][str][:class:`bpy.types.ID`, set[:class:`bpy.types.ID`] ) |
| PyMethodDef BPY_rna_id_collection_batch_remove_method_def |
Definition at line 433 of file bpy_rna_id_collection.cc.
Referenced by BPY_rna_types_extend_capi().
| PyMethodDef BPY_rna_id_collection_orphans_purge_method_def |
Definition at line 439 of file bpy_rna_id_collection.cc.
Referenced by BPY_rna_types_extend_capi().
| PyMethodDef BPY_rna_id_collection_user_map_method_def |
Definition at line 427 of file bpy_rna_id_collection.cc.
Referenced by BPY_rna_types_extend_capi().