Blender V5.0
BKE_idprop.hh File Reference
#include <memory>
#include "DNA_ID.h"
#include "DNA_ID_enums.h"
#include "BLI_compiler_attrs.h"
#include "BLI_function_ref.hh"
#include "BLI_span.hh"
#include "BLI_string_ref.hh"
#include "BLI_sys_types.h"
#include "BLI_vector_set.hh"

Go to the source code of this file.

Classes

union  IDPropertyTemplate
class  blender::bke::idprop::IDPropertyDeleter
struct  blender::bke::idprop::IDPropertyGroupChildrenSet
struct  blender::bke::idprop::IDPropertyGroupChildrenSet::IDPropNameGetter

Namespaces

namespace  blender
namespace  blender::io
namespace  blender::io::serialize
namespace  blender::bke
namespace  blender::bke::idprop

Macros

#define IDP_int_get(prop)
#define IDP_int_set(prop, value)
#define IDP_bool_get(prop)
#define IDP_bool_set(prop, value)
#define IDP_int_or_bool_get(prop)
#define IDP_int_or_bool_set(prop, value)
#define IDP_float_get(prop)
#define IDP_float_set(prop, value)
#define IDP_double_get(prop)
#define IDP_double_set(prop, value)
#define IDP_array_voidp_get(prop)
#define IDP_array_int_get(prop)
#define IDP_array_bool_get(prop)
#define IDP_array_float_get(prop)
#define IDP_array_double_get(prop)
#define IDP_property_array_get(prop)
#define IDP_string_get(prop)
#define IDP_ID_get(prop)
#define IDP_BlendDataRead(reader, prop)

Typedefs

using IDPWalkFunc = void (*)(void *user_data, IDProperty *idp)

Enumerations

enum  eIDPropertyUIDataType {
  IDP_UI_DATA_TYPE_UNSUPPORTED = -1 , IDP_UI_DATA_TYPE_INT = 0 , IDP_UI_DATA_TYPE_FLOAT = 1 , IDP_UI_DATA_TYPE_STRING = 2 ,
  IDP_UI_DATA_TYPE_ID = 3 , IDP_UI_DATA_TYPE_BOOLEAN = 4
}

Functions

IDPropertyIDP_NewIDPArray (blender::StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDPropertyIDP_CopyIDPArray (const IDProperty *array, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_SetIndexArray (IDProperty *prop, int index, IDProperty *item) ATTR_NONNULL()
IDPropertyIDP_GetIndexArray (IDProperty *prop, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_AppendArray (IDProperty *prop, IDProperty *item)
void IDP_ResizeIDPArray (IDProperty *prop, int newlen)
void IDP_ResizeArray (IDProperty *prop, int newlen)
void IDP_FreeArray (IDProperty *prop)
IDPropertyIDP_NewStringMaxSize (const char *st, size_t st_maxncpy, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT
IDPropertyIDP_NewString (const char *st, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT
void IDP_AssignStringMaxSize (IDProperty *prop, const char *st, size_t st_maxncpy) ATTR_NONNULL()
void IDP_AssignString (IDProperty *prop, const char *st) ATTR_NONNULL()
void IDP_FreeString (IDProperty *prop) ATTR_NONNULL()
const IDPropertyUIDataEnumItemIDP_EnumItemFind (const IDProperty *prop)
bool IDP_EnumItemsValidate (const IDPropertyUIDataEnumItem *items, int items_num, void(*error_fn)(const char *))
void IDP_AssignID (IDProperty *prop, ID *id, int flag)
void IDP_SyncGroupValues (IDProperty *dest, const IDProperty *src) ATTR_NONNULL()
void IDP_SyncGroupTypes (IDProperty *dest, const IDProperty *src, bool do_arraylen) ATTR_NONNULL()
void IDP_ReplaceGroupInGroup (IDProperty *dest, const IDProperty *src) ATTR_NONNULL()
void IDP_ReplaceInGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
void IDP_ReplaceInGroup_ex (IDProperty *group, IDProperty *prop, IDProperty *prop_exist, int flag)
void IDP_MergeGroup (IDProperty *dest, const IDProperty *src, bool do_overwrite) ATTR_NONNULL()
void IDP_MergeGroup_ex (IDProperty *dest, const IDProperty *src, bool do_overwrite, int flag) ATTR_NONNULL()
bool IDP_AddToGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
void IDP_RemoveFromGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
void IDP_FreeFromGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
IDPropertyIDP_GetPropertyFromGroup (const IDProperty *prop, blender::StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDPropertyIDP_GetPropertyFromGroup_null (const IDProperty *prop, blender::StringRef name) ATTR_WARN_UNUSED_RESULT
IDPropertyIDP_GetPropertyTypeFromGroup (const IDProperty *prop, blender::StringRef name, char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDPropertyIDP_GetProperties (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDPropertyIDP_EnsureProperties (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDPropertyIDP_ID_system_properties_get (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDPropertyIDP_ID_system_properties_ensure (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDPropertyIDP_CopyProperty (const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDPropertyIDP_CopyProperty_ex (const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_CopyPropertyContent (IDProperty *dst, const IDProperty *src) ATTR_NONNULL()
bool IDP_EqualsProperties_ex (const IDProperty *prop1, const IDProperty *prop2, bool is_strict) ATTR_WARN_UNUSED_RESULT
bool IDP_EqualsProperties (const IDProperty *prop1, const IDProperty *prop2) ATTR_WARN_UNUSED_RESULT
IDPropertyIDP_New (char type, const IDPropertyTemplate *val, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_FreePropertyContent_ex (IDProperty *prop, bool do_id_user)
void IDP_FreePropertyContent (IDProperty *prop)
void IDP_FreeProperty_ex (IDProperty *prop, bool do_id_user)
void IDP_FreeProperty (IDProperty *prop)
void IDP_ClearProperty (IDProperty *prop)
void IDP_Reset (IDProperty *prop, const IDProperty *reference)
const IDProperty_IDP_assert_type (const IDProperty *prop, char ty)
const IDProperty_IDP_assert_type_and_subtype (const IDProperty *prop, char ty, char sub_ty)
const IDProperty_IDP_assert_type_mask (const IDProperty *prop, int ty_mask)
int IDP_coerce_to_int_or_zero (const IDProperty *prop)
float IDP_coerce_to_float_or_zero (const IDProperty *prop)
double IDP_coerce_to_double_or_zero (const IDProperty *prop)
void IDP_foreach_property (IDProperty *id_property_root, int type_filter, blender::FunctionRef< void(IDProperty *id_property)> callback)
char * IDP_reprN (const IDProperty *prop, uint *r_len)
void IDP_repr_fn (const IDProperty *prop, void(*str_append_fn)(void *user_data, const char *str, uint str_len), void *user_data)
void IDP_print (const IDProperty *prop)
const char * IDP_type_str (eIDPropertyType type, short sub_type)
const char * IDP_type_str (const IDProperty *prop)
void IDP_BlendWrite (BlendWriter *writer, const IDProperty *prop)
void IDP_BlendReadData_impl (BlendDataReader *reader, IDProperty **prop, const char *caller_func_id)
bool IDP_ui_data_supported (const IDProperty *prop)
eIDPropertyUIDataType IDP_ui_data_type (const IDProperty *prop)
void IDP_ui_data_free (IDProperty *prop)
void IDP_ui_data_free_unique_contents (IDPropertyUIData *ui_data, eIDPropertyUIDataType type, const IDPropertyUIData *other)
IDPropertyUIDataIDP_ui_data_ensure (IDProperty *prop)
IDPropertyUIDataIDP_ui_data_copy (const IDProperty *prop)
IDPropertyUIDataIDP_TryConvertUIData (IDPropertyUIData *src, eIDPropertyUIDataType src_type, eIDPropertyUIDataType dst_type)
IDProperty to Value
std::unique_ptr< blender::io::serialize::ArrayValueblender::bke::idprop::convert_to_serialize_values (const IDProperty *properties)
 Convert the given properties to Value objects for serialization.
IDProperty from Value
IDPropertyblender::bke::idprop::convert_from_serialize_value (const blender::io::serialize::Value &value)
 Convert the given value to an IDProperty.
Create Functions
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create_bool (StringRef prop_name, bool value, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_BOOLEAN, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, int32_t value, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_INT, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, float value, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_FLOAT, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, double value, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_DOUBLE, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, StringRefNull value, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_STRING, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, ID *value, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_ID, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, Span< int32_t > values, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_ARRAY and sub-type IDP_INT.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, Span< float > values, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_ARRAY and sub-type IDP_FLOAT.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create (StringRef prop_name, Span< double > values, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_ARRAY and sub-type IDP_DOUBLE.
std::unique_ptr< IDProperty, IDPropertyDeleterblender::bke::idprop::create_group (StringRef prop_name, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_GROUP.

Macro Definition Documentation

◆ IDP_array_bool_get

#define IDP_array_bool_get ( prop)
Value:
const IDProperty * _IDP_assert_type_and_subtype(const IDProperty *prop, char ty, char sub_ty)
Definition idprop.cc:1988
@ IDP_BOOLEAN
@ IDP_ARRAY
void * pointer
Definition DNA_ID.h:142
IDPropertyData data
Definition DNA_ID.h:169

Definition at line 355 of file BKE_idprop.hh.

Referenced by BPy_IDArray_GetItem(), BPy_IDArray_SetItem(), BPy_IDArray_slice(), BPy_IDGroup_MapDataToPy(), idp_from_PySequence_Fast(), property_boolean_get_array(), and RNA_property_boolean_set_array().

◆ IDP_array_double_get

◆ IDP_array_float_get

◆ IDP_array_int_get

◆ IDP_array_voidp_get

#define IDP_array_voidp_get ( prop)
Value:
const IDProperty * _IDP_assert_type(const IDProperty *prop, char ty)
Definition idprop.cc:1983

Use when the type of the array is not known.

Avoid using this where possible.

Definition at line 351 of file BKE_idprop.hh.

Referenced by blender::bke::idprop::array_values_set(), BPy_IDArray_ass_slice(), BPy_IDArray_getbuffer(), IDP_EqualsProperties_ex(), idp_from_PySequence_Buffer(), idp_from_PySequence_Fast(), blender::bke::idprop::IDPArraySerializer::idprop_to_dictionary(), and blender::nodes::init_socket_cpp_value_from_property().

◆ IDP_BlendDataRead

◆ IDP_bool_get

◆ IDP_bool_set

◆ IDP_double_get

◆ IDP_double_set

#define IDP_double_set ( prop,
value )
Value:
{ \
IDProperty *prop_ = (prop); \
BLI_assert(prop_->type == IDP_DOUBLE); \
(*(double *)&(prop_)->data.val) = value; \
} \
((void)0)

Definition at line 338 of file BKE_idprop.hh.

Referenced by idp_from_PyFloat(), idp_from_PyLong(), RNA_property_float_set(), RNA_property_float_set_array(), and blender::ed::object::shade_auto_smooth_exec().

◆ IDP_float_get

◆ IDP_float_set

#define IDP_float_set ( prop,
value )

◆ IDP_ID_get

◆ IDP_int_get

◆ IDP_int_or_bool_get

#define IDP_int_or_bool_get ( prop)
Value:
const IDProperty * _IDP_assert_type_mask(const IDProperty *prop, int ty_mask)
Definition idprop.cc:1996

Definition at line 318 of file BKE_idprop.hh.

Referenced by property_boolean_get().

◆ IDP_int_or_bool_set

#define IDP_int_or_bool_set ( prop,
value )
Value:
{ \
IDProperty *prop_ = (prop); \
BLI_assert(ELEM(prop_->type, IDP_INT, IDP_BOOLEAN)); \
prop_->data.val = value; \
} \
((void)0)
#define ELEM(...)

Definition at line 320 of file BKE_idprop.hh.

Referenced by RNA_property_boolean_set().

◆ IDP_int_set

◆ IDP_property_array_get

◆ IDP_string_get

Typedef Documentation

◆ IDPWalkFunc

using IDPWalkFunc = void (*)(void *user_data, IDProperty *idp)

Definition at line 119 of file BKE_idprop.hh.

Enumeration Type Documentation

◆ eIDPropertyUIDataType

Enumerator
IDP_UI_DATA_TYPE_UNSUPPORTED 

Other properties types that don't support RNA UI data.

IDP_UI_DATA_TYPE_INT 

IDP_INT or IDP_ARRAY with subtype IDP_INT.

IDP_UI_DATA_TYPE_FLOAT 

IDP_FLOAT and IDP_DOUBLE or IDP_ARRAY properties with a float or double sub-types.

IDP_UI_DATA_TYPE_STRING 

IDP_STRING properties.

IDP_UI_DATA_TYPE_ID 

IDP_ID.

IDP_UI_DATA_TYPE_BOOLEAN 

IDP_BOOLEAN or IDP_ARRAY with subtype IDP_BOOLEAN.

Definition at line 413 of file BKE_idprop.hh.

Function Documentation

◆ _IDP_assert_type()

const IDProperty * _IDP_assert_type ( const IDProperty * prop,
char ty )

Definition at line 1983 of file idprop.cc.

References BLI_assert, and IDProperty::type.

◆ _IDP_assert_type_and_subtype()

const IDProperty * _IDP_assert_type_and_subtype ( const IDProperty * prop,
char ty,
char sub_ty )

Definition at line 1988 of file idprop.cc.

References BLI_assert, IDProperty::subtype, and IDProperty::type.

◆ _IDP_assert_type_mask()

const IDProperty * _IDP_assert_type_mask ( const IDProperty * prop,
int ty_mask )

Definition at line 1996 of file idprop.cc.

References BLI_assert, and IDProperty::type.

◆ IDP_AddToGroup()

bool IDP_AddToGroup ( IDProperty * group,
IDProperty * prop )

This function has a sanity check to make sure ID properties with the same name don't get added to the group.

The sanity check just means the property is not added to the group if another property exists with the same name; the client code using ID properties then needs to detect this (the function that adds new properties to groups, IDP_AddToGroup, returns false if a property can't be added to the group, and true if it can) and free the property.

Definition at line 717 of file idprop.cc.

References BLI_addtail(), BLI_assert, IDPropertyData::children_map, IDProperty::data, IDPropertyData::group, IDP_GROUP, idp_group_children_map_ensure(), IDProperty::len, and IDProperty::type.

Referenced by BKE_keyconfig_pref_set_select_mouse(), camera_write_cycles_compatibility_data_create(), blender::bke::create_auto_smooth_modifier(), blender::io::usd::ensure_usd_source_path_prop(), blender::bke::idprop::IDPGroupSerializer::entry_to_idprop(), IDP_CopyGroup(), IDP_MergeGroup_ex(), IDP_ReplaceInGroup_ex(), blender::bke::tests::IDSubDataTestData::IDSubDataTestData(), IMB_metadata_set_field(), keymap_update_brushes_handle_add_item(), keymap_update_brushes_handle_remove_item(), blender::bke::node_update_asset_metadata(), operator_last_properties_init_impl(), blender::io::fbx::read_ufbx_property(), blender::ed::geometry::replace_strings_with_id_pointers(), RNA_property_boolean_set(), RNA_property_boolean_set_array(), RNA_property_collection_add(), RNA_property_enum_set(), RNA_property_float_set(), RNA_property_float_set_array(), RNA_property_int_set(), RNA_property_int_set_array(), RNA_property_pointer_add(), RNA_property_string_set(), RNA_property_string_set_bytes(), blender::io::usd::set_bool_prop(), blender::io::usd::set_double_prop(), blender::io::usd::set_float_prop(), blender::io::usd::set_int_prop(), blender::io::usd::set_string_prop(), shortcut_get_operator_property(), shortcut_property_from_rna(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST_F(), texture_paint_image_from_view_exec(), ui_but_event_operator_string_from_menu(), ui_but_event_operator_string_from_panel(), ui_but_event_property_operator_string(), blender::nodes::update_input_properties_from_node_tree(), blender::nodes::update_output_properties_from_node_tree(), version_cycles_property_int_set(), and version_geometry_nodes_add_attribute_input_settings().

◆ IDP_AppendArray()

◆ IDP_AssignID()

void IDP_AssignID ( IDProperty * prop,
ID * id,
int flag )
Parameters
flagthe ID creation/copying flags (LIB_ID_CREATE_...), same as passed to BKE_id_copy_ex.

Definition at line 546 of file idprop.cc.

References BLI_assert, IDProperty::data, flag, ID::flag, ID_FLAG_EMBEDDED_DATA, id_us_min(), id_us_plus(), IDP_ID, IDP_ID_get, LIB_ID_CREATE_NO_USER_REFCOUNT, IDPropertyData::pointer, and IDProperty::type.

Referenced by idp_from_DatablockPointer(), and RNA_property_pointer_set().

◆ IDP_AssignString()

◆ IDP_AssignStringMaxSize()

void IDP_AssignStringMaxSize ( IDProperty * prop,
const char * st,
size_t st_maxncpy )
Parameters
stThe string to assign. Doesn't need to be null terminated when clamped by maxncpy.
maxncpyThe maximum size of the string (including the \0 terminator). When zero, this is the equivalent of passing in strlen(st) + 1

Definition at line 421 of file idprop.cc.

References BLI_assert, BLI_strnlen(), IDProperty::data, IDP_ResizeArray(), IDP_STRING, IDP_string_get, IDP_STRING_SUB_BYTE, IDPropertyData::pointer, IDProperty::subtype, and IDProperty::type.

Referenced by IDP_AssignString(), idp_from_PyBytes(), idp_from_PyUnicode(), RNA_property_string_set(), blender::nodes::update_input_properties_from_node_tree(), and blender::nodes::update_output_properties_from_node_tree().

◆ IDP_BlendReadData_impl()

void IDP_BlendReadData_impl ( BlendDataReader * reader,
IDProperty ** prop,
const char * caller_func_id )

Definition at line 1675 of file idprop.cc.

References IDP_DirectLinkGroup(), IDP_GROUP, and printf.

◆ IDP_BlendWrite()

◆ IDP_ClearProperty()

◆ IDP_coerce_to_double_or_zero()

double IDP_coerce_to_double_or_zero ( const IDProperty * prop)

Return a double from an IDProperty with a compatible type. This should be avoided, but it's sometimes necessary, for example when legacy files have incorrect property types.

Definition at line 813 of file idprop.cc.

References IDP_bool_get, IDP_BOOLEAN, IDP_DOUBLE, IDP_double_get, IDP_FLOAT, IDP_float_get, IDP_INT, IDP_int_get, and IDProperty::type.

Referenced by version_idproperty_move_data_float().

◆ IDP_coerce_to_float_or_zero()

float IDP_coerce_to_float_or_zero ( const IDProperty * prop)

Return a float from an IDProperty with a compatible type. This should be avoided, but it's sometimes necessary, for example when legacy files have incorrect property types.

Definition at line 829 of file idprop.cc.

References float, IDP_bool_get, IDP_BOOLEAN, IDP_DOUBLE, IDP_double_get, IDP_FLOAT, IDP_float_get, IDP_INT, IDP_int_get, and IDProperty::type.

Referenced by version_idproperty_move_data_float().

◆ IDP_coerce_to_int_or_zero()

int IDP_coerce_to_int_or_zero ( const IDProperty * prop)

Return an int from an IDProperty with a compatible type. This should be avoided, but it's sometimes necessary, for example when legacy files have incorrect property types.

Definition at line 797 of file idprop.cc.

References IDP_bool_get, IDP_BOOLEAN, IDP_DOUBLE, IDP_double_get, IDP_FLOAT, IDP_float_get, IDP_INT, IDP_int_get, and IDProperty::type.

Referenced by version_idproperty_move_data_float(), and version_idproperty_move_data_int().

◆ IDP_CopyIDPArray()

IDProperty * IDP_CopyIDPArray ( const IDProperty * array,
int flag )
Parameters
flagthe ID creation/copying flags (LIB_ID_CREATE_...), same as passed to BKE_id_copy_ex.

Definition at line 77 of file idprop.cc.

References BLI_assert, array< T, alignment >::data(), IDProperty::data, flag, GETPROP, i, IDP_CopyProperty_ex(), IDP_IDPARRAY, IDProperty::len, MEM_dupallocN(), MEM_freeN(), MEM_mallocN(), and IDPropertyData::pointer.

Referenced by IDP_CopyProperty_ex().

◆ IDP_CopyProperty()

◆ IDP_CopyProperty_ex()

◆ IDP_CopyPropertyContent()

void IDP_CopyPropertyContent ( IDProperty * dst,
const IDProperty * src )

Copy content from source IDProperty into destination one, freeing destination property's content first.

Definition at line 868 of file idprop.cc.

References IDP_CopyProperty(), IDP_FreeProperty(), IDProperty::next, and IDProperty::prev.

Referenced by uiLayout::op_enum_items(), screen_user_menu_draw(), blender::nodes::update_input_properties_from_node_tree(), and blender::nodes::update_output_properties_from_node_tree().

◆ IDP_EnsureProperties()

IDProperty * IDP_EnsureProperties ( ID * id)

◆ IDP_EnumItemFind()

◆ IDP_EnumItemsValidate()

◆ IDP_EqualsProperties()

bool IDP_EqualsProperties ( const IDProperty * prop1,
const IDProperty * prop2 )

◆ IDP_EqualsProperties_ex()

◆ IDP_foreach_property()

◆ IDP_FreeArray()

void IDP_FreeArray ( IDProperty * prop)

◆ IDP_FreeFromGroup()

◆ IDP_FreeProperty()

void IDP_FreeProperty ( IDProperty * prop)

Definition at line 1251 of file idprop.cc.

References IDP_FreePropertyContent(), and MEM_freeN().

Referenced by BKE_addon_free(), BKE_area_region_free(), BKE_blender_user_menu_item_free(), BKE_collection_exporter_free_data(), BKE_pose_backup_free(), BKE_pose_channel_copy_data(), BKE_workspace_tool_remove(), blo_do_versions_280(), blo_do_versions_400(), bone_free(), camera_write_cycles_compatibility_data_clear(), blender::ed::object::collection_exporter_export(), do_versions_after_linking_280(), ED_armature_edit_free(), ensure_id_properties_freed(), IDP_CopyPropertyContent(), IDP_FreeFromGroup(), idp_from_PyMapping(), idp_from_PySequence_Fast(), idp_resize_group_array(), IMB_metadata_free(), keymap_item_free(), keymap_item_free(), blender::bke::node_update_asset_metadata(), blender::bke::idprop::IDPropertyDeleter::operator()(), operator_last_properties_init_impl(), operatortype_ghash_free_cb(), pose_clear_user_transforms_exec(), poseAnim_mapping_free(), pyrna_struct_dealloc(), pyrna_struct_id_properties_clear(), scene_free_data(), shortcut_free_operator_property(), blender::bke::idprop::tests::TEST(), blender::bke::idprop::tests::TEST(), blender::bke::idprop::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::idprop::tests::test_convert_idprop_from_value(), ui_but_event_operator_string_from_menu(), ui_but_event_operator_string_from_panel(), ui_but_event_property_operator_string(), ui_handler_wait_for_input_remove(), blender::update_id_properties_from_node_group(), userdef_free_keyconfig_prefs(), view3d_free(), wm_drop_item_free_data(), wm_free_operator_properties_callback(), WM_gizmo_properties_free(), wm_keymap_item_find(), wm_keymap_item_find_in_keymap(), wm_keymap_item_free_data(), WM_keymap_item_properties_reset(), WM_keymap_item_restore_to_default(), WM_keymap_remove_item(), WM_operator_free(), WM_operator_last_properties_store(), WM_operator_properties_free(), WM_operatortype_last_properties_clear_all(), WM_operatortype_remove_ptr(), and wm_xr_data_free().

◆ IDP_FreeProperty_ex()

◆ IDP_FreePropertyContent()

void IDP_FreePropertyContent ( IDProperty * prop)

◆ IDP_FreePropertyContent_ex()

◆ IDP_FreeString()

void IDP_FreeString ( IDProperty * prop)

◆ IDP_GetIndexArray()

IDProperty * IDP_GetIndexArray ( IDProperty * prop,
int index )

Definition at line 130 of file idprop.cc.

References BLI_assert, GETPROP, IDP_IDPARRAY, and IDProperty::type.

Referenced by RNA_property_collection_add().

◆ IDP_GetProperties()

IDProperty * IDP_GetProperties ( ID * id)

◆ IDP_GetPropertyFromGroup()

IDProperty * IDP_GetPropertyFromGroup ( const IDProperty * prop,
blender::StringRef name )

Definition at line 747 of file idprop.cc.

References BLI_assert, IDPropertyData::children_map, IDProperty::data, IDP_GROUP, IDProperty::len, name, and IDProperty::type.

Referenced by blender::nodes::attribute_search_exec_fn(), BKE_asset_metadata_idprop_find(), BKE_keyconfig_pref_set_select_mouse(), blo_do_versions_280(), BPy_IDGroup_Contains(), BPy_IDGroup_get(), BPy_IDGroup_Map_GetItem(), BPy_IDGroup_pop(), BPy_IDGroup_SetName(), BPy_IDProperty_Map_ValidateAndCreate(), BPy_Wrap_SetMapItem(), collection_exporter_copy(), blender::io::usd::ensure_usd_source_path_prop(), find_property_rgba(), blender::ed::object::geometry_nodes_input_attribute_toggle_exec(), blender::io::usd::get_usd_source_path(), blender::io::hydra::CameraDelegate::GetCameraParamValue(), IDP_EqualsProperties_ex(), IDP_GetPropertyFromGroup_null(), IDP_GetPropertyTypeFromGroup(), IDP_MergeGroup_ex(), IDP_ReplaceGroupInGroup(), IDP_ReplaceInGroup(), IDP_ReplaceInGroup_ex(), IDP_SyncGroupTypes(), IDP_SyncGroupValues(), idprops_ensure_named_group(), IMB_metadata_get_field(), IMB_metadata_set_field(), keymap_item_has_invalid_wm_context_data_path(), keymap_update_brushes_handle_add_item(), keymap_update_brushes_handle_remove_item(), blender::nodes::layer_name_search_exec_fn(), operator_last_properties_init_impl(), proj_paint_state_viewport_init(), pyrna_struct_contains(), pyrna_struct_get(), pyrna_struct_id_properties_ui(), pyrna_struct_pop(), pyrna_struct_subscript(), rna_idproperty_find(), rna_path_parse(), RNA_struct_system_idprops_unset(), rna_system_idproperty_find(), rna_system_idproperty_free(), blender::ed::object::shade_auto_smooth_exec(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST(), blender::bke::tests::TEST_F(), blender::nodes::update_input_properties_from_node_tree(), blender::nodes::update_output_properties_from_node_tree(), version_bonelayers_to_bonecollections(), version_idproperty_move_data_float(), version_idproperty_move_data_int(), version_idproperty_move_data_string(), version_idproperty_ui_data(), WM_operator_last_properties_init(), WM_toolsystem_ref_properties_get_ex(), WM_toolsystem_ref_properties_get_idprops(), and WM_toolsystem_ref_properties_init_for_keymap().

◆ IDP_GetPropertyFromGroup_null()

◆ IDP_GetPropertyTypeFromGroup()

◆ IDP_ID_system_properties_ensure()

IDProperty * IDP_ID_system_properties_ensure ( ID * id)

Ensure the Group property that contains the system-defined id properties for ID id exists & return it.

Definition at line 900 of file idprop.cc.

References IDP_GROUP, MEM_callocN(), and ID::system_properties.

Referenced by camera_write_cycles_compatibility_data_create().

◆ IDP_ID_system_properties_get()

IDProperty * IDP_ID_system_properties_get ( ID * id)

Get the Group property that contains the system-defined id properties for ID id.

Definition at line 895 of file idprop.cc.

Referenced by camera_write_cycles_compatibility_data_create(), version_cycles_properties_from_ID(), and version_cycles_visibility_properties_from_ID().

◆ IDP_MergeGroup()

void IDP_MergeGroup ( IDProperty * dest,
const IDProperty * src,
bool do_overwrite )

If a property is missing in dest, add it. Do it recursively.

Definition at line 712 of file idprop.cc.

References IDP_MergeGroup_ex().

Referenced by BPy_IDGroup_update(), gizmo_tweak_start_and_finish(), IDP_Reset(), operator_last_properties_init_impl(), WM_gizmo_operator_invoke(), and WM_toolsystem_ref_properties_init_for_keymap().

◆ IDP_MergeGroup_ex()

void IDP_MergeGroup_ex ( IDProperty * dest,
const IDProperty * src,
bool do_overwrite,
int flag )

If a property is missing in dest, add it. Do it recursively.

Parameters
flagthe ID creation/copying flags (LIB_ID_CREATE_...), same as passed to BKE_id_copy_ex.

Definition at line 673 of file idprop.cc.

References BLI_assert, copy(), IDProperty::data, flag, IDPropertyData::group, IDP_AddToGroup(), IDP_CopyProperty_ex(), IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_MergeGroup_ex(), IDP_ReplaceInGroup_ex(), LISTBASE_FOREACH, IDProperty::name, and IDProperty::type.

Referenced by IDP_MergeGroup(), and IDP_MergeGroup_ex().

◆ IDP_New()

IDProperty * IDP_New ( char type,
const IDPropertyTemplate * val,
blender::StringRef name,
eIDPropertyFlag flags = {} )

Allocate a new IDProperty.

This function takes three arguments: the ID property type, a union which defines its initial value, and a name.

The union is simple to use; see the top of BKE_idprop.h for its definition. An example of using this function:

IDProperty *group, *idgroup, *color;
group = IDP_New(IDP_GROUP, val, "group1"); // groups don't need a template.
val.array.len = 4
color = IDP_New(IDP_ARRAY, val, "color1");
idgroup = IDP_EnsureProperties(some_id);
IDP_AddToGroup(idgroup, color);
IDP_AddToGroup(idgroup, group);
IDProperty * IDP_New(char type, const IDPropertyTemplate *val, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:1009
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:717
IDProperty * IDP_EnsureProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition idprop.cc:882
@ IDP_GROUP
struct IDPropertyTemplate::@032057005265002020267344110225167212360002125060 array

Note that you MUST either attach the id property to an id property group with IDP_AddToGroup or MEM_freeN the property, doing anything else might result in a memory leak.

Definition at line 1009 of file idprop.cc.

References IDPropertyTemplate::array, BLI_assert, CLOG_ERROR, IDPropertyTemplate::d, IDProperty::data, DEFAULT_ALLOC_FOR_NULL_STRINGS, ELEM, IDPropertyTemplate::f, IDProperty::flag, IDPropertyTemplate::i, IDPropertyTemplate::id, id_us_plus(), IDP_ARRAY, IDP_BOOLEAN, IDP_DOUBLE, IDP_FLOAT, IDP_GROUP, IDP_ID, IDP_ID_get, IDP_INT, idp_size_table, IDP_STRING, IDP_string_get, IDP_STRING_SUB_BYTE, IDP_STRING_SUB_UTF8, IDProperty::len, IDPropertyTemplate::len, LOG, MEM_calloc_arrayN(), MEM_callocN(), MEM_malloc_arrayN(), IDProperty::name, name, IDPropertyData::pointer, IDPropertyTemplate::str, IDPropertyTemplate::string, IDProperty::subtype, IDPropertyTemplate::subtype, IDProperty::totallen, IDProperty::type, IDPropertyTemplate::type, and IDPropertyData::val.

Referenced by blender::bke::idprop::array_create(), BKE_collection_exporter_add(), blender::bke::idprop::create(), blender::bke::idprop::create(), blender::bke::idprop::create(), blender::bke::idprop::create(), blender::bke::idprop::create_bool(), blender::bke::idprop::create_group(), blender::io::usd::ensure_usd_source_path_prop(), idp_from_PyBytes(), idp_from_PySequence_Buffer(), idp_from_PySequence_Fast(), idp_from_PyUnicode(), blender::io::fbx::read_ufbx_property(), RNA_property_boolean_set_array(), RNA_property_string_set_bytes(), blender::io::usd::set_bool_prop(), blender::io::usd::set_double_prop(), blender::io::usd::set_float_prop(), blender::io::usd::set_int_prop(), and blender::io::usd::set_string_prop().

◆ IDP_NewIDPArray()

IDProperty * IDP_NewIDPArray ( blender::StringRef name)
Note
as a start to move away from the stupid IDP_New function, this type has its own allocation function.

Definition at line 67 of file idprop.cc.

References IDP_IDPARRAY, IDProperty::len, MEM_callocN(), IDProperty::name, name, and IDProperty::type.

Referenced by idp_from_PySequence_Fast(), and RNA_property_collection_add().

◆ IDP_NewString()

IDProperty * IDP_NewString ( const char * st,
blender::StringRef name,
eIDPropertyFlag flags = {} )

Definition at line 399 of file idprop.cc.

References IDP_NewStringMaxSize(), and name.

Referenced by blender::bke::idprop::create().

◆ IDP_NewStringMaxSize()

IDProperty * IDP_NewStringMaxSize ( const char * st,
size_t st_maxncpy,
blender::StringRef name,
eIDPropertyFlag flags = {} )
Parameters
stThe string to assign. Doesn't need to be null terminated when clamped by maxncpy.
nameThe property name.
maxncpyThe maximum size of the string (including the \0 terminator). When zero, this is the equivalent of passing in strlen(st) + 1
Returns
The new string property.

Definition at line 363 of file idprop.cc.

References BLI_assert, BLI_strnlen(), IDProperty::data, DEFAULT_ALLOC_FOR_NULL_STRINGS, IDProperty::flag, IDP_STRING, IDP_string_get, IDProperty::len, MEM_callocN(), MEM_malloc_arrayN(), IDProperty::name, name, IDPropertyData::pointer, IDProperty::totallen, and IDProperty::type.

Referenced by IDP_NewString(), RNA_property_string_set(), ui_but_event_operator_string_from_menu(), ui_but_event_operator_string_from_panel(), and blender::nodes::update_output_properties_from_node_tree().

◆ IDP_print()

void IDP_print ( const IDProperty * prop)

◆ IDP_RemoveFromGroup()

void IDP_RemoveFromGroup ( IDProperty * group,
IDProperty * prop )
Note
this does not free the property!

To free the property, you have to do: #IDP_FreeProperty(prop);

Definition at line 730 of file idprop.cc.

References BLI_assert, BLI_findindex(), BLI_remlink(), IDPropertyData::children_map, IDProperty::data, IDPropertyData::group, IDP_GROUP, IDProperty::len, and IDProperty::type.

Referenced by IDP_FreeFromGroup(), and blender::bke::tests::TEST().

◆ IDP_ReplaceGroupInGroup()

void IDP_ReplaceGroupInGroup ( IDProperty * dest,
const IDProperty * src )

Replaces all properties with the same name in a destination group from a source group.

Definition at line 634 of file idprop.cc.

References BLI_assert, IDProperty::data, IDPropertyData::group, IDP_CopyProperty(), IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_ReplaceInGroup_ex(), LISTBASE_FOREACH, IDProperty::name, and IDProperty::type.

Referenced by blender::bke::tests::TEST(), and wm_operator_create().

◆ IDP_ReplaceInGroup()

◆ IDP_ReplaceInGroup_ex()

void IDP_ReplaceInGroup_ex ( IDProperty * group,
IDProperty * prop,
IDProperty * prop_exist,
int flag )

◆ IDP_repr_fn()

void IDP_repr_fn ( const IDProperty * prop,
void(* str_append_fn )(void *user_data, const char *str, uint str_len),
void * user_data )

Definition at line 232 of file idprop_utils.cc.

References idp_repr_fn_recursive(), state, and str.

Referenced by IDP_reprN().

◆ IDP_reprN()

◆ IDP_Reset()

void IDP_Reset ( IDProperty * prop,
const IDProperty * reference )

Definition at line 1264 of file idprop.cc.

References IDP_ClearProperty(), and IDP_MergeGroup().

◆ IDP_ResizeArray()

void IDP_ResizeArray ( IDProperty * prop,
int newlen )

◆ IDP_ResizeIDPArray()

◆ IDP_SetIndexArray()

void IDP_SetIndexArray ( IDProperty * prop,
int index,
IDProperty * item )

Shallow copies item.

Definition at line 114 of file idprop.cc.

References BLI_assert, GETPROP, IDP_FreePropertyContent(), IDP_IDPARRAY, IDProperty::len, and IDProperty::type.

Referenced by IDP_AppendArray().

◆ IDP_SyncGroupTypes()

◆ IDP_SyncGroupValues()

void IDP_SyncGroupValues ( IDProperty * dest,
const IDProperty * src )

Sync values from one group to another when values name and types match, copy the values, else ignore.

Note
Was used for syncing proxies.

Definition at line 585 of file idprop.cc.

References BLI_assert, IDProperty::data, IDPropertyData::group, IDP_BOOLEAN, IDP_CopyProperty(), IDP_DOUBLE, IDP_FLOAT, IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_INT, IDP_ReplaceInGroup_ex(), IDP_SyncGroupValues(), LISTBASE_FOREACH, IDProperty::name, and IDProperty::type.

Referenced by BKE_pose_backup_restore(), IDP_SyncGroupValues(), pose_bone_do_paste(), poseAnim_mapping_reset(), and blender::bke::tests::TEST().

◆ IDP_TryConvertUIData()

◆ IDP_type_str() [1/2]

const char * IDP_type_str ( const IDProperty * prop)

Definition at line 311 of file idprop_utils.cc.

References IDP_type_str(), IDProperty::subtype, and IDProperty::type.

◆ IDP_type_str() [2/2]

◆ IDP_ui_data_copy()

◆ IDP_ui_data_ensure()

◆ IDP_ui_data_free()

◆ IDP_ui_data_free_unique_contents()

void IDP_ui_data_free_unique_contents ( IDPropertyUIData * ui_data,
eIDPropertyUIDataType type,
const IDPropertyUIData * other )

◆ IDP_ui_data_supported()

◆ IDP_ui_data_type()