Blender V4.5
BPyPropStore Struct Reference

Classes

struct  [struct].py_data

Public Attributes

BPyPropStorenext
BPyPropStoreprev
struct  py_data

Detailed Description

Store #PyObject data for a dynamically defined property. Currently this is only used to store call-back functions. Properties that don't use custom callbacks won't allocate this struct.

Memory/Reference Management

This struct adds/removes the user-count of each #PyObject it references, it's needed in case the function is removed from the class (unlikely but possible), also when an annotation evaluates to a lambda with Python 3.10 and newer e.g: #86332.

Pointers to this struct are held in:

  • PropertyRNA.py_data (owns the memory). Freed when the RNA property is freed.
  • #g_bpy_prop_store_list (borrows the memory) Having a global list means the users can be visited by the GC and cleared on exit.

    This list can't be used for freeing as BPyPropStore doesn't hold a PropertyRNA back-pointer, (while it could be supported it would only complicate things).

    All RNA properties are freed after Python has been shut-down. At that point Python user counts can't be touched and must have already been dealt with.

Decrementing users is handled by:

  • #bpy_prop_py_data_remove manages decrementing at run-time (when a property is removed),
  • BPY_rna_props_clear_all does this on exit for all dynamic properties.

Definition at line 122 of file bpy_props.cc.

Member Data Documentation

◆ next

BPyPropStore* BPyPropStore::next

Definition at line 123 of file bpy_props.cc.

◆ prev

BPyPropStore * BPyPropStore::prev

Definition at line 123 of file bpy_props.cc.

◆ py_data


The documentation for this struct was generated from the following file: