UI: enable string properties for alt-click buttons for multiple objects #106599

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:106591 into main 2023-04-11 10:28:03 +02:00
1 changed files with 12 additions and 0 deletions

View File

@ -1918,6 +1918,7 @@ static void ui_selectcontext_apply(bContext *C,
bool b;
int i;
float f;
char *str;
PointerRNA p;
} delta, min, max;
@ -1950,6 +1951,10 @@ static void ui_selectcontext_apply(bContext *C,
/* Not a delta in fact. */
delta.p = RNA_property_pointer_get(&but->rnapoin, prop);
}
else if (rna_type == PROP_STRING) {
/* Not a delta in fact. */
delta.str = RNA_property_string_get_alloc(&but->rnapoin, prop, nullptr, 0, nullptr);
lichtwerk marked this conversation as resolved Outdated

The size of the string isn't known, this could easily overrun the buffer length.

Using RNA_property_string_get_alloc avoids the problem.

The size of the string isn't known, this could easily overrun the buffer length. Using `RNA_property_string_get_alloc` avoids the problem.
}
# ifdef USE_ALLSELECT_LAYER_HACK
/* make up for not having 'handle_layer_buttons' */
@ -2023,9 +2028,16 @@ static void ui_selectcontext_apply(bContext *C,
const PointerRNA other_value = delta.p;
RNA_property_pointer_set(&lptr, lprop, other_value, nullptr);
}
else if (rna_type == PROP_STRING) {
const char *other_value = delta.str;
RNA_property_string_set(&lptr, lprop, other_value);
}
RNA_property_update(C, &lptr, prop);
}
if (rna_type == PROP_STRING) {
MEM_freeN(delta.str);
}
}
}