Blender V4.3
blender::interface::internal Namespace Reference

Functions

blender::Vector< FCurve * > get_property_drivers (PointerRNA *ptr, PropertyRNA *prop, bool get_all, int index, bool *r_is_array_prop)
 
int paste_property_drivers (blender::Span< FCurve * > src_drivers, bool is_array_prop, PointerRNA *dst_ptr, PropertyRNA *dst_prop)
 

Function Documentation

◆ get_property_drivers()

blender::Vector< FCurve * > blender::interface::internal::get_property_drivers ( PointerRNA * ptr,
PropertyRNA * prop,
bool get_all,
int index,
bool * r_is_array_prop )

Get the driver(s) of the given property.

Note
intended to be used in conjunction with paste_property_drivers() below.
Parameters
ptrThe RNA pointer of the property.
propThe property RNA of the property.
get_allWhether to get all drivers of an array property, or just the one specified by index. Ignored if the property is not an array property.
indexWhich element of an array property to get. Ignored if get_all is true or if the property is not an array properly.
r_is_array_propOutput parameter, that stores whether the passed property is an array property or not.
Returns
A vector of pointers to the drivers of the property. It will be zero-sized if no drivers were fetched (e.g. if the property had no drivers). Otherwise the vector will be the size of the underlying property (e.g. 4 for an array property with 4 elements, 1 for a non-array property). For array properties, elements without drivers will be null.

Definition at line 1579 of file interface_ops.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BKE_animdata_from_id(), BKE_fcurve_find(), BLI_assert, AnimData::drivers, PointerRNA::owner_id, ptr, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), RNA_path_from_ID_to_property(), RNA_property_array_check(), RNA_property_array_length(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().

Referenced by blender::interface::tests::TEST_F(), and blender::interface::tests::TEST_F().

◆ paste_property_drivers()

int blender::interface::internal::paste_property_drivers ( blender::Span< FCurve * > src_drivers,
bool is_array_prop,
PointerRNA * dst_ptr,
PropertyRNA * dst_prop )

Paste the drivers from src_drivers to the destination property.

This function can be used for pasting drivers for all elements of an array property, just some elements of an array property, or a single driver for a non-array property.

Note
intended to be used in conjunction with get_property_drivers() above. The destination property should have the same type and (if an array property) length as the source property passed to get_property_drivers().
Parameters
src_driversThe span of drivers to paste. If is_array_prop is false, this must be a single element. If is_array_prop is true then this should have the same length as the destination array property. Nullptr elements are skipped when pasting.
is_array_propWhether src_drivers are drivers for the elements of an array property.
dst_ptrThe RNA pointer for the destination property.
dist_propThe destination property RNA.
Returns
The number of successfully pasted drivers.

Definition at line 1633 of file interface_ops.cc.

References BKE_animdata_ensure_id(), BKE_fcurve_copy(), BKE_fcurve_find(), BKE_fcurve_find_by_rna(), BKE_fcurve_free(), BKE_fcurve_rnapath_set(), BLI_addtail(), BLI_assert, BLI_remlink(), AnimData::drivers, PointerRNA::owner_id, RNA_path_from_ID_to_property(), and blender::Span< T >::size().

Referenced by blender::interface::tests::TEST_F().