diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2021-12-26 18:09:19 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2022-01-18 16:24:54 +0300 |
commit | 0d7b3ed39c77e1cdd43815a65993afe179691672 (patch) | |
tree | 6440d7ec2e07800185898e0c9703e8f0901d3ce9 /source/blender/makesrna/intern | |
parent | 695222838699921865a1f5685c420c9155f27ca7 (diff) |
RNA: display exact integer values without fraction if step is integer.
Display exact integer values of a floating point fields without
a fraction if the step is also an exact integer. This is intended
for cases when the value can technically be fractional, but most
commonly is supposed to be integer.
This handling is not applied if the field has any unit except frames,
because integer values aren't special for quantities like length.
The fraction is discarded in the normal display mode and when copying
the value to clipboard, but not when editing to remind the user that
the field allows fractions.
Differential Revision: https://developer.blender.org/D13753
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 96e37dfebbb..6b134977c5a 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -907,7 +907,7 @@ static void rna_def_action(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_float_sdna(prop, NULL, "frame_start"); RNA_def_property_float_funcs(prop, NULL, "rna_Action_start_frame_set", NULL); - RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 0); + RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 2); RNA_def_property_ui_text( prop, "Start Frame", "The start frame of the manually set intended playback range"); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); @@ -916,7 +916,7 @@ static void rna_def_action(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_float_sdna(prop, NULL, "frame_end"); RNA_def_property_float_funcs(prop, NULL, "rna_Action_end_frame_set", NULL); - RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 0); + RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 2); RNA_def_property_ui_text( prop, "End Frame", "The end frame of the manually set intended playback range"); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 285f6365ea1..37e7e5e6bed 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -3117,7 +3117,11 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type) prop = RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Precision", "Number of digits after the dot used by buttons"); + RNA_def_property_ui_text(prop, + "Precision", + "Number of digits after the dot used by buttons. Fraction is " + "automatically hidden for exact integer values of fields with unit " + "'NONE' or 'TIME' (frame count) and step divisible by 100."); } } diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index a2db1536f55..2358d236c4d 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -672,7 +672,7 @@ static void rna_def_paint(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Cavity Mask", "Mask painting according to mesh geometry cavity"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - prop = RNA_def_property(srna, "tile_offset", PROP_FLOAT, PROP_XYZ); + prop = RNA_def_property(srna, "tile_offset", PROP_FLOAT, PROP_XYZ_LENGTH); RNA_def_property_float_sdna(prop, NULL, "tile_offset"); RNA_def_property_array(prop, 3); RNA_def_property_range(prop, 0.01, FLT_MAX); |