forked from bartvdbraak/blender
add in asserts for when array/non array RNA funcions are used incorrectly, would have made previous fix a lot easier to find.
also remove unused argument from RNA_property_array_check.
This commit is contained in:
parent
62fdee3d8a
commit
540f0c64b5
@ -1002,7 +1002,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
|
|||||||
|
|
||||||
/* get property to read from, and get value as appropriate */
|
/* get property to read from, and get value as appropriate */
|
||||||
if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
|
if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
|
||||||
if(RNA_property_array_check(&ptr, prop)) {
|
if(RNA_property_array_check(prop)) {
|
||||||
/* array */
|
/* array */
|
||||||
if (index < RNA_property_array_length(&ptr, prop)) {
|
if (index < RNA_property_array_length(&ptr, prop)) {
|
||||||
switch (RNA_property_type(prop)) {
|
switch (RNA_property_type(prop)) {
|
||||||
|
@ -3243,7 +3243,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
|
|||||||
int driven, len=1, index;
|
int driven, len=1, index;
|
||||||
prop = (PropertyRNA *)link;
|
prop = (PropertyRNA *)link;
|
||||||
|
|
||||||
if (RNA_property_array_check(&ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
len = RNA_property_array_length(&ptr, prop);
|
len = RNA_property_array_length(&ptr, prop);
|
||||||
|
|
||||||
for (index=0; index<len; index++) {
|
for (index=0; index<len; index++) {
|
||||||
@ -3261,7 +3261,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
|
|||||||
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
|
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
|
||||||
prop = RNA_struct_find_property(&ptr, "default_value");
|
prop = RNA_struct_find_property(&ptr, "default_value");
|
||||||
|
|
||||||
if (RNA_property_array_check(&ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
len = RNA_property_array_length(&ptr, prop);
|
len = RNA_property_array_length(&ptr, prop);
|
||||||
|
|
||||||
for (index=0; index<len; index++) {
|
for (index=0; index<len; index++) {
|
||||||
|
@ -1000,7 +1000,7 @@ static short pose_propagate_get_refVal (Object *ob, FCurve *fcu, float *value)
|
|||||||
|
|
||||||
/* resolve the property... */
|
/* resolve the property... */
|
||||||
if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) {
|
if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) {
|
||||||
if (RNA_property_array_check(&ptr, prop)) {
|
if (RNA_property_array_check(prop)) {
|
||||||
/* array */
|
/* array */
|
||||||
if (fcu->array_index < RNA_property_array_length(&ptr, prop)) {
|
if (fcu->array_index < RNA_property_array_length(&ptr, prop)) {
|
||||||
found= TRUE;
|
found= TRUE;
|
||||||
|
@ -976,7 +976,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
|||||||
|
|
||||||
/* retrieve info */
|
/* retrieve info */
|
||||||
type= RNA_property_type(prop);
|
type= RNA_property_type(prop);
|
||||||
is_array= RNA_property_array_check(ptr, prop);
|
is_array= RNA_property_array_check(prop);
|
||||||
len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
|
len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
|
||||||
|
|
||||||
/* set name and icon */
|
/* set name and icon */
|
||||||
|
@ -143,7 +143,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper
|
|||||||
|
|
||||||
if(label_align != '\0') {
|
if(label_align != '\0') {
|
||||||
PropertyType type = RNA_property_type(prop);
|
PropertyType type = RNA_property_type(prop);
|
||||||
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(ptr, prop));
|
int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
|
||||||
|
|
||||||
name= RNA_property_ui_name(prop);
|
name= RNA_property_ui_name(prop);
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ int RNA_property_flag(PropertyRNA *prop);
|
|||||||
void *RNA_property_py_data_get(PropertyRNA *prop);
|
void *RNA_property_py_data_get(PropertyRNA *prop);
|
||||||
|
|
||||||
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop);
|
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop);
|
int RNA_property_array_check(PropertyRNA *prop);
|
||||||
int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension);
|
int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dimension);
|
||||||
int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]);
|
int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[]);
|
||||||
char RNA_property_array_item_char(PropertyRNA *prop, int index);
|
char RNA_property_array_item_char(PropertyRNA *prop, int index);
|
||||||
|
@ -288,7 +288,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_ensure_property_array_check(PointerRNA *UNUSED(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;
|
return (prop->getlength || prop->totarraylength) ? 1:0;
|
||||||
@ -765,9 +765,9 @@ int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
return rna_ensure_property_array_length(ptr, prop);
|
return rna_ensure_property_array_length(ptr, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop)
|
int RNA_property_array_check(PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
return rna_ensure_property_array_check(ptr, prop);
|
return rna_ensure_property_array_check(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* used by BPY to make an array from the python object */
|
/* used by BPY to make an array from the python object */
|
||||||
@ -1399,6 +1399,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
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);
|
return IDP_Int(idprop);
|
||||||
@ -1414,6 +1415,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) == 0);
|
||||||
|
|
||||||
/* just incase other values are passed */
|
/* just incase other values are passed */
|
||||||
if(value) value= 1;
|
if(value) value= 1;
|
||||||
@ -1440,6 +1442,7 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
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))) {
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
@ -1463,6 +1466,7 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
|
|||||||
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_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);
|
RNA_property_boolean_get_array(ptr, prop, tmp);
|
||||||
@ -1486,6 +1490,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
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))) {
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
@ -1519,6 +1524,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
|
|||||||
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_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);
|
RNA_property_boolean_get_array(ptr, prop, tmp);
|
||||||
@ -1541,6 +1547,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
|
|||||||
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) == 0);
|
||||||
|
|
||||||
return bprop->defaultvalue;
|
return bprop->defaultvalue;
|
||||||
}
|
}
|
||||||
@ -1550,6 +1557,7 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA
|
|||||||
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) != 0);
|
||||||
|
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
values[0]= bprop->defaultvalue;
|
values[0]= bprop->defaultvalue;
|
||||||
@ -1565,6 +1573,7 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
|
|||||||
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_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);
|
RNA_property_boolean_get_default_array(ptr, prop, tmp);
|
||||||
@ -1588,6 +1597,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
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);
|
return IDP_Int(idprop);
|
||||||
@ -1603,6 +1613,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) == 0);
|
||||||
/* useful to check on bad values but set function should clamp */
|
/* useful to check on bad values but set function should clamp */
|
||||||
/* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */
|
/* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */
|
||||||
|
|
||||||
@ -1628,6 +1639,7 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
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))) {
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
@ -1688,6 +1700,7 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|||||||
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_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);
|
RNA_property_int_get_array(ptr, prop, tmp);
|
||||||
@ -1711,6 +1724,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
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))) {
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
@ -1744,6 +1758,7 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i
|
|||||||
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_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);
|
RNA_property_int_get_array(ptr, prop, tmp);
|
||||||
@ -1772,6 +1787,7 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr
|
|||||||
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
BLI_assert(RNA_property_type(prop) == PROP_INT);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) != 0);
|
||||||
|
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
values[0]= iprop->defaultvalue;
|
values[0]= iprop->defaultvalue;
|
||||||
@ -1808,6 +1824,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
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=rna_idproperty_check(&prop, ptr))) {
|
||||||
if(idprop->type == IDP_FLOAT)
|
if(idprop->type == IDP_FLOAT)
|
||||||
@ -1827,6 +1844,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
|
|||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) == 0);
|
||||||
/* useful to check on bad values but set function should clamp */
|
/* useful to check on bad values but set function should clamp */
|
||||||
/* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */
|
/* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */
|
||||||
|
|
||||||
@ -1858,6 +1876,7 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
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=rna_idproperty_check(&prop, ptr))) {
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
@ -1923,6 +1942,7 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
|
|||||||
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_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);
|
RNA_property_float_get_array(ptr, prop, tmp);
|
||||||
@ -1948,6 +1968,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
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=rna_idproperty_check(&prop, ptr))) {
|
||||||
if(prop->arraydimension == 0) {
|
if(prop->arraydimension == 0) {
|
||||||
@ -1991,6 +2012,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index,
|
|||||||
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_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);
|
RNA_property_float_get_array(ptr, prop, tmp);
|
||||||
@ -2013,6 +2035,7 @@ 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_type(prop) == PROP_FLOAT);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) == 0);
|
||||||
|
|
||||||
return fprop->defaultvalue;
|
return fprop->defaultvalue;
|
||||||
}
|
}
|
||||||
@ -2022,6 +2045,7 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *
|
|||||||
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
||||||
|
|
||||||
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
|
||||||
|
BLI_assert(RNA_property_array_check(prop) != 0);
|
||||||
|
|
||||||
if(prop->arraydimension == 0)
|
if(prop->arraydimension == 0)
|
||||||
values[0]= fprop->defaultvalue;
|
values[0]= fprop->defaultvalue;
|
||||||
@ -2037,6 +2061,7 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
|
|||||||
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_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);
|
RNA_property_float_get_default_array(ptr, prop, tmp);
|
||||||
|
@ -856,7 +856,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
|
|||||||
if(type==PROP_COLLECTION) {
|
if(type==PROP_COLLECTION) {
|
||||||
len= pyrna_prop_collection_length(self);
|
len= pyrna_prop_collection_length(self);
|
||||||
}
|
}
|
||||||
else if (RNA_property_array_check(&self->ptr, self->prop)) {
|
else if (RNA_property_array_check(self->prop)) {
|
||||||
len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
|
len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1224,7 +1224,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
int type= RNA_property_type(prop);
|
int type= RNA_property_type(prop);
|
||||||
|
|
||||||
if (RNA_property_array_check(ptr, prop)) {
|
if (RNA_property_array_check(prop)) {
|
||||||
return pyrna_py_from_array(ptr, prop);
|
return pyrna_py_from_array(ptr, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1369,7 +1369,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
|||||||
int type= RNA_property_type(prop);
|
int type= RNA_property_type(prop);
|
||||||
|
|
||||||
|
|
||||||
if (RNA_property_array_check(ptr, prop)) {
|
if (RNA_property_array_check(prop)) {
|
||||||
/* done getting the length */
|
/* done getting the length */
|
||||||
if(pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) {
|
if(pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -4088,7 +4088,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
|
|||||||
int type= RNA_property_type(prop);
|
int type= RNA_property_type(prop);
|
||||||
int flag= RNA_property_flag(prop);
|
int flag= RNA_property_flag(prop);
|
||||||
|
|
||||||
if(RNA_property_array_check(ptr, prop)) {
|
if(RNA_property_array_check(prop)) {
|
||||||
int a, len;
|
int a, len;
|
||||||
|
|
||||||
if (flag & PROP_DYNAMIC) {
|
if (flag & PROP_DYNAMIC) {
|
||||||
@ -5519,7 +5519,7 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
{
|
{
|
||||||
BPy_PropertyRNA *pyrna;
|
BPy_PropertyRNA *pyrna;
|
||||||
|
|
||||||
if (RNA_property_array_check(ptr, prop) == 0) {
|
if (RNA_property_array_check(prop) == 0) {
|
||||||
PyTypeObject *type;
|
PyTypeObject *type;
|
||||||
|
|
||||||
if (RNA_property_type(prop) != PROP_COLLECTION) {
|
if (RNA_property_type(prop) != PROP_COLLECTION) {
|
||||||
|
@ -107,7 +107,7 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RNA_property_array_check(&r_ptr, prop) == 0) {
|
if(RNA_property_array_check(prop) == 0) {
|
||||||
if((*index) == -1) {
|
if((*index) == -1) {
|
||||||
*index= 0;
|
*index= 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user