diff options
author | Ton Roosendaal <ton@blender.org> | 2008-11-29 18:10:31 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2008-11-29 18:10:31 +0300 |
commit | 78218d89d68861cf96884ce6553ea587b4f6eeb4 (patch) | |
tree | 2189de563ae91e91c1b37a3cb3632b45f7b5ce96 /source/blender/editors/util | |
parent | f07f6f6fa0f7bef70c76a1a8e1eab65ecf501804 (diff) |
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...
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r-- | source/blender/editors/util/Makefile | 54 | ||||
-rw-r--r-- | source/blender/editors/util/SConscript | 10 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 68 |
3 files changed, 132 insertions, 0 deletions
diff --git a/source/blender/editors/util/Makefile b/source/blender/editors/util/Makefile new file mode 100644 index 00000000000..da701dc5d86 --- /dev/null +++ b/source/blender/editors/util/Makefile @@ -0,0 +1,54 @@ +# +# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# +# ***** 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) 2007 Blender Foundation +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): none yet. +# +# ***** END GPL LICENSE BLOCK ***** +# +# Makes module object directory and bounces make to subdirectories. + +LIBNAME = ed_util +DIR = $(OCGDIR)/blender/$(LIBNAME) + +include nan_compile.mk + +CFLAGS += $(LEVEL_1_C_WARNINGS) + +CPPFLAGS += -I$(NAN_GLEW)/include +CPPFLAGS += -I$(OPENGL_HEADERS) + +# not very neat.... +CPPFLAGS += -I../../windowmanager +CPPFLAGS += -I../../blenloader +CPPFLAGS += -I../../blenkernel +CPPFLAGS += -I../../blenlib +CPPFLAGS += -I../../makesdna +CPPFLAGS += -I../../makesrna +CPPFLAGS += -I../../imbuf +CPPFLAGS += -I../../python +CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include + +# own include + +CPPFLAGS += -I../include diff --git a/source/blender/editors/util/SConscript b/source/blender/editors/util/SConscript new file mode 100644 index 00000000000..604ebeebab7 --- /dev/null +++ b/source/blender/editors/util/SConscript @@ -0,0 +1,10 @@ +#!/usr/bin/python +Import ('env') + +sources = env.Glob('*.c') + +incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' +incs += ' ../../makesrna' + +env.BlenderLib ( 'bf_editors_util', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] ) 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 <stdlib.h> +#include <math.h> + +#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); + } +} + |