Blender V4.3
idprop.cc File Reference
#include <cfloat>
#include <climits>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fmt/format.h>
#include "BLI_endian_switch.h"
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_set.hh"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_global.hh"
#include "BKE_idprop.hh"
#include "BKE_lib_id.hh"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLO_read_write.hh"
#include "BLI_strict_flags.h"

Go to the source code of this file.

Macros

#define IDP_ARRAY_REALLOC_LIMIT   200
 

Functions

String Functions (IDProperty String API)
IDPropertyIDP_NewStringMaxSize (const char *st, const size_t st_maxncpy, const char *name, const eIDPropertyFlag flags)
 
IDPropertyIDP_NewString (const char *st, const char *name, const eIDPropertyFlag flags)
 
static IDPropertyIDP_CopyString (const IDProperty *prop, const int flag)
 
void IDP_AssignStringMaxSize (IDProperty *prop, const char *st, const size_t st_maxncpy)
 
void IDP_AssignString (IDProperty *prop, const char *st)
 
void IDP_FreeString (IDProperty *prop)
 
Enum Type (IDProperty Enum API)
static void IDP_int_ui_data_free_enum_items (IDPropertyUIDataInt *ui_data)
 
const IDPropertyUIDataEnumItemIDP_EnumItemFind (const IDProperty *prop)
 
bool IDP_EnumItemsValidate (const IDPropertyUIDataEnumItem *items, const int items_num, void(*error_fn)(const char *))
 
ID Type (IDProperty ID API)
static IDPropertyIDP_CopyID (const IDProperty *prop, const int flag)
 
void IDP_AssignID (IDProperty *prop, ID *id, const int flag)
 
Group Functions (IDProperty Group API)
static IDPropertyIDP_CopyGroup (const IDProperty *prop, const int flag)
 
void IDP_SyncGroupValues (IDProperty *dest, const IDProperty *src)
 
void IDP_SyncGroupTypes (IDProperty *dest, const IDProperty *src, const bool do_arraylen)
 
void IDP_ReplaceGroupInGroup (IDProperty *dest, const IDProperty *src)
 
void IDP_ReplaceInGroup_ex (IDProperty *group, IDProperty *prop, IDProperty *prop_exist)
 
void IDP_ReplaceInGroup (IDProperty *group, IDProperty *prop)
 
void IDP_MergeGroup_ex (IDProperty *dest, const IDProperty *src, const bool do_overwrite, const int flag)
 
void IDP_MergeGroup (IDProperty *dest, const IDProperty *src, const bool do_overwrite)
 
bool IDP_AddToGroup (IDProperty *group, IDProperty *prop)
 
bool IDP_InsertToGroup (IDProperty *group, IDProperty *previous, IDProperty *pnew)
 
void IDP_RemoveFromGroup (IDProperty *group, IDProperty *prop)
 
void IDP_FreeFromGroup (IDProperty *group, IDProperty *prop)
 
IDPropertyIDP_GetPropertyFromGroup (const IDProperty *prop, const char *name)
 
IDPropertyIDP_GetPropertyTypeFromGroup (const IDProperty *prop, const char *name, const char type)
 
static void IDP_FreeGroup (IDProperty *prop, const bool do_id_user)
 
Main Functions (IDProperty Main API)
int IDP_coerce_to_int_or_zero (const IDProperty *prop)
 
double IDP_coerce_to_double_or_zero (const IDProperty *prop)
 
float IDP_coerce_to_float_or_zero (const IDProperty *prop)
 
IDPropertyIDP_CopyProperty_ex (const IDProperty *prop, const int flag)
 
IDPropertyIDP_CopyProperty (const IDProperty *prop)
 
void IDP_CopyPropertyContent (IDProperty *dst, const IDProperty *src)
 
IDPropertyIDP_GetProperties (ID *id)
 
IDPropertyIDP_EnsureProperties (ID *id)
 
bool IDP_EqualsProperties_ex (const IDProperty *prop1, const IDProperty *prop2, const bool is_strict)
 
bool IDP_EqualsProperties (const IDProperty *prop1, const IDProperty *prop2)
 
IDPropertyIDP_New (const char type, const IDPropertyTemplate *val, const char *name, const eIDPropertyFlag flags)
 
void IDP_ui_data_free_unique_contents (IDPropertyUIData *ui_data, const eIDPropertyUIDataType type, const IDPropertyUIData *other)
 
static void ui_data_free (IDPropertyUIData *ui_data, const eIDPropertyUIDataType type)
 
void IDP_ui_data_free (IDProperty *prop)
 
void IDP_FreePropertyContent_ex (IDProperty *prop, const bool do_id_user)
 
void IDP_FreePropertyContent (IDProperty *prop)
 
void IDP_FreeProperty_ex (IDProperty *prop, const bool do_id_user)
 
void IDP_FreeProperty (IDProperty *prop)
 
void IDP_ClearProperty (IDProperty *prop)
 
void IDP_Reset (IDProperty *prop, const IDProperty *reference)
 
void IDP_foreach_property (IDProperty *id_property_root, const int type_filter, const blender::FunctionRef< void(IDProperty *id_property)> callback)
 
void IDP_WriteProperty_OnlyData (const IDProperty *prop, BlendWriter *writer)
 
static void write_ui_data (const IDProperty *prop, BlendWriter *writer)
 
static void IDP_WriteArray (const IDProperty *prop, BlendWriter *writer)
 
static void IDP_WriteIDPArray (const IDProperty *prop, BlendWriter *writer)
 
static void IDP_WriteString (const IDProperty *prop, BlendWriter *writer)
 
static void IDP_WriteGroup (const IDProperty *prop, BlendWriter *writer)
 
void IDP_BlendWrite (BlendWriter *writer, const IDProperty *prop)
 
static void IDP_DirectLinkProperty (IDProperty *prop, BlendDataReader *reader)
 
static void read_ui_data (IDProperty *prop, BlendDataReader *reader)
 
static void IDP_DirectLinkIDPArray (IDProperty *prop, BlendDataReader *reader)
 
static void IDP_DirectLinkArray (IDProperty *prop, BlendDataReader *reader)
 
static void IDP_DirectLinkString (IDProperty *prop, BlendDataReader *reader)
 
static void IDP_DirectLinkGroup (IDProperty *prop, BlendDataReader *reader)
 
void IDP_BlendReadData_impl (BlendDataReader *reader, IDProperty **prop, const char *caller_func_id)
 
eIDPropertyUIDataType IDP_ui_data_type (const IDProperty *prop)
 
bool IDP_ui_data_supported (const IDProperty *prop)
 
static IDPropertyUIDataui_data_alloc (const eIDPropertyUIDataType type)
 
IDPropertyUIDataIDP_ui_data_ensure (IDProperty *prop)
 
static IDPropertyUIDataconvert_base_ui_data (IDPropertyUIData *src, const eIDPropertyUIDataType dst_type)
 
IDPropertyUIDataIDP_TryConvertUIData (IDPropertyUIData *src, const eIDPropertyUIDataType src_type, const eIDPropertyUIDataType dst_type)
 

Variables

static CLG_LogRef LOG = {"bke.idprop"}
 
static size_t idp_size_table []
 

Array Functions (IDP Array API)

#define GETPROP(prop, i)   &(IDP_IDPArray(prop)[i])
 
IDPropertyIDP_NewIDPArray (const char *name)
 
IDPropertyIDP_CopyIDPArray (const IDProperty *array, const int flag)
 
static void IDP_FreeIDPArray (IDProperty *prop, const bool do_id_user)
 
void IDP_SetIndexArray (IDProperty *prop, int index, IDProperty *item)
 
IDPropertyIDP_GetIndexArray (IDProperty *prop, int index)
 
void IDP_AppendArray (IDProperty *prop, IDProperty *item)
 
void IDP_ResizeIDPArray (IDProperty *prop, int newlen)
 
static void idp_resize_group_array (IDProperty *prop, int newlen, void *newarr)
 
void IDP_ResizeArray (IDProperty *prop, int newlen)
 
void IDP_FreeArray (IDProperty *prop)
 
IDPropertyUIDataIDP_ui_data_copy (const IDProperty *prop)
 
static IDPropertyidp_generic_copy (const IDProperty *prop, const int)
 
static IDPropertyIDP_CopyArray (const IDProperty *prop, const int flag)
 

Macro Definition Documentation

◆ GETPROP

#define GETPROP ( prop,
i )   &(IDP_IDPArray(prop)[i])

◆ IDP_ARRAY_REALLOC_LIMIT

#define IDP_ARRAY_REALLOC_LIMIT   200

if the new is 'IDP_ARRAY_REALLOC_LIMIT' items less, than IDProperty.totallen, reallocate anyway.

Definition at line 43 of file idprop.cc.

Referenced by IDP_ResizeArray(), and IDP_ResizeIDPArray().

Function Documentation

◆ convert_base_ui_data()

static IDPropertyUIData * convert_base_ui_data ( IDPropertyUIData * src,
const eIDPropertyUIDataType dst_type )
static

Definition at line 1748 of file idprop.cc.

References IDPropertyUIData::description, and ui_data_alloc().

Referenced by IDP_TryConvertUIData().

◆ 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 722 of file idprop.cc.

References BLI_addtail(), BLI_assert, IDP_GetPropertyFromGroup(), IDP_GROUP, and IDProperty::name.

Referenced by bc_set_IDPropertyMatrix(), 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(), IMB_metadata_set_field(), blender::bke::node_update_asset_metadata(), operator_last_properties_init_impl(), 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(), blender::bke::tests::IDSubDataTestData::setup(), shortcut_get_operator_property(), shortcut_property_from_rna(), 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()

◆ 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 413 of file idprop.cc.

References BLI_assert, BLI_strnlen(), IDProperty::data, IDP_ResizeArray(), IDP_STRING, IDP_String, IDP_STRING_SUB_BYTE, int, 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 1649 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 811 of file idprop.cc.

References double(), IDP_Bool, IDP_BOOLEAN, IDP_DOUBLE, IDP_Double, IDP_FLOAT, IDP_Float, IDP_INT, IDP_Int, 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 827 of file idprop.cc.

References float, IDP_Bool, IDP_BOOLEAN, IDP_DOUBLE, IDP_Double, IDP_FLOAT, IDP_Float, IDP_INT, IDP_Int, 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 795 of file idprop.cc.

References IDP_Bool, IDP_BOOLEAN, IDP_DOUBLE, IDP_Double, IDP_FLOAT, IDP_Float, IDP_INT, IDP_Int, int, and IDProperty::type.

Referenced by version_idproperty_move_data_float(), and version_idproperty_move_data_int().

◆ IDP_CopyArray()

◆ IDP_CopyGroup()

static IDProperty * IDP_CopyGroup ( const IDProperty * prop,
const int flag )
static

Checks if a property with the same name as prop exists, and if so replaces it.

Definition at line 564 of file idprop.cc.

References BLI_addtail(), BLI_assert, IDProperty::data, flag, IDPropertyData::group, IDP_CopyProperty_ex(), idp_generic_copy(), IDP_GROUP, IDProperty::len, LISTBASE_FOREACH, IDProperty::subtype, and IDProperty::type.

Referenced by IDP_CopyProperty_ex().

◆ IDP_CopyID()

static IDProperty * IDP_CopyID ( const IDProperty * prop,
const int flag )
static

◆ IDP_CopyIDPArray()

◆ 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 866 of file idprop.cc.

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

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

◆ IDP_CopyString()

static IDProperty * IDP_CopyString ( const IDProperty * prop,
const int flag )
static

◆ IDP_DirectLinkArray()

◆ IDP_DirectLinkGroup()

static void IDP_DirectLinkGroup ( IDProperty * prop,
BlendDataReader * reader )
static

◆ IDP_DirectLinkIDPArray()

static void IDP_DirectLinkIDPArray ( IDProperty * prop,
BlendDataReader * reader )
static

◆ IDP_DirectLinkProperty()

◆ IDP_DirectLinkString()

static void IDP_DirectLinkString ( IDProperty * prop,
BlendDataReader * reader )
static

◆ 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()

void IDP_foreach_property ( IDProperty * id_property_root,
const int type_filter,
const blender::FunctionRef< void(IDProperty *id_property)> callback )

◆ IDP_FreeArray()

void IDP_FreeArray ( IDProperty * prop)

◆ IDP_FreeFromGroup()

◆ IDP_FreeGroup()

static void IDP_FreeGroup ( IDProperty * prop,
const bool do_id_user )
static

◆ IDP_FreeIDPArray()

static void IDP_FreeIDPArray ( IDProperty * prop,
const bool do_id_user )
static

◆ IDP_FreeProperty()

void IDP_FreeProperty ( IDProperty * prop)

Definition at line 1227 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(), IDP_CopyPropertyContent(), IDP_FreeFromGroup(), idp_from_PyMapping(), idp_from_PySequence_Fast(), IDP_ReplaceGroupInGroup(), IDP_ReplaceInGroup_ex(), idp_resize_group_array(), IDP_SyncGroupTypes(), IDP_SyncGroupValues(), IMB_metadata_free(), keymap_item_free(), keymap_item_free(), blender::bke::idprop::IDPropertyDeleter::operator()(), operator_last_properties_init_impl(), operatortype_ghash_free_cb(), pose_clear_user_transforms_exec(), poseAnim_mapping_free(), pycon_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::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(), uiItemsFullEnumO_items(), 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_exit().

◆ IDP_FreeProperty_ex()

◆ IDP_FreePropertyContent()

void IDP_FreePropertyContent ( IDProperty * prop)

◆ IDP_FreePropertyContent_ex()

◆ IDP_FreeString()

void IDP_FreeString ( IDProperty * prop)

◆ idp_generic_copy()

◆ IDP_GetIndexArray()

IDProperty * IDP_GetIndexArray ( IDProperty * prop,
int index )

Definition at line 133 of file idprop.cc.

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

Referenced by RNA_property_collection_add().

◆ IDP_GetProperties()

◆ IDP_GetPropertyFromGroup()

IDProperty * IDP_GetPropertyFromGroup ( const IDProperty * prop,
const char * name )

Definition at line 763 of file idprop.cc.

References BLI_assert, BLI_findstring(), IDProperty::data, IDPropertyData::group, IDP_GROUP, offsetof, and IDProperty::type.

Referenced by blender::attribute_search_exec_fn(), bc_get_IDProperty(), 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_IDProperty_Map_ValidateAndCreate(), BPy_Wrap_SetMapItem(), blender::check_property_socket_sync(), collection_exporter_copy(), blender::draw_property_for_socket(), blender::ed::geometry::draw_property_for_socket(), blender::io::usd::ensure_usd_source_path_prop(), blender::nodes::find_output_attributes_to_store(), find_rna_property_rgba(), blender::ed::object::geometry_nodes_input_attribute_toggle_exec(), blender::io::usd::get_usd_source_path(), IDP_AddToGroup(), IDP_EqualsProperties_ex(), IDP_GetPropertyTypeFromGroup(), IDP_InsertToGroup(), IDP_MergeGroup_ex(), IDP_ReplaceInGroup(), IDP_ReplaceInGroup_ex(), IDP_SyncGroupTypes(), idprops_ensure_named_group(), IMB_metadata_get_field(), IMB_metadata_set_field(), blender::nodes::initialize_group_input(), blender::nodes::input_attribute_name_get(), keymap_item_has_invalid_wm_context_data_path(), 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_idproperty_free(), rna_path_parse(), RNA_struct_idprops_unset(), blender::ed::object::shade_auto_smooth_exec(), 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_GetPropertyTypeFromGroup()

◆ IDP_InsertToGroup()

bool IDP_InsertToGroup ( IDProperty * group,
IDProperty * previous,
IDProperty * pnew )

◆ IDP_int_ui_data_free_enum_items()

◆ 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 717 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 )

◆ IDP_New()

IDProperty * IDP_New ( char type,
const IDPropertyTemplate * val,
const char * 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, const char *name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:989
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:722
IDProperty * IDP_EnsureProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition idprop.cc:880
@ IDP_FLOAT
@ IDP_GROUP
@ IDP_ARRAY
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
struct IDPropertyTemplate::@30 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 989 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, IDP_INT, idp_size_table, IDP_STRING, IDP_String, IDP_STRING_SUB_BYTE, IDP_STRING_SUB_UTF8, IDProperty::len, IDPropertyTemplate::len, LOG, MEM_callocN, MEM_mallocN, IDProperty::name, IDPropertyData::pointer, IDPropertyTemplate::str, IDPropertyTemplate::string, STRNCPY, IDProperty::subtype, IDPropertyTemplate::subtype, IDProperty::totallen, IDProperty::type, IDPropertyTemplate::type, and IDPropertyData::val.

Referenced by blender::bke::idprop::array_create(), blender::ed::object::collection_exporter_add_exec(), 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(), RNA_property_boolean_set_array(), RNA_property_enum_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(), and blender::io::usd::set_string_prop().

◆ IDP_NewIDPArray()

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

Definition at line 69 of file idprop.cc.

References IDP_IDPARRAY, IDProperty::len, MEM_callocN, IDProperty::name, STRNCPY, and IDProperty::type.

Referenced by idp_from_PySequence_Fast(), and RNA_property_collection_add().

◆ IDP_NewString()

IDProperty * IDP_NewString ( const char * st,
const char * name,
const eIDPropertyFlag flags )

Definition at line 393 of file idprop.cc.

References IDP_NewStringMaxSize().

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

◆ IDP_NewStringMaxSize()

IDProperty * IDP_NewStringMaxSize ( const char * st,
size_t st_maxncpy,
const char * 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 357 of file idprop.cc.

References BLI_assert, BLI_strnlen(), IDProperty::data, DEFAULT_ALLOC_FOR_NULL_STRINGS, IDProperty::flag, IDP_STRING, IDP_String, int, IDProperty::len, MEM_callocN, MEM_mallocN, IDProperty::name, IDPropertyData::pointer, STRNCPY, 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_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 748 of file idprop.cc.

References BLI_assert, BLI_findindex(), BLI_remlink(), and IDP_GROUP.

Referenced by IDP_FreeFromGroup().

◆ 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 630 of file idprop.cc.

References BLI_addtail(), BLI_assert, BLI_insertlinkreplace(), copy(), IDProperty::data, ListBase::first, IDPropertyData::group, IDP_CopyProperty(), IDP_FreeProperty(), IDP_GROUP, IDProperty::len, LISTBASE_FOREACH, IDProperty::name, IDProperty::next, STREQ, and IDProperty::type.

Referenced by wm_operator_create().

◆ IDP_ReplaceInGroup()

◆ IDP_ReplaceInGroup_ex()

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

Checks if a property with the same name as prop exists, and if so replaces it. Use this to preserve order!

Definition at line 654 of file idprop.cc.

References BLI_addtail(), BLI_assert, BLI_insertlinkreplace(), IDP_FreeProperty(), IDP_GetPropertyFromGroup(), IDP_GROUP, and IDProperty::name.

Referenced by BPy_IDProperty_Map_ValidateAndCreate(), IDP_ReplaceInGroup(), idprops_ensure_named_group(), and RNA_property_pointer_set().

◆ IDP_Reset()

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

Definition at line 1240 of file idprop.cc.

References IDP_ClearProperty(), and IDP_MergeGroup().

◆ idp_resize_group_array()

static void idp_resize_group_array ( IDProperty * prop,
int newlen,
void * newarr )
static

◆ 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 117 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 578 of file idprop.cc.

References BLI_assert, BLI_findstring(), BLI_insertlinkreplace(), IDProperty::data, IDPropertyData::group, IDP_BOOLEAN, IDP_CopyProperty(), IDP_DOUBLE, IDP_FLOAT, IDP_FreeProperty(), IDP_GROUP, IDP_INT, IDP_SyncGroupValues(), LISTBASE_FOREACH, offsetof, and IDProperty::type.

Referenced by BKE_pose_backup_restore(), IDP_SyncGroupValues(), pose_bone_do_paste(), and poseAnim_mapping_reset().

◆ IDP_TryConvertUIData()

◆ 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()

◆ IDP_WriteArray()

◆ IDP_WriteGroup()

static void IDP_WriteGroup ( const IDProperty * prop,
BlendWriter * writer )
static

◆ IDP_WriteIDPArray()

static void IDP_WriteIDPArray ( const IDProperty * prop,
BlendWriter * writer )
static

◆ IDP_WriteProperty_OnlyData()

void IDP_WriteProperty_OnlyData ( const IDProperty * prop,
BlendWriter * writer )

◆ IDP_WriteString()

static void IDP_WriteString ( const IDProperty * prop,
BlendWriter * writer )
static

◆ read_ui_data()

◆ ui_data_alloc()

◆ ui_data_free()

◆ write_ui_data()

Variable Documentation

◆ idp_size_table

size_t idp_size_table[]
static
Initial value:
= {
1,
sizeof(int),
sizeof(float),
sizeof(float[3]),
sizeof(float[16]),
0,
sizeof(ListBase),
sizeof(void *),
sizeof(double),
0,
sizeof(int8_t),
sizeof(int),
}
typedef double(DMatrix)[4][4]
struct ListBase ListBase
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
signed char int8_t
Definition stdint.h:75

Local size table, aligned with eIDPropertyType.

Definition at line 48 of file idprop.cc.

Referenced by IDP_EqualsProperties_ex(), IDP_New(), and IDP_ResizeArray().

◆ LOG

CLG_LogRef LOG = {"bke.idprop"}
static

Definition at line 45 of file idprop.cc.

Referenced by IDP_New().