| 
									
										
										
										
											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"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "BLI_arithb.h"
 | 
					
						
							|  |  |  | #include "BLI_blenlib.h"
 | 
					
						
							|  |  |  | #include "BLI_editVert.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "BKE_context.h"
 | 
					
						
							|  |  |  | #include "BKE_global.h"
 | 
					
						
							|  |  |  | #include "BKE_utildefines.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "RNA_access.h"
 | 
					
						
							|  |  |  | #include "RNA_define.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "WM_api.h"
 | 
					
						
							|  |  |  | #include "WM_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "ED_screen.h"
 | 
					
						
							|  |  |  | #include "ED_mesh.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-05 15:19:31 +00:00
										 |  |  | #include "ED_view3d.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-17 18:35:33 +00:00
										 |  |  | #include "BIF_transform.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +00:00
										 |  |  | #include "mesh_intern.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-17 18:35:33 +00:00
										 |  |  | static int mesh_add_duplicate_exec(bContext *C, wmOperator *op) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Object *ob= CTX_data_edit_object(C); | 
					
						
							|  |  |  | 	EditMesh *em= ((Mesh *)ob->data)->edit_mesh; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	adduplicateflag(em, SELECT); | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	return OPERATOR_FINISHED; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-29 18:54:22 +00:00
										 |  |  | 	WM_cursor_wait(1); | 
					
						
							| 
									
										
										
										
											2009-01-17 18:35:33 +00:00
										 |  |  | 	mesh_add_duplicate_exec(C, op); | 
					
						
							| 
									
										
										
										
											2009-01-29 18:54:22 +00:00
										 |  |  | 	WM_cursor_wait(0); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-01-17 18:35:33 +00:00
										 |  |  | 	RNA_int_set(op->ptr, "mode", TFM_TRANSLATION); | 
					
						
							| 
									
										
										
										
											2009-01-18 10:46:26 +00:00
										 |  |  | 	WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr); | 
					
						
							| 
									
										
										
										
											2009-01-17 18:35:33 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	return OPERATOR_FINISHED; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void MESH_OT_add_duplicate(wmOperatorType *ot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	/* identifiers */ | 
					
						
							|  |  |  | 	ot->name= "Add Duplicate"; | 
					
						
							|  |  |  | 	ot->idname= "MESH_OT_add_duplicate"; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	/* api callbacks */ | 
					
						
							|  |  |  | 	ot->invoke= mesh_add_duplicate_invoke; | 
					
						
							|  |  |  | 	ot->exec= mesh_add_duplicate_exec; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	ot->poll= ED_operator_editmesh; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	/* to give to transform */ | 
					
						
							|  |  |  | 	RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +00:00
										 |  |  | /* ************************** registration **********************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void ED_operatortypes_mesh(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_de_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-02-01 12:40:27 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_select_invert); | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_selection_type); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_hide); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_reveal); | 
					
						
							| 
									
										
										
										
											2009-01-31 15:21:26 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_consistant_normals); | 
					
						
							| 
									
										
										
										
											2009-01-16 04:48:33 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_subdivide); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_subdivide_multi); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_subdivide_multi_fractal); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_subdivide_smooth); | 
					
						
							| 
									
										
										
										
											2009-01-19 18:36:54 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_subdivs); | 
					
						
							| 
									
										
										
										
											2009-01-13 02:09:58 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_select_linked_flat_faces); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_select_sharp_edges); | 
					
						
							| 
									
										
										
											
												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
										 |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_plane); | 
					
						
							| 
									
										
										
										
											2009-01-15 03:05:19 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_cube); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_circle); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_cylinder); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_tube); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_cone); | 
					
						
							| 
									
										
										
											
												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
										 |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_grid); | 
					
						
							| 
									
										
										
										
											2009-01-15 03:05:19 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_monkey); | 
					
						
							| 
									
										
										
										
											2009-01-15 18:28:40 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_uv_sphere); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_add_primitive_ico_sphere); | 
					
						
							| 
									
										
										
										
											2009-01-31 03:23:41 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_clear_fgon); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_make_fgon); | 
					
						
							| 
									
										
										
										
											2009-01-17 18:35:33 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_add_duplicate); | 
					
						
							| 
									
										
										
										
											2009-01-23 03:07:07 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_removedoublesflag); | 
					
						
							| 
									
										
										
										
											2009-02-01 12:40:27 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_extrude); | 
					
						
							| 
									
										
										
										
											2009-02-01 00:18:45 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_vertices_to_sphere); | 
					
						
							| 
									
										
										
										
											2009-01-31 02:31:58 +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); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_convert_quads_to_tris); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_convert_tris_to_quads); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_edge_flip); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_faces_shade_smooth); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_faces_shade_solid); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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-01-30 18:53:54 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_loop_select); | 
					
						
							| 
									
										
										
										
											2009-01-30 19:14:50 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_add_edge_face); | 
					
						
							| 
									
										
										
										
											2009-01-31 13:30:56 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_shortest_path_select); | 
					
						
							| 
									
										
										
										
											2009-01-31 15:21:26 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_similar_vertex_select); | 
					
						
							| 
									
										
										
										
											2009-01-31 16:54:37 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_similar_edge_select); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_similar_face_select); | 
					
						
							| 
									
										
										
										
											2009-02-02 19:31:43 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_select_multi_loop); | 
					
						
							| 
									
										
										
										
											2009-02-04 02:58:21 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_mark_seam); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_mark_sharp); | 
					
						
							|  |  |  | 	WM_operatortype_append(MESH_OT_smooth_vertex); | 
					
						
							| 
									
										
										
										
											2009-02-05 01:32:37 +00:00
										 |  |  | 	WM_operatortype_append(MESH_OT_flip_editnormals); | 
					
						
							| 
									
										
										
										
											2009-02-02 19:31:43 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* note mesh keymap also for other space? */ | 
					
						
							|  |  |  | void ED_keymap_mesh(wmWindowManager *wm) | 
					
						
							| 
									
										
										
										
											2009-01-15 18:28:40 +00:00
										 |  |  | {	 | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +00:00
										 |  |  | 	ListBase *keymap= WM_keymap_listbase(wm, "EditMesh", 0, 0); | 
					
						
							| 
									
										
										
										
											2009-01-31 09:23:17 +00:00
										 |  |  | 	wmKeymapItem *kmi; | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +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-01-31 09:23:17 +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); | 
					
						
							|  |  |  | 	RNA_boolean_set(kmi->ptr, "extend", 1); | 
					
						
							|  |  |  | 	kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0); | 
					
						
							|  |  |  | 	RNA_boolean_set(kmi->ptr, "ring", 1); | 
					
						
							|  |  |  | 	kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0); | 
					
						
							|  |  |  | 	RNA_boolean_set(kmi->ptr, "extend", 1); | 
					
						
							|  |  |  | 	RNA_boolean_set(kmi->ptr, "ring", 1); | 
					
						
							| 
									
										
										
										
											2009-01-31 13:30:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_shortest_path_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_de_select_all", AKEY, KM_PRESS, 0, 0); | 
					
						
							| 
									
										
										
										
											2009-01-13 02:09:58 +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); | 
					
						
							| 
									
										
										
										
											2009-02-01 12:40:27 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_select_invert", 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-01-17 16:11:12 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											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-01-16 23:58:10 +00:00
										 |  |  | 	RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_flat_faces", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0); | 
					
						
							| 
									
										
										
										
											2009-01-31 23:57:04 +00:00
										 |  |  | 	RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_sharp_edges", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-02-01 12:40:27 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_select_random", SPACEKEY, KM_PRESS, 0, 0); | 
					
						
							| 
									
										
										
										
											2009-02-01 00:18:45 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_vertices_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0); | 
					
						
							| 
									
										
										
										
											2009-02-04 02:58:21 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_mark_seam", ONEKEY, KM_PRESS, KM_CTRL , 0); | 
					
						
							|  |  |  | 	RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_mark_seam", ONEKEY, KM_PRESS, KM_ALT , 0)->ptr,"clear",1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_CTRL , 0); | 
					
						
							|  |  |  | 	RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_ALT , 0)->ptr,"set",1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_smooth_vertex", THREEKEY, KM_PRESS, KM_CTRL , 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 01:32:37 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_flip_editnormals", THREEKEY, KM_PRESS, KM_ALT , 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-31 16:54:37 +00:00
										 |  |  | 	/* temp hotkeys! */ | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_similar_vertex_select", GKEY, KM_PRESS, KM_SHIFT, 0); | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_similar_edge_select", GKEY, KM_PRESS, KM_SHIFT2|KM_CTRL, 0); | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_similar_face_select", GKEY, KM_PRESS, KM_SHIFT|KM_CTRL2, 0); | 
					
						
							| 
									
										
										
										
											2009-01-31 15:21:26 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-02-01 01:04:00 +00:00
										 |  |  | 	/* selection mode */ | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-02-01 13:24:19 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_selection_type", TABKEY, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2009-02-01 01:04:00 +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-01 19:53:24 +00:00
										 |  |  | 	RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "invert", 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-01-31 15:21:26 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_consistant_normals", NKEY, KM_PRESS, KM_CTRL, 0); | 
					
						
							|  |  |  | 	RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_consistant_normals", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1); | 
					
						
							| 
									
										
										
										
											2009-01-13 02:09:58 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-01-19 18:36:54 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_subdivs", WKEY, KM_PRESS, 0, 0); // this is the menu
 | 
					
						
							|  |  |  | 	/*WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
 | 
					
						
							| 
									
										
										
										
											2009-01-16 04:48:33 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi_fractal", WKEY, KM_PRESS, KM_ALT, 0); | 
					
						
							| 
									
										
										
										
											2009-01-19 18:36:54 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_subdivide_smooth", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);*/ | 
					
						
							| 
									
										
										
										
											2009-01-23 03:07:07 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_removedoublesflag", VKEY, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2009-02-01 12:40:27 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_extrude", EKEY, KM_PRESS, 0, 0); | 
					
						
							| 
									
										
										
										
											2009-02-01 04:22:18 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "VIEW3D_OT_editmesh_face_toolbox", FKEY, KM_PRESS, KM_CTRL, 0); /* operators below are in this toolbox */ | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_convert_quads_to_tris", TKEY, KM_PRESS, KM_CTRL, 0); | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_convert_tris_to_quads", JKEY, KM_PRESS, KM_ALT, 0); | 
					
						
							| 
									
										
										
										
											2009-01-19 18:36:54 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-01-31 09:23:17 +00:00
										 |  |  | 	/* add/remove */ | 
					
						
							| 
									
										
										
										
											2009-01-30 19:14:50 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_add_edge_face", FKEY, KM_PRESS, 0, 0); | 
					
						
							| 
									
										
										
										
											2009-01-17 18:35:33 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_add_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); | 
					
						
							| 
									
										
										
										
											2009-01-25 20:22:05 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "OBJECT_OT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0); | 
					
						
							| 
									
										
										
										
											2009-01-30 15:01:14 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, KM_SHIFT, 0); | 
					
						
							| 
									
										
											  
											
												2.5
Sanitized the 'tweak' event.
Original idea was to have WM event system generating it 
automatically. However, I first tested it via a handler
and operator, to check what kind of configurations would
be useful. It appeared to not work nice, also because
that inserting a tweak operator in a keymap is confusing.
Now 'tweaks' are generated automatically, and can be
catched by keymaps as any event. The current definition
of tweak is:
- if Left/Middle/Rightmouse pressed
    if event wasn't handled by window queue (modal handlers)
       start checking mousepositions
- while mousepositions are checked
   - escape on any event other than mouse
   - on mouse events:
     - add tweak event if mousemove > 10 pixels
     - stop checking for tweak if mousebutton released
- Tweak events have a define indicating mousebutton used
  EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R  
- In keymap definitions you can use _S or _A to map to
  action or select mouse userdef.
- Event value in keymap should be KM_ANY for all tweaks,
  or use one of the eight directions:
  EVT_GESTURE_E, _SE, _S, _SW, _W, _NW, _N, _NE 
- And of course you can add modifier checks in keymaps for it.
- Because tweaks are a result of mouse events, the handlers get
  both to evaluate. That means that RMB-select + tweak will work
  correctly.
  In case you don't want both to be handled, for example the 
  CTRL+LMB 'extrude' and CTRL+LMB-tweak 'lasso select', you will
  need to set the first acting on a EVT_RELEASE, this event only
  gets passed on when tweak fails.
The current system allows all options, configurable, we had in 2.48,
and many more! A diagram of what's possible is on the todo. :)
Also in this commit: lasso select editmesh failed with 'zbuffer 
occluded select'. Also circle-select failed.
											
										 
											2009-02-02 14:13:14 +00:00
										 |  |  | 						/* use KM_RELEASE because same key is used for tweaks */ | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_RELEASE, 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-01-31 09:23:17 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_make_fgon", FKEY, KM_PRESS, KM_ALT, 0); | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "MESH_OT_clear_fgon", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); | 
					
						
							| 
									
										
										
										
											2009-01-31 03:23:41 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-01-30 15:01:14 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-01-01 13:15:35 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 |