Blender V5.3
bpy_rna_id_collection.cc File Reference
#include <Python.h>
#include <cstddef>
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.hh"
#include "BLI_string.hh"
#include "BKE_bpath.hh"
#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 "../generic/python_utildefines.hh"
#include "RNA_enum_types.hh"
#include "RNA_prototypes.hh"
#include "bpy_rna.hh"

Go to the source code of this file.

Classes

struct  blender::IDUserMapData
struct  blender::IDFilePathMapData
struct  blender::IDFilePathForeachData
struct  blender::BPy_FilePathMeta

Namespaces

namespace  blender
 BMesh Iterators.

Functions

static Main * blender::pyrna_bmain_FromPyObject (PyObject *obj)
static int blender::id_code_as_index (const short idcode)
static bool blender::id_check_type (const ID *id, const BLI_bitmap *types_bitmap)
static int blender::foreach_libblock_id_user_map_callback (LibraryIDLinkCallbackData *cb_data)
 blender::PyDoc_STRVAR (bpy_user_map_doc, ".. method:: user_map(*, subset=None, key_types=None, value_types=None)\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" " :param 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`] | None\n" " :param key_types: Filter the keys mapped by ID types.\n" " :type key_types: set[str] | None\n" " :param value_types: Filter the values in the set by ID types.\n" " :type value_types: set[str] | None\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 * blender::bpy_user_map (PyObject *self, PyObject *args, PyObject *kwds)
static bool blender::foreach_id_file_path_map_callback (BPathForeachPathData *bpath_data, char *, size_t, const char *path_src)
static void blender::foreach_id_file_path_map (BPathForeachPathData &bpath_data)
 blender::PyDoc_STRVAR (bpy_file_path_map_doc, ".. method:: file_path_map(*, subset=None, key_types=None, include_libraries=False)\n" "\n" " Returns a mapping of all ID data-blocks in current ``bpy.data`` to a set of all " "file paths used by them.\n" "\n" " For list of valid set members for key_types, see: " ":class:`bpy.types.KeyingSetPath.id_type`.\n" "\n" " :param subset: When given, only these data-blocks and their used file paths " "will be included as keys/values in the map.\n" " :type subset: Sequence[:class:`bpy.types.ID`] | None\n" " :param key_types: When given, filter the keys mapped by ID types. " "Ignored if ``subset`` is also given.\n" " :type key_types: set[str] | None\n" " :param include_libraries: Include library file paths of linked data. False by default.\n" " :type include_libraries: bool\n" " :return: dictionary of :class:`bpy.types.ID` instances, with sets of file path " "strings as their values.\n" " :rtype: dict[:class:`bpy.types.ID`, set[str]]\n")
static PyObject * blender::bpy_file_path_map (PyObject *self, PyObject *args, PyObject *kwds)
 blender::PyDoc_STRVAR (bpy_file_path_meta_is_expanded_doc, "True when the path was expanded from a UDIM tile or sequence frame. These paths can not be " "edited.\n" "\n" ":type: bool\n")
static PyObject * blender::bpy_file_path_meta_get_is_expanded (BPy_FilePathMeta *self, void *)
 blender::PyDoc_STRVAR (bpy_file_path_meta_is_cache_doc, "True when the path is a cache file, like the image texture cache. These paths can not be " "edited.\n" "\n" ":type: bool\n")
static PyObject * blender::bpy_file_path_meta_get_is_cache (BPy_FilePathMeta *self, void *)
 blender::PyDoc_STRVAR (bpy_file_path_meta_is_readonly_doc, "True when the path is read-only and can not be edited.\n" "\n" ":type: bool\n")
static PyObject * blender::bpy_file_path_meta_get_is_readonly (BPy_FilePathMeta *self, void *)
static void blender::bpy_file_path_meta_dealloc (BPy_FilePathMeta *self)
 blender::PyDoc_STRVAR (bpy_file_path_meta_doc, "Metadata about a file path visited by :class:`bpy.types.BlendData.file_path_foreach`.\n")
PyObject * blender::BPyInit_blend_data_path_meta_type ()
static PyObject * blender::bpy_file_path_meta_CreatePyObject (const BPathForeachPathData *bpath_data)
static bool blender::foreach_id_file_path_foreach_callback (BPathForeachPathData *bpath_data, char *path_dst, const size_t path_dst_maxncpy, const char *path_src)
 blender::PyDoc_STRVAR (bpy_file_path_foreach_doc, ".. method:: file_path_foreach(visit_path_fn, *, subset=None, visit_types=None, " "flags={'SKIP_PACKED', 'SKIP_WEAK_REFERENCES'})\n" "\n" " Call ``visit_path_fn`` for the file paths used by all ID data-blocks in current " "``bpy.data``.\n" "\n" " For list of valid set members for visit_types, see: " ":class:`bpy.types.KeyingSetPath.id_type`.\n" "\n" " :param visit_path_fn: function that takes three parameters: the data-block, a file path, " "and a :class:`bpy.types.BlendDataPathMeta` metadata object. " "The function should return either ``None`` or a ``str``. In the latter case, the visited " "file path will be replaced with the returned string.\n" " :type visit_path_fn: Callable[[:class:`bpy.types.ID`, str, " ":class:`bpy.types.BlendDataPathMeta`], str|None]\n" " :param subset: When given, only these data-blocks and their used file paths " "will be visited.\n" " :type subset: set[:class:`bpy.types.ID`] | None\n" " :param visit_types: When given, only visit data-blocks of these types. Ignored if " "``subset`` is also given.\n" " :type visit_types: set[str] | None\n" " :type flags: set[str]\n" " :param flags: Set of flags that influence which data-blocks are visited. See " ":ref:`rna_enum_file_path_foreach_flag_items`.\n")
static PyObject * blender::bpy_file_path_foreach (PyObject *self, PyObject *args, PyObject *kwds)
 blender::PyDoc_STRVAR (bpy_batch_remove_doc, ".. method:: batch_remove(ids)\n" "\n" " Remove (delete) several IDs at once.\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" " :param ids: Sequence of IDs (types can be mixed).\n" " :type ids: Sequence[:class:`bpy.types.ID`]\n")
static PyObject * blender::bpy_batch_remove (PyObject *self, PyObject *args, PyObject *kwds)
 blender::PyDoc_STRVAR (bpy_orphans_purge_doc, ".. method:: orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=False)\n" "\n" " Remove (delete) all IDs with no user.\n" "\n" " :param do_local_ids: Include unused local IDs in the deletion, defaults to True\n" " :type do_local_ids: bool\n" " :param do_linked_ids: Include unused linked IDs in the deletion, defaults to True\n" " :type do_linked_ids: bool\n" " :param 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\n" " :return: The number of deleted IDs.\n" " :rtype: int\n")
static PyObject * blender::bpy_orphans_purge (PyObject *self, PyObject *args, PyObject *kwds)

Variables

const EnumPropertyItem blender::rna_enum_file_path_foreach_flag_items []
static PyGetSetDef blender::bpy_file_path_meta_getset []
static PyTypeObject blender::BPyFilePathMeta_Type
PyMethodDef blender::BPY_rna_id_collection_user_map_method_def
PyMethodDef blender::BPY_rna_id_collection_file_path_map_method_def
PyMethodDef blender::BPY_rna_id_collection_file_path_foreach_method_def
PyMethodDef blender::BPY_rna_id_collection_batch_remove_method_def
PyMethodDef blender::BPY_rna_id_collection_orphans_purge_method_def

Detailed Description

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.