diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operator_props.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_props.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c index 78d8fc9a20d..631a4d23eb5 100644 --- a/source/blender/windowmanager/intern/wm_operator_props.c +++ b/source/blender/windowmanager/intern/wm_operator_props.c @@ -48,6 +48,30 @@ void WM_operator_properties_confirm_or_exec(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); } +/** + * Extends rna_enum_fileselect_params_sort_items with a default item for operators to use. + */ +static const EnumPropertyItem *wm_operator_properties_filesel_sort_items_itemf( + struct bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +{ + EnumPropertyItem *items; + const EnumPropertyItem default_item = { + FILE_SORT_DEFAULT, + "DEFAULT", + 0, + "Default", + "Automatically determine sort method for files", + }; + int totitem = 0; + + RNA_enum_item_add(&items, &totitem, &default_item); + RNA_enum_items_add(&items, &totitem, rna_enum_fileselect_params_sort_items); + RNA_enum_item_end(&items, &totitem); + *r_free = true; + + return items; +} + /* default properties for fileselect */ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, @@ -204,8 +228,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot, prop = RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", ""); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); - prop = RNA_def_enum( - ot->srna, "sort_method", rna_enum_file_sort_items, sort, "File sorting mode", ""); + prop = RNA_def_enum(ot->srna, "sort_method", DummyRNA_NULL_items, sort, "File sorting mode", ""); + RNA_def_enum_funcs(prop, wm_operator_properties_filesel_sort_items_itemf); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); } @@ -260,12 +284,12 @@ void WM_operator_properties_select_random(wmOperatorType *ot) { RNA_def_float_percentage(ot->srna, "percent", - 50.f, + 50.0f, 0.0f, 100.0f, "Percent", "Percentage of objects to select randomly", - 0.f, + 0.0f, 100.0f); RNA_def_int(ot->srna, "seed", @@ -498,6 +522,8 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor) RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); prop = RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "flip", false, "Flip", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); if (cursor) { prop = RNA_def_int(ot->srna, |