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

Go to the source code of this file.

Classes

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

Namespaces

namespace  blender
 BMesh Iterators.
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 blender::IDPWalkFunc = void (*)(void *user_data, IDProperty *idp)

Enumerations

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

Functions

IDProperty * blender::IDP_NewString (blender::StringRef value, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT
void blender::IDP_foreach_property (IDProperty *id_property_root, int type_filter, FunctionRef< void(IDProperty *id_property)> callback)
Array Functions (IDP Array API)
IDProperty * blender::IDP_NewIDPArray (StringRef name) ATTR_WARN_UNUSED_RESULT
IDProperty * blender::IDP_CopyIDPArray (const IDProperty *array, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void blender::IDP_SetIndexArray (IDProperty *prop, int index, IDProperty *item) ATTR_NONNULL()
IDProperty * blender::IDP_GetIndexArray (IDProperty *prop, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void blender::IDP_AppendArray (IDProperty *prop, IDProperty *item)
void blender::IDP_ResizeIDPArray (IDProperty *prop, int newlen)
void blender::IDP_ResizeArray (IDProperty *prop, int newlen)
IDPropertyUIData * blender::IDP_ui_data_copy (const IDProperty *prop)
String Functions (IDProperty String API)
IDProperty * blender::IDP_NewStringMaxSize (const char *st, size_t st_maxncpy, StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT
IDProperty * blender::IDP_NewString (const char *st, StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT
void blender::IDP_AssignStringMaxSize (IDProperty *prop, const char *st, size_t st_maxncpy) ATTR_NONNULL()
void blender::IDP_AssignString (IDProperty *prop, const char *st) ATTR_NONNULL()
void blender::IDP_FreeString (IDProperty *prop) ATTR_NONNULL()
Enum Type (IDProperty Enum API)
const IDPropertyUIDataEnumItem * blender::IDP_EnumItemFind (const IDProperty *prop)
bool blender::IDP_EnumItemsValidate (const IDPropertyUIDataEnumItem *items, int items_num, void(*error_fn)(const char *))
void blender::IDP_EnumItemsFree (IDPropertyUIDataEnumItem *items, int items_num)
ID Type (IDProperty ID API)
void blender::IDP_AssignID (IDProperty *prop, ID *id, int flag)
Group Functions (IDProperty Group API)
void blender::IDP_SyncGroupValues (IDProperty *dest, const IDProperty *src) ATTR_NONNULL()
void blender::IDP_SyncGroupTypes (IDProperty *dest, const IDProperty *src, bool do_arraylen) ATTR_NONNULL()
void blender::IDP_ReplaceGroupInGroup (IDProperty *dest, const IDProperty *src) ATTR_NONNULL()
void blender::IDP_ReplaceInGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
void blender::IDP_ReplaceInGroup_ex (IDProperty *group, IDProperty *prop, IDProperty *prop_exist, int flag)
void blender::IDP_MergeGroup (IDProperty *dest, const IDProperty *src, bool do_overwrite) ATTR_NONNULL()
void blender::IDP_MergeGroup_ex (IDProperty *dest, const IDProperty *src, bool do_overwrite, int flag) ATTR_NONNULL()
bool blender::IDP_AddToGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
void blender::IDP_RemoveFromGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
void blender::IDP_FreeFromGroup (IDProperty *group, IDProperty *prop) ATTR_NONNULL()
IDProperty * blender::IDP_GetPropertyFromGroup (const IDProperty *prop, StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDProperty * blender::IDP_GetPropertyFromGroup_null (const IDProperty *prop, StringRef name) ATTR_WARN_UNUSED_RESULT
IDProperty * blender::IDP_GetPropertyTypeFromGroup (const IDProperty *prop, StringRef name, char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
std::optional< StringRefNull > blender::IDP_group_lookup_string (const IDProperty &group, StringRef name)
std::optional< float > blender::IDP_group_lookup_float (const IDProperty &group, StringRef name)
std::optional< int > blender::IDP_group_lookup_int (const IDProperty &group, StringRef name)
std::optional< bool > blender::IDP_group_lookup_bool (const IDProperty &group, StringRef name)
std::optional< Span< float > > blender::IDP_group_lookup_float_array (const IDProperty &group, StringRef name, int required_size)
Main Functions (IDProperty Main API)
IDProperty * blender::IDP_GetProperties (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDProperty * blender::IDP_EnsureProperties (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDProperty * blender::IDP_ID_system_properties_get (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDProperty * blender::IDP_ID_system_properties_ensure (ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDProperty * blender::IDP_CopyProperty (const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDProperty * blender::IDP_CopyProperty_ex (const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void blender::IDP_CopyPropertyContent (IDProperty *dst, const IDProperty *src) ATTR_NONNULL()
bool blender::IDP_EqualsProperties_ex (const IDProperty *prop1, const IDProperty *prop2, bool is_strict) ATTR_WARN_UNUSED_RESULT
bool blender::IDP_EqualsProperties (const IDProperty *prop1, const IDProperty *prop2) ATTR_WARN_UNUSED_RESULT
IDProperty * blender::IDP_New (char type, const IDPropertyTemplate *val, StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDProperty * blender::IDP_NewInt (int value, blender::StringRef name, eIDPropertyFlag flags={})
void blender::IDP_FreeProperty_ex (IDProperty *prop, bool do_id_user)
void blender::IDP_FreeProperty (IDProperty *prop)
void blender::IDP_ClearProperty (IDProperty *prop)
void blender::IDP_Reset (IDProperty *prop, const IDProperty *reference)
int blender::IDP_coerce_to_int_or_zero (const IDProperty *prop)
float blender::IDP_coerce_to_float_or_zero (const IDProperty *prop)
double blender::IDP_coerce_to_double_or_zero (const IDProperty *prop)
void blender::IDP_BlendWrite (BlendWriter *writer, const IDProperty *prop)
void blender::IDP_BlendReadData_impl (BlendDataReader *reader, IDProperty **prop, const char *caller_func_id)
bool blender::IDP_ui_data_supported (const IDProperty *prop)
eIDPropertyUIDataType blender::IDP_ui_data_type (const IDProperty *prop)
void blender::IDP_ui_data_free (IDProperty *prop)
void blender::IDP_ui_data_free_unique_contents (IDPropertyUIData *ui_data, eIDPropertyUIDataType type, const IDPropertyUIData *other)
IDPropertyUIData * blender::IDP_ui_data_ensure (IDProperty *prop)
IDPropertyUIData * blender::IDP_TryConvertUIData (IDPropertyUIData *src, eIDPropertyUIDataType src_type, eIDPropertyUIDataType dst_type)
Debugging
const IDProperty * blender::_IDP_assert_type (const IDProperty *prop, char ty)
const IDProperty * blender::_IDP_assert_type_and_subtype (const IDProperty *prop, char ty, char sub_ty)
const IDProperty * blender::_IDP_assert_type_mask (const IDProperty *prop, int ty_mask)
IDProp Repr

Convert an IDProperty to a string.

Output should be a valid Python literal (with minor exceptions - float nan for eg).

char * blender::IDP_reprN (const IDProperty *prop, uint *r_len)
void blender::IDP_repr_fn (const IDProperty *prop, void(*str_append_fn)(void *user_data, const char *str, uint str_len), void *user_data)
void blender::IDP_print (const IDProperty *prop)
const char * blender::IDP_type_str (eIDPropertyType type, short sub_type)
const char * blender::IDP_type_str (const IDProperty *prop)
IDProperty to Value
std::unique_ptr< io::serialize::ArrayValue > blender::bke::idprop::convert_to_serialize_values (const IDProperty *properties)
 Convert the given properties to Value objects for serialization.
IDProperty from Value
IDProperty * blender::bke::idprop::convert_from_serialize_value (const io::serialize::Value &value)
 Convert the given value (which must be an array) to an IDProperty.
Create Functions
std::unique_ptr< IDProperty, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::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, IDPropertyDeleter > blender::bke::idprop::create_group (StringRef prop_name, eIDPropertyFlag flags={})
 Allocate a new IDProperty of type IDP_GROUP.

Macro Definition Documentation

◆ IDP_array_bool_get

◆ IDP_array_double_get

◆ IDP_array_float_get

◆ IDP_array_int_get

◆ IDP_array_voidp_get

#define IDP_array_voidp_get ( prop)

◆ IDP_BlendDataRead

◆ IDP_bool_get

◆ IDP_bool_set

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

Definition at line 321 of file BKE_idprop.hh.

Referenced by blender::idp_from_PyBool(), blender::RNA_property_boolean_set(), blender::RNA_property_boolean_set_array(), and blender::update_idprop_bool().

◆ 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 349 of file BKE_idprop.hh.

Referenced by blender::blend_id_property(), blender::idp_from_PyFloat(), blender::idp_from_PyLong(), blender::RNA_property_float_set(), and blender::RNA_property_float_set_array().

◆ IDP_float_get

◆ IDP_float_set

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

Definition at line 340 of file BKE_idprop.hh.

Referenced by blender::blend_id_property(), blender::camera_write_cycles_compatibility_data_create(), blender::idp_from_PyFloat(), blender::idp_from_PyLong(), blender::RNA_property_float_set(), blender::RNA_property_float_set_array(), blender::update_idprop_float(), and blender::bke::ProjectVariable::value_set().

◆ IDP_ID_get

◆ IDP_int_get

#define IDP_int_get ( prop)
Value:
(_IDP_assert_type(prop, IDP_INT)->data.val)

Definition at line 311 of file BKE_idprop.hh.

Referenced by blender::blend_id_property(), blender::build_catalog_tree(), blender::ed::object::build_catalog_tree(), blender::ed::space_node::build_catalog_tree(), blender::ed::vse::build_catalog_tree(), blender::forward_compat::create_legacy_geometry_nodes_properties(), blender::ed::geometry::OperatorTypeData::from_asset(), blender::io::hydra::BlenderCameraIDPropertiesDataSource::Get(), blender::ed::geometry::get_node_tools_type_data(), blender::IDP_coerce_to_double_or_zero(), blender::IDP_coerce_to_float_or_zero(), blender::IDP_coerce_to_int_or_zero(), blender::IDP_EnumItemFind(), blender::IDP_EqualsProperties_ex(), blender::IDP_group_lookup_int(), blender::idp_repr_fn_recursive(), blender::idprop_py_from_idp_int(), blender::bke::idprop::IDPIntSerializer::idprop_to_dictionary(), blender::keymap_update_brushes_handle_add_item(), blender::keymap_update_brushes_handle_remove_item(), blender::ed::space_node::node_group_drop_poll(), blender::property_enum_get(), blender::property_int_get(), blender::ed::space_node::search_link_ops_for_asset_metadata(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::tests::TEST_F(), blender::bke::idprop::tests::test_idprop(), blender::update_idprop_bool(), blender::update_idprop_float(), blender::bke::ProjectVariable::value_int_get(), blender::version_cycles_property_int(), blender::version_geometry_nodes_properties(), blender::version_layer_selection_modifier_inputs(), and blender::view3d_geometry_nodes_drop_poll().

◆ IDP_int_or_bool_get

#define IDP_int_or_bool_get ( prop)
Value:
(_IDP_assert_type_mask(prop, (1 << IDP_INT) | (1 << IDP_BOOLEAN))->data.val)

Definition at line 329 of file BKE_idprop.hh.

Referenced by blender::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 331 of file BKE_idprop.hh.

Referenced by blender::RNA_property_boolean_set().

◆ IDP_int_set

◆ IDP_property_array_get

◆ IDP_string_get