[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47064] trunk/blender/source/blender/ editors/transform/transform.c: Fix #31606: pg up/ down does not work for changing falloff for proportional editing

Sergey Sharybin sergey.vfx at gmail.com
Sun May 27 12:08:37 CEST 2012


Revision: 47064
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47064
Author:   nazgul
Date:     2012-05-27 10:08:37 +0000 (Sun, 27 May 2012)
Log Message:
-----------
Fix #31606: pg up/down does not work for changing falloff for proportional editing

Initially issue was caused by non-proportional edge slide patch in rev46927 which
had several wrong things:

- It introduced new events TFM_WHEEL_DOWN_EVT/TFM_WHEEL_UP_EVT which were defined
  as per-bit OR between edge slide and proportional editing modal events, but
  the issue is that modal events are not bit masks and that meant that new events
  were defined as 20|24 and 21|25 which is a bit strange.
- Another this was caused by the fact, that keymap wasn't creating for some specific
  transform modal keymap item -- it used to be tried to create single shortcut for
  two different modal events, which isn't supported by keymaps and resulted by
  artifacts in keymap editor interface (nodal event type was empty for wheel movements).
  That was caused by different events used by modal keymap and defining shortcuts.
- Actual issue which prevented PgUP/PGDOWN to work was mixing using that new events
  for wheel scrolling in switch statements which doesn't do bitmask check.

Solved by separating keymaps used for proportional editing and edge slide -- now
it's mouse Wheel for proportional editing and Alt-Wheel for edge slide. If someone
would want to have single shortcut for this two events it'll imply one of the follofing
things:

- Support poll function for shortcuts, so keymap would definitely know which
  modal event to send to operator.
- Generalize TFM_MODAL_PROPSIZE_{UP, DOWN} and TFM_MODAL_EDGESLIDE_{UP, DOWN} so
  they can share the same shortcut with current design of keymaps.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46927

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform.c

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2012-05-27 10:03:13 UTC (rev 47063)
+++ trunk/blender/source/blender/editors/transform/transform.c	2012-05-27 10:08:37 UTC (rev 47064)
@@ -539,9 +539,6 @@
 #define TFM_MODAL_EDGESLIDE_UP 24
 #define TFM_MODAL_EDGESLIDE_DOWN 25
 
-#define TFM_WHEEL_DOWN_EVT TFM_MODAL_PROPSIZE_DOWN|TFM_MODAL_EDGESLIDE_DOWN
-#define TFM_WHEEL_UP_EVT TFM_MODAL_PROPSIZE_UP|TFM_MODAL_EDGESLIDE_UP
-
 /* called in transform_ops.c, on each regeneration of keymaps */
 wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
 {
@@ -603,8 +600,11 @@
 
 	WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
 	WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
-	WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_WHEEL_UP_EVT);
-	WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_WHEEL_DOWN_EVT);
+	WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
+	WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
+
+	WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0, TFM_MODAL_EDGESLIDE_UP);
+	WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ALT, 0, TFM_MODAL_EDGESLIDE_DOWN);
 	
 	WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC);
 	WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC);
@@ -869,7 +869,7 @@
 				removeSnapPoint(t);
 				t->redraw |= TREDRAW_HARD;
 				break;
-			case TFM_WHEEL_UP_EVT:
+			case TFM_MODAL_PROPSIZE_UP:
 				if (t->flag & T_PROP_EDIT) {
 					t->prop_size*= 1.1f;
 					if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
@@ -878,13 +878,17 @@
 				}
 				t->redraw |= TREDRAW_HARD;
 				break;
-			case TFM_WHEEL_DOWN_EVT:
+			case TFM_MODAL_PROPSIZE_DOWN:
 				if (t->flag & T_PROP_EDIT) {
 					t->prop_size*= 0.90909090f;
 					calculatePropRatio(t);
 				}
 				t->redraw |= TREDRAW_HARD;
 				break;
+			case TFM_MODAL_EDGESLIDE_UP:
+			case TFM_MODAL_EDGESLIDE_DOWN:
+				t->redraw |= TREDRAW_HARD;
+				break;
 			case TFM_MODAL_AUTOIK_LEN_INC:
 				if (t->flag & T_AUTOIK)
 					transform_autoik_update(t, 1);
@@ -5090,11 +5094,11 @@
 				}
 				case EVT_MODAL_MAP: {
 					switch (event->val) {
-						case TFM_WHEEL_DOWN_EVT: {
+						case TFM_MODAL_EDGESLIDE_DOWN: {
 							sld->curr_sv_index = ((sld->curr_sv_index - 1) + sld->totsv) % sld->totsv;
 							break;
 						}
-						case TFM_WHEEL_UP_EVT: {
+						case TFM_MODAL_EDGESLIDE_UP: {
 							sld->curr_sv_index = (sld->curr_sv_index + 1) % sld->totsv;
 							break;
 						}




More information about the Bf-blender-cvs mailing list