Revert "Cleanup: consistently use rnaindex -1 to mean the no or entire array"
This reverts commit 8ed65fe6de.
Fix #108553: Alt + value change doesn't work for various inputs
Fix #108621: Driven values are no longer marked in purple
This commit is contained in:
@@ -2552,7 +2552,7 @@ double ui_but_value_get(uiBut *but)
|
||||
if (but->rnaprop) {
|
||||
PropertyRNA *prop = but->rnaprop;
|
||||
|
||||
BLI_assert(RNA_property_array_check(prop) ? but->rnaindex != -1 : true);
|
||||
BLI_assert(but->rnaindex != -1);
|
||||
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_BOOLEAN:
|
||||
@@ -4722,7 +4722,7 @@ static uiBut *ui_def_but_rna(uiBlock *block,
|
||||
but->rnaindex = index;
|
||||
}
|
||||
else {
|
||||
but->rnaindex = -1;
|
||||
but->rnaindex = 0;
|
||||
}
|
||||
|
||||
if (icon) {
|
||||
|
||||
@@ -8859,7 +8859,7 @@ uiBut *UI_region_active_but_prop_get(const ARegion *region,
|
||||
else {
|
||||
memset(r_ptr, 0, sizeof(*r_ptr));
|
||||
*r_prop = nullptr;
|
||||
*r_index = -1;
|
||||
*r_index = 0;
|
||||
}
|
||||
|
||||
return activebut;
|
||||
|
||||
@@ -240,8 +240,7 @@ struct uiBut {
|
||||
/* RNA data */
|
||||
PointerRNA rnapoin = {};
|
||||
PropertyRNA *rnaprop = nullptr;
|
||||
/** The index (arrays only), otherwise set to -1. */
|
||||
int rnaindex = -1;
|
||||
int rnaindex = 0;
|
||||
|
||||
/* Operator data */
|
||||
wmOperatorType *optype = nullptr;
|
||||
|
||||
@@ -3172,7 +3172,8 @@ void uiItemDecoratorR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop,
|
||||
/* Decorators have own RNA data, using the normal #uiBut RNA members has many side-effects. */
|
||||
but->decorated_rnapoin = *ptr;
|
||||
but->decorated_rnaprop = prop;
|
||||
but->decorated_rnaindex = (!is_array) ? -1 : (is_expand) ? i : index;
|
||||
/* ui_def_but_rna() sets non-array buttons to have a RNA index of 0. */
|
||||
but->decorated_rnaindex = (!is_array || is_expand) ? i : index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6739,7 +6739,7 @@ void uiTemplateComponentMenu(uiLayout *layout,
|
||||
/* set rna directly, uiDefBlockButN doesn't do this */
|
||||
but->rnapoin = *ptr;
|
||||
but->rnaprop = RNA_struct_find_property(ptr, propname);
|
||||
but->rnaindex = -1;
|
||||
but->rnaindex = 0;
|
||||
|
||||
UI_block_align_end(block);
|
||||
}
|
||||
|
||||
@@ -547,6 +547,11 @@ static eContextResult screen_ctx_property(const bContext *C, bContextDataResult
|
||||
int index;
|
||||
|
||||
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
|
||||
/* UI_context_active_but_prop_get returns an index of 0 if the property is not
|
||||
* an array, but other functions expect -1 for non-arrays. */
|
||||
if (!RNA_property_array_check(prop)) {
|
||||
index = -1;
|
||||
}
|
||||
|
||||
CTX_data_type_set(result, CTX_DATA_TYPE_PROPERTY);
|
||||
CTX_data_pointer_set_ptr(result, &ptr);
|
||||
|
||||
Reference in New Issue
Block a user