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
This commit is contained in:
Sebastian Parborg 2019-04-16 13:12:28 +02:00
parent 2e3bc99590
commit 423d9086e6
Notes: blender-bot 2023-02-14 08:45:09 +01:00
Referenced by issue #68122, Settings for Select root and Select tip in particle edit mode are missing
Referenced by issue #63429, Random deselect function lost
4 changed files with 17 additions and 13 deletions

View File

@ -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 ************************/

View File

@ -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 */

View File

@ -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);

View File

@ -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)