Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-05-14 15:01:33 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-05-14 15:01:33 +0300
commit7aa74dfe5e1af9cf6dd3c6a5f2b3a3fadfcd2a36 (patch)
tree0ea819c1f0441319a36b62d14daff72c8ed63621 /source
parent057a8c625038ba9b22b01ebbd7bce9940479c034 (diff)
Radial operator:
Percentage properties use interaction like factors with number feedback and easier way to go predict lower percentages.
Diffstat (limited to 'source')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 07d0bd0b62f..e8782a744bf 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3850,7 +3850,7 @@ void WM_OT_straightline_gesture(wmOperatorType *ot)
#define WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE (35 * U.pixelsize)
#define WM_RADIAL_CONTROL_DISPLAY_WIDTH (WM_RADIAL_CONTROL_DISPLAY_SIZE - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE)
#define WM_RADIAL_CONTROL_HEADER_LENGTH 180
-#define WM_RADIAL_MAX_STR 6
+#define WM_RADIAL_MAX_STR 10
typedef struct {
PropertyType type;
@@ -3896,10 +3896,12 @@ static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *e
switch (rc->subtype) {
case PROP_NONE:
case PROP_DISTANCE:
- case PROP_PERCENTAGE:
case PROP_PIXEL:
d[0] = rc->initial_value * U.pixelsize;
break;
+ case PROP_PERCENTAGE:
+ d[0] = (100.0f - rc->initial_value) / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
+ break;
case PROP_FACTOR:
d[0] = (1 - rc->initial_value) * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
break;
@@ -4005,13 +4007,21 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
switch (rc->subtype) {
case PROP_NONE:
case PROP_DISTANCE:
- case PROP_PERCENTAGE:
case PROP_PIXEL:
r1 = rc->current_value * U.pixelsize;
r2 = rc->initial_value * U.pixelsize;
tex_radius = r1;
alpha = 0.75;
break;
+ case PROP_PERCENTAGE:
+ r1 = (100.0f - rc->current_value) / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
+ r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
+ rmin = WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
+ BLI_snprintf(str, WM_RADIAL_MAX_STR, "%3.1f%%", rc->current_value);
+ strdrawlen = BLI_strlen_utf8(str);
+ tex_radius = r1;
+ alpha = 0.75;
+ break;
case PROP_FACTOR:
r1 = (1 - rc->current_value) * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
@@ -4446,12 +4456,15 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
switch (rc->subtype) {
case PROP_NONE:
case PROP_DISTANCE:
- case PROP_PERCENTAGE:
case PROP_PIXEL:
new_value = dist;
if (snap) new_value = ((int)new_value + 5) / 10 * 10;
new_value /= U.pixelsize;
break;
+ case PROP_PERCENTAGE:
+ new_value = ((WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH) * 100.0f;
+ if (snap) new_value = ((int)(new_value + 2.5)) / 5 * 5;
+ break;
case PROP_FACTOR:
new_value = (WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH;
if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;