replace RNA_property_array_length with RNA_property_array_check where the length of the array is only used to check if the property is an array or not.
(this isnt reliable since arrays can be zero length).
This commit is contained in:
@@ -1652,19 +1652,19 @@ static void nlaevalchan_value_init(NlaEvalChannel *nec)
|
|||||||
*/
|
*/
|
||||||
switch (RNA_property_type(prop)) {
|
switch (RNA_property_type(prop)) {
|
||||||
case PROP_BOOLEAN:
|
case PROP_BOOLEAN:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
nec->value = (float)RNA_property_boolean_get_default_index(ptr, prop, index);
|
nec->value = (float)RNA_property_boolean_get_default_index(ptr, prop, index);
|
||||||
else
|
else
|
||||||
nec->value = (float)RNA_property_boolean_get_default(ptr, prop);
|
nec->value = (float)RNA_property_boolean_get_default(ptr, prop);
|
||||||
break;
|
break;
|
||||||
case PROP_INT:
|
case PROP_INT:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
nec->value = (float)RNA_property_int_get_default_index(ptr, prop, index);
|
nec->value = (float)RNA_property_int_get_default_index(ptr, prop, index);
|
||||||
else
|
else
|
||||||
nec->value = (float)RNA_property_int_get_default(ptr, prop);
|
nec->value = (float)RNA_property_int_get_default(ptr, prop);
|
||||||
break;
|
break;
|
||||||
case PROP_FLOAT:
|
case PROP_FLOAT:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
nec->value = RNA_property_float_get_default_index(ptr, prop, index);
|
nec->value = RNA_property_float_get_default_index(ptr, prop, index);
|
||||||
else
|
else
|
||||||
nec->value = RNA_property_float_get_default(ptr, prop);
|
nec->value = RNA_property_float_get_default(ptr, prop);
|
||||||
@@ -2071,19 +2071,19 @@ void nladata_flush_channels(ListBase *channels)
|
|||||||
/* write values - see animsys_write_rna_setting() to sync the code */
|
/* write values - see animsys_write_rna_setting() to sync the code */
|
||||||
switch (RNA_property_type(prop)) {
|
switch (RNA_property_type(prop)) {
|
||||||
case PROP_BOOLEAN:
|
case PROP_BOOLEAN:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
RNA_property_boolean_set_index(ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
|
RNA_property_boolean_set_index(ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
|
||||||
else
|
else
|
||||||
RNA_property_boolean_set(ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
|
RNA_property_boolean_set(ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
|
||||||
break;
|
break;
|
||||||
case PROP_INT:
|
case PROP_INT:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
RNA_property_int_set_index(ptr, prop, array_index, (int)value);
|
RNA_property_int_set_index(ptr, prop, array_index, (int)value);
|
||||||
else
|
else
|
||||||
RNA_property_int_set(ptr, prop, (int)value);
|
RNA_property_int_set(ptr, prop, (int)value);
|
||||||
break;
|
break;
|
||||||
case PROP_FLOAT:
|
case PROP_FLOAT:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
RNA_property_float_set_index(ptr, prop, array_index, value);
|
RNA_property_float_set_index(ptr, prop, array_index, value);
|
||||||
else
|
else
|
||||||
RNA_property_float_set(ptr, prop, value);
|
RNA_property_float_set(ptr, prop, value);
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
|||||||
propname = RNA_property_ui_name(prop);
|
propname = RNA_property_ui_name(prop);
|
||||||
|
|
||||||
/* Array Index - only if applicable */
|
/* Array Index - only if applicable */
|
||||||
if (RNA_property_array_length(&ptr, prop)) {
|
if (RNA_property_array_check(prop)) {
|
||||||
char c = RNA_property_array_item_char(prop, fcu->array_index);
|
char c = RNA_property_array_item_char(prop, fcu->array_index);
|
||||||
|
|
||||||
/* we need to write the index to a temp buffer (in py syntax) */
|
/* we need to write the index to a temp buffer (in py syntax) */
|
||||||
|
|||||||
@@ -508,19 +508,19 @@ static float setting_get_rna_value(PointerRNA *ptr, PropertyRNA *prop, int index
|
|||||||
|
|
||||||
switch (RNA_property_type(prop)) {
|
switch (RNA_property_type(prop)) {
|
||||||
case PROP_BOOLEAN:
|
case PROP_BOOLEAN:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
value = (float)RNA_property_boolean_get_index(ptr, prop, index);
|
value = (float)RNA_property_boolean_get_index(ptr, prop, index);
|
||||||
else
|
else
|
||||||
value = (float)RNA_property_boolean_get(ptr, prop);
|
value = (float)RNA_property_boolean_get(ptr, prop);
|
||||||
break;
|
break;
|
||||||
case PROP_INT:
|
case PROP_INT:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
value = (float)RNA_property_int_get_index(ptr, prop, index);
|
value = (float)RNA_property_int_get_index(ptr, prop, index);
|
||||||
else
|
else
|
||||||
value = (float)RNA_property_int_get(ptr, prop);
|
value = (float)RNA_property_int_get(ptr, prop);
|
||||||
break;
|
break;
|
||||||
case PROP_FLOAT:
|
case PROP_FLOAT:
|
||||||
if (RNA_property_array_length(ptr, prop))
|
if (RNA_property_array_check(prop))
|
||||||
value = RNA_property_float_get_index(ptr, prop, index);
|
value = RNA_property_float_get_index(ptr, prop, index);
|
||||||
else
|
else
|
||||||
value = RNA_property_float_get(ptr, prop);
|
value = RNA_property_float_get(ptr, prop);
|
||||||
|
|||||||
@@ -1646,19 +1646,19 @@ void ui_set_but_val(uiBut *but, double value)
|
|||||||
if (RNA_property_editable(&but->rnapoin, prop)) {
|
if (RNA_property_editable(&but->rnapoin, prop)) {
|
||||||
switch (RNA_property_type(prop)) {
|
switch (RNA_property_type(prop)) {
|
||||||
case PROP_BOOLEAN:
|
case PROP_BOOLEAN:
|
||||||
if (RNA_property_array_length(&but->rnapoin, prop))
|
if (RNA_property_array_check(prop))
|
||||||
RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
|
RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
|
||||||
else
|
else
|
||||||
RNA_property_boolean_set(&but->rnapoin, prop, value);
|
RNA_property_boolean_set(&but->rnapoin, prop, value);
|
||||||
break;
|
break;
|
||||||
case PROP_INT:
|
case PROP_INT:
|
||||||
if (RNA_property_array_length(&but->rnapoin, prop))
|
if (RNA_property_array_check(prop))
|
||||||
RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
|
RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
|
||||||
else
|
else
|
||||||
RNA_property_int_set(&but->rnapoin, prop, (int)value);
|
RNA_property_int_set(&but->rnapoin, prop, (int)value);
|
||||||
break;
|
break;
|
||||||
case PROP_FLOAT:
|
case PROP_FLOAT:
|
||||||
if (RNA_property_array_length(&but->rnapoin, prop))
|
if (RNA_property_array_check(prop))
|
||||||
RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
|
RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
|
||||||
else
|
else
|
||||||
RNA_property_float_set(&but->rnapoin, prop, value);
|
RNA_property_float_set(&but->rnapoin, prop, value);
|
||||||
@@ -3027,7 +3027,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
|
|||||||
but->rnapoin = *ptr;
|
but->rnapoin = *ptr;
|
||||||
but->rnaprop = prop;
|
but->rnaprop = prop;
|
||||||
|
|
||||||
if (RNA_property_array_length(&but->rnapoin, but->rnaprop))
|
if (RNA_property_array_check(but->rnaprop))
|
||||||
but->rnaindex = index;
|
but->rnaindex = index;
|
||||||
else
|
else
|
||||||
but->rnaindex = 0;
|
but->rnaindex = 0;
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0) {
|
if (RNA_property_array_check(but->rnaprop) != 0) {
|
||||||
if (but->rnaindex == -1) {
|
if (but->rnaindex == -1) {
|
||||||
if (G.debug & G_DEBUG)
|
if (G.debug & G_DEBUG)
|
||||||
printf("ERROR: create expression failed - can't create expression for entire array\n");
|
printf("ERROR: create expression failed - can't create expression for entire array\n");
|
||||||
|
|||||||
@@ -1102,7 +1102,7 @@ static void tree_element_to_path(TreeElement *te, TreeStoreElem *tselem,
|
|||||||
/* item is part of an array, so must set the array_index */
|
/* item is part of an array, so must set the array_index */
|
||||||
*array_index = te->index;
|
*array_index = te->index;
|
||||||
}
|
}
|
||||||
else if (RNA_property_array_length(ptr, prop)) {
|
else if (RNA_property_array_check(prop)) {
|
||||||
/* entire array was selected, so keyframe all */
|
/* entire array was selected, so keyframe all */
|
||||||
*flag |= KSP_FLAG_WHOLE_ARRAY;
|
*flag |= KSP_FLAG_WHOLE_ARRAY;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user