利用者:Koilz/Page

提供: wiki
< 利用者:Koilz
2014年11月15日 (土) 17:18時点におけるwiki>Koilzによる版
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索


These are some notes, for how to fix the problem, with the Select With option in user preferences.
The first patch would correct some keymaps.
When the Select With option is set to Left, this works though, some of the 3D view keymaps are still set to 'LEFTMOUSE'.
source/blender/editors/sculpt_paint/paint_ops.c
1300
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", BRUSH_STROKE_SMOOTH);
1319
WM_keymap_add_item(keymap, "PAINT_OT_mask_lasso_gesture", LEFTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
1375
WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0);
1403
WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
1409
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_LINEAR);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_RADIAL);
1452
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
1502
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_uv_sculpt_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_uv_sculpt_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_uv_sculpt_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", BRUSH_STROKE_SMOOTH);
These and probably some more, should be changed to 'ACTIONMOUSE'.
When the Select With option is set to Left, VIEW3D_OT_select and 'Select' keymaps are set to LMB, keymaps using 'Action' are set to RMB.
These keymaps should be syncronized to ensure both are swapped correctly, at the moment, some are not.

...

The other patch would re-add this (RMB select for paint modes) feature correctly.
I thought the best way to implement this, would be to limit the LMB/RMB toggle, by checking what mode blender is in, in the UI handler code.
i.e. Adding some conditional statement to WM_userdef_event_map, based on the 3D view mode, sculpt, weight paint, vertex paint, etcetera.
source/blender/windowmanager/intern/wm_event_system.c - 1422
/* do userdef mappings */
int WM_userdef_event_map(int kmitype)
{
 switch (kmitype) {
  case SELECTMOUSE:
   return (U.flag & USER_LMOUSESELECT) ? LEFTMOUSE : RIGHTMOUSE;
  case ACTIONMOUSE:
   return (U.flag & USER_LMOUSESELECT) ? RIGHTMOUSE : LEFTMOUSE;
  case EVT_TWEAK_A:
   return (U.flag & USER_LMOUSESELECT) ? EVT_TWEAK_R : EVT_TWEAK_L;
  case EVT_TWEAK_S:
   return (U.flag & USER_LMOUSESELECT) ? EVT_TWEAK_L : EVT_TWEAK_R;
  case WHEELOUTMOUSE:
   return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE;
  case WHEELINMOUSE:
   return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
 }

 return kmitype;
}
source/blender/windowmanager/intern/wm_event_system.c
wm_handlers_do
	wm_handlers_do_intern
		wm_eventmatch
			WM_userdef_event_map
		wm_handler_operator_call
			wm_event_modalkeymap
				wm_eventmatch
					WM_userdef_event_map
		wm_handler_operator_call
			wm_event_modalkeymap
				wm_eventmatch
					WM_userdef_event_map