Blender V2.61 - r43446
|
#include "DNA_ID.h"
Go to the source code of this file.
Classes | |
union | IDPropertyTemplate |
Defines | |
#define | IDP_Int(prop) ((prop)->data.val) |
#define | IDP_Float(prop) (*(float*)&(prop)->data.val) |
#define | IDP_String(prop) ((char*)(prop)->data.pointer) |
#define | IDP_Array(prop) ((prop)->data.pointer) |
#define | IDP_IDPArray(prop) ((IDProperty*)(prop)->data.pointer) |
#define | IDP_Double(prop) (*(double*)&(prop)->data.val) |
Typedefs | |
typedef union IDPropertyTemplate | IDPropertyTemplate |
Functions | |
IDProperty * | IDP_NewIDPArray (const char *name) |
IDProperty * | IDP_CopyIDPArray (IDProperty *array) |
void | IDP_FreeIDPArray (IDProperty *prop) |
void | IDP_SetIndexArray (struct IDProperty *prop, int index, struct IDProperty *item) |
struct IDProperty * | IDP_GetIndexArray (struct IDProperty *prop, int index) |
struct IDProperty * | IDP_AppendArray (struct IDProperty *prop, struct IDProperty *item) |
void | IDP_ResizeIDPArray (struct IDProperty *prop, int len) |
void | IDP_ResizeArray (struct IDProperty *prop, int newlen) |
void | IDP_FreeArray (struct IDProperty *prop) |
void | IDP_UnlinkArray (struct IDProperty *prop) |
IDProperty * | IDP_NewString (const char *st, const char *name, int maxlen) |
void | IDP_AssignString (struct IDProperty *prop, const char *st, int maxlen) |
void | IDP_ConcatStringC (struct IDProperty *prop, const char *st) |
void | IDP_ConcatString (struct IDProperty *str1, struct IDProperty *append) |
void | IDP_FreeString (struct IDProperty *prop) |
void | IDP_LinkID (struct IDProperty *prop, ID *id) |
void | IDP_UnlinkID (struct IDProperty *prop) |
void | IDP_SyncGroupValues (struct IDProperty *dest, struct IDProperty *src) |
void | IDP_ReplaceGroupInGroup (struct IDProperty *dest, struct IDProperty *src) |
void | IDP_ReplaceInGroup (struct IDProperty *group, struct IDProperty *prop) |
int | IDP_AddToGroup (struct IDProperty *group, struct IDProperty *prop) |
int | IDP_InsertToGroup (struct IDProperty *group, struct IDProperty *previous, struct IDProperty *pnew) |
void | IDP_RemFromGroup (struct IDProperty *group, struct IDProperty *prop) |
IDProperty * | IDP_GetPropertyFromGroup (struct IDProperty *prop, const char *name) |
IDProperty * | IDP_GetPropertyTypeFromGroup (struct IDProperty *prop, const char *name, const char type) |
void * | IDP_GetGroupIterator (struct IDProperty *prop) |
IDProperty * | IDP_GroupIterNext (void *vself) |
void | IDP_FreeIterBeforeEnd (void *vself) |
struct IDProperty * | IDP_GetProperties (struct ID *id, int create_if_needed) |
struct IDProperty * | IDP_CopyProperty (struct IDProperty *prop) |
int | IDP_EqualsProperties (struct IDProperty *prop1, struct IDProperty *prop2) |
struct IDProperty * | IDP_New (const int type, const IDPropertyTemplate *val, const char *name) |
void | IDP_FreeProperty (struct IDProperty *prop) |
void | IDP_UnlinkProperty (struct IDProperty *prop) |
Definition in file BKE_idprop.h.
#define IDP_Array | ( | prop | ) | ((prop)->data.pointer) |
Definition at line 203 of file BKE_idprop.h.
Referenced by BPy_IDArray_ass_slice(), BPy_IDArray_GetItem(), BPy_IDArray_SetItem(), BPy_IDArray_slice(), BPy_IDGroup_MapDataToPy(), BPy_IDProperty_Map_ValidateAndCreate(), IDP_EqualsProperties(), idprop_py_from_idp_string(), project_paint_begin(), RNA_property_boolean_get_array(), RNA_property_boolean_set_array(), RNA_property_float_get_array(), RNA_property_float_set_array(), RNA_property_int_get_array(), RNA_property_int_set_array(), and texture_paint_image_from_view_exec().
#define IDP_Double | ( | prop | ) | (*(double*)&(prop)->data.val) |
Definition at line 205 of file BKE_idprop.h.
Referenced by IDP_EqualsProperties(), RNA_property_float_get(), RNA_property_float_range(), RNA_property_float_set(), RNA_property_float_set_array(), and RNA_property_float_ui_range().
#define IDP_Float | ( | prop | ) | (*(float*)&(prop)->data.val) |
Definition at line 201 of file BKE_idprop.h.
Referenced by IDP_EqualsProperties(), RNA_property_float_get(), RNA_property_float_set(), and RNA_property_float_set_array().
#define IDP_IDPArray | ( | prop | ) | ((IDProperty*)(prop)->data.pointer) |
Definition at line 204 of file BKE_idprop.h.
Referenced by BPy_IDGroup_MapDataToPy(), IDP_EqualsProperties(), idprop_py_from_idp_idparray(), rna_idp_path(), RNA_property_collection_begin(), RNA_property_collection_move(), and RNA_property_collection_remove().
#define IDP_Int | ( | prop | ) | ((prop)->data.val) |
Definition at line 200 of file BKE_idprop.h.
Referenced by IDP_EqualsProperties(), RNA_property_boolean_get(), RNA_property_boolean_set(), RNA_property_boolean_set_array(), RNA_property_enum_get(), RNA_property_enum_set(), RNA_property_int_get(), RNA_property_int_range(), RNA_property_int_set(), RNA_property_int_set_array(), and RNA_property_int_ui_range().
#define IDP_String | ( | prop | ) | ((char*)(prop)->data.pointer) |
Definition at line 202 of file BKE_idprop.h.
Referenced by IDP_EqualsProperties(), rna_ensure_property_description(), RNA_property_string_get(), and RNA_property_string_length().
typedef union IDPropertyTemplate IDPropertyTemplate |
int 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 0 if a property can't be added to the group, and 1 if it can) and free the property.
Currently the code to free ID properties is designesd to leave the actual struct you pass it un-freed, this is needed for how the system works. This means to free an ID property, you first call IDP_FreeProperty then MEM_freeN the struct. In the future this will just be IDP_FreeProperty and the code will be reorganized to work properly.
Definition at line 507 of file idprop.c.
References BLI_addtail(), IDProperty::data, IDPropertyData::group, IDP_GetPropertyFromGroup(), IDProperty::len, IDProperty::name, and NULL.
Referenced by 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(), texture_paint_image_from_view_exec(), and ui_menu_block_set_keymaps().
struct IDProperty* IDP_AppendArray | ( | struct IDProperty * | prop, |
struct IDProperty * | item | ||
) | [read] |
Definition at line 125 of file idprop.c.
References IDP_ResizeIDPArray(), IDP_SetIndexArray(), and IDProperty::len.
Referenced by BPy_IDProperty_Map_ValidateAndCreate(), and RNA_property_collection_add().
void IDP_AssignString | ( | struct IDProperty * | prop, |
const char * | st, | ||
int | maxlen | ||
) |
Definition at line 348 of file idprop.c.
References BLI_strncpy(), IDProperty::data, IDP_ResizeArray(), IDP_STRING_SUB_BYTE, IDPropertyData::pointer, strlen(), and IDProperty::subtype.
Referenced by RNA_property_string_set(), and ui_menu_block_set_keymaps().
void IDP_ConcatString | ( | struct IDProperty * | str1, |
struct IDProperty * | append | ||
) |
Definition at line 377 of file idprop.c.
References IDProperty::data, IDP_ResizeArray(), IDProperty::len, and IDPropertyData::pointer.
void IDP_ConcatStringC | ( | struct IDProperty * | prop, |
const char * | st | ||
) |
Definition at line 366 of file idprop.c.
References IDProperty::data, IDP_ResizeArray(), IDProperty::len, IDPropertyData::pointer, and strlen().
IDProperty* IDP_CopyIDPArray | ( | IDProperty * | array | ) |
Definition at line 75 of file idprop.c.
References IDProperty::data, GETPROP, i, IDP_CopyProperty(), IDProperty::len, MEM_dupallocN(), MEM_freeN(), MEM_mallocN(), and IDPropertyData::pointer.
Referenced by IDP_CopyProperty().
struct IDProperty* IDP_CopyProperty | ( | struct IDProperty * | prop | ) | [read] |
Definition at line 593 of file idprop.c.
References IDP_ARRAY, IDP_CopyArray(), IDP_CopyGroup(), IDP_CopyIDPArray(), IDP_CopyString(), idp_generic_copy(), IDP_GROUP, IDP_IDPARRAY, IDP_STRING, and IDProperty::type.
Referenced by copy_bonechildren(), copy_libblock_data(), copy_pose(), copy_scene(), duplicate_pose_channel_data(), duplicateEditBoneObjects(), ED_armature_from_edit(), fcm_python_copy(), fcurves_to_pchan_links_get(), IDP_CopyArray(), IDP_CopyGroup(), IDP_CopyIDPArray(), IDP_ReplaceGroupInGroup(), IDP_SyncGroupValues(), make_boneList(), menu_add_shortcut(), object_make_proxy(), pose_bone_do_paste(), pose_proxy_synchronize(), poselib_backup_posecopy(), pycon_copy(), uiItemsFullEnumO(), wm_keymap_item_copy(), WM_keymap_restore_item_to_default(), WM_operator_confirm_message(), wm_operator_create(), and wm_operator_init_from_last().
int IDP_EqualsProperties | ( | struct IDProperty * | prop1, |
struct IDProperty * | prop2 | ||
) |
Definition at line 620 of file idprop.c.
References BLI_countlist(), IDProperty::data, ListBase::first, IDPropertyData::group, i, IDP_ARRAY, IDP_Array, IDP_Double, IDP_DOUBLE, IDP_EqualsProperties(), IDP_FLOAT, IDP_Float, IDP_GetPropertyFromGroup(), IDP_GROUP, IDP_IDPArray, IDP_IDPARRAY, IDP_Int, IDP_INT, idp_size_table, IDP_String, IDP_STRING, IDProperty::len, IDProperty::name, IDProperty::next, NULL, IDProperty::subtype, and IDProperty::type.
Referenced by IDP_EqualsProperties(), wm_keymap_item_equals_result(), and wm_keymap_item_find_handlers().
void IDP_FreeArray | ( | struct IDProperty * | prop | ) |
Definition at line 251 of file idprop.c.
References IDProperty::data, idp_resize_group_array(), MEM_freeN(), NULL, and IDPropertyData::pointer.
Referenced by IDP_FreeProperty().
void IDP_FreeIDPArray | ( | IDProperty * | prop | ) |
Definition at line 99 of file idprop.c.
References IDProperty::data, GETPROP, i, IDP_FreeProperty(), IDProperty::len, MEM_freeN(), and IDPropertyData::pointer.
Referenced by IDP_FreeProperty().
void IDP_FreeIterBeforeEnd | ( | void * | vself | ) |
Frees the iterator pointed to at vself, only use this if iteration is stopped early; when the iterator hits the end of the list it'll automatially free itself.
Definition at line 572 of file idprop.c.
References MEM_freeN().
void IDP_FreeProperty | ( | struct IDProperty * | prop | ) |
Definition at line 767 of file idprop.c.
References IDP_ARRAY, IDP_FreeArray(), IDP_FreeGroup(), IDP_FreeIDPArray(), IDP_FreeString(), IDP_GROUP, IDP_IDPARRAY, IDP_STRING, and IDProperty::type.
Referenced by bone_free(), BPy_IDProperty_Map_ValidateAndCreate(), BPy_Wrap_SetMapItem(), duplicate_pose_channel_data(), ED_armature_edit_free(), fcm_python_free(), free_bonelist(), free_libblock(), free_pose_channel(), free_posebuf(), free_scene(), IDP_FreeGroup(), IDP_FreeIDPArray(), IDP_ReplaceGroupInGroup(), IDP_ReplaceInGroup(), idp_resize_group_array(), IDP_ResizeIDPArray(), IDP_SetIndexArray(), IDP_SyncGroupValues(), keymap_item_free(), object_make_proxy(), pose_clear_user_transforms_exec(), pose_proxy_synchronize(), poseAnim_mapping_free(), poselib_backup_free_data(), pycon_free(), pyrna_struct_dealloc(), rna_idproperty_check(), RNA_property_pointer_remove(), RNA_struct_idprops_unset(), shader_preview_free(), ui_menu_block_set_keymaps(), uiItemsFullEnumO(), WM_keymap_restore_item_to_default(), WM_operator_free(), and WM_operator_properties_free().
void IDP_FreeString | ( | struct IDProperty * | prop | ) |
Definition at line 388 of file idprop.c.
References IDProperty::data, MEM_freeN(), and IDPropertyData::pointer.
Referenced by IDP_FreeProperty().
void* IDP_GetGroupIterator | ( | struct IDProperty * | prop | ) |
Get an iterator to iterate over the members of an id property group. Note that this will automatically free the iterator once iteration is complete; if you stop the iteration before hitting the end, make sure to call IDP_FreeIterBeforeEnd().
Definition at line 551 of file idprop.c.
References IDProperty::data, ListBase::first, IDPropertyData::group, MEM_callocN(), IDPIter::next, and IDPIter::parent.
struct IDProperty* IDP_GetIndexArray | ( | struct IDProperty * | prop, |
int | index | ||
) | [read] |
Definition at line 120 of file idprop.c.
References GETPROP.
Referenced by RNA_property_collection_add().
struct IDProperty* IDP_GetProperties | ( | struct ID * | id, |
int | create_if_needed | ||
) | [read] |
Get the Group property that contains the id properties for ID id. Set create_if_needed 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 604 of file idprop.c.
References IDP_GROUP, MEM_callocN(), and ID::properties.
Referenced by project_paint_begin(), shader_preview_free(), texture_paint_camera_project_exec(), and texture_paint_image_from_view_exec().
IDProperty* IDP_GetPropertyFromGroup | ( | struct IDProperty * | prop, |
const char * | name | ||
) |
Definition at line 535 of file idprop.c.
References BLI_findstring(), IDProperty::data, and IDPropertyData::group.
Referenced by BPy_IDGroup_Contains(), BPy_IDGroup_Get(), BPy_IDGroup_Map_GetItem(), BPy_IDGroup_Pop(), BPy_Wrap_SetMapItem(), IDP_AddToGroup(), IDP_EqualsProperties(), IDP_GetPropertyTypeFromGroup(), IDP_InsertToGroup(), IDP_ReplaceInGroup(), project_paint_begin(), pyrna_struct_contains(), pyrna_struct_get(), pyrna_struct_subscript(), rna_idproperty_find(), RNA_path_resolve_full(), RNA_struct_idprops_unset(), and wm_operator_init_from_last().
IDProperty* IDP_GetPropertyTypeFromGroup | ( | struct IDProperty * | prop, |
const char * | name, | ||
const char | type | ||
) |
same as above but ensure type match
Definition at line 540 of file idprop.c.
References IDP_GetPropertyFromGroup(), NULL, and IDProperty::type.
Referenced by rna_ensure_property_description(), rna_idproperty_ui(), RNA_property_float_range(), RNA_property_float_ui_range(), RNA_property_int_range(), RNA_property_int_ui_range(), and texture_paint_camera_project_exec().
IDProperty* IDP_GroupIterNext | ( | void * | vself | ) |
Returns the next item in the iteration. To use, simple for a loop like the following: while (IDP_GroupIterNext(iter) != NULL) { . . . }
Definition at line 559 of file idprop.c.
References if(), MEM_freeN(), next, Link::next, and NULL.
int IDP_InsertToGroup | ( | struct IDProperty * | group, |
struct IDProperty * | previous, | ||
struct IDProperty * | pnew | ||
) |
this is the same as IDP_AddToGroup, only you pass an item in the group list to be inserted after.
Definition at line 518 of file idprop.c.
References BLI_insertlink(), IDProperty::data, IDPropertyData::group, IDP_GetPropertyFromGroup(), IDProperty::len, IDProperty::name, and NULL.
void IDP_LinkID | ( | struct IDProperty * | prop, |
ID * | id | ||
) |
Definition at line 397 of file idprop.c.
References IDProperty::data, id_us_plus(), and IDPropertyData::pointer.
struct IDProperty* IDP_New | ( | const int | type, |
const IDPropertyTemplate * | val, | ||
const char * | name | ||
) | [read] |
Allocate a new ID.
This function takes three arguments: the ID property type, a union which defines it's initial value, and a name.
The union is simple to use; see the top of this header file for its definition. An example of using this function:
IDPropertyTemplate val; IDProperty *group, *idgroup, *color; group = IDP_New(IDP_GROUP, val, "group1"); //groups don't need a template.
val.array.len = 4 val.array.type = IDP_FLOAT; color = IDP_New(IDP_ARRAY, val, "color1");
idgroup = IDP_GetProperties(some_id, 1); IDP_AddToGroup(idgroup, color); IDP_AddToGroup(idgroup, group);
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 675 of file idprop.c.
References IDPropertyTemplate::array, IDPropertyTemplate::d, IDProperty::data, DEFAULT_ALLOC_FOR_NULL_STRINGS, IDPropertyTemplate::f, IDPropertyTemplate::i, IDP_ARRAY, IDP_DOUBLE, IDP_FLOAT, IDP_GROUP, IDP_INT, idp_size_table, IDP_STRING, IDP_STRING_SUB_BYTE, IDP_STRING_SUB_UTF8, if(), IDProperty::len, IDPropertyTemplate::len, MEM_callocN(), MEM_mallocN(), NULL, IDPropertyData::pointer, IDPropertyTemplate::str, IDPropertyTemplate::string, strlen(), IDPropertyTemplate::subtype, IDProperty::subtype, IDProperty::totallen, IDPropertyTemplate::type, and IDPropertyData::val.
Referenced by BPy_IDProperty_Map_ValidateAndCreate(), idp_resize_group_array(), 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(), texture_paint_image_from_view_exec(), ui_menu_block_set_keymaps(), uiItemFullO(), uiLayoutOperatorButs(), wm_operator_create(), and WM_operator_properties_alloc().
IDProperty* IDP_NewIDPArray | ( | const char * | name | ) |
Definition at line 65 of file idprop.c.
References BLI_strncpy(), IDP_IDPARRAY, IDProperty::len, MAX_IDPROP_NAME, MEM_callocN(), IDProperty::name, and IDProperty::type.
Referenced by BPy_IDProperty_Map_ValidateAndCreate(), and RNA_property_collection_add().
IDProperty* IDP_NewString | ( | const char * | st, |
const char * | name, | ||
int | maxlen | ||
) |
Definition at line 307 of file idprop.c.
References BLI_strncpy(), IDProperty::data, DEFAULT_ALLOC_FOR_NULL_STRINGS, IDP_STRING, IDProperty::len, MAX_IDPROP_NAME, MEM_callocN(), IDProperty::name, NULL, IDPropertyData::pointer, strlen(), IDProperty::totallen, and IDProperty::type.
Referenced by RNA_property_string_set(), and ui_menu_block_set_keymaps().
void IDP_RemFromGroup | ( | struct IDProperty * | group, |
struct IDProperty * | prop | ||
) |
To free the property, you have to do: IDP_FreeProperty(prop); //free all subdata MEM_freeN(prop); //free property struct itself
Definition at line 529 of file idprop.c.
References BLI_remlink(), IDProperty::data, IDPropertyData::group, and IDProperty::len.
Referenced by BPy_IDGroup_Pop(), BPy_Wrap_SetMapItem(), rna_idproperty_check(), RNA_property_pointer_remove(), and RNA_struct_idprops_unset().
void IDP_ReplaceGroupInGroup | ( | struct IDProperty * | dest, |
struct IDProperty * | src | ||
) |
replaces all properties with the same name in a destination group from a source group.
Definition at line 460 of file idprop.c.
References BLI_addtail(), BLI_insertlink(), BLI_remlink(), copy(), IDProperty::data, ListBase::first, IDPropertyData::group, IDP_CopyProperty(), IDP_FreeProperty(), IDProperty::len, MEM_freeN(), IDProperty::name, IDProperty::next, and NULL.
Referenced by wm_operator_create().
void IDP_ReplaceInGroup | ( | struct IDProperty * | group, |
struct IDProperty * | prop | ||
) |
checks if a property with the same name as prop exists, and if so replaces it. Use this to preserve order!
Definition at line 489 of file idprop.c.
References BLI_addtail(), BLI_insertlink(), BLI_remlink(), IDProperty::data, IDPropertyData::group, IDP_FreeProperty(), IDP_GetPropertyFromGroup(), IDProperty::len, MEM_freeN(), and IDProperty::name.
Referenced by BPy_IDProperty_Map_ValidateAndCreate(), and wm_operator_init_from_last().
void IDP_ResizeArray | ( | struct IDProperty * | prop, |
int | newlen | ||
) |
Definition at line 210 of file idprop.c.
References IDProperty::data, idp_resize_group_array(), idp_size_table, IDProperty::len, MEM_callocN(), MEM_freeN(), IDPropertyData::pointer, IDProperty::subtype, and IDProperty::totallen.
Referenced by IDP_AssignString(), IDP_ConcatString(), and IDP_ConcatStringC().
void IDP_ResizeIDPArray | ( | struct IDProperty * | prop, |
int | len | ||
) |
Definition at line 132 of file idprop.c.
References IDProperty::data, GETPROP, i, IDP_FreeProperty(), IDProperty::len, MEM_callocN(), MEM_freeN(), IDPropertyData::pointer, and IDProperty::totallen.
Referenced by IDP_AppendArray(), RNA_property_collection_clear(), and RNA_property_collection_remove().
void IDP_SetIndexArray | ( | struct IDProperty * | prop, |
int | index, | ||
struct IDProperty * | item | ||
) |
Definition at line 111 of file idprop.c.
References GETPROP, IDP_FreeProperty(), and IDProperty::len.
Referenced by IDP_AppendArray().
void IDP_SyncGroupValues | ( | struct IDProperty * | dest, |
struct IDProperty * | src | ||
) |
Sync values from one group to another, only where they match
Definition at line 426 of file idprop.c.
References BLI_findstring(), BLI_insertlinkafter(), BLI_remlink(), copy(), IDProperty::data, ListBase::first, IDPropertyData::group, IDP_CopyProperty(), IDP_DOUBLE, IDP_FLOAT, IDP_FreeProperty(), IDP_GROUP, IDP_INT, IDP_SyncGroupValues(), MEM_freeN(), IDProperty::name, IDProperty::next, and IDProperty::type.
Referenced by IDP_SyncGroupValues(), pose_bone_do_paste(), pose_proxy_synchronize(), poseAnim_mapping_reset(), and poselib_backup_restore().
void IDP_UnlinkArray | ( | struct IDProperty * | prop | ) |
void IDP_UnlinkID | ( | struct IDProperty * | prop | ) |
Definition at line 404 of file idprop.c.
References IDProperty::data, and IDPropertyData::pointer.
Referenced by IDP_UnlinkProperty().
void IDP_UnlinkProperty | ( | struct IDProperty * | prop | ) |
Unlinks any struct IDProperty<->ID linkage that might be going on.
Definition at line 787 of file idprop.c.
References IDP_ID, IDP_UnlinkID(), and IDProperty::type.