diff --git a/source/blender/makesrna/intern/makesrna.cc b/source/blender/makesrna/intern/makesrna.cc index 719898b821b..e66c23f9e0a 100644 --- a/source/blender/makesrna/intern/makesrna.cc +++ b/source/blender/makesrna/intern/makesrna.cc @@ -2180,6 +2180,17 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) case PROP_ENUM: { EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; + if (dp->enumbitflags && eprop->item_fn && + !(eprop->item != rna_enum_dummy_NULL_items || eprop->set || eprop->set_ex)) + { + CLOG_ERROR(&LOG, + "%s.%s, bitflag enum should not define an `item` callback function, unless " + "they also define a static list of items, or a custom `set` callback.", + srna->identifier, + prop->identifier); + DefRNA.error = true; + } + if (!(prop->flag & PROP_EDITABLE) && (eprop->set || eprop->set_ex)) { CLOG_ERROR(&LOG, "%s.%s, is read-only but has defines a \"set\" callback.", @@ -4210,10 +4221,11 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr else { if (!defaultfound && !(eprop->item_fn && eprop->item == rna_enum_dummy_NULL_items)) { CLOG_ERROR(&LOG, - "%s%s.%s, enum default is not in items.", + "%s%s.%s, enum default '%d' is not in items.", srna->identifier, errnest, - prop->identifier); + prop->identifier, + eprop->defaultvalue); DefRNA.error = true; } } diff --git a/source/blender/makesrna/intern/rna_define.cc b/source/blender/makesrna/intern/rna_define.cc index d5d524e5916..69ecabc8291 100644 --- a/source/blender/makesrna/intern/rna_define.cc +++ b/source/blender/makesrna/intern/rna_define.cc @@ -2965,17 +2965,6 @@ void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, if (dp) { dp->enumbitflags = 1; - -#ifndef RNA_RUNTIME - int defaultvalue_mask = 0; - EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; - for (int i = 0; i < eprop->totitem; i++) { - if (eprop->item[i].identifier[0]) { - defaultvalue_mask |= eprop->defaultvalue & eprop->item[i].value; - } - } - eprop->defaultvalue = defaultvalue_mask; -#endif } } diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 9dc3889e3d0..a8b4918372b 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -5371,6 +5371,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop = RNA_def_property(srna, "header_align", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, header_align_items); RNA_def_property_enum_bitflag_sdna(prop, nullptr, "uiflag"); + RNA_def_property_enum_default(prop, USER_HEADER_FROM_PREF | USER_HEADER_BOTTOM); RNA_def_property_ui_text(prop, "Header Position", "Default header position for new space-types"); RNA_def_property_update(prop, 0, "rna_userdef_screen_update_header_default");