Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-03-06 03:30:41 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-03-06 03:30:41 +0400
commit0114d78c33edfaef5bc412eefcb5d52a0a6823b0 (patch)
tree2deb1401eb9152ccf44855b8674ee75560b1ad9f /source/blender/makesrna/intern/rna_access.c
parent1eb893a11410955a9cf3ceb41ab50d515f5393b1 (diff)
Code cleanup in rna files (huge, higly automated with py script).
Addresses: * C++ comments. * Spaces after if/for/while/switch statements. * Spaces around assignment operators.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c2490
1 files changed, 1245 insertions, 1245 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 0df8a625caf..0a420b1c6bf 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -63,7 +63,7 @@
#include "rna_internal.h"
-const PointerRNA PointerRNA_NULL= {{NULL}};
+const PointerRNA PointerRNA_NULL = {{NULL}};
/* Init/Exit */
@@ -72,12 +72,12 @@ void RNA_init(void)
StructRNA *srna;
PropertyRNA *prop;
- for(srna=BLENDER_RNA.structs.first; srna; srna=srna->cont.next) {
- if(!srna->cont.prophash) {
- srna->cont.prophash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "RNA_init gh");
+ for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
+ if (!srna->cont.prophash) {
+ srna->cont.prophash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "RNA_init gh");
- for(prop=srna->cont.properties.first; prop; prop=prop->next)
- if(!(prop->flag & PROP_BUILTIN))
+ for (prop = srna->cont.properties.first; prop; prop = prop->next)
+ if (!(prop->flag & PROP_BUILTIN))
BLI_ghash_insert(srna->cont.prophash, (void*)prop->identifier, prop);
}
}
@@ -89,10 +89,10 @@ void RNA_exit(void)
RNA_property_update_cache_free();
- for(srna=BLENDER_RNA.structs.first; srna; srna=srna->cont.next) {
- if(srna->cont.prophash) {
+ for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
+ if (srna->cont.prophash) {
BLI_ghash_free(srna->cont.prophash, NULL, NULL);
- srna->cont.prophash= NULL;
+ srna->cont.prophash = NULL;
}
}
@@ -103,95 +103,95 @@ void RNA_exit(void)
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
{
- r_ptr->id.data= NULL;
- r_ptr->type= &RNA_BlendData;
- r_ptr->data= main;
+ r_ptr->id.data = NULL;
+ r_ptr->type = &RNA_BlendData;
+ r_ptr->data = main;
}
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
{
- StructRNA *type, *idtype= NULL;
+ StructRNA *type, *idtype = NULL;
- if(id) {
- PointerRNA tmp= {{NULL}};
- tmp.data= id;
- idtype= rna_ID_refine(&tmp);
+ if (id) {
+ PointerRNA tmp = {{NULL}};
+ tmp.data = id;
+ idtype = rna_ID_refine(&tmp);
- while(idtype->refine) {
- type= idtype->refine(&tmp);
+ while (idtype->refine) {
+ type = idtype->refine(&tmp);
- if(type == idtype)
+ if (type == idtype)
break;
else
- idtype= type;
+ idtype = type;
}
}
- r_ptr->id.data= id;
- r_ptr->type= idtype;
- r_ptr->data= id;
+ r_ptr->id.data = id;
+ r_ptr->type = idtype;
+ r_ptr->data = id;
}
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
{
#if 0 /* UNUSED */
- StructRNA *idtype= NULL;
+ StructRNA *idtype = NULL;
- if(id) {
- PointerRNA tmp= {{0}};
- tmp.data= id;
- idtype= rna_ID_refine(&tmp);
+ if (id) {
+ PointerRNA tmp = {{0}};
+ tmp.data = id;
+ idtype = rna_ID_refine(&tmp);
}
#endif
- r_ptr->id.data= id;
- r_ptr->type= type;
- r_ptr->data= data;
+ r_ptr->id.data = id;
+ r_ptr->type = type;
+ r_ptr->data = data;
- if(data) {
- while(r_ptr->type && r_ptr->type->refine) {
- StructRNA *rtype= r_ptr->type->refine(r_ptr);
+ if (data) {
+ while (r_ptr->type && r_ptr->type->refine) {
+ StructRNA *rtype = r_ptr->type->refine(r_ptr);
- if(rtype == r_ptr->type)
+ if (rtype == r_ptr->type)
break;
else
- r_ptr->type= rtype;
+ r_ptr->type = rtype;
}
}
}
static void rna_pointer_inherit_id(StructRNA *type, PointerRNA *parent, PointerRNA *ptr)
{
- if(type && type->flag & STRUCT_ID) {
- ptr->id.data= ptr->data;
+ if (type && type->flag & STRUCT_ID) {
+ ptr->id.data = ptr->data;
}
else {
- ptr->id.data= parent->id.data;
+ ptr->id.data = parent->id.data;
}
}
void RNA_blender_rna_pointer_create(PointerRNA *r_ptr)
{
- r_ptr->id.data= NULL;
- r_ptr->type= &RNA_BlenderRNA;
- r_ptr->data= &BLENDER_RNA;
+ r_ptr->id.data = NULL;
+ r_ptr->type = &RNA_BlenderRNA;
+ r_ptr->data = &BLENDER_RNA;
}
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
{
- if(data) {
+ if (data) {
PointerRNA result;
- result.data= data;
- result.type= type;
+ result.data = data;
+ result.type = type;
rna_pointer_inherit_id(type, ptr, &result);
- while(result.type->refine) {
- type= result.type->refine(&result);
+ while (result.type->refine) {
+ type = result.type->refine(&result);
- if(type == result.type)
+ if (type == result.type)
break;
else
- result.type= type;
+ result.type = type;
}
return result;
}
@@ -203,8 +203,8 @@ PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *da
/**/
void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
{
-#if 0 // works but this case if covered by more general code below.
- if(RNA_struct_is_ID(ptr->type)) {
+#if 0 /* works but this case if covered by more general code below. */
+ if (RNA_struct_is_ID(ptr->type)) {
/* simple case */
RNA_id_pointer_create(ptr->id.data, r_ptr);
}
@@ -213,12 +213,12 @@ void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
{
StructRNA *base;
PointerRNA t_ptr;
- *r_ptr= *ptr; /* initialize as the same incase cant recast */
+ *r_ptr = *ptr; /* initialize as the same incase cant recast */
- for(base=ptr->type->base; base; base=base->base) {
- t_ptr= rna_pointer_inherit_refine(ptr, base, ptr->data);
- if(t_ptr.type && t_ptr.type != ptr->type) {
- *r_ptr= t_ptr;
+ for (base = ptr->type->base; base; base = base->base) {
+ t_ptr = rna_pointer_inherit_refine(ptr, base, ptr->data);
+ if (t_ptr.type && t_ptr.type != ptr->type) {
+ *r_ptr = t_ptr;
}
}
}
@@ -237,14 +237,14 @@ IDProperty *rna_idproperty_ui(PropertyRNA *prop)
{
IDProperty *idprop;
- for(idprop= ((IDProperty *)prop)->prev; idprop; idprop= idprop->prev) {
- if (strcmp(RNA_IDP_UI, idprop->name)==0)
+ for (idprop = ((IDProperty *)prop)->prev; idprop; idprop = idprop->prev) {
+ if (strcmp(RNA_IDP_UI, idprop->name) == 0)
break;
}
- if(idprop==NULL) {
- for(idprop= ((IDProperty *)prop)->next; idprop; idprop= idprop->next) {
- if (strcmp(RNA_IDP_UI, idprop->name)==0)
+ if (idprop == NULL) {
+ for (idprop = ((IDProperty *)prop)->next; idprop; idprop = idprop->next) {
+ if (strcmp(RNA_IDP_UI, idprop->name) == 0)
break;
}
}
@@ -258,9 +258,9 @@ IDProperty *rna_idproperty_ui(PropertyRNA *prop)
IDProperty *RNA_struct_idprops(PointerRNA *ptr, int create)
{
- StructRNA *type= ptr->type;
+ StructRNA *type = ptr->type;
- if(type && type->idproperties)
+ if (type && type->idproperties)
return type->idproperties(ptr, create);
return NULL;
@@ -273,9 +273,9 @@ int RNA_struct_idprops_check(StructRNA *srna)
static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
{
- IDProperty *group= RNA_struct_idprops(ptr, 0);
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
- if(group)
+ if (group)
return IDP_GetPropertyFromGroup(group, name);
return NULL;
@@ -283,14 +283,14 @@ static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
{
- if(prop->magic == RNA_MAGIC) {
+ if (prop->magic == RNA_MAGIC) {
int arraylen[RNA_MAX_ARRAY_DIMENSION];
return (prop->getlength && ptr->data)? prop->getlength(ptr, arraylen): prop->totarraylength;
}
else {
- IDProperty *idprop= (IDProperty*)prop;
+ IDProperty *idprop = (IDProperty*)prop;
- if(idprop->type == IDP_ARRAY)
+ if (idprop->type == IDP_ARRAY)
return idprop->len;
else
return 0;
@@ -299,11 +299,11 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
static int rna_ensure_property_array_check(PropertyRNA *prop)
{
- if(prop->magic == RNA_MAGIC) {
+ if (prop->magic == RNA_MAGIC) {
return (prop->getlength || prop->totarraylength) ? 1:0;
}
else {
- IDProperty *idprop= (IDProperty*)prop;
+ IDProperty *idprop = (IDProperty*)prop;
return idprop->type == IDP_ARRAY ? 1:0;
}
@@ -311,19 +311,19 @@ static int rna_ensure_property_array_check(PropertyRNA *prop)
static void rna_ensure_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int length[])
{
- if(prop->magic == RNA_MAGIC) {
- if(prop->getlength)
+ if (prop->magic == RNA_MAGIC) {
+ if (prop->getlength)
prop->getlength(ptr, length);
else
memcpy(length, prop->arraylength, prop->arraydimension*sizeof(int));
}
else {
- IDProperty *idprop= (IDProperty*)prop;
+ IDProperty *idprop = (IDProperty*)prop;
- if(idprop->type == IDP_ARRAY)
- length[0]= idprop->len;
+ if (idprop->type == IDP_ARRAY)
+ length[0] = idprop->len;
else
- length[0]= 0;
+ length[0] = 0;
}
}
@@ -334,36 +334,36 @@ static int rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDPro
* rna property access is type safe, e.g. if you defined the rna
* to have a certain array length you can count on that staying so */
- switch(idprop->type) {
+ switch (idprop->type) {
case IDP_IDPARRAY:
- if(prop->type != PROP_COLLECTION)
+ if (prop->type != PROP_COLLECTION)
return 0;
break;
case IDP_ARRAY:
- if(rna_ensure_property_array_length(ptr, prop) != idprop->len)
+ if (rna_ensure_property_array_length(ptr, prop) != idprop->len)
return 0;
- if(idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT)
+ if (idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT)
return 0;
- if(idprop->subtype == IDP_INT && !ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
+ if (idprop->subtype == IDP_INT && !ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
return 0;
break;
case IDP_INT:
- if(!ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
+ if (!ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
return 0;
break;
case IDP_FLOAT:
case IDP_DOUBLE:
- if(prop->type != PROP_FLOAT)
+ if (prop->type != PROP_FLOAT)
return 0;
break;
case IDP_STRING:
- if(prop->type != PROP_STRING)
+ if (prop->type != PROP_STRING)
return 0;
break;
case IDP_GROUP:
- if(prop->type != PROP_POINTER)
+ if (prop->type != PROP_POINTER)
return 0;
break;
default:
@@ -398,12 +398,12 @@ IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr)
* we look up an IDP PropertyRNA based on the type, and set the data
* pointer to the IDProperty. */
- if((*prop)->magic == RNA_MAGIC) {
- if((*prop)->flag & PROP_IDPROPERTY) {
- IDProperty *idprop= rna_idproperty_find(ptr, (*prop)->identifier);
+ if ((*prop)->magic == RNA_MAGIC) {
+ if ((*prop)->flag & PROP_IDPROPERTY) {
+ IDProperty *idprop = rna_idproperty_find(ptr, (*prop)->identifier);
- if(idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) {
- IDProperty *group= RNA_struct_idprops(ptr, 0);
+ if (idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) {
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
IDP_RemFromGroup(group, idprop);
IDP_FreeProperty(idprop);
@@ -418,12 +418,12 @@ IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr)
}
{
- IDProperty *idprop= (IDProperty*)(*prop);
+ IDProperty *idprop = (IDProperty*)(*prop);
- if(idprop->type == IDP_ARRAY)
- *prop= arraytypemap[(int)(idprop->subtype)];
- else
- *prop= typemap[(int)(idprop->type)];
+ if (idprop->type == IDP_ARRAY)
+ *prop = arraytypemap[(int)(idprop->subtype)];
+ else
+ *prop = typemap[(int)(idprop->type)];
return idprop;
}
@@ -433,22 +433,22 @@ static PropertyRNA *rna_ensure_property(PropertyRNA *prop)
{
/* the quick version if we don't need the idproperty */
- if(prop->magic == RNA_MAGIC)
+ if (prop->magic == RNA_MAGIC)
return prop;
{
- IDProperty *idprop= (IDProperty*)prop;
+ IDProperty *idprop = (IDProperty*)prop;
- if(idprop->type == IDP_ARRAY)
+ if (idprop->type == IDP_ARRAY)
return arraytypemap[(int)(idprop->subtype)];
- else
+ else
return typemap[(int)(idprop->type)];
}
}
static const char *rna_ensure_property_identifier(PropertyRNA *prop)
{
- if(prop->magic == RNA_MAGIC)
+ if (prop->magic == RNA_MAGIC)
return prop->identifier;
else
return ((IDProperty*)prop)->name;
@@ -456,27 +456,27 @@ static const char *rna_ensure_property_identifier(PropertyRNA *prop)
static const char *rna_ensure_property_description(PropertyRNA *prop)
{
- const char *description= NULL;
+ const char *description = NULL;
- if(prop->magic == RNA_MAGIC)
- description= prop->description;
+ if (prop->magic == RNA_MAGIC)
+ description = prop->description;
else {
/* attempt to get the local ID values */
- IDProperty *idp_ui= rna_idproperty_ui(prop);
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if(idp_ui) {
- IDProperty *item= IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
- if(item)
- description= IDP_String(item);
+ if (idp_ui) {
+ IDProperty *item = IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
+ if (item)
+ description = IDP_String(item);
}
- if(description == NULL)
- description= ((IDProperty*)prop)->name; /* XXX - not correct */
+ if (description == NULL)
+ description = ((IDProperty*)prop)->name; /* XXX - not correct */
}
#ifdef WITH_INTERNATIONAL
- if(description && BLF_translate_tooltips())
- description= BLF_gettext(description);
+ if (description && BLF_translate_tooltips())
+ description = BLF_gettext(description);
#endif
return description;
@@ -486,14 +486,14 @@ static const char *rna_ensure_property_name(PropertyRNA *prop)
{
const char *name;
- if(prop->magic == RNA_MAGIC)
- name= prop->name;
+ if (prop->magic == RNA_MAGIC)
+ name = prop->name;
else
- name= ((IDProperty*)prop)->name;
+ name = ((IDProperty*)prop)->name;
#ifdef WITH_INTERNATIONAL
- if(BLF_translate_iface()) {
- if(prop->translation_context)
+ if (BLF_translate_iface()) {
+ if (prop->translation_context)
name = BLF_pgettext(prop->translation_context, name);
else
name = BLF_gettext(name);
@@ -510,7 +510,7 @@ StructRNA *RNA_struct_find(const char *identifier)
StructRNA *type;
if (identifier) {
for (type = BLENDER_RNA.structs.first; type; type = type->cont.next)
- if (strcmp(type->identifier, identifier)==0)
+ if (strcmp(type->identifier, identifier) == 0)
return type;
}
return NULL;
@@ -528,7 +528,7 @@ const char *RNA_struct_ui_name(StructRNA *type)
int RNA_struct_ui_icon(StructRNA *type)
{
- if(type)
+ if (type)
return type->icon;
else
return ICON_DOT;
@@ -572,11 +572,11 @@ int RNA_struct_idprops_register_check(StructRNA *type)
/* remove an id-property */
int RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
{
- IDProperty *group= RNA_struct_idprops(ptr, 0);
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
- if(group) {
- IDProperty *idp= IDP_GetPropertyFromGroup(group, identifier);
- if(idp) {
+ if (group) {
+ IDProperty *idp = IDP_GetPropertyFromGroup(group, identifier);
+ if (idp) {
IDP_RemFromGroup(group, idp);
IDP_FreeProperty(idp);
MEM_freeN(idp);
@@ -591,12 +591,12 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna)
{
StructRNA *base;
- if(!type)
+ if (!type)
return 0;
/* ptr->type is always maximally refined */
- for(base=type; base; base=base->base)
- if(base == srna)
+ for (base = type; base; base = base->base)
+ if (base == srna)
return 1;
return 0;
@@ -604,19 +604,19 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna)
PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
{
- if(identifier[0]=='[' && identifier[1]=='"') { // " (dummy comment to avoid confusing some function lists in text editors)
+ if (identifier[0] =='[' && identifier[1] =='"') { /* " (dummy comment to avoid confusing some function lists in text editors) */
/* id prop lookup, not so common */
- PropertyRNA *r_prop= NULL;
+ PropertyRNA *r_prop = NULL;
PointerRNA r_ptr; /* only support single level props */
- if(RNA_path_resolve(ptr, identifier, &r_ptr, &r_prop) && r_ptr.type==ptr->type && r_ptr.data==ptr->data)
+ if (RNA_path_resolve(ptr, identifier, &r_ptr, &r_prop) && r_ptr.type == ptr->type && r_ptr.data == ptr->data)
return r_prop;
}
else {
/* most common case */
- PropertyRNA *iterprop= RNA_struct_iterator_property(ptr->type);
+ PropertyRNA *iterprop = RNA_struct_iterator_property(ptr->type);
PointerRNA propptr;
- if(RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr))
+ if (RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr))
return propptr.data;
}
@@ -626,12 +626,12 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
/* Find the property which uses the given nested struct */
PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna)
{
- PropertyRNA *prop= NULL;
+ PropertyRNA *prop = NULL;
RNA_STRUCT_BEGIN(ptr, iprop) {
/* This assumes that there can only be one user of this nested struct */
if (RNA_property_pointer_type(ptr, iprop) == srna) {
- prop= iprop;
+ prop = iprop;
break;
}
}
@@ -646,14 +646,14 @@ int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test)
/* validate the RNA is ok */
PropertyRNA *iterprop;
- int found= FALSE;
+ int found = FALSE;
- iterprop= RNA_struct_iterator_property(ptr->type);
+ iterprop = RNA_struct_iterator_property(ptr->type);
RNA_PROP_BEGIN(ptr, itemptr, iterprop) {
/* PropertyRNA *prop= itemptr.data; */
- if(prop_test == (PropertyRNA *)itemptr.data) {
- found= TRUE;
+ if (prop_test == (PropertyRNA *)itemptr.data) {
+ found = TRUE;
break;
}
}
@@ -678,9 +678,9 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
#if 1
FunctionRNA *func;
StructRNA *type;
- for(type= ptr->type; type; type= type->base) {
- func= (FunctionRNA *)BLI_findstring_ptr(&type->functions, identifier, offsetof(FunctionRNA, identifier));
- if(func) {
+ for (type = ptr->type; type; type = type->base) {
+ func = (FunctionRNA *)BLI_findstring_ptr(&type->functions, identifier, offsetof(FunctionRNA, identifier));
+ if (func) {
return func;
}
}
@@ -693,13 +693,13 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
FunctionRNA *func;
RNA_pointer_create(NULL, &RNA_Struct, ptr->type, &tptr);
- iterprop= RNA_struct_find_property(&tptr, "functions");
+ iterprop = RNA_struct_find_property(&tptr, "functions");
- func= NULL;
+ func = NULL;
RNA_PROP_BEGIN(&tptr, funcptr, iterprop) {
- if(strcmp(identifier, RNA_function_identifier(funcptr.data)) == 0) {
- func= funcptr.data;
+ if (strcmp(identifier, RNA_function_identifier(funcptr.data)) == 0) {
+ func = funcptr.data;
break;
}
}
@@ -722,21 +722,21 @@ StructRegisterFunc RNA_struct_register(StructRNA *type)
StructUnregisterFunc RNA_struct_unregister(StructRNA *type)
{
do {
- if(type->unreg)
+ if (type->unreg)
return type->unreg;
- } while((type=type->base));
+ } while ((type = type->base));
return NULL;
}
void **RNA_struct_instance(PointerRNA *ptr)
{
- StructRNA *type= ptr->type;
+ StructRNA *type = ptr->type;
do {
- if(type->instance)
+ if (type->instance)
return type->instance(ptr);
- } while((type=type->base));
+ } while ((type = type->base));
return NULL;
}
@@ -748,7 +748,7 @@ void *RNA_struct_py_type_get(StructRNA *srna)
void RNA_struct_py_type_set(StructRNA *srna, void *py_type)
{
- srna->py_type= py_type;
+ srna->py_type = py_type;
}
void *RNA_struct_blender_type_get(StructRNA *srna)
@@ -758,14 +758,14 @@ void *RNA_struct_blender_type_get(StructRNA *srna)
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
{
- srna->blender_type= blender_type;
+ srna->blender_type = blender_type;
}
char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
{
PropertyRNA *nameprop;
- if(ptr->data && (nameprop = RNA_struct_name_property(ptr->type)))
+ if (ptr->data && (nameprop = RNA_struct_name_property(ptr->type)))
return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen, r_len);
return NULL;
@@ -821,9 +821,9 @@ int RNA_property_array_check(PropertyRNA *prop)
/* used by BPY to make an array from the python object */
int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[])
{
- PropertyRNA *rprop= rna_ensure_property(prop);
+ PropertyRNA *rprop = rna_ensure_property(prop);
- if(length)
+ if (length)
rna_ensure_property_multi_array_length(ptr, prop, length);
return rprop->arraydimension;
@@ -841,16 +841,16 @@ int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dim)
char RNA_property_array_item_char(PropertyRNA *prop, int index)
{
- const char *vectoritem= "XYZW";
- const char *quatitem= "WXYZ";
- const char *coloritem= "RGBA";
- PropertySubType subtype= rna_ensure_property(prop)->subtype;
+ const char *vectoritem = "XYZW";
+ const char *quatitem = "WXYZ";
+ const char *coloritem = "RGBA";
+ PropertySubType subtype = rna_ensure_property(prop)->subtype;
/* get string to use for array index */
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
return quatitem[index];
}
- else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
+ else if ((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
{
return vectoritem[index];
@@ -864,7 +864,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
int RNA_property_array_item_index(PropertyRNA *prop, char name)
{
- PropertySubType subtype= rna_ensure_property(prop)->subtype;
+ PropertySubType subtype = rna_ensure_property(prop)->subtype;
/* get index based on string name/alias */
/* maybe a function to find char index in string would be better than all the switches */
@@ -880,7 +880,7 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
return 3;
}
}
- else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
+ else if (ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
{
switch (name) {
@@ -913,142 +913,142 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)rna_ensure_property(prop);
+ IntPropertyRNA *iprop = (IntPropertyRNA*)rna_ensure_property(prop);
- if(prop->magic != RNA_MAGIC) {
+ if (prop->magic != RNA_MAGIC) {
/* attempt to get the local ID values */
- IDProperty *idp_ui= rna_idproperty_ui(prop);
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if(idp_ui) {
+ if (idp_ui) {
IDProperty *item;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT);
- *hardmin= item ? IDP_Int(item) : INT_MIN;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT);
+ *hardmin = item ? IDP_Int(item) : INT_MIN;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT);
- *hardmax= item ? IDP_Int(item) : INT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT);
+ *hardmax = item ? IDP_Int(item) : INT_MAX;
return;
}
}
- if(iprop->range) {
+ if (iprop->range) {
iprop->range(ptr, hardmin, hardmax);
}
else {
- *hardmin= iprop->hardmin;
- *hardmax= iprop->hardmax;
+ *hardmin = iprop->hardmin;
+ *hardmax = iprop->hardmax;
}
}
void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)rna_ensure_property(prop);
+ IntPropertyRNA *iprop = (IntPropertyRNA*)rna_ensure_property(prop);
int hardmin, hardmax;
- if(prop->magic != RNA_MAGIC) {
+ if (prop->magic != RNA_MAGIC) {
/* attempt to get the local ID values */
- IDProperty *idp_ui= rna_idproperty_ui(prop);
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if(idp_ui) {
+ if (idp_ui) {
IDProperty *item;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT);
- *softmin= item ? IDP_Int(item) : INT_MIN;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT);
+ *softmin = item ? IDP_Int(item) : INT_MIN;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT);
- *softmax= item ? IDP_Int(item) : INT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT);
+ *softmax = item ? IDP_Int(item) : INT_MAX;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT);
- *step= item ? IDP_Int(item) : 1;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT);
+ *step = item ? IDP_Int(item) : 1;
return;
}
}
- if(iprop->range) {
+ if (iprop->range) {
iprop->range(ptr, &hardmin, &hardmax);
- *softmin= MAX2(iprop->softmin, hardmin);
- *softmax= MIN2(iprop->softmax, hardmax);
+ *softmin = MAX2(iprop->softmin, hardmin);
+ *softmax = MIN2(iprop->softmax, hardmax);
}
else {
- *softmin= iprop->softmin;
- *softmax= iprop->softmax;
+ *softmin = iprop->softmin;
+ *softmax = iprop->softmax;
}
- *step= iprop->step;
+ *step = iprop->step;
}
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)rna_ensure_property(prop);
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)rna_ensure_property(prop);
- if(prop->magic != RNA_MAGIC) {
+ if (prop->magic != RNA_MAGIC) {
/* attempt to get the local ID values */
- IDProperty *idp_ui= rna_idproperty_ui(prop);
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if(idp_ui) {
+ if (idp_ui) {
IDProperty *item;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
- *hardmin= item ? (float)IDP_Double(item) : FLT_MIN;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
+ *hardmin = item ? (float)IDP_Double(item) : FLT_MIN;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
- *hardmax= item ? (float)IDP_Double(item) : FLT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
+ *hardmax = item ? (float)IDP_Double(item) : FLT_MAX;
return;
}
}
- if(fprop->range) {
+ if (fprop->range) {
fprop->range(ptr, hardmin, hardmax);
}
else {
- *hardmin= fprop->hardmin;
- *hardmax= fprop->hardmax;
+ *hardmin = fprop->hardmin;
+ *hardmax = fprop->hardmax;
}
}
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)rna_ensure_property(prop);
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)rna_ensure_property(prop);
float hardmin, hardmax;
- if(prop->magic != RNA_MAGIC) {
+ if (prop->magic != RNA_MAGIC) {
/* attempt to get the local ID values */
- IDProperty *idp_ui= rna_idproperty_ui(prop);
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if(idp_ui) {
+ if (idp_ui) {
IDProperty *item;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE);
- *softmin= item ? (float)IDP_Double(item) : FLT_MIN;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE);
+ *softmin = item ? (float)IDP_Double(item) : FLT_MIN;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE);
- *softmax= item ? (float)IDP_Double(item) : FLT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE);
+ *softmax = item ? (float)IDP_Double(item) : FLT_MAX;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE);
- *step= item ? (float)IDP_Double(item) : 1.0f;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE);
+ *step = item ? (float)IDP_Double(item) : 1.0f;
- item= IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE);
- *precision= item ? (float)IDP_Double(item) : 3.0f;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE);
+ *precision = item ? (float)IDP_Double(item) : 3.0f;
return;
}
}
- if(fprop->range) {
+ if (fprop->range) {
fprop->range(ptr, &hardmin, &hardmax);
- *softmin= MAX2(fprop->softmin, hardmin);
- *softmax= MIN2(fprop->softmax, hardmax);
+ *softmin = MAX2(fprop->softmin, hardmin);
+ *softmax = MIN2(fprop->softmax, hardmax);
}
else {
- *softmin= fprop->softmin;
- *softmax= fprop->softmax;
+ *softmin = fprop->softmin;
+ *softmax = fprop->softmax;
}
- *step= fprop->step;
- *precision= (float)fprop->precision;
+ *step = fprop->step;
+ *precision = (float)fprop->precision;
}
int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
@@ -1057,12 +1057,12 @@ int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
RNA_property_float_range(ptr, prop, &min, &max);
- if(*value < min) {
- *value= min;
+ if (*value < min) {
+ *value = min;
return -1;
}
- else if(*value > max) {
- *value= max;
+ else if (*value > max) {
+ *value = max;
return 1;
}
else {
@@ -1076,12 +1076,12 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
RNA_property_int_range(ptr, prop, &min, &max);
- if(*value < min) {
- *value= min;
+ if (*value < min) {
+ *value = min;
return -1;
}
- else if(*value > max) {
- *value= max;
+ else if (*value > max) {
+ *value = max;
return 1;
}
else {
@@ -1093,26 +1093,26 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
* '0' used when their is no maximum */
int RNA_property_string_maxlength(PropertyRNA *prop)
{
- StringPropertyRNA *sprop= (StringPropertyRNA*)rna_ensure_property(prop);
+ StringPropertyRNA *sprop = (StringPropertyRNA*)rna_ensure_property(prop);
return sprop->maxlength;
}
StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
{
- prop= rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- if(prop->type == PROP_POINTER) {
- PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+ if (prop->type == PROP_POINTER) {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
- if(pprop->typef)
+ if (pprop->typef)
return pprop->typef(ptr);
- else if(pprop->type)
+ else if (pprop->type)
return pprop->type;
}
- else if(prop->type == PROP_COLLECTION) {
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+ else if (prop->type == PROP_COLLECTION) {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
- if(cprop->item_type)
+ if (cprop->item_type)
return cprop->item_type;
}
/* ignore other types, RNA_struct_find_nested calls with unchecked props */
@@ -1122,11 +1122,11 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value)
{
- prop= rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- if(prop->type == PROP_POINTER) {
- PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
- if(pprop->poll)
+ if (prop->type == PROP_POINTER) {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
+ if (pprop->poll)
return pprop->poll(ptr, *value);
return 1;
@@ -1149,31 +1149,31 @@ EnumPropertyItem DummyRNA_DEFAULT_items[] = {
void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free)
{
- EnumPropertyRNA *eprop= (EnumPropertyRNA*)rna_ensure_property(prop);
+ EnumPropertyRNA *eprop = (EnumPropertyRNA*)rna_ensure_property(prop);
- *free= 0;
+ *free = 0;
- if(eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
- int tot= 0;
+ if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
+ int tot = 0;
if (prop->flag & PROP_ENUM_NO_CONTEXT)
- *item= eprop->itemf(NULL, ptr, prop, free);
+ *item = eprop->itemf(NULL, ptr, prop, free);
else
- *item= eprop->itemf(C, ptr, prop, free);
+ *item = eprop->itemf(C, ptr, prop, free);
- if(totitem) {
- if(*item) {
- for( ; (*item)[tot].identifier; tot++);
+ if (totitem) {
+ if (*item) {
+ for ( ; (*item)[tot].identifier; tot++);
}
- *totitem= tot;
+ *totitem = tot;
}
}
else {
- *item= eprop->item;
- if(totitem)
- *totitem= eprop->totitem;
+ *item = eprop->item;
+ if (totitem)
+ *totitem = eprop->totitem;
}
}
@@ -1182,67 +1182,67 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
RNA_property_enum_items(C, ptr, prop, item, totitem, free);
#ifdef WITH_INTERNATIONAL
- if(BLF_translate_iface()) {
+ if (BLF_translate_iface()) {
int i;
EnumPropertyItem *nitem;
- if(*free) {
- nitem= *item;
+ if (*free) {
+ nitem = *item;
} else {
- int totitem= 0;
+ int totitem = 0;
/* count */
- for(i=0; (*item)[i].identifier; i++)
+ for (i = 0; (*item)[i].identifier; i++)
totitem++;
- nitem= MEM_callocN(sizeof(EnumPropertyItem)*(totitem+1), "enum_items_gettexted");
+ nitem = MEM_callocN(sizeof(EnumPropertyItem)*(totitem+1), "enum_items_gettexted");
- for(i=0; (*item)[i].identifier; i++)
- nitem[i]= (*item)[i];
+ for (i = 0; (*item)[i].identifier; i++)
+ nitem[i] = (*item)[i];
- *free= 1;
+ *free = 1;
}
- for(i=0; nitem[i].identifier; i++) {
- if( nitem[i].name ) {
- if(prop->translation_context)
+ for (i = 0; nitem[i].identifier; i++) {
+ if ( nitem[i].name ) {
+ if (prop->translation_context)
nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name);
else
nitem[i].name = BLF_gettext(nitem[i].name);
}
- if( nitem[i].description )
+ if ( nitem[i].description )
nitem[i].description = BLF_gettext(nitem[i].description);
}
- *item= nitem;
+ *item = nitem;
}
#endif
}
int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value)
-{
+{
EnumPropertyItem *item, *item_array;
int free, found;
RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free);
- if(item_array) {
- for(item= item_array; item->identifier; item++) {
- if(item->identifier[0] && strcmp(item->identifier, identifier)==0) {
+ if (item_array) {
+ for (item = item_array; item->identifier; item++) {
+ if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
*value = item->value;
break;
}
}
- found= (item->identifier != NULL); /* could be alloc'd, assign before free */
+ found = (item->identifier != NULL); /* could be alloc'd, assign before free */
- if(free) {
+ if (free) {
MEM_freeN(item_array);
}
}
else {
- found= 0;
+ found = 0;
}
return found;
}
@@ -1250,7 +1250,7 @@ int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, con
int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier)
{
for (; item->identifier; item++) {
- if(item->identifier[0] && item->value==value) {
+ if (item->identifier[0] && item->value == value) {
*identifier = item->identifier;
return 1;
}
@@ -1260,20 +1260,20 @@ int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **id
int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **identifier)
{
- int index= 0;
+ int index = 0;
for (; item->identifier; item++) {
- if(item->identifier[0] && item->value & value) {
+ if (item->identifier[0] && item->value & value) {
identifier[index++] = item->identifier;
}
}
- identifier[index]= NULL;
+ identifier[index] = NULL;
return index;
}
int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name)
{
for (; item->identifier; item++) {
- if(item->identifier[0] && item->value==value) {
+ if (item->identifier[0] && item->value == value) {
*name = item->name;
return 1;
}
@@ -1284,7 +1284,7 @@ int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name)
int RNA_enum_description(EnumPropertyItem *item, const int value, const char **description)
{
for (; item->identifier; item++) {
- if(item->identifier[0] && item->value==value) {
+ if (item->identifier[0] && item->value == value) {
*description = item->description;
return 1;
}
@@ -1293,14 +1293,14 @@ int RNA_enum_description(EnumPropertyItem *item, const int value, const char **d
}
int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
-{
- EnumPropertyItem *item= NULL;
+{
+ EnumPropertyItem *item = NULL;
int result, free;
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if(item) {
- result= RNA_enum_identifier(item, value, identifier);
- if(free)
+ if (item) {
+ result = RNA_enum_identifier(item, value, identifier);
+ if (free)
MEM_freeN(item);
return result;
@@ -1309,14 +1309,14 @@ int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop
}
int RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
-{
- EnumPropertyItem *item= NULL;
+{
+ EnumPropertyItem *item = NULL;
int result, free;
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if(item) {
- result= RNA_enum_name(item, value, name);
- if(free)
+ if (item) {
+ result = RNA_enum_name(item, value, name);
+ if (free)
MEM_freeN(item);
return result;
@@ -1326,13 +1326,13 @@ int RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, cons
int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
{
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
int result, free;
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if(item) {
- result= RNA_enum_bitflag_identifiers(item, value, identifier);
- if(free)
+ if (item) {
+ result = RNA_enum_bitflag_identifiers(item, value, identifier);
+ if (free)
MEM_freeN(item);
return result;
@@ -1357,11 +1357,11 @@ int RNA_property_ui_icon(PropertyRNA *prop)
int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
{
- ID *id= ptr->id.data;
+ ID *id = ptr->id.data;
int flag;
- prop= rna_ensure_property(prop);
- flag= prop->editable ? prop->editable(ptr) : prop->flag;
+ prop = rna_ensure_property(prop);
+ flag = prop->editable ? prop->editable(ptr) : prop->flag;
return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION));
}
@@ -1369,8 +1369,8 @@ int RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop)
{
int flag;
- prop= rna_ensure_property(prop);
- flag= prop->editable ? prop->editable(ptr) : prop->flag;
+ prop = rna_ensure_property(prop);
+ flag = prop->editable ? prop->editable(ptr) : prop->flag;
return (flag & PROP_EDITABLE);
}
@@ -1380,17 +1380,17 @@ int RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index)
ID *id;
int flag;
- prop= rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- flag= prop->flag;
+ flag = prop->flag;
- if(prop->editable)
+ if (prop->editable)
flag &= prop->editable(ptr);
if (prop->itemeditable)
flag &= prop->itemeditable(ptr, index);
- id= ptr->id.data;
+ id = ptr->id.data;
return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION));
}
@@ -1401,9 +1401,9 @@ int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop)
if (!id_type_can_have_animdata(ptr->id.data))
return 0;
- prop= rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- if(!(prop->flag & PROP_ANIMATABLE))
+ if (!(prop->flag & PROP_ANIMATABLE))
return 0;
return (prop->flag & PROP_EDITABLE);
@@ -1421,17 +1421,17 @@ int RNA_property_animated(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
* its slow so dont call in a loop */
int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
{
- char *path= RNA_path_from_ID_to_property(ptr, prop);
- int ret= 0;
+ char *path = RNA_path_from_ID_to_property(ptr, prop);
+ int ret = 0;
- if(path) {
+ if (path) {
PointerRNA id_ptr;
PointerRNA r_ptr;
PropertyRNA *r_prop;
RNA_id_pointer_create(ptr->id.data, &id_ptr);
RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop);
- ret= (prop == r_prop);
+ ret = (prop == r_prop);
MEM_freeN(path);
}
@@ -1442,15 +1442,15 @@ int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
{
int is_rna = (prop->magic == RNA_MAGIC);
- prop= rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- if(is_rna) {
- if(prop->update) {
+ if (is_rna) {
+ if (prop->update) {
/* ideally no context would be needed for update, but there's some
parts of the code that need it still, so we have this exception */
- if(prop->flag & PROP_CONTEXT_UPDATE) {
- if(C) {
- if(prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) {
+ if (prop->flag & PROP_CONTEXT_UPDATE) {
+ if (C) {
+ if (prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) {
((ContextPropUpdateFunc)prop->update)(C, ptr, prop);
}
else {
@@ -1461,11 +1461,11 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR
else
prop->update(bmain, scene, ptr);
}
- if(prop->noteflag)
+ if (prop->noteflag)
WM_main_add_notifier(prop->noteflag, ptr->id.data);
}
- if(!is_rna || (prop->flag & PROP_IDPROPERTY)) {
+ if (!is_rna || (prop->flag & PROP_IDPROPERTY)) {
/* WARNING! This is so property drivers update the display!
* not especially nice */
DAG_id_tag_update(ptr->id.data, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
@@ -1530,7 +1530,7 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
if (ELEM(NULL, ptr, prop))
return;
- prop= rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
/* we can only handle update calls with no context args for now (makes animsys updates easier) */
if ((is_rna == 0) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE))
@@ -1568,7 +1568,7 @@ void RNA_property_update_cache_flush(Main *bmain, Scene *scene)
{
tRnaUpdateCacheElem *uce;
- // TODO: should we check that bmain and scene are valid? The above stuff doesn't!
+ /* TODO: should we check that bmain and scene are valid? The above stuff doesn't! */
/* execute the cached updates */
for (uce = rna_updates_cache.first; uce; uce = uce->next) {
@@ -1602,15 +1602,15 @@ void RNA_property_update_cache_free(void)
int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
{
- BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) == 0);
- if((idprop=rna_idproperty_check(&prop, ptr)))
+ if ((idprop = rna_idproperty_check(&prop, ptr)))
return IDP_Int(idprop);
- else if(bprop->get)
+ else if (bprop->get)
return bprop->get(ptr);
else
return bprop->defaultvalue;
@@ -1618,52 +1618,52 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
{
- BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) == 0);
/* just incase other values are passed */
- if(value) value= 1;
+ if (value) value = 1;
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- IDP_Int(idprop)= value;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_Int(idprop) = value;
rna_idproperty_touch(idprop);
}
- else if(bprop->set)
+ else if (bprop->set)
bprop->set(ptr, value);
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.i= value;
+ val.i = value;
- group= RNA_struct_idprops(ptr, 1);
- if(group)
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
}
}
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
{
- BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) != 0);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(prop->arraydimension == 0)
- values[0]= RNA_property_boolean_get(ptr, prop);
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0)
+ values[0] = RNA_property_boolean_get(ptr, prop);
else
memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len);
}
- else if(prop->arraydimension == 0)
- values[0]= RNA_property_boolean_get(ptr, prop);
- else if(bprop->getarray)
+ else if (prop->arraydimension == 0)
+ values[0] = RNA_property_boolean_get(ptr, prop);
+ else if (bprop->getarray)
bprop->getarray(ptr, values);
- else if(bprop->defaultarray)
+ else if (bprop->defaultarray)
memcpy(values, bprop->defaultarray, sizeof(int)*prop->totarraylength);
else
memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -1672,21 +1672,21 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val
int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
int tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_boolean_get_array(ptr, prop, tmp);
return tmp[index];
}
else {
int *tmparray, value;
- tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
+ tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
RNA_property_boolean_get_array(ptr, prop, tmparray);
- value= tmparray[index];
+ value = tmparray[index];
MEM_freeN(tmparray);
return value;
@@ -1695,34 +1695,34 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
{
- BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) != 0);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(prop->arraydimension == 0)
- IDP_Int(idprop)= values[0];
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0)
+ IDP_Int(idprop) = values[0];
else
memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
rna_idproperty_touch(idprop);
}
- else if(prop->arraydimension == 0)
+ else if (prop->arraydimension == 0)
RNA_property_boolean_set(ptr, prop, values[0]);
- else if(bprop->setarray)
+ else if (bprop->setarray)
bprop->setarray(ptr, values);
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.array.len= prop->totarraylength;
- val.array.type= IDP_INT;
+ val.array.len = prop->totarraylength;
+ val.array.type = IDP_INT;
- group= RNA_struct_idprops(ptr, 1);
- if(group) {
- idprop= IDP_New(IDP_ARRAY, &val, prop->identifier);
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
IDP_AddToGroup(group, idprop);
memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
}
@@ -1732,22 +1732,22 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in
void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
{
int tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_boolean_get_array(ptr, prop, tmp);
- tmp[index]= value;
+ tmp[index] = value;
RNA_property_boolean_set_array(ptr, prop, tmp);
}
else {
int *tmparray;
- tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
+ tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
RNA_property_boolean_get_array(ptr, prop, tmparray);
- tmparray[index]= value;
+ tmparray[index] = value;
RNA_property_boolean_set_array(ptr, prop, tmparray);
MEM_freeN(tmparray);
}
@@ -1755,7 +1755,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) == 0);
@@ -1765,14 +1765,14 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
{
- BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(prop->arraydimension == 0)
- values[0]= bprop->defaultvalue;
- else if(bprop->defaultarray)
+ if (prop->arraydimension == 0)
+ values[0] = bprop->defaultvalue;
+ else if (bprop->defaultarray)
memcpy(values, bprop->defaultarray, sizeof(int)*prop->totarraylength);
else
memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -1781,21 +1781,21 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA
int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
int tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_boolean_get_default_array(ptr, prop, tmp);
return tmp[index];
}
else {
int *tmparray, value;
- tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_default_index");
+ tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_default_index");
RNA_property_boolean_get_default_array(ptr, prop, tmparray);
- value= tmparray[index];
+ value = tmparray[index];
MEM_freeN(tmparray);
return value;
@@ -1804,15 +1804,15 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+ IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_INT);
BLI_assert(RNA_property_array_check(prop) == 0);
- if((idprop=rna_idproperty_check(&prop, ptr)))
+ if ((idprop = rna_idproperty_check(&prop, ptr)))
return IDP_Int(idprop);
- else if(iprop->get)
+ else if (iprop->get)
return iprop->get(ptr);
else
return iprop->defaultvalue;
@@ -1820,7 +1820,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+ IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_INT);
@@ -1828,43 +1828,43 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
/* useful to check on bad values but set function should clamp */
/* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- IDP_Int(idprop)= value;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_Int(idprop) = value;
rna_idproperty_touch(idprop);
}
- else if(iprop->set)
+ else if (iprop->set)
iprop->set(ptr, value);
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.i= value;
+ val.i = value;
- group= RNA_struct_idprops(ptr, 1);
- if(group)
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
}
}
void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+ IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_INT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(prop->arraydimension == 0)
- values[0]= RNA_property_int_get(ptr, prop);
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0)
+ values[0] = RNA_property_int_get(ptr, prop);
else
memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len);
}
- else if(prop->arraydimension == 0)
- values[0]= RNA_property_int_get(ptr, prop);
- else if(iprop->getarray)
+ else if (prop->arraydimension == 0)
+ values[0] = RNA_property_int_get(ptr, prop);
+ else if (iprop->getarray)
iprop->getarray(ptr, values);
- else if(iprop->defaultarray)
+ else if (iprop->defaultarray)
memcpy(values, iprop->defaultarray, sizeof(int)*prop->totarraylength);
else
memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -1872,36 +1872,36 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int values[2])
{
- const int array_len= RNA_property_array_length(ptr, prop);
+ const int array_len = RNA_property_array_length(ptr, prop);
- if(array_len <= 0) {
- values[0]= 0;
- values[1]= 0;
+ if (array_len <= 0) {
+ values[0] = 0;
+ values[1] = 0;
}
else if (array_len == 1) {
RNA_property_int_get_array(ptr, prop, values);
- values[1]= values[0];
+ values[1] = values[0];
}
else {
int arr_stack[32];
int *arr;
int i;
- if(array_len > 32) {
- arr= MEM_mallocN(sizeof(int) * array_len, "RNA_property_int_get_array_range");
+ if (array_len > 32) {
+ arr = MEM_mallocN(sizeof(int) * array_len, "RNA_property_int_get_array_range");
}
else {
- arr= arr_stack;
+ arr = arr_stack;
}
RNA_property_int_get_array(ptr, prop, arr);
- values[0]= values[1]= arr[0];
- for(i= 1; i < array_len; i++) {
- values[0]= MIN2(values[0], arr[i]);
- values[1]= MAX2(values[1], arr[i]);
+ values[0] = values[1] = arr[0];
+ for (i = 1; i < array_len; i++) {
+ values[0] = MIN2(values[0], arr[i]);
+ values[1] = MAX2(values[1], arr[i]);
}
- if(arr != arr_stack) {
+ if (arr != arr_stack) {
MEM_freeN(arr);
}
}
@@ -1910,21 +1910,21 @@ void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int va
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
int tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_INT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_int_get_array(ptr, prop, tmp);
return tmp[index];
}
else {
int *tmparray, value;
- tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
+ tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
RNA_property_int_get_array(ptr, prop, tmparray);
- value= tmparray[index];
+ value = tmparray[index];
MEM_freeN(tmparray);
return value;
@@ -1933,34 +1933,34 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+ IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_INT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(prop->arraydimension == 0)
- IDP_Int(idprop)= values[0];
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0)
+ IDP_Int(idprop) = values[0];
else
memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
rna_idproperty_touch(idprop);
}
- else if(prop->arraydimension == 0)
+ else if (prop->arraydimension == 0)
RNA_property_int_set(ptr, prop, values[0]);
- else if(iprop->setarray)
+ else if (iprop->setarray)
iprop->setarray(ptr, values);
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.array.len= prop->totarraylength;
- val.array.type= IDP_INT;
+ val.array.len = prop->totarraylength;
+ val.array.type = IDP_INT;
- group= RNA_struct_idprops(ptr, 1);
- if(group) {
- idprop= IDP_New(IDP_ARRAY, &val, prop->identifier);
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
IDP_AddToGroup(group, idprop);
memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
}
@@ -1970,22 +1970,22 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v
void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
{
int tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_INT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_int_get_array(ptr, prop, tmp);
- tmp[index]= value;
+ tmp[index] = value;
RNA_property_int_set_array(ptr, prop, tmp);
}
else {
int *tmparray;
- tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
+ tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
RNA_property_int_get_array(ptr, prop, tmparray);
- tmparray[index]= value;
+ tmparray[index] = value;
RNA_property_int_set_array(ptr, prop, tmparray);
MEM_freeN(tmparray);
}
@@ -1993,20 +1993,20 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i
int RNA_property_int_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+ IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
return iprop->defaultvalue;
}
void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
{
- IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+ IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_INT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(prop->arraydimension == 0)
- values[0]= iprop->defaultvalue;
- else if(iprop->defaultarray)
+ if (prop->arraydimension == 0)
+ values[0] = iprop->defaultvalue;
+ else if (iprop->defaultarray)
memcpy(values, iprop->defaultarray, sizeof(int)*prop->totarraylength);
else
memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -2015,18 +2015,18 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr
int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
int tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_int_get_default_array(ptr, prop, tmp);
return tmp[index];
}
else {
int *tmparray, value;
- tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_int_get_default_index");
+ tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_int_get_default_index");
RNA_property_int_get_default_array(ptr, prop, tmparray);
- value= tmparray[index];
+ value = tmparray[index];
MEM_freeN(tmparray);
return value;
@@ -2035,19 +2035,19 @@ int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int i
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) == 0);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(idprop->type == IDP_FLOAT)
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (idprop->type == IDP_FLOAT)
return IDP_Float(idprop);
else
return (float)IDP_Double(idprop);
}
- else if(fprop->get)
+ else if (fprop->get)
return fprop->get(ptr);
else
return fprop->defaultvalue;
@@ -2055,7 +2055,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
@@ -2063,54 +2063,54 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
/* useful to check on bad values but set function should clamp */
/* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(idprop->type == IDP_FLOAT)
- IDP_Float(idprop)= value;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (idprop->type == IDP_FLOAT)
+ IDP_Float(idprop) = value;
else
- IDP_Double(idprop)= value;
+ IDP_Double(idprop) = value;
rna_idproperty_touch(idprop);
}
- else if(fprop->set) {
+ else if (fprop->set) {
fprop->set(ptr, value);
}
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.f= value;
+ val.f = value;
- group= RNA_struct_idprops(ptr, 1);
- if(group)
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
IDP_AddToGroup(group, IDP_New(IDP_FLOAT, &val, prop->identifier));
}
}
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
IDProperty *idprop;
int i;
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(prop->arraydimension == 0)
- values[0]= RNA_property_float_get(ptr, prop);
- else if(idprop->subtype == IDP_FLOAT) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0)
+ values[0] = RNA_property_float_get(ptr, prop);
+ else if (idprop->subtype == IDP_FLOAT) {
memcpy(values, IDP_Array(idprop), sizeof(float)*idprop->len);
}
else {
- for(i=0; i<idprop->len; i++)
- values[i]= (float)(((double*)IDP_Array(idprop))[i]);
+ for (i = 0; i<idprop->len; i++)
+ values[i] = (float)(((double*)IDP_Array(idprop))[i]);
}
}
- else if(prop->arraydimension == 0)
- values[0]= RNA_property_float_get(ptr, prop);
- else if(fprop->getarray)
+ else if (prop->arraydimension == 0)
+ values[0] = RNA_property_float_get(ptr, prop);
+ else if (fprop->getarray)
fprop->getarray(ptr, values);
- else if(fprop->defaultarray)
+ else if (fprop->defaultarray)
memcpy(values, fprop->defaultarray, sizeof(float)*prop->totarraylength);
else
memset(values, 0, sizeof(float)*prop->totarraylength);
@@ -2118,36 +2118,36 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val
void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, float values[2])
{
- const int array_len= RNA_property_array_length(ptr, prop);
+ const int array_len = RNA_property_array_length(ptr, prop);
- if(array_len <= 0) {
- values[0]= 0.0f;
- values[1]= 0.0f;
+ if (array_len <= 0) {
+ values[0] = 0.0f;
+ values[1] = 0.0f;
}
else if (array_len == 1) {
RNA_property_float_get_array(ptr, prop, values);
- values[1]= values[0];
+ values[1] = values[0];
}
else {
float arr_stack[32];
float *arr;
int i;
- if(array_len > 32) {
- arr= MEM_mallocN(sizeof(float) * array_len, "RNA_property_float_get_array_range");
+ if (array_len > 32) {
+ arr = MEM_mallocN(sizeof(float) * array_len, "RNA_property_float_get_array_range");
}
else {
- arr= arr_stack;
+ arr = arr_stack;
}
RNA_property_float_get_array(ptr, prop, arr);
- values[0]= values[1]= arr[0];
- for(i= 1; i < array_len; i++) {
- values[0]= MIN2(values[0], arr[i]);
- values[1]= MAX2(values[1], arr[i]);
+ values[0] = values[1] = arr[0];
+ for (i = 1; i < array_len; i++) {
+ values[0] = MIN2(values[0], arr[i]);
+ values[1] = MAX2(values[1], arr[i]);
}
- if(arr != arr_stack) {
+ if (arr != arr_stack) {
MEM_freeN(arr);
}
}
@@ -2156,21 +2156,21 @@ void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, floa
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
float tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_float_get_array(ptr, prop, tmp);
return tmp[index];
}
else {
float *tmparray, value;
- tmparray= MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
+ tmparray = MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
RNA_property_float_get_array(ptr, prop, tmparray);
- value= tmparray[index];
+ value = tmparray[index];
MEM_freeN(tmparray);
return value;
@@ -2180,45 +2180,45 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
IDProperty *idprop;
int i;
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- if(prop->arraydimension == 0) {
- if(idprop->type == IDP_FLOAT)
- IDP_Float(idprop)= values[0];
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0) {
+ if (idprop->type == IDP_FLOAT)
+ IDP_Float(idprop) = values[0];
else
- IDP_Double(idprop)= values[0];
+ IDP_Double(idprop) = values[0];
}
- else if(idprop->subtype == IDP_FLOAT) {
+ else if (idprop->subtype == IDP_FLOAT) {
memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len);
}
else {
- for(i=0; i<idprop->len; i++)
- ((double*)IDP_Array(idprop))[i]= values[i];
+ for (i = 0; i<idprop->len; i++)
+ ((double*)IDP_Array(idprop))[i] = values[i];
}
rna_idproperty_touch(idprop);
}
- else if(prop->arraydimension == 0)
+ else if (prop->arraydimension == 0)
RNA_property_float_set(ptr, prop, values[0]);
- else if(fprop->setarray) {
+ else if (fprop->setarray) {
fprop->setarray(ptr, values);
}
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.array.len= prop->totarraylength;
- val.array.type= IDP_FLOAT;
+ val.array.len = prop->totarraylength;
+ val.array.type = IDP_FLOAT;
- group= RNA_struct_idprops(ptr, 1);
- if(group) {
- idprop= IDP_New(IDP_ARRAY, &val, prop->identifier);
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
IDP_AddToGroup(group, idprop);
memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len);
}
@@ -2228,22 +2228,22 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
{
float tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_float_get_array(ptr, prop, tmp);
- tmp[index]= value;
+ tmp[index] = value;
RNA_property_float_set_array(ptr, prop, tmp);
}
else {
float *tmparray;
- tmparray= MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
+ tmparray = MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
RNA_property_float_get_array(ptr, prop, tmparray);
- tmparray[index]= value;
+ tmparray[index] = value;
RNA_property_float_set_array(ptr, prop, tmparray);
MEM_freeN(tmparray);
}
@@ -2251,7 +2251,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index,
float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) == 0);
@@ -2261,14 +2261,14 @@ float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, float *values)
{
- FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(prop->arraydimension == 0)
- values[0]= fprop->defaultvalue;
- else if(fprop->defaultarray)
+ if (prop->arraydimension == 0)
+ values[0] = fprop->defaultvalue;
+ else if (fprop->defaultarray)
memcpy(values, fprop->defaultarray, sizeof(float)*prop->totarraylength);
else
memset(values, 0, sizeof(float)*prop->totarraylength);
@@ -2277,21 +2277,21 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *
float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
float tmp[RNA_MAX_ARRAY_LENGTH];
- int len= rna_ensure_property_array_length(ptr, prop);
+ int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
BLI_assert(RNA_property_array_check(prop) != 0);
- if(len <= RNA_MAX_ARRAY_LENGTH) {
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
RNA_property_float_get_default_array(ptr, prop, tmp);
return tmp[index];
}
else {
float *tmparray, value;
- tmparray= MEM_callocN(sizeof(float)*len, "RNA_property_float_get_default_index");
+ tmparray = MEM_callocN(sizeof(float)*len, "RNA_property_float_get_default_index");
RNA_property_float_get_default_array(ptr, prop, tmparray);
- value= tmparray[index];
+ value = tmparray[index];
MEM_freeN(tmparray);
return value;
@@ -2300,23 +2300,23 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
{
- StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+ StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_STRING);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
/* editing bytes is not 100% supported
* since they can contain NIL chars */
if (idprop->subtype == IDP_STRING_SUB_BYTE) {
memcpy(value, IDP_String(idprop), idprop->len);
- value[idprop->len]= '\0';
+ value[idprop->len] = '\0';
}
else {
memcpy(value, IDP_String(idprop), idprop->len);
}
}
- else if(sprop->get) {
+ else if (sprop->get) {
sprop->get(ptr, value);
}
else {
@@ -2332,16 +2332,16 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop,
BLI_assert(RNA_property_type(prop) == PROP_STRING);
- length= RNA_property_string_length(ptr, prop);
+ length = RNA_property_string_length(ptr, prop);
- if(length+1 < fixedlen)
- buf= fixedbuf;
+ if (length+1 < fixedlen)
+ buf = fixedbuf;
else
- buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
+ buf = MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
#ifndef NDEBUG
/* safety check to ensure the string is actually set */
- buf[length]= 255;
+ buf[length] = 255;
#endif
RNA_property_string_get(ptr, prop, buf);
@@ -2351,7 +2351,7 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop,
#endif
if (r_len) {
- *r_len= length;
+ *r_len = length;
}
return buf;
@@ -2360,12 +2360,12 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop,
/* this is the length without \0 terminator */
int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
{
- StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+ StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_STRING);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
if (idprop->subtype == IDP_STRING_SUB_BYTE) {
return idprop->len;
}
@@ -2377,7 +2377,7 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
return idprop->len - 1;
}
}
- else if(sprop->length)
+ else if (sprop->length)
return sprop->length(ptr);
else
return strlen(sprop->defaultvalue);
@@ -2385,30 +2385,30 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
{
- StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+ StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_STRING);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
/* both IDP_STRING_SUB_BYTE / IDP_STRING_SUB_UTF8 */
IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1);
rna_idproperty_touch(idprop);
}
- else if(sprop->set)
+ else if (sprop->set)
sprop->set(ptr, value); /* set function needs to clamp its self */
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDProperty *group;
- group= RNA_struct_idprops(ptr, 1);
- if(group)
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
IDP_AddToGroup(group, IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop) - 1));
}
}
void RNA_property_string_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop, char *value)
{
- StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+ StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_STRING);
@@ -2422,12 +2422,12 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop,
BLI_assert(RNA_property_type(prop) == PROP_STRING);
- length= RNA_property_string_default_length(ptr, prop);
+ length = RNA_property_string_default_length(ptr, prop);
- if(length+1 < fixedlen)
- buf= fixedbuf;
+ if (length+1 < fixedlen)
+ buf = fixedbuf;
else
- buf= MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
+ buf = MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
RNA_property_string_get_default(ptr, prop, buf);
@@ -2437,7 +2437,7 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop,
/* this is the length without \0 terminator */
int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+ StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_STRING);
@@ -2446,14 +2446,14 @@ int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *pro
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
{
- EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_ENUM);
- if((idprop=rna_idproperty_check(&prop, ptr)))
+ if ((idprop = rna_idproperty_check(&prop, ptr)))
return IDP_Int(idprop);
- else if(eprop->get)
+ else if (eprop->get)
return eprop->get(ptr);
else
return eprop->defaultvalue;
@@ -2461,33 +2461,33 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
{
- EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_ENUM);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- IDP_Int(idprop)= value;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_Int(idprop) = value;
rna_idproperty_touch(idprop);
}
- else if(eprop->set) {
+ else if (eprop->set) {
eprop->set(ptr, value);
}
- else if(prop->flag & PROP_EDITABLE) {
+ else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.i= value;
+ val.i = value;
- group= RNA_struct_idprops(ptr, 1);
- if(group)
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
}
}
int RNA_property_enum_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_ENUM);
@@ -2496,7 +2496,7 @@ int RNA_property_enum_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
void *RNA_property_enum_py_data_get(PropertyRNA *prop)
{
- EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
BLI_assert(RNA_property_type(prop) == PROP_ENUM);
@@ -2505,21 +2505,21 @@ void *RNA_property_enum_py_data_get(PropertyRNA *prop)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
{
- PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+ PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- pprop= (PointerPropertyRNA*)prop;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ pprop = (PointerPropertyRNA*)prop;
/* for groups, data is idprop itself */
return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
}
- else if(pprop->get) {
+ else if (pprop->get) {
return pprop->get(ptr);
}
- else if(prop->flag & PROP_IDPROPERTY) {
+ else if (prop->flag & PROP_IDPROPERTY) {
/* XXX temporary hack to add it automatically, reading should
never do any write ops, to ensure thread safety etc .. */
RNA_property_pointer_add(ptr, prop);
@@ -2536,14 +2536,14 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
- if((/*idprop=*/ rna_idproperty_check(&prop, ptr))) {
+ if ((/*idprop=*/ rna_idproperty_check(&prop, ptr))) {
/* not supported */
/* rna_idproperty_touch(idprop); */
}
else {
- PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+ PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
- if( pprop->set &&
+ if ( pprop->set &&
!((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
!((prop->flag & PROP_ID_SELF_CHECK) && ptr->id.data == ptr_value.id.data)
) {
@@ -2554,11 +2554,11 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr
PointerRNA RNA_property_pointer_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
{
- //PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+ /*PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; */
- // BLI_assert(RNA_property_type(prop) == PROP_POINTER);
+ /* BLI_assert(RNA_property_type(prop) == PROP_POINTER); */
- return PointerRNA_NULL; // FIXME: there has to be a way...
+ return PointerRNA_NULL; /* FIXME: there has to be a way... */
}
void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
@@ -2567,17 +2567,17 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
- if((/*idprop=*/rna_idproperty_check(&prop, ptr))) {
+ if ((/*idprop=*/rna_idproperty_check(&prop, ptr))) {
/* already exists */
}
- else if(prop->flag & PROP_IDPROPERTY) {
+ else if (prop->flag & PROP_IDPROPERTY) {
IDPropertyTemplate val = {0};
IDProperty *group;
- val.i= 0;
+ val.i = 0;
- group= RNA_struct_idprops(ptr, 1);
- if(group)
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
IDP_AddToGroup(group, IDP_New(IDP_GROUP, &val, prop->identifier));
}
else
@@ -2590,10 +2590,10 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop)
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
- group= RNA_struct_idprops(ptr, 0);
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ group = RNA_struct_idprops(ptr, 0);
- if(group) {
+ if (group) {
IDP_RemFromGroup(group, idprop);
IDP_FreeProperty(idprop);
MEM_freeN(idprop);
@@ -2605,10 +2605,10 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop)
static void rna_property_collection_get_idp(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)iter->prop;
- iter->ptr.data= rna_iterator_array_get(iter);
- iter->ptr.type= cprop->item_type;
+ iter->ptr.data = rna_iterator_array_get(iter);
+ iter->ptr.type = cprop->item_type;
rna_pointer_inherit_id(cprop->item_type, &iter->parent, &iter->ptr);
}
@@ -2620,34 +2620,34 @@ void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, Collectio
memset(iter, 0, sizeof(*iter));
- if((idprop=rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) {
- iter->parent= *ptr;
- iter->prop= prop;
+ if ((idprop = rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) {
+ iter->parent = *ptr;
+ iter->prop = prop;
- if(idprop)
+ if (idprop)
rna_iterator_array_begin(iter, IDP_IDPArray(idprop), sizeof(IDProperty), idprop->len, 0, NULL);
else
rna_iterator_array_begin(iter, NULL, sizeof(IDProperty), 0, 0, NULL);
- if(iter->valid)
+ if (iter->valid)
rna_property_collection_get_idp(iter);
- iter->idprop= 1;
+ iter->idprop = 1;
}
else {
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
cprop->begin(iter, ptr);
}
}
void RNA_property_collection_next(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
- if(iter->idprop) {
+ if (iter->idprop) {
rna_iterator_array_next(iter);
- if(iter->valid)
+ if (iter->valid)
rna_property_collection_get_idp(iter);
}
else
@@ -2656,9 +2656,9 @@ void RNA_property_collection_next(CollectionPropertyIterator *iter)
void RNA_property_collection_end(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
- if(iter->idprop)
+ if (iter->idprop)
rna_iterator_array_end(iter);
else
cprop->end(iter);
@@ -2666,23 +2666,23 @@ void RNA_property_collection_end(CollectionPropertyIterator *iter)
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
IDProperty *idprop;
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
return idprop->len;
}
- else if(cprop->length) {
+ else if (cprop->length) {
return cprop->length(ptr);
}
else {
CollectionPropertyIterator iter;
- int length= 0;
+ int length = 0;
RNA_property_collection_begin(ptr, prop, &iter);
- for(; iter.valid; RNA_property_collection_next(&iter))
+ for (; iter.valid; RNA_property_collection_next(&iter))
length++;
RNA_property_collection_end(&iter);
@@ -2693,39 +2693,39 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
{
IDProperty *idprop;
-// CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+/* CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; */
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
IDPropertyTemplate val = {0};
IDProperty *item;
- item= IDP_New(IDP_GROUP, &val, "");
+ item = IDP_New(IDP_GROUP, &val, "");
IDP_AppendArray(idprop, item);
- // IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
+ /* IDP_FreeProperty(item); *//* IDP_AppendArray does a shallow copy (memcpy), only free memory */
MEM_freeN(item);
}
- else if(prop->flag & PROP_IDPROPERTY) {
+ else if (prop->flag & PROP_IDPROPERTY) {
IDProperty *group, *item;
IDPropertyTemplate val = {0};
- group= RNA_struct_idprops(ptr, 1);
- if(group) {
- idprop= IDP_NewIDPArray(prop->identifier);
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_NewIDPArray(prop->identifier);
IDP_AddToGroup(group, idprop);
- item= IDP_New(IDP_GROUP, &val, "");
+ item = IDP_New(IDP_GROUP, &val, "");
IDP_AppendArray(idprop, item);
- // IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
+ /* IDP_FreeProperty(item); *//* IDP_AppendArray does a shallow copy (memcpy), only free memory */
MEM_freeN(item);
}
}
/* py api calls directly */
#if 0
- else if(cprop->add){
- if(!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+ else if (cprop->add){
+ if (!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
ParameterList params;
RNA_parameter_list_create(&params, ptr, cprop->add);
RNA_function_call(NULL, NULL, ptr, cprop->add, &params);
@@ -2736,12 +2736,12 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
printf("%s %s.%s: not implemented for this property.\n", __func__, ptr->type->identifier, prop->identifier);*/
#endif
- if(r_ptr) {
- if(idprop) {
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+ if (r_ptr) {
+ if (idprop) {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
- r_ptr->data= IDP_GetIndexArray(idprop, idprop->len-1);
- r_ptr->type= cprop->item_type;
+ r_ptr->data = IDP_GetIndexArray(idprop, idprop->len-1);
+ r_ptr->type = cprop->item_type;
rna_pointer_inherit_id(NULL, ptr, r_ptr);
}
else
@@ -2752,19 +2752,19 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
{
IDProperty *idprop;
-// CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+/* CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; */
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
IDProperty tmp, *array;
int len;
- len= idprop->len;
- array= IDP_IDPArray(idprop);
+ len = idprop->len;
+ array = IDP_IDPArray(idprop);
- if(key >= 0 && key < len) {
- if(key+1 < len) {
+ if (key >= 0 && key < len) {
+ if (key+1 < len) {
/* move element to be removed to the back */
memcpy(&tmp, &array[key], sizeof(IDProperty));
memmove(array+key, array+key+1, sizeof(IDProperty)*(len-(key+1)));
@@ -2776,13 +2776,13 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
return 1;
}
- else if(prop->flag & PROP_IDPROPERTY)
+ else if (prop->flag & PROP_IDPROPERTY)
return 1;
/* py api calls directly */
#if 0
- else if(cprop->remove){
- if(!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+ else if (cprop->remove){
+ if (!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
ParameterList params;
RNA_parameter_list_create(&params, ptr, cprop->remove);
RNA_function_call(NULL, NULL, ptr, cprop->remove, &params);
@@ -2803,16 +2803,16 @@ int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, in
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if((idprop=rna_idproperty_check(&prop, ptr))) {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
IDProperty tmp, *array;
int len;
- len= idprop->len;
- array= IDP_IDPArray(idprop);
+ len = idprop->len;
+ array = IDP_IDPArray(idprop);
- if(key >= 0 && key < len && pos >= 0 && pos < len && key != pos) {
+ if (key >= 0 && key < len && pos >= 0 && pos < len && key != pos) {
memcpy(&tmp, &array[key], sizeof(IDProperty));
- if(pos < key)
+ if (pos < key)
memmove(array+pos+1, array+pos, sizeof(IDProperty)*(key - pos));
else
memmove(array+key, array+key+1, sizeof(IDProperty)*(pos - key));
@@ -2821,7 +2821,7 @@ int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, in
return 1;
}
- else if(prop->flag & PROP_IDPROPERTY)
+ else if (prop->flag & PROP_IDPROPERTY)
return 1;
return 0;
@@ -2833,19 +2833,19 @@ void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop)
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if((idprop=rna_idproperty_check(&prop, ptr)))
+ if ((idprop = rna_idproperty_check(&prop, ptr)))
IDP_ResizeIDPArray(idprop, 0);
}
int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *t_ptr)
{
CollectionPropertyIterator iter;
- int index= 0;
+ int index = 0;
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
RNA_property_collection_begin(ptr, prop, &iter);
- for(index=0; iter.valid; RNA_property_collection_next(&iter), index++) {
+ for (index = 0; iter.valid; RNA_property_collection_next(&iter), index++) {
if (iter.ptr.data == t_ptr->data)
break;
}
@@ -2860,11 +2860,11 @@ int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, Poi
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(prop);
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if(cprop->lookupint) {
+ if (cprop->lookupint) {
/* we have a callback defined, use it */
return cprop->lookupint(ptr, key, r_ptr);
}
@@ -2874,15 +2874,15 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
int i;
RNA_property_collection_begin(ptr, prop, &iter);
- for(i=0; iter.valid; RNA_property_collection_next(&iter), i++) {
- if(i == key) {
- *r_ptr= iter.ptr;
+ for (i = 0; iter.valid; RNA_property_collection_next(&iter), i++) {
+ if (i == key) {
+ *r_ptr = iter.ptr;
break;
}
}
RNA_property_collection_end(&iter);
- if(!iter.valid)
+ if (!iter.valid)
memset(r_ptr, 0, sizeof(*r_ptr));
return iter.valid;
@@ -2891,11 +2891,11 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(prop);
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if(cprop->lookupstring) {
+ if (cprop->lookupstring) {
/* we have a callback defined, use it */
return cprop->lookupstring(ptr, key, r_ptr);
}
@@ -2904,32 +2904,32 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
CollectionPropertyIterator iter;
PropertyRNA *nameprop;
char name[256], *nameptr;
- int found= 0;
- int keylen= strlen(key);
+ int found = 0;
+ int keylen = strlen(key);
int namelen;
RNA_property_collection_begin(ptr, prop, &iter);
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- if(iter.ptr.data && iter.ptr.type->nameproperty) {
- nameprop= iter.ptr.type->nameproperty;
+ for (; iter.valid; RNA_property_collection_next(&iter)) {
+ if (iter.ptr.data && iter.ptr.type->nameproperty) {
+ nameprop = iter.ptr.type->nameproperty;
- nameptr= RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen);
+ nameptr = RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen);
- if((keylen == namelen) && (strcmp(nameptr, key) == 0)) {
- *r_ptr= iter.ptr;
- found= 1;
+ if ((keylen == namelen) && (strcmp(nameptr, key) == 0)) {
+ *r_ptr = iter.ptr;
+ found = 1;
}
- if((char *)&name != nameptr)
+ if ((char *)&name != nameptr)
MEM_freeN(nameptr);
- if(found)
+ if (found)
break;
}
}
RNA_property_collection_end(&iter);
- if(!iter.valid)
+ if (!iter.valid)
memset(r_ptr, 0, sizeof(*r_ptr));
return iter.valid;
@@ -2939,11 +2939,11 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
/* zero return is an assignment error */
int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(prop);
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if(cprop->assignint) {
+ if (cprop->assignint) {
/* we have a callback defined, use it */
return cprop->assignint(ptr, key, assign_ptr);
}
@@ -2955,7 +2955,7 @@ int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, Pointer
{
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- *r_ptr= *ptr;
+ *r_ptr = *ptr;
return ((r_ptr->type = rna_ensure_property(prop)->srna) ? 1:0);
}
@@ -2967,26 +2967,26 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if(!(prop->flag & PROP_RAW_ARRAY) || !(itemprop->flag & PROP_RAW_ACCESS))
+ if (!(prop->flag & PROP_RAW_ARRAY) || !(itemprop->flag & PROP_RAW_ACCESS))
return 0;
RNA_property_collection_begin(ptr, prop, &iter);
- if(iter.valid) {
+ if (iter.valid) {
/* get data from array iterator and item property */
- internal= iter.internal;
- arrayp= (iter.valid)? iter.ptr.data: NULL;
+ internal = iter.internal;
+ arrayp = (iter.valid)? iter.ptr.data: NULL;
- if(internal->skip || !RNA_property_editable(&iter.ptr, itemprop)) {
+ if (internal->skip || !RNA_property_editable(&iter.ptr, itemprop)) {
/* we might skip some items, so it's not a proper array */
RNA_property_collection_end(&iter);
return 0;
}
- array->array= arrayp + itemprop->rawoffset;
- array->stride= internal->itemsize;
- array->len= ((char*)internal->endptr - arrayp)/internal->itemsize;
- array->type= itemprop->rawtype;
+ array->array = arrayp + itemprop->rawoffset;
+ array->stride = internal->itemsize;
+ array->len = ((char*)internal->endptr - arrayp)/internal->itemsize;
+ array->type = itemprop->rawtype;
}
else
memset(array, 0, sizeof(RawArray));
@@ -2998,7 +2998,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
#define RAW_GET(dtype, var, raw, a) \
{ \
- switch(raw.type) { \
+ switch (raw.type) { \
case PROP_RAW_CHAR: var = (dtype)((char*)raw.array)[a]; break; \
case PROP_RAW_SHORT: var = (dtype)((short*)raw.array)[a]; break; \
case PROP_RAW_INT: var = (dtype)((int*)raw.array)[a]; break; \
@@ -3010,7 +3010,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
#define RAW_SET(dtype, raw, a, var) \
{ \
- switch(raw.type) { \
+ switch (raw.type) { \
case PROP_RAW_CHAR: ((char*)raw.array)[a] = (char)var; break; \
case PROP_RAW_SHORT: ((short*)raw.array)[a] = (short)var; break; \
case PROP_RAW_INT: ((int*)raw.array)[a] = (int)var; break; \
@@ -3022,7 +3022,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
int RNA_raw_type_sizeof(RawPropertyType type)
{
- switch(type) {
+ switch (type) {
case PROP_RAW_CHAR: return sizeof(char);
case PROP_RAW_SHORT: return sizeof(short);
case PROP_RAW_INT: return sizeof(int);
@@ -3037,59 +3037,59 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
StructRNA *ptype;
PointerRNA itemptr;
PropertyRNA *itemprop, *iprop;
- PropertyType itemtype=0;
+ PropertyType itemtype = 0;
RawArray in;
- int itemlen= 0;
+ int itemlen = 0;
/* initialize in array, stride assumed 0 in following code */
- in.array= inarray;
- in.type= intype;
- in.len= inlen;
- in.stride= 0;
+ in.array = inarray;
+ in.type = intype;
+ in.len = inlen;
+ in.stride = 0;
- ptype= RNA_property_pointer_type(ptr, prop);
+ ptype = RNA_property_pointer_type(ptr, prop);
/* try to get item property pointer */
RNA_pointer_create(NULL, ptype, NULL, &itemptr);
- itemprop= RNA_struct_find_property(&itemptr, propname);
+ itemprop = RNA_struct_find_property(&itemptr, propname);
- if(itemprop) {
+ if (itemprop) {
/* we have item property pointer */
RawArray out;
/* check type */
- itemtype= RNA_property_type(itemprop);
+ itemtype = RNA_property_type(itemprop);
- if(!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+ if (!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
return 0;
}
/* check item array */
- itemlen= RNA_property_array_length(&itemptr, itemprop);
+ itemlen = RNA_property_array_length(&itemptr, itemprop);
/* try to access as raw array */
- if(RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
+ if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
int arraylen = (itemlen == 0) ? 1 : itemlen;
- if(in.len != arraylen*out.len) {
+ if (in.len != arraylen*out.len) {
BKE_reportf(reports, RPT_ERROR, "Array length mismatch (expected %d, got %d)", out.len*arraylen, in.len);
return 0;
}
/* matching raw types */
- if(out.type == in.type) {
- void *inp= in.array;
- void *outp= out.array;
+ if (out.type == in.type) {
+ void *inp = in.array;
+ void *outp = out.array;
int a, size;
- size= RNA_raw_type_sizeof(out.type) * arraylen;
+ size = RNA_raw_type_sizeof(out.type) * arraylen;
- for(a=0; a<out.len; a++) {
- if(set) memcpy(outp, inp, size);
+ for (a = 0; a<out.len; a++) {
+ if (set) memcpy(outp, inp, size);
else memcpy(inp, outp, size);
- inp= (char*)inp + size;
- outp= (char*)outp + out.stride;
+ inp = (char*)inp + size;
+ outp = (char*)outp + out.stride;
}
return 1;
@@ -3101,9 +3101,9 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
}
{
- void *tmparray= NULL;
- int tmplen= 0;
- int err= 0, j, a= 0;
+ void *tmparray = NULL;
+ int tmplen = 0;
+ int err = 0, j, a = 0;
int needconv = 1;
if (((itemtype == PROP_BOOLEAN || itemtype == PROP_INT) && in.type == PROP_RAW_INT) ||
@@ -3114,44 +3114,44 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
/* no item property pointer, can still be id property, or
* property of a type derived from the collection pointer type */
RNA_PROP_BEGIN(ptr, itemptr, prop) {
- if(itemptr.data) {
- if(itemprop) {
+ if (itemptr.data) {
+ if (itemprop) {
/* we got the property already */
- iprop= itemprop;
+ iprop = itemprop;
}
else {
/* not yet, look it up and verify if it is valid */
- iprop= RNA_struct_find_property(&itemptr, propname);
+ iprop = RNA_struct_find_property(&itemptr, propname);
- if(iprop) {
- itemlen= RNA_property_array_length(&itemptr, iprop);
- itemtype= RNA_property_type(iprop);
+ if (iprop) {
+ itemlen = RNA_property_array_length(&itemptr, iprop);
+ itemtype = RNA_property_type(iprop);
}
else {
BKE_reportf(reports, RPT_ERROR, "Property named %s not found", propname);
- err= 1;
+ err = 1;
break;
}
- if(!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+ if (!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
- err= 1;
+ err = 1;
break;
}
}
/* editable check */
- if(!set || RNA_property_editable(&itemptr, iprop)) {
- if(a+itemlen > in.len) {
+ if (!set || RNA_property_editable(&itemptr, iprop)) {
+ if (a+itemlen > in.len) {
BKE_reportf(reports, RPT_ERROR, "Array length mismatch (got %d, expected more)", in.len);
- err= 1;
+ err = 1;
break;
}
- if(itemlen == 0) {
+ if (itemlen == 0) {
/* handle conversions */
- if(set) {
- switch(itemtype) {
+ if (set) {
+ switch (itemtype) {
case PROP_BOOLEAN: {
int b;
RAW_GET(int, b, in, a);
@@ -3175,19 +3175,19 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
}
}
else {
- switch(itemtype) {
+ switch (itemtype) {
case PROP_BOOLEAN: {
- int b= RNA_property_boolean_get(&itemptr, iprop);
+ int b = RNA_property_boolean_get(&itemptr, iprop);
RAW_SET(int, in, a, b);
break;
}
case PROP_INT: {
- int i= RNA_property_int_get(&itemptr, iprop);
+ int i = RNA_property_int_get(&itemptr, iprop);
RAW_SET(int, in, a, i);
break;
}
case PROP_FLOAT: {
- float f= RNA_property_float_get(&itemptr, iprop);
+ float f = RNA_property_float_get(&itemptr, iprop);
RAW_SET(float, in, a, f);
break;
}
@@ -3199,32 +3199,32 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
}
else if (needconv == 1) {
/* allocate temporary array if needed */
- if(tmparray && tmplen != itemlen) {
+ if (tmparray && tmplen != itemlen) {
MEM_freeN(tmparray);
- tmparray= NULL;
+ tmparray = NULL;
}
- if(!tmparray) {
- tmparray= MEM_callocN(sizeof(float)*itemlen, "RNA tmparray\n");
- tmplen= itemlen;
+ if (!tmparray) {
+ tmparray = MEM_callocN(sizeof(float)*itemlen, "RNA tmparray\n");
+ tmplen = itemlen;
}
/* handle conversions */
- if(set) {
- switch(itemtype) {
+ if (set) {
+ switch (itemtype) {
case PROP_BOOLEAN: {
- for(j=0; j<itemlen; j++, a++)
+ for (j = 0; j<itemlen; j++, a++)
RAW_GET(int, ((int*)tmparray)[j], in, a);
RNA_property_boolean_set_array(&itemptr, iprop, tmparray);
break;
}
case PROP_INT: {
- for(j=0; j<itemlen; j++, a++)
+ for (j = 0; j<itemlen; j++, a++)
RAW_GET(int, ((int*)tmparray)[j], in, a);
RNA_property_int_set_array(&itemptr, iprop, tmparray);
break;
}
case PROP_FLOAT: {
- for(j=0; j<itemlen; j++, a++)
+ for (j = 0; j<itemlen; j++, a++)
RAW_GET(float, ((float*)tmparray)[j], in, a);
RNA_property_float_set_array(&itemptr, iprop, tmparray);
break;
@@ -3234,22 +3234,22 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
}
}
else {
- switch(itemtype) {
+ switch (itemtype) {
case PROP_BOOLEAN: {
RNA_property_boolean_get_array(&itemptr, iprop, tmparray);
- for(j=0; j<itemlen; j++, a++)
+ for (j = 0; j<itemlen; j++, a++)
RAW_SET(int, in, a, ((int*)tmparray)[j]);
break;
}
case PROP_INT: {
RNA_property_int_get_array(&itemptr, iprop, tmparray);
- for(j=0; j<itemlen; j++, a++)
+ for (j = 0; j<itemlen; j++, a++)
RAW_SET(int, in, a, ((int*)tmparray)[j]);
break;
}
case PROP_FLOAT: {
RNA_property_float_get_array(&itemptr, iprop, tmparray);
- for(j=0; j<itemlen; j++, a++)
+ for (j = 0; j<itemlen; j++, a++)
RAW_SET(float, in, a, ((float*)tmparray)[j]);
break;
}
@@ -3259,8 +3259,8 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
}
}
else {
- if(set) {
- switch(itemtype) {
+ if (set) {
+ switch (itemtype) {
case PROP_BOOLEAN: {
RNA_property_boolean_set_array(&itemptr, iprop, &((int*)in.array)[a]);
a += itemlen;
@@ -3281,7 +3281,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
}
}
else {
- switch(itemtype) {
+ switch (itemtype) {
case PROP_BOOLEAN: {
RNA_property_boolean_get_array(&itemptr, iprop, &((int*)in.array)[a]);
a += itemlen;
@@ -3307,7 +3307,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
}
RNA_PROP_END;
- if(tmparray)
+ if (tmparray)
MEM_freeN(tmparray);
return !err;
@@ -3350,36 +3350,36 @@ void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
{
ListBaseIterator *internal;
- internal= MEM_callocN(sizeof(ListBaseIterator), "ListBaseIterator");
- internal->link= (lb)? lb->first: NULL;
- internal->skip= skip;
+ internal = MEM_callocN(sizeof(ListBaseIterator), "ListBaseIterator");
+ internal->link = (lb)? lb->first: NULL;
+ internal->skip = skip;
- iter->internal= internal;
- iter->valid= (internal->link != NULL);
+ iter->internal = internal;
+ iter->valid = (internal->link != NULL);
- if(skip && iter->valid && skip(iter, internal->link))
+ if (skip && iter->valid && skip(iter, internal->link))
rna_iterator_listbase_next(iter);
}
void rna_iterator_listbase_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal= iter->internal;
+ ListBaseIterator *internal = iter->internal;
- if(internal->skip) {
+ if (internal->skip) {
do {
- internal->link= internal->link->next;
- iter->valid= (internal->link != NULL);
- } while(iter->valid && internal->skip(iter, internal->link));
+ internal->link = internal->link->next;
+ iter->valid = (internal->link != NULL);
+ } while (iter->valid && internal->skip(iter, internal->link));
}
else {
- internal->link= internal->link->next;
- iter->valid= (internal->link != NULL);
+ internal->link = internal->link->next;
+ iter->valid = (internal->link != NULL);
}
}
void *rna_iterator_listbase_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal= iter->internal;
+ ListBaseIterator *internal = iter->internal;
return internal->link;
}
@@ -3387,12 +3387,12 @@ void *rna_iterator_listbase_get(CollectionPropertyIterator *iter)
void rna_iterator_listbase_end(CollectionPropertyIterator *iter)
{
MEM_freeN(iter->internal);
- iter->internal= NULL;
+ iter->internal = NULL;
}
PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct ListBase *lb, int index)
{
- void *data= BLI_findlink(lb, index);
+ void *data = BLI_findlink(lb, index);
return rna_pointer_inherit_refine(ptr, type, data);
}
@@ -3400,54 +3400,54 @@ void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int i
{
ArrayIterator *internal;
- if(ptr == NULL)
- length= 0;
+ if (ptr == NULL)
+ length = 0;
else if (length == 0) {
- ptr= NULL;
- itemsize= 0;
+ ptr = NULL;
+ itemsize = 0;
}
- internal= MEM_callocN(sizeof(ArrayIterator), "ArrayIterator");
- internal->ptr= ptr;
- internal->free_ptr= free_ptr ? ptr:NULL;
- internal->endptr= ((char*)ptr)+length*itemsize;
- internal->itemsize= itemsize;
- internal->skip= skip;
- internal->length= length;
+ internal = MEM_callocN(sizeof(ArrayIterator), "ArrayIterator");
+ internal->ptr = ptr;
+ internal->free_ptr = free_ptr ? ptr:NULL;
+ internal->endptr = ((char*)ptr)+length*itemsize;
+ internal->itemsize = itemsize;
+ internal->skip = skip;
+ internal->length = length;
- iter->internal= internal;
- iter->valid= (internal->ptr != internal->endptr);
+ iter->internal = internal;
+ iter->valid = (internal->ptr != internal->endptr);
- if(skip && iter->valid && skip(iter, internal->ptr))
+ if (skip && iter->valid && skip(iter, internal->ptr))
rna_iterator_array_next(iter);
}
void rna_iterator_array_next(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal= iter->internal;
+ ArrayIterator *internal = iter->internal;
- if(internal->skip) {
+ if (internal->skip) {
do {
internal->ptr += internal->itemsize;
- iter->valid= (internal->ptr != internal->endptr);
- } while(iter->valid && internal->skip(iter, internal->ptr));
+ iter->valid = (internal->ptr != internal->endptr);
+ } while (iter->valid && internal->skip(iter, internal->ptr));
}
else {
internal->ptr += internal->itemsize;
- iter->valid= (internal->ptr != internal->endptr);
+ iter->valid = (internal->ptr != internal->endptr);
}
}
void *rna_iterator_array_get(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal= iter->internal;
+ ArrayIterator *internal = iter->internal;
return internal->ptr;
}
void *rna_iterator_array_dereference_get(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal= iter->internal;
+ ArrayIterator *internal = iter->internal;
/* for ** arrays */
return *(void**)(internal->ptr);
@@ -3455,19 +3455,19 @@ void *rna_iterator_array_dereference_get(CollectionPropertyIterator *iter)
void rna_iterator_array_end(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal= iter->internal;
+ ArrayIterator *internal = iter->internal;
- if(internal->free_ptr) {
+ if (internal->free_ptr) {
MEM_freeN(internal->free_ptr);
- internal->free_ptr= NULL;
+ internal->free_ptr = NULL;
}
MEM_freeN(iter->internal);
- iter->internal= NULL;
+ iter->internal = NULL;
}
PointerRNA rna_array_lookup_int(PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index)
{
- if(index < 0 || index >= length)
+ if (index < 0 || index >= length)
return PointerRNA_NULL;
return rna_pointer_inherit_refine(ptr, type, ((char*)data) + index*itemsize);
@@ -3479,37 +3479,37 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
{
const char *p;
char *buf;
- char quote= '\0';
+ char quote = '\0';
int i, j, len, escape;
- len= 0;
+ len = 0;
- if(bracket) {
+ if (bracket) {
/* get data between [], check escaping ] with \] */
- if(**path == '[') (*path)++;
+ if (**path == '[') (*path)++;
else return NULL;
- p= *path;
+ p = *path;
/* 2 kinds of lookups now, quoted or unquoted */
- quote= *p;
+ quote = *p;
- if(quote != '"') /* " - this comment is hack for Aligorith's text editor's sanity */
- quote= 0;
+ if (quote != '"') /* " - this comment is hack for Aligorith's text editor's sanity */
+ quote = 0;
- if(quote==0) {
- while(*p && (*p != ']')) {
+ if (quote == 0) {
+ while (*p && (*p != ']')) {
len++;
p++;
}
}
else {
- escape= 0;
+ escape = 0;
/* skip the first quote */
len++;
p++;
- while(*p && (*p != quote || escape)) {
- escape= (*p == '\\');
+ while (*p && (*p != quote || escape)) {
+ escape = (*p == '\\');
len++;
p++;
}
@@ -3519,57 +3519,57 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
p++;
}
- if(*p != ']') return NULL;
+ if (*p != ']') return NULL;
}
else {
/* get data until . or [ */
- p= *path;
+ p = *path;
- while(*p && *p != '.' && *p != '[') {
+ while (*p && *p != '.' && *p != '[') {
len++;
p++;
}
}
/* empty, return */
- if(len == 0)
+ if (len == 0)
return NULL;
/* try to use fixed buffer if possible */
- if(len+1 < fixedlen)
- buf= fixedbuf;
+ if (len+1 < fixedlen)
+ buf = fixedbuf;
else
- buf= MEM_callocN(sizeof(char)*(len+1), "rna_path_token");
+ buf = MEM_callocN(sizeof(char)*(len+1), "rna_path_token");
/* copy string, taking into account escaped ] */
- if(bracket) {
- for(p=*path, i=0, j=0; i<len; i++, p++) {
- if(*p == '\\' && *(p+1) == quote);
- else buf[j++]= *p;
+ if (bracket) {
+ for (p = *path, i = 0, j = 0; i<len; i++, p++) {
+ if (*p == '\\' && *(p+1) == quote);
+ else buf[j++] = *p;
}
- buf[j]= 0;
+ buf[j] = 0;
}
else {
memcpy(buf, *path, sizeof(char)*len);
- buf[len]= '\0';
+ buf[len] = '\0';
}
/* set path to start of next token */
- if(*p == ']') p++;
- if(*p == '.') p++;
- *path= p;
+ if (*p == ']') p++;
+ if (*p == '.') p++;
+ *path = p;
return buf;
}
static int rna_token_strip_quotes(char *token)
{
- if(token[0]=='"') {
+ if (token[0] =='"') {
int len = strlen(token);
- if (len >= 2 && token[len-1]=='"') {
+ if (len >= 2 && token[len-1] =='"') {
/* strip away "" */
- token[len-1]= '\0';
+ token[len-1] = '\0';
return 1;
}
}
@@ -3589,80 +3589,80 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
char fixedbuf[256], *token;
int type, intkey;
- prop= NULL;
- curptr= *ptr;
+ prop = NULL;
+ curptr = *ptr;
- if(path==NULL || *path=='\0')
+ if (path == NULL || *path =='\0')
return 0;
- while(*path) {
- int use_id_prop = (*path=='[') ? 1:0;
+ while (*path) {
+ int use_id_prop = (*path =='[') ? 1:0;
/* custom property lookup ?
* C.object["someprop"]
*/
/* look up property name in current struct */
- token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop);
+ token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop);
- if(!token)
+ if (!token)
return 0;
- if(use_id_prop) { /* look up property name in current struct */
- IDProperty *group= RNA_struct_idprops(&curptr, 0);
- if(group && rna_token_strip_quotes(token))
- prop= (PropertyRNA *)IDP_GetPropertyFromGroup(group, token+1);
+ if (use_id_prop) { /* look up property name in current struct */
+ IDProperty *group = RNA_struct_idprops(&curptr, 0);
+ if (group && rna_token_strip_quotes(token))
+ prop = (PropertyRNA *)IDP_GetPropertyFromGroup(group, token+1);
}
else {
- prop= RNA_struct_find_property(&curptr, token);
+ prop = RNA_struct_find_property(&curptr, token);
}
- if(token != fixedbuf)
+ if (token != fixedbuf)
MEM_freeN(token);
- if(!prop)
+ if (!prop)
return 0;
- type= RNA_property_type(prop);
+ type = RNA_property_type(prop);
/* now look up the value of this property if it is a pointer or
* collection, otherwise return the property rna so that the
* caller can read the value of the property itself */
switch (type) {
case PROP_POINTER:
- nextptr= RNA_property_pointer_get(&curptr, prop);
+ nextptr = RNA_property_pointer_get(&curptr, prop);
- if(nextptr.data) {
- curptr= nextptr;
- prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
- if(index) *index= -1;
+ if (nextptr.data) {
+ curptr = nextptr;
+ prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ if (index) *index = -1;
}
else
return 0;
break;
case PROP_COLLECTION:
- if(*path) {
- if(*path == '[') {
+ if (*path) {
+ if (*path == '[') {
/* resolve the lookup with [] brackets */
- token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
+ token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
- if(!token)
+ if (!token)
return 0;
/* check for "" to see if it is a string */
- if(rna_token_strip_quotes(token)) {
+ if (rna_token_strip_quotes(token)) {
RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr);
}
else {
/* otherwise do int lookup */
- intkey= atoi(token);
- if(intkey==0 && (token[0] != '0' || token[1] != '\0')) {
+ intkey = atoi(token);
+ if (intkey == 0 && (token[0] != '0' || token[1] != '\0')) {
return 0; /* we can be sure the fixedbuf was used in this case */
}
RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
}
- if(token != fixedbuf) {
+ if (token != fixedbuf) {
MEM_freeN(token);
}
}
@@ -3672,15 +3672,15 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
/* ensure we quit on invalid values */
nextptr.data = NULL;
- if(RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
- nextptr= c_ptr;
+ if (RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
+ nextptr = c_ptr;
}
}
- if(nextptr.data) {
- curptr= nextptr;
- prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
- if(index) *index= -1;
+ if (nextptr.data) {
+ curptr = nextptr;
+ prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ if (index) *index = -1;
}
else
return 0;
@@ -3688,38 +3688,38 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
break;
default:
- if (index==NULL)
+ if (index == NULL)
break;
- *index= -1;
+ *index = -1;
if (*path) {
- int index_arr[RNA_MAX_ARRAY_DIMENSION]= {0};
+ int index_arr[RNA_MAX_ARRAY_DIMENSION] = {0};
int len[RNA_MAX_ARRAY_DIMENSION];
- const int dim= RNA_property_array_dimension(&curptr, prop, len);
+ const int dim = RNA_property_array_dimension(&curptr, prop, len);
int i, temp_index;
- for(i=0; i<dim; i++) {
- temp_index= -1;
+ for (i = 0; i<dim; i++) {
+ temp_index = -1;
/* multi index resolve */
- if (*path=='[') {
- token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
+ if (*path =='[') {
+ token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
- if(token==NULL) {
+ if (token == NULL) {
/* invalid syntax blah[] */
return 0;
}
/* check for "" to see if it is a string */
- else if(rna_token_strip_quotes(token)) {
- temp_index= RNA_property_array_item_index(prop, *(token+1));
+ else if (rna_token_strip_quotes(token)) {
+ temp_index = RNA_property_array_item_index(prop, *(token+1));
}
else {
/* otherwise do int lookup */
- temp_index= atoi(token);
+ temp_index = atoi(token);
- if(temp_index==0 && (token[0] != '0' || token[1] != '\0')) {
- if(token != fixedbuf) {
+ if (temp_index == 0 && (token[0] != '0' || token[1] != '\0')) {
+ if (token != fixedbuf) {
MEM_freeN(token);
}
@@ -3727,49 +3727,49 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
}
}
}
- else if(dim==1) {
+ else if (dim == 1) {
/* location.x || scale.X, single dimension arrays only */
- token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0);
- if(token==NULL) {
+ token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0);
+ if (token == NULL) {
/* invalid syntax blah.. */
return 0;
}
- temp_index= RNA_property_array_item_index(prop, *token);
+ temp_index = RNA_property_array_item_index(prop, *token);
}
- if(token != fixedbuf) {
+ if (token != fixedbuf) {
MEM_freeN(token);
}
/* out of range */
- if(temp_index < 0 || temp_index >= len[i])
+ if (temp_index < 0 || temp_index >= len[i])
return 0;
- index_arr[i]= temp_index;
+ index_arr[i] = temp_index;
/* end multi index resolve */
}
/* arrays always contain numbers so further values are not valid */
- if(*path) {
+ if (*path) {
return 0;
}
else {
- int totdim= 1;
- int flat_index= 0;
+ int totdim = 1;
+ int flat_index = 0;
- for(i=dim-1; i>=0; i--) {
+ for (i = dim-1; i >= 0; i--) {
flat_index += index_arr[i] * totdim;
totdim *= len[i];
}
- *index= flat_index;
+ *index = flat_index;
}
}
}
}
- *r_ptr= curptr;
- *r_prop= prop;
+ *r_ptr = curptr;
+ *r_prop = prop;
return 1;
}
@@ -3781,32 +3781,32 @@ char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *pr
const char *s;
char appendstr[128], *result;
- dynstr= BLI_dynstr_new();
+ dynstr = BLI_dynstr_new();
/* add .identifier */
- if(path) {
+ if (path) {
BLI_dynstr_append(dynstr, (char*)path);
- if(*path)
+ if (*path)
BLI_dynstr_append(dynstr, ".");
}
BLI_dynstr_append(dynstr, RNA_property_identifier(prop));
- if(RNA_property_type(prop) == PROP_COLLECTION) {
+ if (RNA_property_type(prop) == PROP_COLLECTION) {
/* add ["strkey"] or [intkey] */
BLI_dynstr_append(dynstr, "[");
- if(strkey) {
+ if (strkey) {
BLI_dynstr_append(dynstr, "\"");
- for(s=strkey; *s; s++) {
- if(*s == '[') {
- appendstr[0]= '\\';
- appendstr[1]= *s;
- appendstr[2]= 0;
+ for (s = strkey; *s; s++) {
+ if (*s == '[') {
+ appendstr[0] = '\\';
+ appendstr[1] = *s;
+ appendstr[2] = 0;
}
else {
- appendstr[0]= *s;
- appendstr[1]= 0;
+ appendstr[0] = *s;
+ appendstr[1] = 0;
}
BLI_dynstr_append(dynstr, appendstr);
}
@@ -3820,7 +3820,7 @@ char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *pr
BLI_dynstr_append(dynstr, "]");
}
- result= BLI_dynstr_get_cstring(dynstr);
+ result = BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
return result;
@@ -3833,42 +3833,42 @@ char *RNA_path_back(const char *path)
char *result, *token;
int i;
- if(!path)
+ if (!path)
return NULL;
- previous= NULL;
- current= path;
+ previous = NULL;
+ current = path;
/* parse token by token until the end, then we back up to the previous
* position and strip of the next token to get the path one step back */
- while(*current) {
- token= rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 0);
+ while (*current) {
+ token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 0);
- if(!token)
+ if (!token)
return NULL;
- if(token != fixedbuf)
+ if (token != fixedbuf)
MEM_freeN(token);
/* in case of collection we also need to strip off [] */
- token= rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 1);
- if(token && token != fixedbuf)
+ token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 1);
+ if (token && token != fixedbuf)
MEM_freeN(token);
- if(!*current)
+ if (!*current)
break;
- previous= current;
+ previous = current;
}
- if(!previous)
+ if (!previous)
return NULL;
/* copy and strip off last token */
- i= previous - path;
- result= BLI_strdup(path);
+ i = previous - path;
+ result = BLI_strdup(path);
- if(i > 0 && result[i-1] == '.') i--;
- result[i]= 0;
+ if (i > 0 && result[i-1] == '.') i--;
+ result[i] = 0;
return result;
}
@@ -3885,42 +3885,42 @@ typedef struct IDP_Chain {
static char *rna_idp_path_create(IDP_Chain *child_link)
{
- DynStr *dynstr= BLI_dynstr_new();
+ DynStr *dynstr = BLI_dynstr_new();
char *path;
- short first= TRUE;
+ short first = TRUE;
- int tot= 0;
- IDP_Chain *link= child_link;
+ int tot = 0;
+ IDP_Chain *link = child_link;
/* reverse the list */
IDP_Chain *link_prev;
- link_prev= NULL;
- while(link) {
- IDP_Chain *link_next= link->up;
- link->up= link_prev;
- link_prev= link;
- link= link_next;
+ link_prev = NULL;
+ while (link) {
+ IDP_Chain *link_next = link->up;
+ link->up = link_prev;
+ link_prev = link;
+ link = link_next;
tot++;
}
- for(link= link_prev; link; link= link->up) {
+ for (link = link_prev; link; link = link->up) {
/* pass */
- if(link->index >= 0) {
+ if (link->index >= 0) {
BLI_dynstr_appendf(dynstr, first ? "%s[%d]" : ".%s[%d]", link->name, link->index);
}
else {
BLI_dynstr_appendf(dynstr, first ? "%s" : ".%s", link->name);
}
- first= FALSE;
+ first = FALSE;
}
- path= BLI_dynstr_get_cstring(dynstr);
+ path = BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
- if(*path=='\0') {
+ if (*path =='\0') {
MEM_freeN(path);
- path= NULL;
+ path = NULL;
}
return path;
@@ -3928,7 +3928,7 @@ static char *rna_idp_path_create(IDP_Chain *child_link)
static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *needle, IDP_Chain *parent_link)
{
- char *path= NULL;
+ char *path = NULL;
IDP_Chain link;
IDProperty *iter;
@@ -3936,50 +3936,50 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee
BLI_assert(haystack->type == IDP_GROUP);
- link.up= parent_link;
- link.name= NULL;
- link.index= -1;
+ link.up = parent_link;
+ link.name = NULL;
+ link.index = -1;
- for (i=0, iter= haystack->data.group.first; iter; iter= iter->next, i++) {
- if(needle == iter) { /* found! */
- link.name= iter->name;
- path= rna_idp_path_create(&link);
+ for (i = 0, iter = haystack->data.group.first; iter; iter = iter->next, i++) {
+ if (needle == iter) { /* found! */
+ link.name = iter->name;
+ path = rna_idp_path_create(&link);
break;
}
else {
- if(iter->type == IDP_GROUP) {
+ if (iter->type == IDP_GROUP) {
/* ensure this is RNA */
- PointerRNA child_ptr= RNA_pointer_get(ptr, iter->name);
- if(child_ptr.type) {
- link.name= iter->name;
- if((path= rna_idp_path(&child_ptr, iter, needle, &link))) {
+ PointerRNA child_ptr = RNA_pointer_get(ptr, iter->name);
+ if (child_ptr.type) {
+ link.name = iter->name;
+ if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) {
break;
}
}
}
else if (iter->type == IDP_IDPARRAY) {
- PropertyRNA *prop= RNA_struct_find_property(ptr, iter->name);
- if(prop && prop->type == PROP_COLLECTION) {
- IDProperty *array= IDP_IDPArray(iter);
- if(needle >= array && needle < (iter->len + array)) { /* found! */
- link.name= iter->name;
- link.index= (int)(needle - array);
- path= rna_idp_path_create(&link);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name);
+ if (prop && prop->type == PROP_COLLECTION) {
+ IDProperty *array = IDP_IDPArray(iter);
+ if (needle >= array && needle < (iter->len + array)) { /* found! */
+ link.name = iter->name;
+ link.index = (int)(needle - array);
+ path = rna_idp_path_create(&link);
break;
}
else {
int i;
- link.name= iter->name;
- for(i= 0; i < iter->len; i++, array++) {
+ link.name = iter->name;
+ for (i = 0; i < iter->len; i++, array++) {
PointerRNA child_ptr;
- if(RNA_property_collection_lookup_int(ptr, prop, i, &child_ptr)) {
- link.index= i;
- if((path= rna_idp_path(&child_ptr, array, needle, &link))) {
+ if (RNA_property_collection_lookup_int(ptr, prop, i, &child_ptr)) {
+ link.index = i;
+ if ((path = rna_idp_path(&child_ptr, array, needle, &link))) {
break;
}
}
}
- if(path)
+ if (path)
break;
}
}
@@ -4002,9 +4002,9 @@ static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr)
* unless this is added only way to find this is to also search all bones and pose bones of an armature or object */
RNA_id_pointer_create(ptr->id.data, &id_ptr);
- haystack= RNA_struct_idprops(&id_ptr, FALSE);
- if(haystack) { /* can fail when called on bones */
- needle= ptr->data;
+ haystack = RNA_struct_idprops(&id_ptr, FALSE);
+ if (haystack) { /* can fail when called on bones */
+ needle = ptr->data;
return rna_idp_path(&id_ptr, haystack, needle, NULL);
}
else {
@@ -4014,17 +4014,17 @@ static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr)
char *RNA_path_from_ID_to_struct(PointerRNA *ptr)
{
- char *ptrpath=NULL;
+ char *ptrpath = NULL;
- if(!ptr->id.data || !ptr->data)
+ if (!ptr->id.data || !ptr->data)
return NULL;
- if(!RNA_struct_is_ID(ptr->type)) {
- if(ptr->type->path) {
+ if (!RNA_struct_is_ID(ptr->type)) {
+ if (ptr->type->path) {
/* if type has a path to some ID, use it */
- ptrpath= ptr->type->path(ptr);
+ ptrpath = ptr->type->path(ptr);
}
- else if(ptr->type->nested && RNA_struct_is_ID(ptr->type->nested)) {
+ else if (ptr->type->nested && RNA_struct_is_ID(ptr->type->nested)) {
PointerRNA parentptr;
PropertyRNA *userprop;
@@ -4032,12 +4032,12 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr)
* use its identifier as the first part of the path used...
*/
RNA_id_pointer_create(ptr->id.data, &parentptr);
- userprop= RNA_struct_find_nested(&parentptr, ptr->type);
+ userprop = RNA_struct_find_nested(&parentptr, ptr->type);
- if(userprop)
- ptrpath= BLI_strdup(RNA_property_identifier(userprop));
+ if (userprop)
+ ptrpath = BLI_strdup(RNA_property_identifier(userprop));
else
- return NULL; // can't do anything about this case yet...
+ return NULL; /* can't do anything about this case yet... */
}
else if (RNA_struct_is_a(ptr->type, &RNA_PropertyGroup)) {
/* special case, easier to deal with here then in ptr->type->path() */
@@ -4056,23 +4056,23 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
const char *propname;
char *ptrpath, *path;
- if(!ptr->id.data || !ptr->data || !prop)
+ if (!ptr->id.data || !ptr->data || !prop)
return NULL;
/* path from ID to the struct holding this property */
- ptrpath= RNA_path_from_ID_to_struct(ptr);
+ ptrpath = RNA_path_from_ID_to_struct(ptr);
- propname= RNA_property_identifier(prop);
+ propname = RNA_property_identifier(prop);
- if(ptrpath) {
- path= BLI_sprintfN(is_rna ? "%s.%s":"%s[\"%s\"]", ptrpath, propname);
+ if (ptrpath) {
+ path = BLI_sprintfN(is_rna ? "%s.%s":"%s[\"%s\"]", ptrpath, propname);
MEM_freeN(ptrpath);
}
else {
- if(is_rna)
- path= BLI_strdup(propname);
+ if (is_rna)
+ path = BLI_strdup(propname);
else
- path= BLI_sprintfN("[\"%s\"]", propname);
+ path = BLI_sprintfN("[\"%s\"]", propname);
}
return path;
@@ -4082,9 +4082,9 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
int RNA_boolean_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_boolean_get(ptr, prop);
}
else {
@@ -4095,9 +4095,9 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_boolean_set(ptr, prop, value);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4105,9 +4105,9 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_boolean_get_array(ptr, prop, values);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4115,9 +4115,9 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_boolean_set_array(ptr, prop, values);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4125,9 +4125,9 @@ void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values)
int RNA_int_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_int_get(ptr, prop);
}
else {
@@ -4138,9 +4138,9 @@ int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_int_set(ptr, prop, value);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4148,9 +4148,9 @@ void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_int_get_array(ptr, prop, values);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4158,9 +4158,9 @@ void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_int_set_array(ptr, prop, values);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4168,9 +4168,9 @@ void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_float_get(ptr, prop);
}
else {
@@ -4181,9 +4181,9 @@ float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_float_set(ptr, prop, value);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4191,9 +4191,9 @@ void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_float_get_array(ptr, prop, values);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4201,9 +4201,9 @@ void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_float_set_array(ptr, prop, values);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4211,9 +4211,9 @@ void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_enum_get(ptr, prop);
}
else {
@@ -4224,9 +4224,9 @@ int RNA_enum_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_enum_set(ptr, prop, value);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4234,11 +4234,11 @@ void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
int value;
- if(RNA_property_enum_value(NULL, ptr, prop, id, &value))
+ if (RNA_property_enum_value(NULL, ptr, prop, id, &value))
RNA_property_enum_set(ptr, prop, value);
else
printf("%s: %s.%s has no enum id '%s'.\n", __func__, ptr->type->identifier, name, id);
@@ -4250,18 +4250,18 @@ void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id)
int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
EnumPropertyItem *item;
int free;
- if(prop) {
+ if (prop) {
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- for(; item->identifier; item++)
- if(strcmp(item->identifier, enumname) == 0)
+ for (; item->identifier; item++)
+ if (strcmp(item->identifier, enumname) == 0)
return (item->value == RNA_property_enum_get(ptr, prop));
- if(free)
+ if (free)
MEM_freeN(item);
printf("%s: %s.%s item %s not found.\n", __func__, ptr->type->identifier, name, enumname);
@@ -4275,9 +4275,9 @@ int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char
int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value)
{
- for( ; item->identifier; item++) {
- if(strcmp(item->identifier, identifier)==0) {
- *value= item->value;
+ for ( ; item->identifier; item++) {
+ if (strcmp(item->identifier, identifier) == 0) {
+ *value = item->value;
return 1;
}
}
@@ -4287,9 +4287,9 @@ int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *
int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier)
{
- for( ; item->identifier; item++) {
- if(item->value==value) {
- *identifier= item->identifier;
+ for ( ; item->identifier; item++) {
+ if (item->value == value) {
+ *identifier = item->identifier;
return 1;
}
}
@@ -4299,8 +4299,8 @@ int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **ident
int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon)
{
- for( ; item->identifier; item++) {
- if(item->value==value) {
+ for ( ; item->identifier; item++) {
+ if (item->value == value) {
*icon = item->icon;
return 1;
}
@@ -4311,22 +4311,22 @@ int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
RNA_property_string_get(ptr, prop, value);
}
else {
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- value[0]= '\0';
+ value[0] = '\0';
}
}
char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen, NULL); /* TODO, pass length */
}
else {
@@ -4337,9 +4337,9 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in
int RNA_string_length(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_string_length(ptr, prop);
}
else {
@@ -4350,9 +4350,9 @@ int RNA_string_length(PointerRNA *ptr, const char *name)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_string_set(ptr, prop, value);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4360,9 +4360,9 @@ void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_pointer_get(ptr, prop);
}
else {
@@ -4374,9 +4374,9 @@ PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
RNA_property_pointer_set(ptr, prop, ptr_value);
}
else {
@@ -4386,9 +4386,9 @@ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
void RNA_pointer_add(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_pointer_add(ptr, prop);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4396,9 +4396,9 @@ void RNA_pointer_add(PointerRNA *ptr, const char *name)
void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_collection_begin(ptr, prop, iter);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4406,9 +4406,9 @@ void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyI
void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_collection_add(ptr, prop, r_value);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4416,9 +4416,9 @@ void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
void RNA_collection_clear(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop)
+ if (prop)
RNA_property_collection_clear(ptr, prop);
else
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4426,9 +4426,9 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name)
int RNA_collection_length(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if(prop) {
+ if (prop) {
return RNA_property_collection_length(ptr, prop);
}
else {
@@ -4439,7 +4439,7 @@ int RNA_collection_length(PointerRNA *ptr, const char *name)
int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
{
- if(prop->flag & PROP_IDPROPERTY) {
+ if (prop->flag & PROP_IDPROPERTY) {
IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
return ((idprop != NULL) && !(idprop->flag & IDP_FLAG_GHOST));
}
@@ -4450,9 +4450,9 @@ int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
{
- PropertyRNA *prop= RNA_struct_find_property(ptr, identifier);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
- if(prop) {
+ if (prop) {
return RNA_property_is_set(ptr, prop);
}
else {
@@ -4464,7 +4464,7 @@ int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
int RNA_property_is_idprop(PropertyRNA *prop)
{
- return (prop->magic!=RNA_MAGIC);
+ return (prop->magic != RNA_MAGIC);
}
/* string representation of a property, python
@@ -4472,7 +4472,7 @@ int RNA_property_is_idprop(PropertyRNA *prop)
* context may be NULL */
char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
{
- DynStr *dynstr= BLI_dynstr_new();
+ DynStr *dynstr = BLI_dynstr_new();
char *cstring;
const char *propname;
@@ -4483,12 +4483,12 @@ char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
RNA_STRUCT_BEGIN(ptr, prop) {
propname = RNA_property_identifier(prop);
- if(strcmp(propname, "rna_type")==0)
+ if (strcmp(propname, "rna_type") == 0)
continue;
- if(first_time==0)
+ if (first_time == 0)
BLI_dynstr_append(dynstr, ", ");
- first_time= 0;
+ first_time = 0;
cstring = RNA_property_as_string(C, ptr, prop);
BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring);
@@ -4510,50 +4510,50 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
int len = RNA_property_array_length(ptr, prop);
int i;
- DynStr *dynstr= BLI_dynstr_new();
+ DynStr *dynstr = BLI_dynstr_new();
char *cstring;
/* see if we can coorce into a python type - PropertyType */
switch (type) {
case PROP_BOOLEAN:
- if(len==0) {
+ if (len == 0) {
BLI_dynstr_append(dynstr, RNA_property_boolean_get(ptr, prop) ? "True" : "False");
}
else {
BLI_dynstr_append(dynstr, "(");
- for(i=0; i<len; i++) {
+ for (i = 0; i<len; i++) {
BLI_dynstr_appendf(dynstr, i?", %s":"%s", RNA_property_boolean_get_index(ptr, prop, i) ? "True" : "False");
}
- if(len==1)
+ if (len == 1)
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
BLI_dynstr_append(dynstr, ")");
}
break;
case PROP_INT:
- if(len==0) {
+ if (len == 0) {
BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get(ptr, prop));
}
else {
BLI_dynstr_append(dynstr, "(");
- for(i=0; i<len; i++) {
+ for (i = 0; i<len; i++) {
BLI_dynstr_appendf(dynstr, i?", %d":"%d", RNA_property_int_get_index(ptr, prop, i));
}
- if(len==1)
+ if (len == 1)
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
BLI_dynstr_append(dynstr, ")");
}
break;
case PROP_FLOAT:
- if(len==0) {
+ if (len == 0) {
BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get(ptr, prop));
}
else {
BLI_dynstr_append(dynstr, "(");
- for(i=0; i<len; i++) {
+ for (i = 0; i<len; i++) {
BLI_dynstr_appendf(dynstr, i?", %g":"%g", RNA_property_float_get_index(ptr, prop, i));
}
- if(len==1)
+ if (len == 1)
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
BLI_dynstr_append(dynstr, ")");
}
@@ -4564,9 +4564,9 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
char *buf;
int length;
- length= RNA_property_string_length(ptr, prop);
- buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_property_as_string");
- buf_esc= MEM_mallocN(sizeof(char)*(length*2+1), "RNA_property_as_string esc");
+ length = RNA_property_string_length(ptr, prop);
+ buf = MEM_mallocN(sizeof(char)*(length+1), "RNA_property_as_string");
+ buf_esc = MEM_mallocN(sizeof(char)*(length*2+1), "RNA_property_as_string esc");
RNA_property_string_get(ptr, prop, buf);
BLI_strescape(buf_esc, buf, length*2+1);
MEM_freeN(buf);
@@ -4580,31 +4580,31 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
const char *identifier;
int val = RNA_property_enum_get(ptr, prop);
- if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
/* represent as a python set */
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
int free;
BLI_dynstr_append(dynstr, "{");
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if(item) {
- short is_first= TRUE;
+ if (item) {
+ short is_first = TRUE;
for (; item->identifier; item++) {
- if(item->identifier[0] && item->value & val) {
+ if (item->identifier[0] && item->value & val) {
BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
- is_first= FALSE;
+ is_first = FALSE;
}
}
- if(free) {
+ if (free) {
MEM_freeN(item);
}
}
BLI_dynstr_append(dynstr, "}");
}
- else if(RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
+ else if (RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
BLI_dynstr_appendf(dynstr, "'%s'", identifier);
}
else {
@@ -4614,8 +4614,8 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
}
case PROP_POINTER:
{
- PointerRNA tptr= RNA_property_pointer_get(ptr, prop);
- cstring= RNA_pointer_as_string(C, &tptr);
+ PointerRNA tptr = RNA_property_pointer_get(ptr, prop);
+ cstring = RNA_pointer_as_string(C, &tptr);
BLI_dynstr_append(dynstr, cstring);
MEM_freeN(cstring);
break;
@@ -4626,15 +4626,15 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
CollectionPropertyIterator collect_iter;
BLI_dynstr_append(dynstr, "[");
- for(RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid; RNA_property_collection_next(&collect_iter)) {
- PointerRNA itemptr= collect_iter.ptr;
+ for (RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid; RNA_property_collection_next(&collect_iter)) {
+ PointerRNA itemptr = collect_iter.ptr;
- if(first_time==0)
+ if (first_time == 0)
BLI_dynstr_append(dynstr, ", ");
- first_time= 0;
+ first_time = 0;
/* now get every prop of the collection */
- cstring= RNA_pointer_as_string(C, &itemptr);
+ cstring = RNA_pointer_as_string(C, &itemptr);
BLI_dynstr_append(dynstr, cstring);
MEM_freeN(cstring);
}
@@ -4696,58 +4696,58 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSE
{
PropertyRNA *parm;
void *data;
- int alloc_size= 0, size;
+ int alloc_size = 0, size;
- parms->arg_count= 0;
- parms->ret_count= 0;
+ parms->arg_count = 0;
+ parms->ret_count = 0;
/* allocate data */
- for(parm= func->cont.properties.first; parm; parm= parm->next) {
+ for (parm = func->cont.properties.first; parm; parm = parm->next) {
alloc_size += rna_parameter_size_alloc(parm);
- if(parm->flag & PROP_OUTPUT)
+ if (parm->flag & PROP_OUTPUT)
parms->ret_count++;
else
parms->arg_count++;
}
- parms->data= MEM_callocN(alloc_size, "RNA_parameter_list_create");
- parms->func= func;
- parms->alloc_size= alloc_size;
+ parms->data = MEM_callocN(alloc_size, "RNA_parameter_list_create");
+ parms->func = func;
+ parms->alloc_size = alloc_size;
/* set default values */
- data= parms->data;
+ data = parms->data;
- for(parm= func->cont.properties.first; parm; parm= parm->next) {
- size= rna_parameter_size(parm);
+ for (parm = func->cont.properties.first; parm; parm = parm->next) {
+ size = rna_parameter_size(parm);
/* set length to 0, these need to be set later, see bpy_array.c's py_to_array */
if (parm->flag & PROP_DYNAMIC) {
- ParameterDynAlloc *data_alloc= data;
- data_alloc->array_tot= 0;
- data_alloc->array= NULL;
+ ParameterDynAlloc *data_alloc = data;
+ data_alloc->array_tot = 0;
+ data_alloc->array = NULL;
}
- if(!(parm->flag & PROP_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
- switch(parm->type) {
+ if (!(parm->flag & PROP_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
+ switch (parm->type) {
case PROP_BOOLEAN:
- if(parm->arraydimension) memcpy(data, ((BoolPropertyRNA*)parm)->defaultarray, size);
+ if (parm->arraydimension) memcpy(data, ((BoolPropertyRNA*)parm)->defaultarray, size);
else memcpy(data, &((BoolPropertyRNA*)parm)->defaultvalue, size);
break;
case PROP_INT:
- if(parm->arraydimension) memcpy(data, ((IntPropertyRNA*)parm)->defaultarray, size);
+ if (parm->arraydimension) memcpy(data, ((IntPropertyRNA*)parm)->defaultarray, size);
else memcpy(data, &((IntPropertyRNA*)parm)->defaultvalue, size);
break;
case PROP_FLOAT:
- if(parm->arraydimension) memcpy(data, ((FloatPropertyRNA*)parm)->defaultarray, size);
+ if (parm->arraydimension) memcpy(data, ((FloatPropertyRNA*)parm)->defaultarray, size);
else memcpy(data, &((FloatPropertyRNA*)parm)->defaultvalue, size);
break;
case PROP_ENUM:
memcpy(data, &((EnumPropertyRNA*)parm)->defaultvalue, size);
break;
case PROP_STRING: {
- const char *defvalue= ((StringPropertyRNA*)parm)->defaultvalue;
- if(defvalue && defvalue[0]) {
+ const char *defvalue = ((StringPropertyRNA*)parm)->defaultvalue;
+ if (defvalue && defvalue[0]) {
/* causes bug [#29988], possibly this is only correct for thick wrapped
* need to look further into it - campbell */
#if 0
@@ -4764,7 +4764,7 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSE
}
}
- data= ((char*)data) + rna_parameter_size_alloc(parm);
+ data = ((char*)data) + rna_parameter_size_alloc(parm);
}
return parms;
@@ -4775,24 +4775,24 @@ void RNA_parameter_list_free(ParameterList *parms)
PropertyRNA *parm;
int tot;
- parm= parms->func->cont.properties.first;
- for(tot= 0; parm; parm= parm->next) {
- if(parm->type == PROP_COLLECTION)
+ parm = parms->func->cont.properties.first;
+ for (tot = 0; parm; parm = parm->next) {
+ if (parm->type == PROP_COLLECTION)
BLI_freelistN((ListBase*)((char*)parms->data+tot));
else if (parm->flag & PROP_DYNAMIC) {
/* for dynamic arrays and strings, data is a pointer to an array */
- ParameterDynAlloc *data_alloc= (void *)(((char *)parms->data) + tot);
- if(data_alloc->array)
+ ParameterDynAlloc *data_alloc = (void *)(((char *)parms->data) + tot);
+ if (data_alloc->array)
MEM_freeN(data_alloc->array);
}
- tot+= rna_parameter_size_alloc(parm);
+ tot += rna_parameter_size_alloc(parm);
}
MEM_freeN(parms->data);
- parms->data= NULL;
+ parms->data = NULL;
- parms->func= NULL;
+ parms->func = NULL;
}
int RNA_parameter_list_size(ParameterList *parms)
@@ -4815,26 +4815,26 @@ void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter)
/* may be useful but unused now */
/* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/
- iter->parms= parms;
- iter->parm= parms->func->cont.properties.first;
- iter->valid= iter->parm != NULL;
- iter->offset= 0;
+ iter->parms = parms;
+ iter->parm = parms->func->cont.properties.first;
+ iter->valid = iter->parm != NULL;
+ iter->offset = 0;
- if(iter->valid) {
- iter->size= rna_parameter_size_alloc(iter->parm);
- iter->data= (((char*)iter->parms->data)); /* +iter->offset, always 0 */
+ if (iter->valid) {
+ iter->size = rna_parameter_size_alloc(iter->parm);
+ iter->data = (((char*)iter->parms->data)); /* +iter->offset, always 0 */
}
}
void RNA_parameter_list_next(ParameterIterator *iter)
{
- iter->offset+= iter->size;
- iter->parm= iter->parm->next;
- iter->valid= iter->parm != NULL;
+ iter->offset += iter->size;
+ iter->parm = iter->parm->next;
+ iter->valid = iter->parm != NULL;
- if(iter->valid) {
- iter->size= rna_parameter_size_alloc(iter->parm);
- iter->data= (((char*)iter->parms->data)+iter->offset);
+ if (iter->valid) {
+ iter->size = rna_parameter_size_alloc(iter->parm);
+ iter->data = (((char*)iter->parms->data)+iter->offset);
}
}
@@ -4849,14 +4849,14 @@ void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value)
RNA_parameter_list_begin(parms, &iter);
- for(; iter.valid; RNA_parameter_list_next(&iter))
- if(iter.parm==parm)
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
break;
- if(iter.valid)
- *value= iter.data;
+ if (iter.valid)
+ *value = iter.data;
else
- *value= NULL;
+ *value = NULL;
RNA_parameter_list_end(&iter);
}
@@ -4865,12 +4865,12 @@ void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void
{
PropertyRNA *parm;
- parm= parms->func->cont.properties.first;
- for(; parm; parm= parm->next)
- if(strcmp(RNA_property_identifier(parm), identifier)==0)
+ parm = parms->func->cont.properties.first;
+ for (; parm; parm = parm->next)
+ if (strcmp(RNA_property_identifier(parm), identifier) == 0)
break;
- if(parm)
+ if (parm)
RNA_parameter_get(parms, parm, value);
}
@@ -4880,11 +4880,11 @@ void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *valu
RNA_parameter_list_begin(parms, &iter);
- for(; iter.valid; RNA_parameter_list_next(&iter))
- if(iter.parm==parm)
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
break;
- if(iter.valid)
+ if (iter.valid)
memcpy(iter.data, value, iter.size);
RNA_parameter_list_end(&iter);
@@ -4894,28 +4894,28 @@ void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, cons
{
PropertyRNA *parm;
- parm= parms->func->cont.properties.first;
- for(; parm; parm= parm->next)
- if(strcmp(RNA_property_identifier(parm), identifier)==0)
+ parm = parms->func->cont.properties.first;
+ for (; parm; parm = parm->next)
+ if (strcmp(RNA_property_identifier(parm), identifier) == 0)
break;
- if(parm)
+ if (parm)
RNA_parameter_set(parms, parm, value);
}
int RNA_parameter_length_get(ParameterList *parms, PropertyRNA *parm)
{
ParameterIterator iter;
- int len= 0;
+ int len = 0;
RNA_parameter_list_begin(parms, &iter);
- for(; iter.valid; RNA_parameter_list_next(&iter))
- if(iter.parm==parm)
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
break;
- if(iter.valid)
- len= RNA_parameter_length_get_data(parms, parm, iter.data);
+ if (iter.valid)
+ len = RNA_parameter_length_get_data(parms, parm, iter.data);
RNA_parameter_list_end(&iter);
@@ -4928,11 +4928,11 @@ void RNA_parameter_length_set(ParameterList *parms, PropertyRNA *parm, int lengt
RNA_parameter_list_begin(parms, &iter);
- for(; iter.valid; RNA_parameter_list_next(&iter))
- if(iter.parm==parm)
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
break;
- if(iter.valid)
+ if (iter.valid)
RNA_parameter_length_set_data(parms, parm, iter.data, length);
RNA_parameter_list_end(&iter);
@@ -4945,12 +4945,12 @@ int RNA_parameter_length_get_data(ParameterList *UNUSED(parms), PropertyRNA *UNU
void RNA_parameter_length_set_data(ParameterList *UNUSED(parms), PropertyRNA *UNUSED(parm), void *data, int length)
{
- *((int *)data)= length;
+ *((int *)data) = length;
}
int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
{
- if(func->call) {
+ if (func->call) {
func->call(C, reports, ptr, parms);
return 0;
@@ -4963,9 +4963,9 @@ int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr,
{
FunctionRNA *func;
- func= RNA_struct_find_function(ptr, identifier);
+ func = RNA_struct_find_function(ptr, identifier);
- if(func)
+ if (func)
return RNA_function_call(C, reports, ptr, func, parms);
return -1;
@@ -4978,7 +4978,7 @@ int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr,
va_start(args, format);
- ret= RNA_function_call_direct_va(C, reports, ptr, func, format, args);
+ ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
va_end(args);
@@ -4989,15 +4989,15 @@ int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA
{
FunctionRNA *func;
- func= RNA_struct_find_function(ptr, identifier);
+ func = RNA_struct_find_function(ptr, identifier);
- if(func) {
+ if (func) {
va_list args;
int ret;
va_start(args, format);
- ret= RNA_function_call_direct_va(C, reports, ptr, func, format, args);
+ ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
va_end(args);
@@ -5010,15 +5010,15 @@ int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA
static int rna_function_format_array_length(const char *format, int ofs, int flen)
{
char lenbuf[16];
- int idx= 0;
+ int idx = 0;
- if (format[ofs++]=='[')
- for (; ofs<flen && format[ofs]!=']' && idx<sizeof(*lenbuf)-1; idx++, ofs++)
- lenbuf[idx]= format[ofs];
+ if (format[ofs++] =='[')
+ for (; ofs<flen && format[ofs] !=']' && idx<sizeof(*lenbuf)-1; idx++, ofs++)
+ lenbuf[idx] = format[ofs];
- if (ofs<flen && format[ofs+1]==']') {
+ if (ofs<flen && format[ofs+1] ==']') {
/* XXX put better error reporting for ofs>=flen or idx over lenbuf capacity */
- lenbuf[idx]= '\0';
+ lenbuf[idx] = '\0';
return atoi(lenbuf);
}
@@ -5034,13 +5034,13 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
switch (type) {
case PROP_BOOLEAN:
{
- if (ftype!='b') {
+ if (ftype !='b') {
fprintf(stderr, "%s.%s: wrong type for parameter %s, a boolean was expected\n", tid, fid, pid);
return -1;
}
- if (len==0)
- *((int*)dest)= *((int*)src);
+ if (len == 0)
+ *((int*)dest) = *((int*)src);
else
memcpy(dest, src, len*sizeof(int));
@@ -5048,13 +5048,13 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
}
case PROP_INT:
{
- if (ftype!='i') {
+ if (ftype !='i') {
fprintf(stderr, "%s.%s: wrong type for parameter %s, an integer was expected\n", tid, fid, pid);
return -1;
}
- if (len==0)
- *((int*)dest)= *((int*)src);
+ if (len == 0)
+ *((int*)dest) = *((int*)src);
else
memcpy(dest, src, len*sizeof(int));
@@ -5062,13 +5062,13 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
}
case PROP_FLOAT:
{
- if (ftype!='f') {
+ if (ftype !='f') {
fprintf(stderr, "%s.%s: wrong type for parameter %s, a float was expected\n", tid, fid, pid);
return -1;
}
- if (len==0)
- *((float*)dest)= *((float*)src);
+ if (len == 0)
+ *((float*)dest) = *((float*)src);
else
memcpy(dest, src, len*sizeof(float));
@@ -5076,23 +5076,23 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
}
case PROP_STRING:
{
- if (ftype!='s') {
+ if (ftype !='s') {
fprintf(stderr, "%s.%s: wrong type for parameter %s, a string was expected\n", tid, fid, pid);
return -1;
}
- *((char**)dest)= *((char**)src);
+ *((char**)dest) = *((char**)src);
break;
}
case PROP_ENUM:
{
- if (ftype!='e') {
+ if (ftype !='e') {
fprintf(stderr, "%s.%s: wrong type for parameter %s, an enum was expected\n", tid, fid, pid);
return -1;
}
- *((int*)dest)= *((int*)src);
+ *((int*)dest) = *((int*)src);
break;
}
@@ -5100,26 +5100,26 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
{
StructRNA *ptype;
- if (ftype!='O') {
+ if (ftype !='O') {
fprintf(stderr, "%s.%s: wrong type for parameter %s, an object was expected\n", tid, fid, pid);
return -1;
}
- ptype= RNA_property_pointer_type(ptr, prop);
+ ptype = RNA_property_pointer_type(ptr, prop);
- if(prop->flag & PROP_RNAPTR) {
- *((PointerRNA*)dest)= *((PointerRNA*)src);
+ if (prop->flag & PROP_RNAPTR) {
+ *((PointerRNA*)dest) = *((PointerRNA*)src);
break;
}
- if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
+ if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
fprintf(stderr, "%s.%s: wrong type for parameter %s, "
"an object of type %s was expected, passed an object of type %s\n",
tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
return -1;
}
- *((void**)dest)= *((void**)src);
+ *((void**)dest) = *((void**)src);
break;
}
@@ -5130,16 +5130,16 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
Link *link;
CollectionPointerLink *clink;
- if (ftype!='C') {
+ if (ftype !='C') {
fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection was expected\n", tid, fid, pid);
return -1;
}
- lb= (ListBase *)src;
- clb= (ListBase *)dest;
- ptype= RNA_property_pointer_type(ptr, prop);
+ lb = (ListBase *)src;
+ clb = (ListBase *)dest;
+ ptype = RNA_property_pointer_type(ptr, prop);
- if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
+ if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
fprintf(stderr, "%s.%s: wrong type for parameter %s, "
"a collection of objects of type %s was expected, "
"passed a collection of objects of type %s\n",
@@ -5147,17 +5147,17 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
return -1;
}
- for (link= lb->first; link; link= link->next) {
- clink= MEM_callocN(sizeof(CollectionPointerLink), "CCollectionPointerLink");
+ for (link = lb->first; link; link = link->next) {
+ clink = MEM_callocN(sizeof(CollectionPointerLink), "CCollectionPointerLink");
RNA_pointer_create(NULL, srna, link, &clink->ptr);
BLI_addtail(clb, clink);
}
break;
}
- default:
+ default:
{
- if (len==0)
+ if (len == 0)
fprintf(stderr, "%s.%s: unknown type for parameter %s\n", tid, fid, pid);
else
fprintf(stderr, "%s.%s: unknown array type for parameter %s\n", tid, fid, pid);
@@ -5176,38 +5176,38 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
ParameterIterator iter;
PropertyRNA *pret, *parm;
PropertyType type;
- int i, ofs, flen, flag, len, alen, err= 0;
- const char *tid, *fid, *pid=NULL;
+ int i, ofs, flen, flag, len, alen, err = 0;
+ const char *tid, *fid, *pid = NULL;
char ftype;
- void **retdata=NULL;
+ void **retdata = NULL;
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
- tid= RNA_struct_identifier(ptr->type);
- fid= RNA_function_identifier(func);
- pret= func->c_ret;
- flen= strlen(format);
+ tid = RNA_struct_identifier(ptr->type);
+ fid = RNA_function_identifier(func);
+ pret = func->c_ret;
+ flen = strlen(format);
RNA_parameter_list_create(&parms, ptr, func);
RNA_parameter_list_begin(&parms, &iter);
- for(i= 0, ofs= 0; iter.valid; RNA_parameter_list_next(&iter), i++) {
- parm= iter.parm;
- flag= RNA_property_flag(parm);
+ for (i = 0, ofs = 0; iter.valid; RNA_parameter_list_next(&iter), i++) {
+ parm = iter.parm;
+ flag = RNA_property_flag(parm);
- if(parm==pret) {
- retdata= iter.data;
+ if (parm == pret) {
+ retdata = iter.data;
continue;
}
else if (flag & PROP_OUTPUT) {
continue;
}
- pid= RNA_property_identifier(parm);
+ pid = RNA_property_identifier(parm);
- if (ofs>=flen || format[ofs]=='N') {
+ if (ofs >= flen || format[ofs] =='N') {
if (flag & PROP_REQUIRED) {
- err= -1;
+ err = -1;
fprintf(stderr, "%s.%s: missing required parameter %s\n", tid, fid, pid);
break;
}
@@ -5215,13 +5215,13 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
continue;
}
- type= RNA_property_type(parm);
- ftype= format[ofs++];
- len= RNA_property_array_length(&funcptr, parm);
- alen= rna_function_format_array_length(format, ofs, flen);
+ type = RNA_property_type(parm);
+ ftype = format[ofs++];
+ len = RNA_property_array_length(&funcptr, parm);
+ alen = rna_function_format_array_length(format, ofs, flen);
- if (len!=alen) {
- err= -1;
+ if (len != alen) {
+ err = -1;
fprintf(stderr, "%s.%s: for parameter %s, "
"was expecting an array of %i elements, "
"passed %i elements instead\n",
@@ -5234,62 +5234,62 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
case PROP_INT:
case PROP_ENUM:
{
- int arg= va_arg(args, int);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ int arg = va_arg(args, int);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
break;
}
case PROP_FLOAT:
{
- double arg= va_arg(args, double);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ double arg = va_arg(args, double);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
break;
}
case PROP_STRING:
{
- char *arg= va_arg(args, char*);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ char *arg = va_arg(args, char*);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
break;
}
case PROP_POINTER:
{
- StructRNA *srna= va_arg(args, StructRNA*);
- void *arg= va_arg(args, void*);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+ StructRNA *srna = va_arg(args, StructRNA*);
+ void *arg = va_arg(args, void*);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
break;
}
case PROP_COLLECTION:
{
- StructRNA *srna= va_arg(args, StructRNA*);
- ListBase *arg= va_arg(args, ListBase*);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+ StructRNA *srna = va_arg(args, StructRNA*);
+ ListBase *arg = va_arg(args, ListBase*);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
break;
}
default:
{
/* handle errors */
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL, NULL, tid, fid, pid);
break;
}
}
- if (err!=0)
+ if (err != 0)
break;
}
- if (err==0)
- err= RNA_function_call(C, reports, ptr, func, &parms);
+ if (err == 0)
+ err = RNA_function_call(C, reports, ptr, func, &parms);
/* XXX throw error when more parameters than those needed are passed or leave silent? */
- if (err==0 && pret && ofs<flen && format[ofs++]=='R') {
- parm= pret;
+ if (err == 0 && pret && ofs<flen && format[ofs++] =='R') {
+ parm = pret;
- type= RNA_property_type(parm);
- ftype= format[ofs++];
- len= RNA_property_array_length(&funcptr, parm);
- alen= rna_function_format_array_length(format, ofs, flen);
+ type = RNA_property_type(parm);
+ ftype = format[ofs++];
+ len = RNA_property_array_length(&funcptr, parm);
+ alen = rna_function_format_array_length(format, ofs, flen);
- if (len!=alen) {
- err= -1;
+ if (len != alen) {
+ err = -1;
fprintf(stderr, "%s.%s: for return parameter %s, "
"was expecting an array of %i elements, passed %i elements instead\n",
tid, fid, pid, len, alen);
@@ -5300,40 +5300,40 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
case PROP_INT:
case PROP_ENUM:
{
- int *arg= va_arg(args, int*);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ int *arg = va_arg(args, int*);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
break;
}
case PROP_FLOAT:
{
- float *arg= va_arg(args, float*);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ float *arg = va_arg(args, float*);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
break;
}
case PROP_STRING:
{
- char **arg= va_arg(args, char**);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ char **arg = va_arg(args, char**);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
break;
}
case PROP_POINTER:
{
- StructRNA *srna= va_arg(args, StructRNA*);
- void **arg= va_arg(args, void**);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+ StructRNA *srna = va_arg(args, StructRNA*);
+ void **arg = va_arg(args, void**);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
break;
}
case PROP_COLLECTION:
{
- StructRNA *srna= va_arg(args, StructRNA*);
- ListBase **arg= va_arg(args, ListBase**);
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+ StructRNA *srna = va_arg(args, StructRNA*);
+ ListBase **arg = va_arg(args, ListBase**);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
break;
- }
+ }
default:
{
/* handle errors */
- err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL, NULL, tid, fid, pid);
+ err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL, NULL, tid, fid, pid);
break;
}
}
@@ -5351,9 +5351,9 @@ int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, Pointer
{
FunctionRNA *func;
- func= RNA_struct_find_function(ptr, identifier);
+ func = RNA_struct_find_function(ptr, identifier);
- if(func)
+ if (func)
return RNA_function_call_direct_va(C, reports, ptr, func, format, args);
return 0;
@@ -5364,14 +5364,14 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
int len;
/* get the length of the array to work with */
- len= RNA_property_array_length(ptr, prop);
+ len = RNA_property_array_length(ptr, prop);
/* get and set the default values as appropriate for the various types */
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
if (len) {
if (index == -1) {
- int *tmparray= MEM_callocN(sizeof(int)*len, "reset_defaults - boolean");
+ int *tmparray = MEM_callocN(sizeof(int)*len, "reset_defaults - boolean");
RNA_property_boolean_get_default_array(ptr, prop, tmparray);
RNA_property_boolean_set_array(ptr, prop, tmparray);
@@ -5379,19 +5379,19 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
MEM_freeN(tmparray);
}
else {
- int value= RNA_property_boolean_get_default_index(ptr, prop, index);
+ int value = RNA_property_boolean_get_default_index(ptr, prop, index);
RNA_property_boolean_set_index(ptr, prop, index, value);
}
}
else {
- int value= RNA_property_boolean_get_default(ptr, prop);
+ int value = RNA_property_boolean_get_default(ptr, prop);
RNA_property_boolean_set(ptr, prop, value);
}
return 1;
case PROP_INT:
if (len) {
if (index == -1) {
- int *tmparray= MEM_callocN(sizeof(int)*len, "reset_defaults - int");
+ int *tmparray = MEM_callocN(sizeof(int)*len, "reset_defaults - int");
RNA_property_int_get_default_array(ptr, prop, tmparray);
RNA_property_int_set_array(ptr, prop, tmparray);
@@ -5399,19 +5399,19 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
MEM_freeN(tmparray);
}
else {
- int value= RNA_property_int_get_default_index(ptr, prop, index);
+ int value = RNA_property_int_get_default_index(ptr, prop, index);
RNA_property_int_set_index(ptr, prop, index, value);
}
}
else {
- int value= RNA_property_int_get_default(ptr, prop);
+ int value = RNA_property_int_get_default(ptr, prop);
RNA_property_int_set(ptr, prop, value);
}
return 1;
case PROP_FLOAT:
if (len) {
if (index == -1) {
- float *tmparray= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
+ float *tmparray = MEM_callocN(sizeof(float)*len, "reset_defaults - float");
RNA_property_float_get_default_array(ptr, prop, tmparray);
RNA_property_float_set_array(ptr, prop, tmparray);
@@ -5419,25 +5419,25 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
MEM_freeN(tmparray);
}
else {
- float value= RNA_property_float_get_default_index(ptr, prop, index);
+ float value = RNA_property_float_get_default_index(ptr, prop, index);
RNA_property_float_set_index(ptr, prop, index, value);
}
}
else {
- float value= RNA_property_float_get_default(ptr, prop);
+ float value = RNA_property_float_get_default(ptr, prop);
RNA_property_float_set(ptr, prop, value);
}
return 1;
case PROP_ENUM:
{
- int value= RNA_property_enum_get_default(ptr, prop);
+ int value = RNA_property_enum_get_default(ptr, prop);
RNA_property_enum_set(ptr, prop, value);
return 1;
}
case PROP_STRING:
{
- char *value= RNA_property_string_get_default_alloc(ptr, prop, NULL, 0);
+ char *value = RNA_property_string_get_default_alloc(ptr, prop, NULL, 0);
RNA_property_string_set(ptr, prop, value);
MEM_freeN(value);
return 1;
@@ -5445,13 +5445,13 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
case PROP_POINTER:
{
- PointerRNA value= RNA_property_pointer_get_default(ptr, prop);
+ PointerRNA value = RNA_property_pointer_get_default(ptr, prop);
RNA_property_pointer_set(ptr, prop, value);
return 1;
}
- default:
- // FIXME: are there still any cases that haven't been handled? comment out "default" block to check :)
+ default:
+ /* FIXME: are there still any cases that haven't been handled? comment out "default" block to check :) */
return 0;
}
}
@@ -5461,10 +5461,10 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
int len, fromlen;
/* get the length of the array to work with */
- len= RNA_property_array_length(ptr, prop);
- fromlen= RNA_property_array_length(ptr, prop);
+ len = RNA_property_array_length(ptr, prop);
+ fromlen = RNA_property_array_length(ptr, prop);
- if(len != fromlen)
+ if (len != fromlen)
return 0;
/* get and set the default values as appropriate for the various types */
@@ -5472,7 +5472,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
case PROP_BOOLEAN:
if (len) {
if (index == -1) {
- int *tmparray= MEM_callocN(sizeof(int)*len, "copy - boolean");
+ int *tmparray = MEM_callocN(sizeof(int)*len, "copy - boolean");
RNA_property_boolean_get_array(fromptr, prop, tmparray);
RNA_property_boolean_set_array(ptr, prop, tmparray);
@@ -5480,19 +5480,19 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
MEM_freeN(tmparray);
}
else {
- int value= RNA_property_boolean_get_index(fromptr, prop, index);
+ int value = RNA_property_boolean_get_index(fromptr, prop, index);
RNA_property_boolean_set_index(ptr, prop, index, value);
}
}
else {
- int value= RNA_property_boolean_get(fromptr, prop);
+ int value = RNA_property_boolean_get(fromptr, prop);
RNA_property_boolean_set(ptr, prop, value);
}
return 1;
case PROP_INT:
if (len) {
if (index == -1) {
- int *tmparray= MEM_callocN(sizeof(int)*len, "copy - int");
+ int *tmparray = MEM_callocN(sizeof(int)*len, "copy - int");
RNA_property_int_get_array(fromptr, prop, tmparray);
RNA_property_int_set_array(ptr, prop, tmparray);
@@ -5500,19 +5500,19 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
MEM_freeN(tmparray);
}
else {
- int value= RNA_property_int_get_index(fromptr, prop, index);
+ int value = RNA_property_int_get_index(fromptr, prop, index);
RNA_property_int_set_index(ptr, prop, index, value);
}
}
else {
- int value= RNA_property_int_get(fromptr, prop);
+ int value = RNA_property_int_get(fromptr, prop);
RNA_property_int_set(ptr, prop, value);
}
return 1;
case PROP_FLOAT:
if (len) {
if (index == -1) {
- float *tmparray= MEM_callocN(sizeof(float)*len, "copy - float");
+ float *tmparray = MEM_callocN(sizeof(float)*len, "copy - float");
RNA_property_float_get_array(fromptr, prop, tmparray);
RNA_property_float_set_array(ptr, prop, tmparray);
@@ -5520,30 +5520,30 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
MEM_freeN(tmparray);
}
else {
- float value= RNA_property_float_get_index(fromptr, prop, index);
+ float value = RNA_property_float_get_index(fromptr, prop, index);
RNA_property_float_set_index(ptr, prop, index, value);
}
}
else {
- float value= RNA_property_float_get(fromptr, prop);
+ float value = RNA_property_float_get(fromptr, prop);
RNA_property_float_set(ptr, prop, value);
}
return 1;
case PROP_ENUM:
{
- int value= RNA_property_enum_get(fromptr, prop);
+ int value = RNA_property_enum_get(fromptr, prop);
RNA_property_enum_set(ptr, prop, value);
return 1;
}
case PROP_POINTER:
{
- PointerRNA value= RNA_property_pointer_get(fromptr, prop);
+ PointerRNA value = RNA_property_pointer_get(fromptr, prop);
RNA_property_pointer_set(ptr, prop, value);
return 1;
}
case PROP_STRING:
{
- char *value= RNA_property_string_get_alloc(fromptr, prop, NULL, 0, NULL);
+ char *value = RNA_property_string_get_alloc(fromptr, prop, NULL, 0, NULL);
RNA_property_string_set(ptr, prop, value);
MEM_freeN(value);
return 1;