Fix #119854: Avoid unsetting HIDDEN flag to properties #119881

Manually merged
Campbell Barton merged 3 commits from guishe/blender:fix-hidden-override into main 2024-04-20 07:01:17 +02:00
1 changed files with 5 additions and 2 deletions

View File

@ -68,10 +68,13 @@ static void file_panel_operator(const bContext *C, Panel *panel)
/* Hack: temporary hide. */
const char *hide[] = {"filepath", "files", "directory", "filename"};
/* Track overridden properties with #PROP_HIDDEN flag. */
bool hidden_override[ARRAY_SIZE(hide)]{false};
guishe marked this conversation as resolved Outdated

Replace 4 with ARRAY_SIZE(hide) to avoid errors in the future.

Replace `4` with `ARRAY_SIZE(hide)` to avoid errors in the future.
for (int i = 0; i < ARRAY_SIZE(hide); i++) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]);
if (prop) {
if (prop && !(RNA_property_flag(prop) & PROP_HIDDEN)) {
RNA_def_property_flag(prop, PROP_HIDDEN);
hidden_override[i] = true;
}
}
@ -81,7 +84,7 @@ static void file_panel_operator(const bContext *C, Panel *panel)
/* Hack: temporary hide. */
for (int i = 0; i < ARRAY_SIZE(hide); i++) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]);
if (prop) {
if (prop && hidden_override[i]) {
RNA_def_property_clear_flag(prop, PROP_HIDDEN);
}
}