From 423d9086e64e5f9bfb175f95e17ca426567af17d Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Tue, 16 Apr 2019 13:12:28 +0200 Subject: Fix T63429: Random deselect function lost Add back the ability to choose the select operation for random select. Now we allow the operator to specify if the select operation should be visible in the GUI or not. Reviewed By: Brecht Differential Revision: http://developer.blender.org/D4665 --- source/blender/editors/physics/particle_edit.c | 4 ++-- source/blender/editors/space_info/info_report.c | 2 +- source/blender/windowmanager/WM_api.h | 4 ++-- .../blender/windowmanager/intern/wm_operator_props.c | 20 ++++++++++++-------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index dcd8f7a93da..f2d9871a99d 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1814,7 +1814,7 @@ void PARTICLE_OT_select_roots(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - WM_operator_properties_select_action(ot, SEL_SELECT); + WM_operator_properties_select_action(ot, SEL_SELECT, true); } /************************ select tip operator ************************/ @@ -1884,7 +1884,7 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - WM_operator_properties_select_action(ot, SEL_SELECT); + WM_operator_properties_select_action(ot, SEL_SELECT, true); } /*********************** select random operator ************************/ diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index a8f5d9b9b76..e4202483574 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -209,7 +209,7 @@ void INFO_OT_select_all(wmOperatorType *ot) ot->exec = report_select_all_exec; /* properties */ - WM_operator_properties_select_action(ot, SEL_SELECT); + WM_operator_properties_select_action(ot, SEL_SELECT, true); } /* box_select operator */ diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 38fb27d2538..0ee5ffaa267 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -377,8 +377,8 @@ void WM_operator_properties_gesture_straightline(struct wmOperatorType *o void WM_operator_properties_gesture_circle(struct wmOperatorType *ot); void WM_operator_properties_mouse_select(struct wmOperatorType *ot); void WM_operator_properties_select_all(struct wmOperatorType *ot); -void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action); -void WM_operator_properties_select_action_simple(struct wmOperatorType *ot, int default_action); +void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action, bool hide_gui); +void WM_operator_properties_select_action_simple(struct wmOperatorType *ot, int default_action, bool hide_gui); void WM_operator_properties_select_random(struct wmOperatorType *ot); int WM_operator_properties_select_random_seed_increment_get(wmOperator *op); void WM_operator_properties_select_operation(struct wmOperatorType *ot); diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c index 0e4d8a7bf71..55b45adbe2d 100644 --- a/source/blender/windowmanager/intern/wm_operator_props.c +++ b/source/blender/windowmanager/intern/wm_operator_props.c @@ -140,14 +140,18 @@ void WM_operator_properties_filesel( } static void wm_operator_properties_select_action_ex(wmOperatorType *ot, int default_action, - const EnumPropertyItem *select_actions) + const EnumPropertyItem *select_actions, + bool hide_gui) { PropertyRNA *prop; prop = RNA_def_enum(ot->srna, "action", select_actions, default_action, "Action", "Selection action to execute"); - RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + + if (hide_gui) { + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + } } -void WM_operator_properties_select_action(wmOperatorType *ot, int default_action) +void WM_operator_properties_select_action(wmOperatorType *ot, int default_action, bool hide_gui) { static const EnumPropertyItem select_actions[] = { {SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"}, @@ -157,13 +161,13 @@ void WM_operator_properties_select_action(wmOperatorType *ot, int default_action {0, NULL, 0, NULL, NULL}, }; - wm_operator_properties_select_action_ex(ot, default_action, select_actions); + wm_operator_properties_select_action_ex(ot, default_action, select_actions, hide_gui); } /** * only SELECT/DESELECT */ -void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default_action) +void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default_action, bool hide_gui) { static const EnumPropertyItem select_actions[] = { {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"}, @@ -171,7 +175,7 @@ void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default {0, NULL, 0, NULL, NULL}, }; - wm_operator_properties_select_action_ex(ot, default_action, select_actions); + wm_operator_properties_select_action_ex(ot, default_action, select_actions, hide_gui); } /** @@ -187,7 +191,7 @@ void WM_operator_properties_select_random(wmOperatorType *ot) ot->srna, "seed", 0, 0, INT_MAX, "Random Seed", "Seed for the random number generator", 0, 255); - WM_operator_properties_select_action_simple(ot, SEL_SELECT); + WM_operator_properties_select_action_simple(ot, SEL_SELECT, false); } int WM_operator_properties_select_random_seed_increment_get(wmOperator *op) @@ -206,7 +210,7 @@ int WM_operator_properties_select_random_seed_increment_get(wmOperator *op) void WM_operator_properties_select_all(wmOperatorType *ot) { - WM_operator_properties_select_action(ot, SEL_TOGGLE); + WM_operator_properties_select_action(ot, SEL_TOGGLE, true); } void WM_operator_properties_border(wmOperatorType *ot) -- cgit v1.2.3