2009-01-01 13:15:35 +00:00
|
|
|
/**
|
|
|
|
* $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) 2009 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_object_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2009-01-01 13:15:35 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_editVert.h"
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
|
|
|
#include "BKE_global.h"
|
2009-04-20 15:06:46 +00:00
|
|
|
#include "BKE_mesh.h"
|
2009-01-01 13:15:35 +00:00
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
#include "ED_mesh.h"
|
2009-10-22 23:22:05 +00:00
|
|
|
#include "ED_object.h"
|
2009-07-08 16:17:47 +00:00
|
|
|
#include "ED_screen.h"
|
|
|
|
#include "ED_transform.h"
|
2009-01-05 15:19:31 +00:00
|
|
|
#include "ED_view3d.h"
|
2009-01-01 13:15:35 +00:00
|
|
|
|
2009-07-08 21:31:28 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
2009-01-01 13:15:35 +00:00
|
|
|
#include "mesh_intern.h"
|
|
|
|
|
2009-07-08 21:31:28 +00:00
|
|
|
/**************************** registration **********************************/
|
2009-01-01 13:15:35 +00:00
|
|
|
|
|
|
|
void ED_operatortypes_mesh(void)
|
|
|
|
{
|
2009-11-29 22:16:29 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_all);
|
2009-01-13 02:09:58 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_more);
|
|
|
|
WM_operatortype_append(MESH_OT_select_less);
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_inverse);
|
2009-01-13 02:09:58 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_non_manifold);
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_linked);
|
|
|
|
WM_operatortype_append(MESH_OT_select_linked_pick);
|
|
|
|
WM_operatortype_append(MESH_OT_select_random);
|
2009-11-04 10:49:42 +00:00
|
|
|
//WM_operatortype_append(MESH_OT_pin);
|
|
|
|
//WM_operatortype_append(MESH_OT_unpin);
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_operatortype_append(MESH_OT_hide);
|
|
|
|
WM_operatortype_append(MESH_OT_reveal);
|
2009-07-08 15:34:41 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_by_number_vertices);
|
2009-11-01 00:06:53 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_mirror);
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_operatortype_append(MESH_OT_normals_make_consistent);
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_operatortype_append(MESH_OT_merge);
|
2009-01-16 04:48:33 +00:00
|
|
|
WM_operatortype_append(MESH_OT_subdivide);
|
2009-04-12 17:43:43 +00:00
|
|
|
WM_operatortype_append(MESH_OT_faces_select_linked_flat);
|
|
|
|
WM_operatortype_append(MESH_OT_edges_select_sharp);
|
2009-04-12 17:28:16 +00:00
|
|
|
WM_operatortype_append(MESH_OT_primitive_plane_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_cube_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_circle_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_tube_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_cone_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_grid_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_monkey_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
|
|
|
|
WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_operatortype_append(MESH_OT_duplicate);
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_operatortype_append(MESH_OT_remove_doubles);
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_operatortype_append(MESH_OT_extrude);
|
2009-02-16 20:04:01 +00:00
|
|
|
WM_operatortype_append(MESH_OT_spin);
|
2009-02-18 03:01:45 +00:00
|
|
|
WM_operatortype_append(MESH_OT_screw);
|
2009-02-16 20:04:01 +00:00
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(MESH_OT_split);
|
2009-02-07 23:20:36 +00:00
|
|
|
WM_operatortype_append(MESH_OT_extrude_repeat);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(MESH_OT_edge_rotate);
|
2009-07-08 15:34:41 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_vertex_path);
|
2009-02-07 23:20:36 +00:00
|
|
|
WM_operatortype_append(MESH_OT_loop_to_region);
|
|
|
|
WM_operatortype_append(MESH_OT_region_to_loop);
|
2009-11-05 18:29:48 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_axis);
|
2009-02-07 23:20:36 +00:00
|
|
|
|
2009-04-12 17:54:07 +00:00
|
|
|
WM_operatortype_append(MESH_OT_uvs_rotate);
|
2009-09-12 07:08:57 +00:00
|
|
|
//WM_operatortype_append(MESH_OT_uvs_mirror);
|
|
|
|
WM_operatortype_append(MESH_OT_uvs_reverse);
|
2009-04-12 17:54:07 +00:00
|
|
|
WM_operatortype_append(MESH_OT_colors_rotate);
|
2009-09-20 18:18:40 +00:00
|
|
|
//WM_operatortype_append(MESH_OT_colors_mirror);
|
|
|
|
WM_operatortype_append(MESH_OT_colors_reverse);
|
2009-02-07 23:20:36 +00:00
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_operatortype_append(MESH_OT_fill);
|
2009-02-01 04:22:18 +00:00
|
|
|
WM_operatortype_append(MESH_OT_beauty_fill);
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_operatortype_append(MESH_OT_quads_convert_to_tris);
|
|
|
|
WM_operatortype_append(MESH_OT_tris_convert_to_quads);
|
2009-02-01 04:22:18 +00:00
|
|
|
WM_operatortype_append(MESH_OT_edge_flip);
|
|
|
|
WM_operatortype_append(MESH_OT_faces_shade_smooth);
|
2009-07-21 00:36:07 +00:00
|
|
|
WM_operatortype_append(MESH_OT_faces_shade_flat);
|
2009-02-01 04:22:18 +00:00
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_operatortype_append(MESH_OT_delete);
|
2009-01-31 02:31:58 +00:00
|
|
|
|
2009-01-30 15:01:14 +00:00
|
|
|
WM_operatortype_append(MESH_OT_separate);
|
2.5
- Edit mesh: Add ctrl+click add vertex or extrude.
I've made it not move the 3d cursor in that case.
Also found out tweak events conflicted with existing
keymap definitions; on tweak failure (= no mousemove)
it now passes on the mouse event as 'mouse down' for
the remaining keymaps to check.
These then actually respond to mouse-up instead of down...
The location in the keymaps where tweaks get generated
remains important. Examples:
1 - 'select' mouse-handler, operator return pass-through
2 - tweak handler checks, and makes tweak event
3 - grabber responds to tweak event
1 - ctrl+mouse tweak handler checks, makes tweak event,
or passes event on
2 - if tweak event, it runs lasso
3 - else when passed on, ctrl+click extrude happens
In the first case, select works on mouse-down, immediate.
In the second case, extrude happens on mouse-release, even
though the keymap defined mouse-press.
This will make designing nice balanced keymaps still not
simple; especially because you can't tell operators to
pass on the key... although we can add the convention that
select-mouse operators always pass on to enable tweaks.
Still a good reason to wait with custom keymaps
when this is fully settled!
2009-01-30 18:18:41 +00:00
|
|
|
WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
|
2009-04-12 17:43:43 +00:00
|
|
|
WM_operatortype_append(MESH_OT_loop_select);
|
2009-04-12 17:28:16 +00:00
|
|
|
WM_operatortype_append(MESH_OT_edge_face_add);
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_shortest_path);
|
2009-07-08 15:34:41 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_similar);
|
2009-04-12 17:43:43 +00:00
|
|
|
WM_operatortype_append(MESH_OT_loop_multi_select);
|
2009-02-04 02:58:21 +00:00
|
|
|
WM_operatortype_append(MESH_OT_mark_seam);
|
|
|
|
WM_operatortype_append(MESH_OT_mark_sharp);
|
2009-04-12 17:43:43 +00:00
|
|
|
WM_operatortype_append(MESH_OT_vertices_smooth);
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_operatortype_append(MESH_OT_flip_normals);
|
2009-02-07 15:44:16 +00:00
|
|
|
WM_operatortype_append(MESH_OT_knife_cut);
|
2009-02-19 19:03:53 +00:00
|
|
|
WM_operatortype_append(MESH_OT_rip);
|
2009-11-01 00:06:53 +00:00
|
|
|
WM_operatortype_append(MESH_OT_blend_from_shape);
|
2009-10-27 15:40:56 +00:00
|
|
|
WM_operatortype_append(MESH_OT_shape_propagate_to_all);
|
2009-02-02 19:31:43 +00:00
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
WM_operatortype_append(MESH_OT_uv_texture_add);
|
|
|
|
WM_operatortype_append(MESH_OT_uv_texture_remove);
|
|
|
|
WM_operatortype_append(MESH_OT_vertex_color_add);
|
|
|
|
WM_operatortype_append(MESH_OT_vertex_color_remove);
|
|
|
|
WM_operatortype_append(MESH_OT_sticky_add);
|
|
|
|
WM_operatortype_append(MESH_OT_sticky_remove);
|
2009-07-17 05:09:33 +00:00
|
|
|
WM_operatortype_append(MESH_OT_vert_connect);
|
2009-07-17 06:05:09 +00:00
|
|
|
WM_operatortype_append(MESH_OT_edge_split);
|
Brought Extrude all the way back. The contextual menu works,
as does only edges and individual faces extrude (individual vert
extrude already did).
Note that I need to port this, after we all figure out how to handle
operators with variable transform follow-ons.
I also implemented the merge->collapse function, which is currently
accessable under ctrl->v, Bmesh Test Operator. I still need to
implement the other merge modes, and properly hook everything into
the merge menu tool, which I plan on doing soon (tomorrow hopefully).
The cool thing about the collapse tool, is not only does it handle (all)
UV layers, it handles vcols as well. To do this, I had to add a few math
functions to the customdata API, which seem to be working well.
2009-08-11 07:49:35 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(MESH_OT_extrude_region);
|
|
|
|
WM_operatortype_append(MESH_OT_extrude_verts_indiv);
|
|
|
|
WM_operatortype_append(MESH_OT_extrude_edges_indiv);
|
|
|
|
WM_operatortype_append(MESH_OT_extrude_faces_indiv);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
|
Brought Extrude all the way back. The contextual menu works,
as does only edges and individual faces extrude (individual vert
extrude already did).
Note that I need to port this, after we all figure out how to handle
operators with variable transform follow-ons.
I also implemented the merge->collapse function, which is currently
accessable under ctrl->v, Bmesh Test Operator. I still need to
implement the other merge modes, and properly hook everything into
the merge menu tool, which I plan on doing soon (tomorrow hopefully).
The cool thing about the collapse tool, is not only does it handle (all)
UV layers, it handles vcols as well. To do this, I had to add a few math
functions to the customdata API, which seem to be working well.
2009-08-11 07:49:35 +00:00
|
|
|
WM_operatortype_append(MESH_OT_bm_test);
|
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
WM_operatortype_append(MESH_OT_edgering_select);
|
|
|
|
WM_operatortype_append(MESH_OT_loopcut);
|
2009-12-14 23:35:13 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(MESH_OT_solidify);
|
2009-12-22 19:01:51 +00:00
|
|
|
WM_operatortype_append(MESH_OT_select_nth);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
void ED_operatormacros_mesh(void)
|
|
|
|
{
|
|
|
|
wmOperatorType *ot;
|
|
|
|
wmOperatorTypeMacro *otmacro;
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-12-06 17:36:27 +00:00
|
|
|
ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
|
2009-11-17 22:19:48 +00:00
|
|
|
WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
|
2009-12-10 10:36:32 +00:00
|
|
|
WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
|
|
|
WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
|
2009-12-10 10:36:32 +00:00
|
|
|
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
|
|
|
|
ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
|
|
|
|
WM_operatortype_macro_define(ot, "MESH_OT_rip");
|
2009-12-10 10:36:32 +00:00
|
|
|
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
|
2009-08-06 09:56:14 +00:00
|
|
|
/*ot= WM_operatortype_append_macro("MESH_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
WM_operatortype_macro_define(ot, "MESH_OT_extrude");
|
2009-12-10 10:36:32 +00:00
|
|
|
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
2009-10-22 23:22:05 +00:00
|
|
|
RNA_enum_set(otmacro->ptr, "proportional", 0);
|
Brought Extrude all the way back. The contextual menu works,
as does only edges and individual faces extrude (individual vert
extrude already did).
Note that I need to port this, after we all figure out how to handle
operators with variable transform follow-ons.
I also implemented the merge->collapse function, which is currently
accessable under ctrl->v, Bmesh Test Operator. I still need to
implement the other merge modes, and properly hook everything into
the merge menu tool, which I plan on doing soon (tomorrow hopefully).
The cool thing about the collapse tool, is not only does it handle (all)
UV layers, it handles vcols as well. To do this, I had to add a few math
functions to the customdata API, which seem to be working well.
2009-08-11 07:49:35 +00:00
|
|
|
RNA_enum_set(otm->ptr, "proportional", 0);
|
|
|
|
RNA_boolean_set(otm->ptr, "mirror", 0);
|
|
|
|
|
|
|
|
RNA_enum_set(otm->ptr, "constraint_orientation", V3D_MANIP_NORMAL);
|
|
|
|
RNA_boolean_set_array(otm->ptr, "constraint_axis", constraint_axis);*/
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* note mesh keymap also for other space? */
|
2009-10-22 23:22:05 +00:00
|
|
|
void ED_keymap_mesh(wmKeyConfig *keyconf)
|
2009-01-15 18:28:40 +00:00
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
wmKeyMap *keymap;
|
|
|
|
wmKeyMapItem *kmi;
|
|
|
|
|
2009-12-24 09:26:06 +00:00
|
|
|
keymap= WM_keymap_find(keyconf, "Mesh", 0, 0);
|
2009-10-22 23:22:05 +00:00
|
|
|
keymap->poll= ED_operator_editmesh;
|
2009-01-01 13:15:35 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_loopcut", RKEY, KM_PRESS, KM_CTRL, 0);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2.5
Editmesh: add primitive basics back. Had to clean up a load of
crap there... but it's sorta in control, so I think Shul can
pick it up again.
Test: ctrl+0 adds plane, or ctrl+9 adds grid.
Notes for Shul:
- i've added a transform function, which gets correctly passed
on to the add_prim function, should work for all object
transforms. Only the code inside add_prim might be needed
to check (it uses 4x4 mat now, not a 3x3)
- The old code with buttons has been ifdeffed out, check for
user input and make it rna properties, which get read
in the exec(), and handed over to the add_prim. Set them
default now to the values from old buttons.
- Operator naming is preferred lower case, I gave this
a new name.
- check a bit on formatting code, but don't use the old code
as example! Look also at ED_keymap_mesh() for example.
2009-01-14 19:26:11 +00:00
|
|
|
/* selecting */
|
2009-01-31 13:30:56 +00:00
|
|
|
/* standard mouse selection goes via space_view3d */
|
2009-04-12 17:43:43 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
|
|
|
|
kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
|
2009-01-31 09:23:17 +00:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", 1);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
|
|
|
|
kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
|
2009-01-31 09:23:17 +00:00
|
|
|
RNA_boolean_set(kmi->ptr, "extend", 1);
|
2009-01-31 13:30:56 +00:00
|
|
|
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-11-29 22:16:29 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_all", AKEY, KM_PRESS, 0, 0);
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
|
2009-01-13 02:09:58 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
|
2009-08-05 07:15:17 +00:00
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_more", EQUALKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_less", MINUSKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
|
2009-01-17 16:11:12 +00:00
|
|
|
|
2009-04-12 17:43:43 +00:00
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_edges_select_sharp", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
|
2009-07-08 15:34:41 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-07-17 06:05:09 +00:00
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_edge_split", MKEY, KM_PRESS, 0, 0);
|
2009-01-31 15:21:26 +00:00
|
|
|
|
2009-02-01 01:04:00 +00:00
|
|
|
/* selection mode */
|
2009-12-22 16:11:11 +00:00
|
|
|
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_selection_mode", TABKEY, KM_PRESS, KM_CTRL, 0);
|
2009-02-01 01:04:00 +00:00
|
|
|
|
2009-09-10 03:59:12 +00:00
|
|
|
/* pin */
|
2009-11-04 10:49:42 +00:00
|
|
|
//WM_keymap_add_item(keymap, "MESH_OT_pin", RETKEY, KM_PRESS, 0, 0);
|
|
|
|
//RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_pin", RETKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
|
|
|
|
//WM_keymap_add_item(keymap, "MESH_OT_unpin", RETKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
//RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_unpin", RETKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "unselected", 1);
|
2009-09-10 03:59:12 +00:00
|
|
|
|
2.5
Editmesh: add primitive basics back. Had to clean up a load of
crap there... but it's sorta in control, so I think Shul can
pick it up again.
Test: ctrl+0 adds plane, or ctrl+9 adds grid.
Notes for Shul:
- i've added a transform function, which gets correctly passed
on to the add_prim function, should work for all object
transforms. Only the code inside add_prim might be needed
to check (it uses 4x4 mat now, not a 3x3)
- The old code with buttons has been ifdeffed out, check for
user input and make it rna properties, which get read
in the exec(), and handed over to the add_prim. Set them
default now to the values from old buttons.
- Operator naming is preferred lower case, I gave this
a new name.
- check a bit on formatting code, but don't use the old code
as example! Look also at ED_keymap_mesh() for example.
2009-01-14 19:26:11 +00:00
|
|
|
/* hide */
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
|
2009-02-20 20:39:27 +00:00
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
|
2009-01-13 02:09:58 +00:00
|
|
|
|
2.5
Editmesh: add primitive basics back. Had to clean up a load of
crap there... but it's sorta in control, so I think Shul can
pick it up again.
Test: ctrl+0 adds plane, or ctrl+9 adds grid.
Notes for Shul:
- i've added a transform function, which gets correctly passed
on to the add_prim function, should work for all object
transforms. Only the code inside add_prim might be needed
to check (it uses 4x4 mat now, not a 3x3)
- The old code with buttons has been ifdeffed out, check for
user input and make it rna properties, which get read
in the exec(), and handed over to the add_prim. Set them
default now to the values from old buttons.
- Operator naming is preferred lower case, I gave this
a new name.
- check a bit on formatting code, but don't use the old code
as example! Look also at ED_keymap_mesh() for example.
2009-01-14 19:26:11 +00:00
|
|
|
/* tools */
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1);
|
2009-01-13 02:09:58 +00:00
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_extrude", EKEY, KM_PRESS, 0, 0);
|
2009-07-17 05:09:33 +00:00
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_vert_connect", YKEY, KM_PRESS, 0, 0);
|
2009-02-01 04:22:18 +00:00
|
|
|
|
2009-02-16 20:04:01 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-02-01 04:22:18 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_beauty_fill", FKEY, KM_PRESS, KM_ALT, 0);
|
2009-04-15 15:40:31 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_edge_flip", FKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
2009-11-02 17:24:06 +00:00
|
|
|
|
2009-10-07 21:19:58 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_rip_move",VKEY, KM_PRESS, KM_SHIFT, 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
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
|
2009-02-19 19:03:53 +00:00
|
|
|
|
Keymap conflict detection operator.
Takes into account the hierarchical structures of keymaps as well as wildcards (KM_ANY) in event definitions, user remaps (emulate numpad, action/select mouse buttons, ...) and event values that overlap (click, press and release)
For now, doesn't do anything other than print conflicts in the console.
As a result, I cleaned up a lot of keymaps that had double definitions, moved some keymap items in more appropriate places, fixed wrong definitions and removed kmi that were added for testing a long long time ago.
Out of all the remaining conflicts, after removing obvious non-issues, here's what remains: http://www.pasteall.org/9898
2009-12-17 22:14:43 +00:00
|
|
|
WM_keymap_add_item(keymap, "TRANSFORM_OT_shrink_fatten", SKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
|
2009-01-31 09:23:17 +00:00
|
|
|
/* add/remove */
|
2009-04-12 17:28:16 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0);
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_skin", FKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); /* python */
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "name", "INFO_MT_mesh_add");
|
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
|
2009-11-02 17:24:06 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0);
|
2009-11-23 16:24:28 +00:00
|
|
|
|
|
|
|
/* use KM_CLICK because same key is used for tweaks */
|
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
|
2009-01-30 15:01:14 +00:00
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0);
|
2009-01-31 09:23:17 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
|
2010-01-11 05:55:34 +00:00
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
|
2009-07-08 21:31:28 +00:00
|
|
|
|
|
|
|
/* menus */
|
2009-10-22 23:22:05 +00:00
|
|
|
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", WKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_specials");
|
|
|
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", FKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_faces");
|
2009-02-07 15:44:16 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", EKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_edges");
|
|
|
|
|
|
|
|
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", VKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_vertices");
|
|
|
|
|
2009-11-03 18:20:03 +00:00
|
|
|
kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", UKEY, KM_PRESS, 0, 0);
|
2010-01-05 22:33:41 +00:00
|
|
|
RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_uv_map");
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
ED_object_generic_keymap(keyconf, keymap, TRUE);
|
2009-01-01 13:15:35 +00:00
|
|
|
}
|
|
|
|
|