Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2017-11-23 15:58:05 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-11-23 15:58:05 +0300
commit60cbdb01527e08f9036eb3d577da1c44a9ce30c7 (patch)
tree555662f7568a87840d5cd5e57ff2d4f90f884977 /source/blender/makesrna/intern/rna_wm.c
parent23d148ecaf923a490c3dd4a22d6dd96ea7cb9654 (diff)
Support tagging operator properties as 'advanced'
This will later be used to show advanced operator properties separate from basic (as in non-advanced) ones in the UI. Tagging a single operator property in C should be done via `WM_operatortype_prop_tag()`. It does additional checks for type safety that `RNA_def_property_tags()` doesn't do. To avoid having to tag each advanced property individually, multiple ones can be tagged by wrapping them into `WM_operatortype_props_advanced_bein()` and `WM_operatortype_props_advanced_end()` calls. It's also possible to only call `_begin()`, all properties added after this will get tagged then. In most cases this last approach should be sufficient. Example of Python usage: `my_float = bpy.props.FloatProperty(name="Some Float", tags={'ADVANCED'})`
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 31393d0923d..7d821ee407b 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -442,6 +442,11 @@ const EnumPropertyItem rna_enum_operator_return_items[] = {
{0, NULL, 0, NULL, NULL}
};
+const EnumPropertyItem rna_enum_operator_property_tags[] = {
+ {OP_PROP_TAG_ADVANCED, "ADVANCED", 0, "Advanced", "The property is advanced so UI is suggested to hide it"},
+ {0, NULL, 0, NULL, NULL}
+};
+
/* flag/enum */
const EnumPropertyItem rna_enum_wm_report_items[] = {
{RPT_DEBUG, "DEBUG", 0, "Debug", ""},
@@ -1285,6 +1290,7 @@ static StructRNA *rna_Operator_register(
/* create a new operator type */
dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
+ RNA_def_struct_property_tags(dummyot.ext.srna, rna_enum_operator_property_tags);
RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
dummyot.ext.data = data;
dummyot.ext.call = call;
@@ -1639,6 +1645,7 @@ static void rna_def_operator(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
+ RNA_def_struct_property_tags(srna, rna_enum_operator_property_tags);
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}