2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2010-03-21 01:14:04 +00:00
|
|
|
* $Id$
|
2008-12-19 17:14:02 +00:00
|
|
|
*
|
|
|
|
|
* ***** 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-19 17:14:02 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_view3d/view3d_ops.c
|
|
|
|
|
* \ingroup spview3d
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2008-12-19 17:14:02 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2008-12-19 17:14:02 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-12-19 17:14:02 +00:00
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2009-07-08 16:17:47 +00:00
|
|
|
#include "ED_transform.h"
|
2008-12-19 17:14:02 +00:00
|
|
|
|
|
|
|
|
#include "view3d_intern.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************** registration **********************************/
|
|
|
|
|
|
|
|
|
|
void view3d_operatortypes(void)
|
|
|
|
|
{
|
2009-09-25 10:24:42 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_rotate);
|
|
|
|
|
WM_operatortype_append(VIEW3D_OT_move);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_zoom);
|
2011-02-23 06:48:47 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_zoom_camera_1_to_1);
|
2011-04-22 15:34:07 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_dolly);
|
2009-07-09 08:39:58 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_view_all);
|
2008-12-26 11:11:21 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_viewnumpad);
|
2009-02-03 03:54:03 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_view_orbit);
|
|
|
|
|
WM_operatortype_append(VIEW3D_OT_view_pan);
|
|
|
|
|
WM_operatortype_append(VIEW3D_OT_view_persportho);
|
2010-12-08 11:42:11 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_background_image_add);
|
|
|
|
|
WM_operatortype_append(VIEW3D_OT_background_image_remove);
|
2010-01-13 22:17:56 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_view_selected);
|
2009-11-22 23:11:32 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_view_center_cursor);
|
2010-07-03 20:47:03 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_view_center_camera);
|
2008-12-26 11:11:21 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_select);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_select_border);
|
2009-07-09 08:39:58 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_clip_border);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_select_circle);
|
2008-12-26 18:15:46 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_smoothview);
|
2008-12-27 01:29:56 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_render_border);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_zoom_border);
|
2009-07-08 15:01:28 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_manipulator);
|
2010-01-14 05:29:25 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_enable_manipulator);
|
2008-12-26 19:07:31 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_cursor3d);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_select_lasso);
|
2009-01-06 00:19:47 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_setcameratoview);
|
2010-07-24 01:32:03 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_object_as_camera);
|
2009-02-14 10:03:24 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_localview);
|
2009-06-13 17:25:54 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_game_start);
|
2009-09-23 11:26:16 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_fly);
|
2009-02-20 18:01:33 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_layers);
|
2009-02-14 13:07:09 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_properties);
|
2010-01-12 07:50:14 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_toolshelf);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
|
2009-02-14 13:07:09 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid);
|
|
|
|
|
WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor);
|
|
|
|
|
WM_operatortype_append(VIEW3D_OT_snap_cursor_to_grid);
|
2010-01-13 22:17:56 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_snap_cursor_to_center);
|
2009-02-14 13:07:09 +00:00
|
|
|
WM_operatortype_append(VIEW3D_OT_snap_cursor_to_selected);
|
|
|
|
|
WM_operatortype_append(VIEW3D_OT_snap_cursor_to_active);
|
2009-02-14 10:03:24 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
transform_operatortypes();
|
2008-12-19 17:14:02 +00:00
|
|
|
}
|
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void view3d_keymap(wmKeyConfig *keyconf)
|
2008-12-19 17:14:02 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-11-17 16:04:17 +00:00
|
|
|
wmKeyMapItem *kmi;
|
2008-12-19 17:14:02 +00:00
|
|
|
|
2010-09-06 05:40:52 +00:00
|
|
|
keymap= WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
|
2009-09-17 21:36:02 +00:00
|
|
|
|
2009-02-10 15:38:00 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
|
2010-01-12 07:50:14 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
|
2009-02-10 15:38:00 +00:00
|
|
|
|
|
|
|
|
/* only for region 3D window */
|
2010-09-06 05:40:52 +00:00
|
|
|
keymap= WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
|
2009-02-10 15:38:00 +00:00
|
|
|
|
2010-04-03 17:38:43 +00:00
|
|
|
kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "release_confirm", 1);
|
2009-11-12 19:42:53 +00:00
|
|
|
/*
|
|
|
|
|
* Doesn't work with KM_SHIFT, have to use KM_ANY and filter in invoke
|
|
|
|
|
* */
|
|
|
|
|
// WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
|
2009-08-26 01:49:57 +00:00
|
|
|
|
2008-12-26 19:07:31 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0);
|
|
|
|
|
|
2009-09-25 10:24:42 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
|
|
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
|
2011-04-22 15:34:07 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_dolly", MIDDLEMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
2010-01-13 22:17:56 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
|
2009-11-22 23:57:06 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center_cursor", PADPERIOD, KM_PRESS, KM_CTRL, 0);
|
2008-12-19 19:27:41 +00:00
|
|
|
|
2009-09-24 06:48:03 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_fly", FKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-09-23 11:26:16 +00:00
|
|
|
|
2008-12-26 18:15:46 +00:00
|
|
|
WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0);
|
|
|
|
|
|
2010-01-11 11:14:36 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEPAN, 0, KM_ALT, 0);
|
|
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEROTATE, 0, 0, 0);
|
|
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_move", MOUSEPAN, 0, 0, 0);
|
|
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEZOOM, 0, 0, 0);
|
|
|
|
|
|
2010-01-14 05:22:16 +00:00
|
|
|
/*numpad +/-*/
|
2009-03-29 02:15:13 +00:00
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADMINUS, KM_PRESS, 0, 0)->ptr, "delta", -1);
|
2010-01-14 05:22:16 +00:00
|
|
|
|
|
|
|
|
/*ctrl +/-*/
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", EQUALKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MINUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
|
|
|
|
|
|
|
|
|
|
/*wheel mouse forward/back*/
|
2009-03-29 02:15:13 +00:00
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1);
|
2008-12-19 19:27:41 +00:00
|
|
|
|
2011-02-23 06:48:47 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_camera_1_to_1", PADENTER, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
|
|
2010-07-03 20:47:03 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */
|
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0)->ptr, "center", 0); /* only without camera view */
|
2009-07-09 08:39:58 +00:00
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "center", 1);
|
2008-12-20 11:33:16 +00:00
|
|
|
|
2008-12-23 09:59:02 +00:00
|
|
|
/* numpad view hotkeys*/
|
2009-10-27 02:54:25 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_CAMERA);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
|
2009-02-03 03:54:03 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD2, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
|
2009-10-27 02:54:25 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
|
2009-02-03 03:54:03 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD4, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
|
|
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_view_persportho", PAD5, KM_PRESS, 0, 0);
|
|
|
|
|
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD6, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
|
2009-10-27 02:54:25 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
|
2009-02-03 03:54:03 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD8, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPUP);
|
2009-10-27 02:54:25 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BACK);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_LEFT);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
|
2009-02-03 03:54:03 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD2, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANDOWN);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD4, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD6, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD8, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANUP);
|
2010-01-04 00:39:55 +00:00
|
|
|
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANUP);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANDOWN);
|
|
|
|
|
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPUP);
|
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
|
|
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* active aligned, replaces '*' key in 2.4x */
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
|
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
|
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
|
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
|
|
|
|
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BACK);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
|
|
|
|
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_LEFT);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
|
|
|
|
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
|
2009-11-06 10:38:00 +00:00
|
|
|
|
2009-02-14 10:03:24 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_localview", PADSLASHKEY, KM_PRESS, 0, 0);
|
|
|
|
|
|
2009-02-20 18:01:33 +00:00
|
|
|
/* layers, shift + alt are properties set in invoke() */
|
2009-09-22 04:40:16 +00:00
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ACCENTGRAVEKEY, KM_PRESS, 0, 0)->ptr, "nr", 0);
|
2009-02-20 18:01:33 +00:00
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ONEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 1);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", TWOKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 2);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", THREEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 3);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FOURKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 4);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FIVEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 5);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SIXKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 6);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SEVENKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 7);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", EIGHTKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 8);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", NINEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 9);
|
|
|
|
|
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ZEROKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 10);
|
|
|
|
|
|
2009-01-06 19:58:42 +00:00
|
|
|
/* drawtype */
|
|
|
|
|
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, 0, 0);
|
2010-08-17 07:49:53 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
|
2009-11-17 16:04:17 +00:00
|
|
|
RNA_string_set(kmi->ptr, "value_1", "SOLID");
|
|
|
|
|
RNA_string_set(kmi->ptr, "value_2", "WIREFRAME");
|
2009-01-06 19:58:42 +00:00
|
|
|
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, KM_ALT, 0);
|
2010-08-17 07:49:53 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
|
2009-11-17 16:04:17 +00:00
|
|
|
RNA_string_set(kmi->ptr, "value_1", "TEXTURED");
|
|
|
|
|
RNA_string_set(kmi->ptr, "value_2", "SOLID");
|
2009-10-13 23:15:34 +00:00
|
|
|
|
2008-12-28 01:28:31 +00:00
|
|
|
/* selection*/
|
|
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
|
2009-09-16 01:15:30 +00:00
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
|
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "center", TRUE);
|
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "enumerate", TRUE);
|
|
|
|
|
|
|
|
|
|
/* selection key-combinations */
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "center", TRUE);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "center", TRUE);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "center", TRUE);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "extend", TRUE);
|
|
|
|
|
RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
|
2009-09-16 01:15:30 +00:00
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
|
|
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
|
RNA
* Enums can now be dynamically created in the _itemf callback,
using RNA_enum_item(s)_add, RNA_enum_item_end. All places asking
for enum items now need to potentially free the items.
* This callback now also gets context, this was added specifically
for operators. This doesn't fit design well at all, needed to do
some ugly hacks, but can't find a good solution at the moment.
* All enums must have a default list of items too, even with an
_itemf callback, for docs and fallback in case there is no context.
* Used by MESH_OT_merge, MESH_OT_select_similar, TFM_OT_select_orientation.
* Also changes some operator properties that were enums to booleas
(unselected, deselect), to make them consistent with other ops.
2009-07-10 19:56:13 +00:00
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0)->ptr, "deselect", 1);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
|
2008-12-28 01:28:31 +00:00
|
|
|
|
2009-07-09 08:39:58 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
|
2008-12-27 01:29:56 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-01-06 00:19:47 +00:00
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT|KM_CTRL, 0);
|
2009-10-06 02:45:42 +00:00
|
|
|
WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
|
2009-12-24 10:39:30 +00:00
|
|
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
|
2010-01-14 05:29:25 +00:00
|
|
|
|
2009-10-13 15:30:19 +00:00
|
|
|
/* context ops */
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
|
2010-06-14 03:52:10 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
2009-11-17 16:04:17 +00:00
|
|
|
RNA_string_set(kmi->ptr, "value", "BOUNDING_BOX_CENTER");
|
2009-10-13 15:30:19 +00:00
|
|
|
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, KM_CTRL, 0); /* 2.4x allowed Comma+Shift too, rather not use both */
|
2010-06-14 03:52:10 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
2009-11-17 16:04:17 +00:00
|
|
|
RNA_string_set(kmi->ptr, "value", "MEDIAN_POINT");
|
2009-10-13 15:30:19 +00:00
|
|
|
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", COMMAKEY, KM_PRESS, KM_ALT, 0); /* new in 2.5 */
|
2010-12-17 14:49:38 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.use_pivot_point_align");
|
2009-10-13 15:30:19 +00:00
|
|
|
|
2009-11-29 00:13:34 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* new in 2.5 */
|
2010-08-19 14:43:52 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.show_manipulator");
|
2009-11-29 00:13:34 +00:00
|
|
|
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
|
2010-06-14 03:52:10 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
2009-11-17 16:04:17 +00:00
|
|
|
RNA_string_set(kmi->ptr, "value", "CURSOR");
|
2009-10-13 15:30:19 +00:00
|
|
|
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_CTRL, 0);
|
2010-06-14 03:52:10 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
2009-12-09 00:03:18 +00:00
|
|
|
RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS");
|
2009-10-13 15:30:19 +00:00
|
|
|
|
2009-11-17 16:04:17 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_ALT, 0);
|
2010-06-14 03:52:10 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
2009-11-17 16:04:17 +00:00
|
|
|
RNA_string_set(kmi->ptr, "value", "ACTIVE_ELEMENT");
|
2009-10-13 15:30:19 +00:00
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
fly_modal_keymap(keyconf);
|
|
|
|
|
viewrotate_modal_keymap(keyconf);
|
|
|
|
|
viewmove_modal_keymap(keyconf);
|
|
|
|
|
viewzoom_modal_keymap(keyconf);
|
2008-12-19 17:14:02 +00:00
|
|
|
}
|
|
|
|
|
|