Page MenuHome

UI: Remove incorrect RNA percentage property definitions
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Oct 25 2020, 10:25 PM.

Details

Summary


We now have a nice preference to control whether to display factors or
percentages, so it doesn't make sense to manually define properties with
percentages anymore.

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:

Given the the existance of RNA_def_float_factor, this patch completely
removes RNA_def_float_percentage to prevent further confusion. I would
be fine leaving this change out, but it's worth considering.

Fixes T82070

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Oct 25 2020, 10:25 PM

When I search for "PROP_FLOAT, PROP_PERCENTAGE" I get a few matches like eraser_strength_factor, I guess they are cases where the developer wanted to force display of percents, or just old code?

  • Changes missed in previous commit
Hans Goudey (HooglyBoogly) retitled this revision from UI: Remove RNA percentage property definitions to UI: Remove incorrect RNA percentage property definitions.

When I search for "PROP_FLOAT, PROP_PERCENTAGE" I get a few matches like eraser_strength_factor, I guess they are cases where the developer wanted to force display of percents, or just old code?

Yeah, I'm not quite sure about that. I would like to discuss with the UI team whether there are circumstances where it's better to force the display of percentages with PROP_PERCENTAGE. If so there should be some guideline for when it makes sense.

Campbell Barton (campbellbarton) requested changes to this revision.Oct 28 2020, 11:13 AM

Generally seems fine, calling this percent no longer makes any sense though.

Suggest to rename to factor, the UI label as well.

This revision now requires changes to proceed.Oct 28 2020, 11:13 AM

Right, good point. I think I prefer "Ratio" here since it's more specific to this action.
If you have a strong preference though, I can use "Factor".

This revision is now accepted and ready to land.Jan 27 2021, 5:35 AM

Note regarding ratio / factor, currently in Blender factor is normally used as a multiplier.

Ratio's are often represented as two values (16:9, 4:3 ... etc).

In this case for selection, ratio is already used in some areas, so I don't have a strong opinion against using ratio in this patch.

Although, I rather not try to push this change into new areas seeing as we have approx 100 use of the term factor in RNA, in the interest of not breaking API compatibility or having two different conventions depending on who writes the code, better leave these as-is.