Blender V5.0
BPyPropStore Struct Reference

Public Attributes

BPyPropStorenext
BPyPropStoreprev
struct { 
   PyObject *   get_fn 
   PyObject *   set_fn 
   PyObject *   get_transform_fn 
   PyObject *   set_transform_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 124 of file bpy_props.cc.

Member Data Documentation

◆ [struct]

struct { ... } BPyPropStore::enum_data

◆ get_fn

PyObject* BPyPropStore::get_fn

Wrap: RNA_def_property_*_funcs (depending on type).

  • get/set are used to provide access to a non-standard storage for the value (i.e. not in the default 'system-defined' IDProperties storage).
    • Their fallback implementation uses the system IDProperties storage system.
    • If get is specified, but not set, the property is considered read-only.
    • If set is specified, but not get, this is an error.
  • get_transform/set_transform are used to perform some additional transformation of the data, after get is called / before set is called (or their matching default get/set implementations).
    • Their fallback implementation is 'pass-through'.

Conceptually, the flow of callings is:

Definition at line 151 of file bpy_props.cc.

Referenced by bpy_prop_boolean_array_get_fn(), bpy_prop_boolean_get_fn(), bpy_prop_callback_assign_boolean(), bpy_prop_callback_assign_boolean_array(), bpy_prop_callback_assign_enum(), bpy_prop_callback_assign_float(), bpy_prop_callback_assign_float_array(), bpy_prop_callback_assign_int(), bpy_prop_callback_assign_int_array(), bpy_prop_callback_assign_string(), bpy_prop_enum_get_fn(), bpy_prop_float_array_get_fn(), bpy_prop_float_array_get_transform_fn(), bpy_prop_float_get_fn(), bpy_prop_int_array_get_fn(), bpy_prop_int_get_fn(), and bpy_prop_string_get_locked_fn().

◆ get_transform_fn

◆ itemf_fn

PyObject* BPyPropStore::itemf_fn

◆ next

BPyPropStore* BPyPropStore::next

Definition at line 125 of file bpy_props.cc.

◆ [struct]

struct { ... } BPyPropStore::pointer_data

◆ poll_fn

PyObject* BPyPropStore::poll_fn

◆ prev

BPyPropStore * BPyPropStore::prev

Definition at line 125 of file bpy_props.cc.

◆ [struct]

struct { ... } BPyPropStore::py_data

Only store #PyObject types, so this member can be cast to an array and iterated over. nullptr members are skipped.

Referenced by bpy_prop_boolean_array_get_fn(), bpy_prop_boolean_array_get_transform_fn(), bpy_prop_boolean_array_set_fn(), bpy_prop_boolean_array_set_transform_fn(), bpy_prop_boolean_get_fn(), bpy_prop_boolean_get_transform_fn(), bpy_prop_boolean_set_fn(), bpy_prop_boolean_set_transform_fn(), bpy_prop_callback_assign_boolean(), bpy_prop_callback_assign_boolean_array(), bpy_prop_callback_assign_enum(), bpy_prop_callback_assign_float(), bpy_prop_callback_assign_float_array(), bpy_prop_callback_assign_int(), bpy_prop_callback_assign_int_array(), bpy_prop_callback_assign_pointer(), bpy_prop_callback_assign_string(), bpy_prop_callback_assign_update(), bpy_prop_enum_get_fn(), bpy_prop_enum_get_transform_fn(), bpy_prop_enum_itemf_fn(), bpy_prop_enum_set_fn(), bpy_prop_enum_set_transform_fn(), bpy_prop_float_array_get_fn(), bpy_prop_float_array_get_transform_fn(), bpy_prop_float_array_set_fn(), bpy_prop_float_array_set_transform_fn(), bpy_prop_float_get_fn(), bpy_prop_float_get_transform_fn(), bpy_prop_float_set_fn(), bpy_prop_float_set_transform_fn(), bpy_prop_int_array_get_fn(), bpy_prop_int_array_get_transform_fn(), bpy_prop_int_array_set_fn(), bpy_prop_int_array_set_transform_fn(), bpy_prop_int_get_fn(), bpy_prop_int_get_transform_fn(), bpy_prop_int_set_fn(), bpy_prop_int_set_transform_fn(), bpy_prop_pointer_poll_fn(), bpy_prop_py_data_remove(), bpy_prop_string_get_locked_fn(), bpy_prop_string_get_transform_locked_fn(), bpy_prop_string_set_fn(), bpy_prop_string_set_transform_fn(), bpy_prop_string_visit_for_search_fn(), and bpy_prop_update_fn().

◆ search_fn

PyObject* BPyPropStore::search_fn

◆ set_fn

◆ set_transform_fn

◆ [struct]

struct { ... } BPyPropStore::string_data

◆ update_fn

PyObject* BPyPropStore::update_fn

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