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;
|
||||
|
||||
prop = RNA_def_float_percentage(ot->srna,
|
||||
"percentage",
|
||||
0.5f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
"Percentage",
|
||||
"Weighting factor for which keyframe is favored more",
|
||||
0.0,
|
||||
1.0);
|
||||
prop = RNA_def_float_factor(ot->srna,
|
||||
"factor",
|
||||
0.5f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
"Factor",
|
||||
"Weighting factor for which keyframe is favored more",
|
||||
0.0,
|
||||
1.0);
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
@ -734,7 +734,7 @@ void GPENCIL_OT_interpolate(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
||||
/* properties */
|
||||
RNA_def_float_percentage(
|
||||
RNA_def_float_factor(
|
||||
ot->srna,
|
||||
"shift",
|
||||
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)
|
||||
{
|
||||
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 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)
|
||||
{
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
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 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 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 bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT);
|
||||
RNG *rng;
|
||||
|
@ -505,15 +505,15 @@ void GRAPH_OT_decimate(wmOperatorType *ot)
|
||||
"Mode",
|
||||
"Which mode to use for decimation");
|
||||
|
||||
RNA_def_float_percentage(ot->srna,
|
||||
"remove_ratio",
|
||||
1.0f / 3.0f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
"Remove",
|
||||
"The percentage of keyframes to remove",
|
||||
0.0f,
|
||||
1.0f);
|
||||
RNA_def_float_factor(ot->srna,
|
||||
"remove_ratio",
|
||||
1.0f / 3.0f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
"Remove",
|
||||
"The ratio of remaining keyframes after the operation",
|
||||
0.0f,
|
||||
1.0f);
|
||||
RNA_def_float(ot->srna,
|
||||
"remove_error_margin",
|
||||
0.0f,
|
||||
|
@ -284,15 +284,15 @@ void WM_operator_properties_select_action_simple(wmOperatorType *ot,
|
||||
*/
|
||||
void WM_operator_properties_select_random(wmOperatorType *ot)
|
||||
{
|
||||
RNA_def_float_percentage(ot->srna,
|
||||
"percent",
|
||||
50.0f,
|
||||
0.0f,
|
||||
100.0f,
|
||||
"Percent",
|
||||
"Percentage of objects to select randomly",
|
||||
0.0f,
|
||||
100.0f);
|
||||
RNA_def_float_factor(ot->srna,
|
||||
"ratio",
|
||||
0.5f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
"Ratio",
|
||||
"Portion of items to select randomly",
|
||||
0.f,
|
||||
1.0f);
|
||||
RNA_def_int(ot->srna,
|
||||
"seed",
|
||||
0,
|
||||
|
Loading…
Reference in New Issue
Block a user