From 78218d89d68861cf96884ce6553ea587b4f6eeb4 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 29 Nov 2008 15:10:31 +0000 Subject: 2.5: work on bringing back SpaceTime options - RMB select, also with SHIFT - RMB tweak for translate - SHIFT+D dupli - BKEY border select/deselect - AKEY (de)select all - XKEY delete - GKEY grab Added some XXX comments for future todos, especially for when other spaces come back with time markers. Also added ED_util for putting in all to-be-cleaned cruft Context conflict: input methods for Markers can conflict with other spacetypes. It was solved in pre-2.5 with manually tweaking it all over, but I would prefer one keymap for all marker stuff. Needs some thinking... could be solved with a boundbox check for bottom part of 2d window. Tweak issue: both tweak styles are possible: - Hold mouse button, move, operator ends on mouse release - Hold mouse button, move, operator ends on mouse click Problem is that modally handled operators use fixed keymaps... like ESC, SPACE, ENTER, or press/release mousebutton for 'assign'. There's a lot to say for making this all consistant, or become part of 1 general keymap? Should also be possibe to define 'tweak' defaults for Tablet different than for mouse... --- source/blender/editors/util/ed_util.c | 68 +++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 source/blender/editors/util/ed_util.c (limited to 'source/blender/editors/util/ed_util.c') diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c new file mode 100644 index 00000000000..fc485b8df7b --- /dev/null +++ b/source/blender/editors/util/ed_util.c @@ -0,0 +1,68 @@ +/** + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2008 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include +#include + +#include "MEM_guardedalloc.h" + +#include "DNA_scene_types.h" + +#include "BLI_blenlib.h" + +#include "BKE_global.h" + + +/* ********* general editor util funcs, not BKE stuff please! ********* */ +/* ***** XXX: functions are using old blender names, cleanup later ***** */ + + +/* now only used in 2d spaces, like time, ipo, nla, sima... */ +/* XXX clean G.qual */ +void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert) +{ + /* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */ + int ctrl; + + if(invert) { + if(G.qual & LR_CTRLKEY) ctrl= 0; + else ctrl= 1; + } + else ctrl= (G.qual & LR_CTRLKEY); + + if(ctrl && (G.qual & LR_SHIFTKEY)) { + if(fac3!= 0.0) *val= fac3*floor(*val/fac3 +.5); + } + else if(ctrl) { + if(fac2!= 0.0) *val= fac2*floor(*val/fac2 +.5); + } + else { + if(fac1!= 0.0) *val= fac1*floor(*val/fac1 +.5); + } +} + -- cgit v1.2.3