Blender  V3.3
Classes | Typedefs | Functions | Variables
bpy_rna_id_collection.c File Reference
#include <Python.h>
#include <stddef.h>
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.h"
#include "BLI_utildefines.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "DNA_ID.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "WM_api.h"
#include "WM_types.h"
#include "bpy_capi_utils.h"
#include "bpy_rna_id_collection.h"
#include "../generic/py_capi_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "RNA_types.h"
#include "bpy_rna.h"

Go to the source code of this file.

Classes

struct  IDUserMapData
 

Typedefs

typedef struct IDUserMapData 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 " "datablocks 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 of strings\n" " :arg value_types: Filter the values in the set by ID types.\n" " :type value_types: set of strings\n" " :return: dictionary of :class:`bpy.types.ID` instances, with sets of ID's as " "their values.\n" " :rtype: dict\n")
 
static PyObject * bpy_user_map (PyObject *UNUSED(self), 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: Iterables of IDs (types can be mixed).\n" " :type subset: sequence\n")
 
static PyObject * bpy_batch_remove (PyObject *UNUSED(self), 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 *UNUSED(self), 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
 

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.c.

Typedef Documentation

◆ IDUserMapData

typedef struct IDUserMapData IDUserMapData

Function Documentation

◆ bpy_batch_remove()

static PyObject* bpy_batch_remove ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kwds 
)
static

◆ bpy_orphans_purge()

static PyObject* bpy_orphans_purge ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kwds 
)
static

◆ bpy_user_map()

static PyObject* bpy_user_map ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kwds 
)
static

◆ foreach_libblock_id_user_map_callback()

static int foreach_libblock_id_user_map_callback ( LibraryIDLinkCallbackData cb_data)
static

◆ id_check_type()

static bool id_check_type ( const ID id,
const BLI_bitmap types_bitmap 
)
static

◆ id_code_as_index()

static int id_code_as_index ( const short  idcode)
static

Definition at line 58 of file bpy_rna_id_collection.c.

Referenced by id_check_type().

◆ PyDoc_STRVAR() [1/3]

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:Iterables of IDs(types can be mixed).\n" " :type subset:sequence\n"   
)

◆ PyDoc_STRVAR() [2/3]

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() [3/3]

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 " "datablocks 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 of strings\n" " :arg value_types:Filter the values in the set by ID types.\n" " :type value_types:set of strings\n" " :return:dictionary of :class:`bpy.types.ID instances,
with sets of ID 's as " "their values.\n" " :rtype:dict\n"   
)

Variable Documentation

◆ BPY_rna_id_collection_batch_remove_method_def

PyMethodDef BPY_rna_id_collection_batch_remove_method_def
Initial value:
= {
"batch_remove",
(PyCFunction)bpy_batch_remove,
METH_STATIC | METH_VARARGS | METH_KEYWORDS,
bpy_batch_remove_doc,
}
static PyObject * bpy_batch_remove(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)

Definition at line 422 of file bpy_rna_id_collection.c.

Referenced by BPY_rna_types_extend_capi().

◆ BPY_rna_id_collection_orphans_purge_method_def

PyMethodDef BPY_rna_id_collection_orphans_purge_method_def
Initial value:
= {
"orphans_purge",
(PyCFunction)bpy_orphans_purge,
METH_STATIC | METH_VARARGS | METH_KEYWORDS,
bpy_orphans_purge_doc,
}
static PyObject * bpy_orphans_purge(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)

Definition at line 428 of file bpy_rna_id_collection.c.

Referenced by BPY_rna_types_extend_capi().

◆ BPY_rna_id_collection_user_map_method_def

PyMethodDef BPY_rna_id_collection_user_map_method_def
Initial value:
= {
"user_map",
(PyCFunction)bpy_user_map,
METH_STATIC | METH_VARARGS | METH_KEYWORDS,
bpy_user_map_doc,
}
static PyObject * bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)

Definition at line 416 of file bpy_rna_id_collection.c.

Referenced by BPY_rna_types_extend_capi().