Blender V4.3
BPyPropStore Struct Reference

Public Attributes

BPyPropStorenext
 
BPyPropStoreprev
 
struct { 
 
   PyObject *   get_fn 
 
   PyObject *   set_fn 
 
   PyObject *   update_fn 
 
   union { 
 
      struct { 
 
         PyObject *   itemf_fn 
 
      }   enum_data 
 
      struct { 
 
         PyObject *   poll_fn 
 
      }   pointer_data 
 
      struct { 
 
         PyObject *   search_fn 
 
      }   string_data 
 
   }  
 
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:

Definition at line 122 of file bpy_props.cc.

Member Data Documentation

◆ [struct]

struct { ... } BPyPropStore::enum_data

◆ get_fn

◆ itemf_fn

PyObject* BPyPropStore::itemf_fn

◆ next

BPyPropStore* BPyPropStore::next

Definition at line 123 of file bpy_props.cc.

◆ [struct]

struct { ... } BPyPropStore::pointer_data

◆ poll_fn

PyObject* BPyPropStore::poll_fn

◆ prev

BPyPropStore * BPyPropStore::prev

Definition at line 123 of file bpy_props.cc.

◆ [struct]

◆ search_fn

PyObject* BPyPropStore::search_fn

◆ set_fn

◆ [struct]

struct { ... } BPyPropStore::string_data

◆ update_fn

PyObject* BPyPropStore::update_fn

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