UI: Fix incorrect RNA percentage property definitions
In two cases the percentage property was actually used incorrectly, as pointed out in T82070. The range was [0, 1], but the properties were still displayed as percentages. There is a preference to control whether to display factors or percentages, so it usually doesn't make sense to manually define properties as percentages. Resolves T82070 Differential Revision: https://developer.blender.org/D9344
This commit is contained in:
parent
0e39c526d8
commit
c71a8e8376
@ -1246,15 +1246,15 @@ static void pose_slide_opdef_properties(wmOperatorType *ot)
|
|||||||
{
|
{
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
|
|
||||||
prop = RNA_def_float_percentage(ot->srna,
|
prop = RNA_def_float_factor(ot->srna,
|
||||||
"percentage",
|
"factor",
|
||||||
0.5f,
|
0.5f,
|
||||||
0.0f,
|
0.0f,
|
||||||
1.0f,
|
1.0f,
|
||||||
"Percentage",
|
"Factor",
|
||||||
"Weighting factor for which keyframe is favored more",
|
"Weighting factor for which keyframe is favored more",
|
||||||
0.0,
|
0.0,
|
||||||
1.0);
|
1.0);
|
||||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||||
|
|
||||||
prop = RNA_def_int(ot->srna,
|
prop = RNA_def_int(ot->srna,
|
||||||
|
@ -1242,7 +1242,7 @@ static void curve_select_random(ListBase *editnurb, float randfac, int seed, boo
|
|||||||
static int curve_select_random_exec(bContext *C, wmOperator *op)
|
static int curve_select_random_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
||||||
const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
|
const float randfac = RNA_float_get(op->ptr, "ratio");
|
||||||
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
||||||
|
|
||||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
|
@ -734,7 +734,7 @@ void GPENCIL_OT_interpolate(wmOperatorType *ot)
|
|||||||
ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
|
ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
RNA_def_float_percentage(
|
RNA_def_float_factor(
|
||||||
ot->srna,
|
ot->srna,
|
||||||
"shift",
|
"shift",
|
||||||
0.0f,
|
0.0f,
|
||||||
|
@ -108,7 +108,7 @@ bool ED_lattice_deselect_all_multi(struct bContext *C)
|
|||||||
|
|
||||||
static int lattice_select_random_exec(bContext *C, wmOperator *op)
|
static int lattice_select_random_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
|
const float randfac = RNA_float_get(op->ptr, "ratio");
|
||||||
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
||||||
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
||||||
|
|
||||||
|
@ -4573,7 +4573,7 @@ void MESH_OT_select_non_manifold(wmOperatorType *ot)
|
|||||||
static int edbm_select_random_exec(bContext *C, wmOperator *op)
|
static int edbm_select_random_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
||||||
const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
|
const float randfac = RNA_float_get(op->ptr, "ratio");
|
||||||
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
||||||
|
|
||||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
|
@ -483,7 +483,7 @@ void MBALL_OT_select_similar(wmOperatorType *ot)
|
|||||||
static int select_random_metaelems_exec(bContext *C, wmOperator *op)
|
static int select_random_metaelems_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
||||||
const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
|
const float randfac = RNA_float_get(op->ptr, "ratio");
|
||||||
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
||||||
|
|
||||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
|
@ -1453,7 +1453,7 @@ void OBJECT_OT_select_less(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int object_select_random_exec(bContext *C, wmOperator *op)
|
static int object_select_random_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
|
const float randfac = RNA_float_get(op->ptr, "ratio");
|
||||||
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
||||||
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
||||||
|
|
||||||
|
@ -1999,7 +1999,7 @@ static int select_random_exec(bContext *C, wmOperator *op)
|
|||||||
int p;
|
int p;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f;
|
const float randfac = RNA_float_get(op->ptr, "ratio");
|
||||||
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
const int seed = WM_operator_properties_select_random_seed_increment_get(op);
|
||||||
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
||||||
RNG *rng;
|
RNG *rng;
|
||||||
|
@ -505,15 +505,15 @@ void GRAPH_OT_decimate(wmOperatorType *ot)
|
|||||||
"Mode",
|
"Mode",
|
||||||
"Which mode to use for decimation");
|
"Which mode to use for decimation");
|
||||||
|
|
||||||
RNA_def_float_percentage(ot->srna,
|
RNA_def_float_factor(ot->srna,
|
||||||
"remove_ratio",
|
"remove_ratio",
|
||||||
1.0f / 3.0f,
|
1.0f / 3.0f,
|
||||||
0.0f,
|
0.0f,
|
||||||
1.0f,
|
1.0f,
|
||||||
"Remove",
|
"Remove",
|
||||||
"The percentage of keyframes to remove",
|
"The ratio of remaining keyframes after the operation",
|
||||||
0.0f,
|
0.0f,
|
||||||
1.0f);
|
1.0f);
|
||||||
RNA_def_float(ot->srna,
|
RNA_def_float(ot->srna,
|
||||||
"remove_error_margin",
|
"remove_error_margin",
|
||||||
0.0f,
|
0.0f,
|
||||||
|
@ -284,15 +284,15 @@ void WM_operator_properties_select_action_simple(wmOperatorType *ot,
|
|||||||
*/
|
*/
|
||||||
void WM_operator_properties_select_random(wmOperatorType *ot)
|
void WM_operator_properties_select_random(wmOperatorType *ot)
|
||||||
{
|
{
|
||||||
RNA_def_float_percentage(ot->srna,
|
RNA_def_float_factor(ot->srna,
|
||||||
"percent",
|
"ratio",
|
||||||
50.0f,
|
0.5f,
|
||||||
0.0f,
|
0.0f,
|
||||||
100.0f,
|
1.0f,
|
||||||
"Percent",
|
"Ratio",
|
||||||
"Percentage of objects to select randomly",
|
"Portion of items to select randomly",
|
||||||
0.0f,
|
0.f,
|
||||||
100.0f);
|
1.0f);
|
||||||
RNA_def_int(ot->srna,
|
RNA_def_int(ot->srna,
|
||||||
"seed",
|
"seed",
|
||||||
0,
|
0,
|
||||||
|
Loading…
Reference in New Issue
Block a user