Blender
V3.3
|
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "BLI_endian_switch.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_lib_id.h"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLO_read_write.h"
#include "BLI_strict_flags.h"
Go to the source code of this file.
Macros | |
#define | IDP_ARRAY_REALLOC_LIMIT 200 |
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]) |
IDProperty * | IDP_NewIDPArray (const char *name) |
IDProperty * | IDP_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) |
IDProperty * | IDP_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) |
IDPropertyUIData * | IDP_ui_data_copy (const IDProperty *prop) |
static IDProperty * | idp_generic_copy (const IDProperty *prop, const int UNUSED(flag)) |
static IDProperty * | IDP_CopyArray (const IDProperty *prop, const int flag) |
#define GETPROP | ( | prop, | |
i | |||
) | &(IDP_IDPArray(prop)[i]) |
#define IDP_ARRAY_REALLOC_LIMIT 200 |
if the new is 'IDP_ARRAY_REALLOC_LIMIT' items less, than IDProperty.totallen, reallocate anyway.
bool IDP_AddToGroup | ( | struct IDProperty * | group, |
struct 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 631 of file idprop.c.
References BLI_addtail(), BLI_assert, IDProperty::data, IDPropertyData::group, IDP_GetPropertyFromGroup(), IDP_GROUP, IDProperty::len, IDProperty::name, NULL, and IDProperty::type.
Referenced by bc_set_IDPropertyMatrix(), BKE_keyconfig_pref_set_select_mouse(), cycles_property_int_set(), blender::bke::idprop::IDPGroupSerializer::entry_to_idprop(), IMB_metadata_set_field(), MOD_nodes_update_interface(), operator_last_properties_init_impl(), RNA_property_boolean_set(), RNA_property_boolean_set_array(), RNA_property_collection_add(), RNA_property_copy(), 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(), 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(), and version_geometry_nodes_add_attribute_input_settings().
void IDP_AppendArray | ( | IDProperty * | prop, |
IDProperty * | item | ||
) |
Definition at line 133 of file idprop.c.
References BLI_assert, IDP_IDPARRAY, IDP_ResizeIDPArray(), IDP_SetIndexArray(), IDProperty::len, and IDProperty::type.
Referenced by BPy_IDProperty_Map_ValidateAndCreate(), and RNA_property_collection_add().
void IDP_AssignID | ( | IDProperty * | prop, |
ID * | id, | ||
const int | flag | ||
) |
Definition at line 452 of file idprop.c.
References BLI_assert, IDProperty::data, id, id_us_min(), id_us_plus(), IDP_Id, IDP_ID, LIB_ID_CREATE_NO_USER_REFCOUNT, NULL, IDPropertyData::pointer, and IDProperty::type.
Referenced by RNA_property_pointer_set().
void IDP_AssignString | ( | IDProperty * | prop, |
const char * | st, | ||
int | maxlen | ||
) |
Definition at line 383 of file idprop.c.
References BLI_assert, BLI_strncpy(), IDProperty::data, IDP_ResizeArray(), IDP_STRING, IDP_STRING_SUB_BYTE, IDPropertyData::pointer, usdtokens::st(), IDProperty::subtype, and IDProperty::type.
Referenced by attribute_search_exec_fn(), IMB_metadata_set_field(), MOD_nodes_update_interface(), and RNA_property_string_set().
void IDP_BlendReadData_impl | ( | BlendDataReader * | reader, |
IDProperty ** | prop, | ||
const char * | caller_func_id | ||
) |
Definition at line 1419 of file idprop.c.
References IDP_DirectLinkGroup(), IDP_GROUP, and NULL.
void IDP_BlendReadExpand | ( | struct BlendExpander * | expander, |
IDProperty * | prop | ||
) |
Definition at line 1471 of file idprop.c.
References BLO_expand, IDProperty::data, IDPropertyData::group, IDP_BlendReadExpand(), IDP_GROUP, IDP_Id, IDP_ID, IDP_IDPArray, IDP_IDPARRAY, IDProperty::len, LISTBASE_FOREACH, and IDProperty::type.
Referenced by BKE_pose_blend_read_expand(), expand_bones(), expand_id(), expand_node_socket(), IDP_BlendReadExpand(), ntreeBlendReadExpand(), scene_blend_read_expand(), and seq_blend_read_expand().
void IDP_BlendReadLib | ( | BlendLibReader * | reader, |
Library * | lib, | ||
IDProperty * | prop | ||
) |
Definition at line 1435 of file idprop.c.
References BLO_read_get_new_id_address(), IDProperty::data, G, IDPropertyData::group, IDP_BlendReadLib(), IDP_GROUP, IDP_Id, IDP_ID, IDP_IDPArray, IDP_IDPARRAY, IDProperty::len, lib, LISTBASE_FOREACH, IDProperty::name, IDPropertyData::pointer, and IDProperty::type.
Referenced by BKE_pose_blend_read_lib(), BKE_view_layer_blend_read_lib(), IDP_BlendReadLib(), lib_link_bones(), lib_link_id(), lib_link_node_socket(), ntreeBlendReadLib(), scene_blend_read_lib(), and seq_read_lib_cb().
void IDP_BlendWrite | ( | BlendWriter * | writer, |
const IDProperty * | prop | ||
) |
Definition at line 1260 of file idprop.c.
References BLO_write_struct, and IDP_WriteProperty_OnlyData().
Referenced by IDP_WriteArray(), and IDP_WriteGroup().
void IDP_ClearProperty | ( | IDProperty * | prop | ) |
Definition at line 1099 of file idprop.c.
References IDProperty::data, IDP_FreePropertyContent(), IDProperty::len, NULL, IDPropertyData::pointer, and IDProperty::totallen.
Referenced by blo_update_defaults_scene(), BPy_IDGroup_clear(), IDP_Reset(), WM_gizmo_properties_clear(), and WM_operator_properties_clear().
double IDP_coerce_to_double_or_zero | ( | const IDProperty * | prop | ) |
Definition at line 718 of file idprop.c.
References IDP_Double, IDP_DOUBLE, IDP_Float, IDP_FLOAT, IDP_Int, IDP_INT, and IDProperty::type.
float IDP_coerce_to_float_or_zero | ( | const IDProperty * | prop | ) |
Definition at line 732 of file idprop.c.
References IDP_Double, IDP_DOUBLE, IDP_Float, IDP_FLOAT, IDP_Int, IDP_INT, and IDProperty::type.
int IDP_coerce_to_int_or_zero | ( | const IDProperty * | prop | ) |
Definition at line 704 of file idprop.c.
References IDP_Double, IDP_DOUBLE, IDP_Float, IDP_FLOAT, IDP_Int, IDP_INT, and IDProperty::type.
void IDP_ConcatString | ( | IDProperty * | str1, |
IDProperty * | append | ||
) |
Definition at line 413 of file idprop.c.
References BLI_assert, IDProperty::data, IDP_ResizeArray(), IDP_STRING, IDProperty::len, IDPropertyData::pointer, and IDProperty::type.
void IDP_ConcatStringC | ( | IDProperty * | prop, |
const char * | st | ||
) |
Definition at line 402 of file idprop.c.
References BLI_assert, IDProperty::data, IDP_ResizeArray(), IDP_STRING, IDProperty::len, IDPropertyData::pointer, usdtokens::st(), and IDProperty::type.
|
static |
Definition at line 310 of file idprop.c.
References Freestyle::a, IDProperty::data, IDP_CopyProperty_ex(), idp_generic_copy(), IDP_GROUP, IDProperty::len, MEM_dupallocN, IDPropertyData::pointer, IDProperty::subtype, IDProperty::totallen, and IDProperty::type.
Referenced by IDP_CopyProperty_ex().
|
static |
Checks if a property with the same name as prop exists, and if so replaces it.
Definition at line 476 of file idprop.c.
References BLI_addtail(), BLI_assert, IDProperty::data, IDPropertyData::group, IDP_CopyProperty_ex(), idp_generic_copy(), IDP_GROUP, IDProperty::len, LISTBASE_FOREACH, IDProperty::subtype, and IDProperty::type.
Referenced by IDP_CopyProperty_ex().
|
static |
Definition at line 439 of file idprop.c.
References BLI_assert, IDProperty::data, id_us_plus(), idp_generic_copy(), IDP_Id, IDP_ID, LIB_ID_CREATE_NO_USER_REFCOUNT, IDPropertyData::pointer, and IDProperty::type.
Referenced by IDP_CopyProperty_ex().
IDProperty* IDP_CopyIDPArray | ( | const IDProperty * | array, |
const int | flag | ||
) |
Definition at line 73 of file idprop.c.
References BLI_assert, array< T, alignment >::data(), IDProperty::data, GETPROP, IDP_CopyProperty_ex(), IDP_IDPARRAY, IDProperty::len, MEM_dupallocN, MEM_freeN, MEM_mallocN, and IDPropertyData::pointer.
Referenced by IDP_CopyProperty_ex().
IDProperty* IDP_CopyProperty | ( | const IDProperty * | prop | ) |
Definition at line 764 of file idprop.c.
References IDP_CopyProperty_ex().
Referenced by IDP_CopyPropertyContent(), IDP_ReplaceGroupInGroup(), IDP_SyncGroupTypes(), and IDP_SyncGroupValues().
IDProperty* IDP_CopyProperty_ex | ( | const IDProperty * | prop, |
const int | flag | ||
) |
Definition at line 746 of file idprop.c.
References IDP_ARRAY, IDP_CopyArray(), IDP_CopyGroup(), IDP_CopyID(), IDP_CopyIDPArray(), IDP_CopyString(), idp_generic_copy(), IDP_GROUP, IDP_ID, IDP_IDPARRAY, IDP_STRING, and IDProperty::type.
Referenced by IDP_CopyArray(), IDP_CopyGroup(), IDP_CopyIDPArray(), IDP_CopyProperty(), and IDP_MergeGroup_ex().
void IDP_CopyPropertyContent | ( | struct IDProperty * | dst, |
struct IDProperty * | src | ||
) |
Copy content from source IDProperty into destination one, freeing destination property's content first.
Definition at line 769 of file idprop.c.
References IDP_CopyProperty(), IDP_FreeProperty(), IDProperty::next, IDProperty::prev, src, and SWAP.
Referenced by MOD_nodes_update_interface().
|
static |
Definition at line 368 of file idprop.c.
References BLI_assert, IDProperty::data, idp_generic_copy(), IDP_STRING, IDProperty::len, MEM_dupallocN, IDPropertyData::pointer, IDProperty::subtype, IDProperty::totallen, and IDProperty::type.
Referenced by IDP_CopyProperty_ex().
|
static |
Definition at line 1329 of file idprop.c.
References BLO_read_double_array(), BLO_read_int32_array(), BLO_read_pointer_array(), IDProperty::data, IDP_DirectLinkProperty(), IDP_DOUBLE, IDP_GROUP, IDProperty::len, IDPropertyData::pointer, IDProperty::subtype, and IDProperty::totallen.
Referenced by IDP_DirectLinkProperty().
|
static |
Definition at line 1358 of file idprop.c.
References BLO_read_list(), IDProperty::data, IDPropertyData::group, IDP_DirectLinkProperty(), and LISTBASE_FOREACH.
Referenced by IDP_BlendReadData_impl(), and IDP_DirectLinkProperty().
|
static |
Definition at line 1309 of file idprop.c.
References BLO_read_data_address, IDProperty::data, IDP_DirectLinkProperty(), if(), IDProperty::len, NULL, IDPropertyData::pointer, and IDProperty::totallen.
Referenced by IDP_DirectLinkProperty().
|
static |
Definition at line 1370 of file idprop.c.
References BLI_endian_switch_int32(), BLI_endian_switch_int64(), BLO_read_requires_endian_switch(), IDProperty::data, IDP_ARRAY, IDP_DirectLinkArray(), IDP_DirectLinkGroup(), IDP_DirectLinkIDPArray(), IDP_DirectLinkString(), IDP_DOUBLE, IDP_FLOAT, IDP_GROUP, IDP_ID, IDP_IDPARRAY, IDP_Int, IDP_INT, IDP_STRING, NULL, read_ui_data(), IDProperty::subtype, IDProperty::type, IDProperty::ui_data, IDPropertyData::val, and IDPropertyData::val2.
Referenced by IDP_DirectLinkArray(), IDP_DirectLinkGroup(), and IDP_DirectLinkIDPArray().
|
static |
Definition at line 1351 of file idprop.c.
References BLO_read_data_address, IDProperty::data, IDProperty::len, IDPropertyData::pointer, and IDProperty::totallen.
Referenced by IDP_DirectLinkProperty().
bool IDP_EqualsProperties | ( | IDProperty * | prop1, |
IDProperty * | prop2 | ||
) |
Definition at line 882 of file idprop.c.
References IDP_EqualsProperties_ex().
Referenced by ED_screen_user_menu_item_find_operator(), wm_xr_operator_test_event(), and wm_xr_session_modal_action_test().
bool IDP_EqualsProperties_ex | ( | struct IDProperty * | prop1, |
struct IDProperty * | prop2, | ||
bool | is_strict | ||
) |
is_strict | When false treat missing items as a match. |
Definition at line 795 of file idprop.c.
References BLI_assert_unreachable, IDProperty::data, fabsf, IDPropertyData::group, IDP_Array, IDP_ARRAY, IDP_Double, IDP_DOUBLE, IDP_EqualsProperties_ex(), IDP_Float, IDP_FLOAT, IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_Id, IDP_ID, IDP_IDPArray, IDP_IDPARRAY, IDP_Int, IDP_INT, IDP_print(), idp_size_table, IDP_String, IDP_STRING, IDProperty::len, LISTBASE_FOREACH, max_ff(), IDProperty::name, NULL, STREQLEN, IDProperty::subtype, and IDProperty::type.
Referenced by IDP_EqualsProperties(), IDP_EqualsProperties_ex(), and wm_keymap_item_find_in_keymap().
void IDP_foreach_property | ( | struct IDProperty * | id_property_root, |
int | type_filter, | ||
IDPForeachPropertyCallback | callback, | ||
void * | user_data | ||
) |
Loop through all ID properties in hierarchy of given id_property_root included.
type_filter | If not 0, only apply callback on properties of matching types, see IDP_TYPE_FILTER_ enum in DNA_ID.h. |
Definition at line 1117 of file idprop.c.
References callback, IDProperty::data, IDPropertyData::group, IDP_Array, IDP_foreach_property(), IDP_GROUP, IDP_IDPARRAY, IDProperty::len, LISTBASE_FOREACH, IDProperty::type, and user_data.
Referenced by armature_foreach_id_bone(), armature_foreach_id_editbone(), BKE_fcurve_foreach_id(), blender::deg::DepsgraphNodeBuilder::build_idproperties(), blender::deg::DepsgraphRelationBuilder::build_idproperties(), find_used_ids_from_settings(), foreachIDLink(), IDP_foreach_property(), library_foreach_ID_link(), library_foreach_node_socket(), node_foreach_id(), object_foreach_id(), scene_foreach_id(), and seq_foreach_member_id_cb().
void IDP_FreeArray | ( | IDProperty * | prop | ) |
Definition at line 248 of file idprop.c.
References IDProperty::data, idp_resize_group_array(), MEM_freeN, NULL, and IDPropertyData::pointer.
Referenced by IDP_FreePropertyContent_ex().
void IDP_FreeFromGroup | ( | struct IDProperty * | group, |
struct IDProperty * | prop | ||
) |
Removes the property from the group and frees it.
Definition at line 666 of file idprop.c.
References IDP_FreeProperty(), and IDP_RemoveFromGroup().
Referenced by BPy_IDGroup_pop(), BPy_Wrap_SetMapItem(), IDP_SyncGroupTypes(), IMB_metadata_set_field(), pyrna_struct_pop(), rna_idproperty_free(), RNA_property_pointer_remove(), rna_property_rna_or_id_get(), RNA_struct_idprops_unset(), and version_idproperty_ui_data().
|
static |
Definition at line 688 of file idprop.c.
References BLI_assert, BLI_freelistN(), IDProperty::data, IDPropertyData::group, IDP_FreePropertyContent_ex(), IDP_GROUP, LISTBASE_FOREACH, and IDProperty::type.
Referenced by IDP_FreePropertyContent_ex().
|
static |
Definition at line 97 of file idprop.c.
References BLI_assert, IDProperty::data, GETPROP, IDP_FreePropertyContent_ex(), IDP_IDPARRAY, IDProperty::len, MEM_freeN, IDPropertyData::pointer, and IDProperty::type.
Referenced by IDP_FreePropertyContent_ex().
void IDP_FreeProperty | ( | IDProperty * | prop | ) |
Definition at line 1093 of file idprop.c.
References IDP_FreePropertyContent(), and MEM_freeN.
Referenced by BKE_addon_free(), BKE_area_region_free(), BKE_asset_metadata_free(), BKE_blender_user_menu_item_free(), BKE_pose_channel_copy_data(), BKE_workspace_tool_remove(), blo_do_versions_280(), bone_free(), do_versions_after_linking_280(), ED_armature_edit_free(), ED_pose_backup_free(), fcm_python_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(), MOD_nodes_update_interface(), blender::bke::idprop::IDPropertyDeleter::operator()(), operator_last_properties_init_impl(), operatortype_ghash_free_cb(), pose_clear_user_transforms_exec(), poseAnim_mapping_free(), poselib_backup_free_data(), 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_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(), userdef_free_keyconfig_prefs(), view3d_free(), wm_free_operator_properties_callback(), WM_gizmo_properties_free(), wm_keymap_item_find(), wm_keymap_item_find_in_keymap(), WM_keymap_item_restore_to_default(), 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().
void IDP_FreeProperty_ex | ( | IDProperty * | prop, |
const bool | do_id_user | ||
) |
Definition at line 1087 of file idprop.c.
References IDP_FreePropertyContent_ex(), and MEM_freeN.
Referenced by BKE_armature_bonelist_free(), BKE_armature_editbonelist_free(), BKE_pose_channel_free_ex(), BKE_view_layer_free_ex(), ED_armature_ebone_listbase_free(), freeData(), and node_socket_interface_free().
void IDP_FreePropertyContent | ( | IDProperty * | prop | ) |
Definition at line 1082 of file idprop.c.
References IDP_FreePropertyContent_ex().
Referenced by BPy_IDProperty_Map_ValidateAndCreate(), ed_marker_delete_exec(), IDP_ClearProperty(), IDP_FreeProperty(), IDP_ResizeIDPArray(), and IDP_SetIndexArray().
void IDP_FreePropertyContent_ex | ( | struct IDProperty * | prop, |
bool | do_id_user | ||
) |
Definition at line 1055 of file idprop.c.
References id_us_min(), IDP_ARRAY, IDP_FreeArray(), IDP_FreeGroup(), IDP_FreeIDPArray(), IDP_FreeString(), IDP_GROUP, IDP_Id, IDP_ID, IDP_IDPARRAY, IDP_STRING, IDP_ui_data_free(), NULL, IDProperty::type, and IDProperty::ui_data.
Referenced by BKE_libblock_free_data(), IDP_FreeGroup(), IDP_FreeIDPArray(), IDP_FreeProperty_ex(), IDP_FreePropertyContent(), node_free_node(), node_socket_free(), preview_id_copy_free(), scene_free_markers(), and seq_sequence_free_ex().
void IDP_FreeString | ( | IDProperty * | prop | ) |
Definition at line 424 of file idprop.c.
References BLI_assert, IDProperty::data, IDP_STRING, MEM_freeN, IDPropertyData::pointer, and IDProperty::type.
Referenced by IDP_FreePropertyContent_ex().
|
static |
Definition at line 293 of file idprop.c.
References BLI_strncpy(), IDProperty::data, IDProperty::flag, IDP_ui_data_copy(), MAX_IDPROP_NAME, MEM_callocN, IDProperty::name, NULL, IDProperty::type, IDProperty::ui_data, IDPropertyData::val, and IDPropertyData::val2.
Referenced by IDP_CopyArray(), IDP_CopyGroup(), IDP_CopyID(), IDP_CopyProperty_ex(), and IDP_CopyString().
IDProperty* IDP_GetIndexArray | ( | IDProperty * | prop, |
int | index | ||
) |
Definition at line 126 of file idprop.c.
References BLI_assert, GETPROP, IDP_IDPARRAY, and IDProperty::type.
Referenced by RNA_property_collection_add().
IDProperty* IDP_GetProperties | ( | struct ID * | id, |
bool | create_if_needed | ||
) |
Get the Group property that contains the id properties for ID id
.
create_if_needed | Set to create the group property and attach it to id if it doesn't exist; otherwise the function will return NULL if there's no Group property attached to the ID. |
Definition at line 778 of file idprop.c.
References id, IDP_GROUP, MEM_callocN, and ID::properties.
Referenced by blo_update_defaults_scene(), cycles_properties_from_ID(), cycles_visibility_properties_from_ID(), do_versions_idproperty_ui_data(), preview_id_copy_free(), proj_paint_state_viewport_init(), texture_paint_camera_project_exec(), and texture_paint_image_from_view_exec().
IDProperty* IDP_GetPropertyFromGroup | ( | const IDProperty * | prop, |
const char * | name | ||
) |
Definition at line 672 of file idprop.c.
References BLI_assert, BLI_findstring(), IDProperty::data, IDPropertyData::group, IDP_GROUP, and IDProperty::type.
Referenced by IDP_AddToGroup(), IDP_EqualsProperties_ex(), IDP_GetPropertyTypeFromGroup(), IDP_InsertToGroup(), IDP_MergeGroup_ex(), IDP_ReplaceInGroup(), IDP_ReplaceInGroup_ex(), and IDP_SyncGroupTypes().
IDProperty* IDP_GetPropertyTypeFromGroup | ( | const IDProperty * | prop, |
const char * | name, | ||
const char | type | ||
) |
Definition at line 678 of file idprop.c.
References IDP_GetPropertyFromGroup(), NULL, type, and IDProperty::type.
bool IDP_InsertToGroup | ( | IDProperty * | group, |
IDProperty * | previous, | ||
IDProperty * | pnew | ||
) |
Definition at line 644 of file idprop.c.
References BLI_assert, BLI_insertlinkafter(), IDProperty::data, IDPropertyData::group, IDP_GetPropertyFromGroup(), IDP_GROUP, IDProperty::len, IDProperty::name, NULL, and IDProperty::type.
void IDP_MergeGroup | ( | IDProperty * | dest, |
const IDProperty * | src, | ||
const bool | do_overwrite | ||
) |
Definition at line 626 of file idprop.c.
References dest, IDP_MergeGroup_ex(), and src.
Referenced by IDP_Reset().
void IDP_MergeGroup_ex | ( | IDProperty * | dest, |
const IDProperty * | src, | ||
const bool | do_overwrite, | ||
const int | flag | ||
) |
Definition at line 585 of file idprop.c.
References BLI_addtail(), BLI_assert, copy(), dest, IDP_CopyProperty_ex(), IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_ReplaceInGroup(), LISTBASE_FOREACH, IDProperty::name, NULL, src, and IDProperty::type.
Referenced by IDP_MergeGroup().
IDProperty* IDP_New | ( | char | type, |
const IDPropertyTemplate * | val, | ||
const char * | name | ||
) |
Allocate a new ID.
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:
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 887 of file idprop.c.
References IDPropertyTemplate::array, BLI_assert, CLOG_ERROR, IDPropertyTemplate::d, IDProperty::data, DEFAULT_ALLOC_FOR_NULL_STRINGS, ELEM, IDPropertyTemplate::f, IDPropertyTemplate::i, IDPropertyTemplate::id, id_us_plus(), IDP_ARRAY, 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, if(), IDPropertyTemplate::len, IDProperty::len, LOG, MEM_callocN, MEM_mallocN, NULL, IDPropertyData::pointer, usdtokens::st(), IDPropertyTemplate::str, IDPropertyTemplate::string, IDPropertyTemplate::subtype, IDProperty::subtype, IDProperty::totallen, IDPropertyTemplate::type, type, IDProperty::type, and IDPropertyData::val.
Referenced by action_asset_type_property(), blender::bke::idprop::array_create(), bc_set_IDPropertyMatrix(), BKE_asset_metadata_idprop_ensure(), BKE_keyconfig_pref_ensure(), BKE_keyconfig_pref_set_select_mouse(), blender::bke::idprop::create(), blender::bke::idprop::create_group(), cycles_property_int_set(), id_property_create_from_socket(), idp_from_DatablockPointer(), idp_from_PyBytes(), idp_from_PyFloat(), idp_from_PyLong(), idp_from_PyMapping(), idp_from_PySequence_Buffer(), idp_from_PySequence_Fast(), idp_from_PyUnicode(), idp_resize_group_array(), idprops_ensure_named_group(), IMB_metadata_ensure(), MOD_nodes_update_interface(), object_asset_dimensions_property(), 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_pointer_set(), RNA_property_string_set_bytes(), RNA_struct_idprops(), shortcut_get_operator_property(), shortcut_property_from_rna(), template_operator_property_buts_draw_single(), 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(), uiItemFullO_ptr_ex(), version_geometry_nodes_add_attribute_input_settings(), wm_gizmo_create(), WM_gizmo_operator_invoke(), WM_gizmo_properties_alloc(), wm_operator_create(), WM_operator_last_properties_ensure_idprops(), WM_operator_last_properties_store(), WM_operator_properties_alloc(), WM_toolsystem_ref_properties_ensure_idprops(), and WM_toolsystem_ref_properties_init_for_keymap().
IDProperty* IDP_NewIDPArray | ( | const char * | name | ) |
Definition at line 63 of file idprop.c.
References BLI_strncpy(), IDP_IDPARRAY, IDProperty::len, MAX_IDPROP_NAME, MEM_callocN, IDProperty::name, and IDProperty::type.
Referenced by idp_from_PySequence_Fast(), and RNA_property_collection_add().
IDProperty* IDP_NewString | ( | const char * | st, |
const char * | name, | ||
int | maxlen | ||
) |
st | The string to assign. |
name | The property name. |
maxlen | The size of the new string (including the \0 terminator). |
Definition at line 339 of file idprop.c.
References BLI_strncpy(), IDProperty::data, DEFAULT_ALLOC_FOR_NULL_STRINGS, IDP_String, IDP_STRING, IDProperty::len, MAX_IDPROP_NAME, MEM_callocN, MEM_mallocN, IDProperty::name, NULL, IDPropertyData::pointer, usdtokens::st(), IDProperty::totallen, and IDProperty::type.
Referenced by blender::bke::idprop::create(), IMB_metadata_set_field(), MOD_nodes_update_interface(), RNA_property_string_set(), shortcut_get_operator_property(), shortcut_property_from_rna(), ui_but_event_operator_string_from_menu(), ui_but_event_operator_string_from_panel(), and ui_but_event_property_operator_string().
void IDP_RemoveFromGroup | ( | struct IDProperty * | group, |
struct IDProperty * | prop | ||
) |
To free the property, you have to do: #IDP_FreeProperty(prop);
Definition at line 657 of file idprop.c.
References BLI_assert, BLI_findindex(), BLI_remlink(), IDProperty::data, IDPropertyData::group, IDP_GROUP, IDProperty::len, and IDProperty::type.
Referenced by IDP_FreeFromGroup().
void IDP_ReplaceGroupInGroup | ( | IDProperty * | dest, |
const IDProperty * | src | ||
) |
Definition at line 539 of file idprop.c.
References BLI_addtail(), BLI_assert, BLI_insertlinkreplace(), copy(), dest, IDP_CopyProperty(), IDP_FreeProperty(), IDP_GROUP, LISTBASE_FOREACH, IDProperty::name, IDProperty::next, NULL, src, and STREQ.
void IDP_ReplaceInGroup | ( | IDProperty * | group, |
IDProperty * | prop | ||
) |
Definition at line 578 of file idprop.c.
References IDP_GetPropertyFromGroup(), IDP_ReplaceInGroup_ex(), and IDProperty::name.
Referenced by BKE_asset_metadata_idprop_ensure(), IDP_MergeGroup_ex(), RNA_property_pointer_set(), ui_but_event_operator_string_from_panel(), and WM_operator_last_properties_store().
void IDP_ReplaceInGroup_ex | ( | struct IDProperty * | group, |
struct IDProperty * | prop, | ||
struct 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 563 of file idprop.c.
References BLI_addtail(), BLI_assert, BLI_insertlinkreplace(), IDProperty::data, IDPropertyData::group, IDP_FreeProperty(), IDP_GetPropertyFromGroup(), IDP_GROUP, IDProperty::len, IDProperty::name, NULL, and IDProperty::type.
Referenced by BPy_IDProperty_Map_ValidateAndCreate(), IDP_ReplaceInGroup(), idprops_ensure_named_group(), and RNA_property_pointer_set().
void IDP_Reset | ( | IDProperty * | prop, |
const IDProperty * | reference | ||
) |
Definition at line 1106 of file idprop.c.
References IDP_ClearProperty(), IDP_MergeGroup(), and NULL.
|
static |
Definition at line 185 of file idprop.c.
References Freestyle::a, IDProperty::data, IDPropertyTemplate::i, IDP_FreeProperty(), IDP_GROUP, IDP_New(), IDProperty::len, IDPropertyData::pointer, and IDProperty::subtype.
Referenced by IDP_FreeArray(), and IDP_ResizeArray().
void IDP_ResizeArray | ( | struct IDProperty * | prop, |
int | newlen | ||
) |
This function works for strings too!
Definition at line 211 of file idprop.c.
References IDProperty::data, IDP_ARRAY_REALLOC_LIMIT, idp_resize_group_array(), idp_size_table, IDProperty::len, MEM_recallocN, IDPropertyData::pointer, IDProperty::subtype, and IDProperty::totallen.
Referenced by IDP_AssignString(), IDP_ConcatString(), IDP_ConcatStringC(), and RNA_property_string_set_bytes().
void IDP_ResizeIDPArray | ( | IDProperty * | prop, |
int | newlen | ||
) |
Definition at line 141 of file idprop.c.
References BLI_assert, IDProperty::data, GETPROP, IDP_ARRAY_REALLOC_LIMIT, IDP_FreePropertyContent(), IDP_IDPARRAY, len, IDProperty::len, MEM_recallocN, IDPropertyData::pointer, IDProperty::totallen, and IDProperty::type.
Referenced by IDP_AppendArray(), RNA_property_collection_clear(), and RNA_property_collection_remove().
void IDP_SetIndexArray | ( | struct IDProperty * | prop, |
int | index, | ||
struct IDProperty * | item | ||
) |
Shallow copies item.
Definition at line 110 of file idprop.c.
References BLI_assert, GETPROP, IDP_FreePropertyContent(), IDP_IDPARRAY, IDProperty::len, and IDProperty::type.
Referenced by IDP_AppendArray().
void IDP_SyncGroupTypes | ( | IDProperty * | dest, |
const IDProperty * | src, | ||
const bool | do_arraylen | ||
) |
Definition at line 517 of file idprop.c.
References BLI_insertlinkreplace(), dest, ELEM, IDP_ARRAY, IDP_CopyProperty(), IDP_FreeFromGroup(), IDP_FreeProperty(), IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_IDPARRAY, IDProperty::len, LISTBASE_FOREACH_MUTABLE, NULL, src, IDProperty::subtype, and IDProperty::type.
void IDP_SyncGroupValues | ( | IDProperty * | dest, |
const IDProperty * | src | ||
) |
Definition at line 490 of file idprop.c.
References BLI_assert, BLI_findstring(), BLI_insertlinkreplace(), IDProperty::data, dest, IDP_CopyProperty(), IDP_DOUBLE, IDP_FLOAT, IDP_FreeProperty(), IDP_GROUP, IDP_INT, LISTBASE_FOREACH, IDProperty::name, src, and IDProperty::type.
IDPropertyUIData* IDP_ui_data_copy | ( | const IDProperty * | prop | ) |
Definition at line 256 of file idprop.c.
References IDPropertyUIData::description, IDP_ui_data_type(), IDP_UI_DATA_TYPE_FLOAT, IDP_UI_DATA_TYPE_ID, IDP_UI_DATA_TYPE_INT, IDP_UI_DATA_TYPE_STRING, IDP_UI_DATA_TYPE_UNSUPPORTED, MEM_dupallocN, src, and IDProperty::ui_data.
Referenced by idp_generic_copy().
IDPropertyUIData* IDP_ui_data_ensure | ( | IDProperty * | prop | ) |
Definition at line 1519 of file idprop.c.
References BLI_assert_unreachable, IDP_ui_data_type(), IDP_UI_DATA_TYPE_FLOAT, IDP_UI_DATA_TYPE_ID, IDP_UI_DATA_TYPE_INT, IDP_UI_DATA_TYPE_STRING, IDP_UI_DATA_TYPE_UNSUPPORTED, IDPropertyUIDataInt::max, IDPropertyUIDataFloat::max, MEM_callocN, IDPropertyUIDataInt::min, IDPropertyUIDataFloat::min, NULL, IDPropertyUIDataFloat::precision, IDPropertyUIDataInt::soft_max, IDPropertyUIDataFloat::soft_max, IDPropertyUIDataInt::soft_min, IDPropertyUIDataFloat::soft_min, IDPropertyUIDataInt::step, IDPropertyUIDataFloat::step, and IDProperty::ui_data.
Referenced by BPy_IDIDPropertyUIManager_as_dict(), BPy_IDPropertyUIManager_update(), id_property_create_from_socket(), MOD_nodes_update_interface(), RNA_property_float_set_default(), RNA_property_int_set_default(), and version_idproperty_ui_data().
void IDP_ui_data_free | ( | IDProperty * | prop | ) |
Definition at line 1023 of file idprop.c.
References IDPropertyUIDataInt::default_array, IDPropertyUIDataFloat::default_array, IDPropertyUIDataString::default_value, IDPropertyUIData::description, IDP_ui_data_type(), IDP_UI_DATA_TYPE_FLOAT, IDP_UI_DATA_TYPE_ID, IDP_UI_DATA_TYPE_INT, IDP_UI_DATA_TYPE_STRING, IDP_UI_DATA_TYPE_UNSUPPORTED, MEM_freeN, MEM_SAFE_FREE, NULL, and IDProperty::ui_data.
Referenced by BPy_IDPropertyUIManager_clear(), IDP_FreePropertyContent_ex(), and MOD_nodes_update_interface().
void IDP_ui_data_free_unique_contents | ( | IDPropertyUIData * | ui_data, |
const eIDPropertyUIDataType | type, | ||
const IDPropertyUIData * | other | ||
) |
Definition at line 981 of file idprop.c.
References IDPropertyUIDataInt::default_array, IDPropertyUIDataFloat::default_array, IDPropertyUIDataString::default_value, IDPropertyUIData::description, IDP_UI_DATA_TYPE_FLOAT, IDP_UI_DATA_TYPE_ID, IDP_UI_DATA_TYPE_INT, IDP_UI_DATA_TYPE_STRING, IDP_UI_DATA_TYPE_UNSUPPORTED, MEM_SAFE_FREE, and type.
bool IDP_ui_data_supported | ( | const IDProperty * | prop | ) |
Definition at line 1514 of file idprop.c.
References IDP_ui_data_type(), and IDP_UI_DATA_TYPE_UNSUPPORTED.
eIDPropertyUIDataType IDP_ui_data_type | ( | const IDProperty * | prop | ) |
Definition at line 1496 of file idprop.c.
References ELEM, IDP_ARRAY, IDP_DOUBLE, IDP_FLOAT, IDP_ID, IDP_INT, IDP_STRING, IDP_UI_DATA_TYPE_FLOAT, IDP_UI_DATA_TYPE_ID, IDP_UI_DATA_TYPE_INT, IDP_UI_DATA_TYPE_STRING, IDP_UI_DATA_TYPE_UNSUPPORTED, IDProperty::subtype, and IDProperty::type.
Referenced by IDP_ui_data_copy(), IDP_ui_data_ensure(), IDP_ui_data_free(), IDP_ui_data_supported(), read_ui_data(), and write_ui_data().
|
static |
Definition at line 1194 of file idprop.c.
References Freestyle::a, BLO_write_raw(), IDProperty::data, IDP_BlendWrite(), IDP_GROUP, IDProperty::len, MEM_allocN_len, IDPropertyData::pointer, and IDProperty::subtype.
Referenced by IDP_WriteProperty_OnlyData().
|
static |
Definition at line 1231 of file idprop.c.
References IDProperty::data, IDPropertyData::group, IDP_BlendWrite(), and LISTBASE_FOREACH.
Referenced by IDP_WriteProperty_OnlyData().
|
static |
Definition at line 1211 of file idprop.c.
References Freestyle::a, BLO_write_struct_array, IDProperty::data, IDP_WriteProperty_OnlyData(), IDProperty::len, and IDPropertyData::pointer.
Referenced by IDP_WriteProperty_OnlyData().
void IDP_WriteProperty_OnlyData | ( | const IDProperty * | prop, |
BlendWriter * | writer | ||
) |
Definition at line 1239 of file idprop.c.
References IDP_ARRAY, IDP_GROUP, IDP_IDPARRAY, IDP_STRING, IDP_WriteArray(), IDP_WriteGroup(), IDP_WriteIDPArray(), IDP_WriteString(), NULL, IDProperty::type, IDProperty::ui_data, and write_ui_data().
Referenced by IDP_BlendWrite(), and IDP_WriteIDPArray().
|
static |
Definition at line 1225 of file idprop.c.
References BLO_write_raw(), IDProperty::data, IDProperty::len, and IDPropertyData::pointer.
Referenced by IDP_WriteProperty_OnlyData().
|
static |
Definition at line 1268 of file idprop.c.
References BLI_assert_unreachable, BLO_read_data_address, BLO_read_double_array(), BLO_read_int32_array(), IDPropertyUIDataInt::default_array, IDPropertyUIDataFloat::default_array, IDPropertyUIDataInt::default_array_len, IDPropertyUIDataFloat::default_array_len, IDPropertyUIDataString::default_value, IDPropertyUIData::description, IDP_ARRAY, IDP_ui_data_type(), IDP_UI_DATA_TYPE_FLOAT, IDP_UI_DATA_TYPE_ID, IDP_UI_DATA_TYPE_INT, IDP_UI_DATA_TYPE_STRING, IDP_UI_DATA_TYPE_UNSUPPORTED, if(), IDProperty::type, and IDProperty::ui_data.
Referenced by IDP_DirectLinkProperty().
|
static |
Definition at line 1152 of file idprop.c.
References BLI_assert_unreachable, BLO_write_double_array(), BLO_write_int32_array(), BLO_write_string(), BLO_write_struct, IDPropertyUIDataInt::default_array, IDPropertyUIDataFloat::default_array, IDPropertyUIDataInt::default_array_len, IDPropertyUIDataFloat::default_array_len, IDPropertyUIDataString::default_value, IDPropertyUIData::description, IDP_ARRAY, IDP_ui_data_type(), IDP_UI_DATA_TYPE_FLOAT, IDP_UI_DATA_TYPE_ID, IDP_UI_DATA_TYPE_INT, IDP_UI_DATA_TYPE_STRING, IDP_UI_DATA_TYPE_UNSUPPORTED, IDProperty::type, and IDProperty::ui_data.
Referenced by IDP_WriteProperty_OnlyData().
|
static |
Definition at line 43 of file idprop.c.
Referenced by IDP_EqualsProperties_ex(), IDP_New(), and IDP_ResizeArray().
|
static |