Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_define.c
| Show First 20 Lines • Show All 960 Lines • ▼ Show 20 Lines | void RNA_def_struct_flag(StructRNA *srna, int flag) | ||||
| srna->flag |= flag; | srna->flag |= flag; | ||||
| } | } | ||||
| void RNA_def_struct_clear_flag(StructRNA *srna, int flag) | void RNA_def_struct_clear_flag(StructRNA *srna, int flag) | ||||
| { | { | ||||
| srna->flag &= ~flag; | srna->flag &= ~flag; | ||||
| } | } | ||||
| void RNA_def_struct_property_tags(StructRNA *srna, EnumPropertyItem *prop_tag_defines) | |||||
| { | |||||
| srna->prop_tag_defines = prop_tag_defines; | |||||
| } | |||||
| void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) | void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) | ||||
| { | { | ||||
| if (!DefRNA.preprocess) { | if (!DefRNA.preprocess) { | ||||
| fprintf(stderr, "%s: only during preprocessing.\n", __func__); | fprintf(stderr, "%s: only during preprocessing.\n", __func__); | ||||
| return; | return; | ||||
| } | } | ||||
| if (refine) srna->refine = (StructRefineFunc)refine; | if (refine) srna->refine = (StructRefineFunc)refine; | ||||
| ▲ Show 20 Lines • Show All 298 Lines • ▼ Show 20 Lines | void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag) | ||||
| prop->flag |= flag; | prop->flag |= flag; | ||||
| } | } | ||||
| void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag) | void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag) | ||||
| { | { | ||||
| prop->flag &= ~flag; | prop->flag &= ~flag; | ||||
| } | } | ||||
| /** | |||||
| * Add the property-tags passed as \a tags to \a prop (if valid). | |||||
| * | |||||
| * \note Multiple tags can be set by passing them within \a tags (using bitflags). | |||||
| */ | |||||
| void RNA_def_property_tags(PropertyRNA *prop, int tags) | |||||
| { | |||||
| const StructRNA *srna = DefRNA.laststruct; | |||||
| int tags_remaining = tags; | |||||
| for (const EnumPropertyItem *tags_define = srna->prop_tag_defines; | |||||
| tags_define->identifier && (tags_remaining > 0); | |||||
| tags_define++) | |||||
| { | |||||
| if ((tags & tags_define->value) == tags_define->value) { // found a valid tag value | |||||
| tags_remaining &= ~tags_define->value; | |||||
| prop->tags |= tags_define->value; | |||||
| } | |||||
| } | |||||
| if ((tags_remaining > 0) && (tags > 0)) { | |||||
| fprintf(stderr, "%s: Property tag(s) of value %d not found in struct type \"%s\" (set for \"%s.%s\").\n", | |||||
| __func__, tags, srna->identifier, srna->identifier, prop->identifier); | |||||
| DefRNA.error = 1; | |||||
| return; | |||||
| } | |||||
| } | |||||
| void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter) | void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter) | ||||
| { | { | ||||
| prop->flag |= flag_property; | prop->flag |= flag_property; | ||||
| prop->flag_parameter |= flag_parameter; | prop->flag_parameter |= flag_parameter; | ||||
| } | } | ||||
| void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter) | void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 2,288 Lines • Show Last 20 Lines | |||||