Fix T56120: bad property access (from 2.8)

Thanks to @brita_ for the fix.
This commit is contained in:
Campbell Barton 2018-07-29 12:09:00 +10:00
parent b747524144
commit 018c9af446
Notes: blender-bot 2023-02-14 10:14:07 +01:00
Referenced by issue #56120, Crash on "Import ..."  any light type (matcap, world hdri, env hdri)
1 changed files with 9 additions and 5 deletions

View File

@ -80,17 +80,21 @@ static void file_panel_operator(const bContext *C, Panel *pa)
UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
/* Hack: temporary hide.*/
const char *hide[3] = {"filepath", "directory", "filename"};
const char *hide[] = {"filepath", "directory", "filename", "files"};
for (int i = 0; i < ARRAY_SIZE(hide); i++) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
RNA_def_property_flag(prop, PROP_HIDDEN);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]);
if (prop) {
RNA_def_property_flag(prop, PROP_HIDDEN);
}
}
uiTemplateOperatorPropertyButs(C, pa->layout, op, '\0', UI_TEMPLATE_OP_PROPS_SHOW_EMPTY);
for (int i = 0; i < ARRAY_SIZE(hide); i++) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
RNA_def_property_clear_flag(prop, PROP_HIDDEN);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]);
if (prop) {
RNA_def_property_clear_flag(prop, PROP_HIDDEN);
}
}
UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL);