From ba91587183105fb7edcab3d4f4e37ce0078bd86e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 31 Dec 2008 13:16:37 +0000 Subject: RNA * Store RNA collections different in ID properties, using a generic ID property array, using the patch provided by Joe. * Fix bug accessing registered operator properties in the wm from the outliner. * In the outliner, only use the RNA icon for RNA data, and use dot again for unknown icon. * Also, show pointer properties data in the second column, and auto expand two levels when opening them. * Added small RNA_struct_defined_properties function to get only the defined properties without builtin and undefined id properties (for py operators). --- source/blender/blenkernel/BKE_idprop.h | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/BKE_idprop.h') diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 0021d531c85..4f57e1d6d14 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -49,7 +49,22 @@ typedef union { } matrix_or_vector; } IDPropertyTemplate; -/* ----------- Array Type ----------- */ +/* ----------- Property Array Type ---------- */ + +/*note: as a start to move away from the stupid IDP_New function, this type + has it's own allocation function.*/ +IDProperty *IDP_NewIDPArray(const char *name); +IDProperty *IDP_CopyIDPArray(IDProperty *array); + +void IDP_FreeIDPArray(IDProperty *prop); + +/* shallow copies item */ +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); + +/* ----------- Numeric Array Type ----------- */ /*this function works for strings too!*/ void IDP_ResizeArray(struct IDProperty *prop, int newlen); void IDP_FreeArray(struct IDProperty *prop); @@ -152,7 +167,7 @@ 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. */ -struct IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name); +struct IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name); \ /*NOTE: this will free all child properties of list arrays and groups! Also, note that this does NOT unlink anything! Plus it doesn't free @@ -162,10 +177,11 @@ void IDP_FreeProperty(struct IDProperty *prop); /*Unlinks any struct IDProperty<->ID linkage that might be going on.*/ void IDP_UnlinkProperty(struct IDProperty *prop); -#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_Double(prop) (*(double*)&prop->data.val) +#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) #endif /* _BKE_IDPROP_H */ -- cgit v1.2.3