[#19688] pressing O and alt+O doesn't toggle proportional edit mode when editing...
[blender-staging.git] / source / blender / editors / physics / physics_ops.c
1 /**
2  * $Id:
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2009 Blender Foundation.
21  * All rights reserved.
22  *
23  * Contributor(s): Blender Foundation
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 #include <stdlib.h>
29
30 #include "DNA_windowmanager_types.h"
31
32 #include "RNA_access.h"
33
34 #include "WM_api.h"
35 #include "WM_types.h"
36
37 #include "ED_physics.h"
38 #include "ED_object.h"
39
40 #include "physics_intern.h" // own include
41
42 /***************************** particles ***********************************/
43
44 static void operatortypes_particle(void)
45 {
46         WM_operatortype_append(PARTICLE_OT_select_all_toggle);
47         WM_operatortype_append(PARTICLE_OT_select_first);
48         WM_operatortype_append(PARTICLE_OT_select_last);
49         WM_operatortype_append(PARTICLE_OT_select_linked);
50         WM_operatortype_append(PARTICLE_OT_select_less);
51         WM_operatortype_append(PARTICLE_OT_select_more);
52
53         WM_operatortype_append(PARTICLE_OT_hide);
54         WM_operatortype_append(PARTICLE_OT_reveal);
55
56         WM_operatortype_append(PARTICLE_OT_rekey);
57         WM_operatortype_append(PARTICLE_OT_subdivide);
58         WM_operatortype_append(PARTICLE_OT_remove_doubles);
59         WM_operatortype_append(PARTICLE_OT_delete);
60         WM_operatortype_append(PARTICLE_OT_mirror);
61
62         WM_operatortype_append(PARTICLE_OT_brush_set);
63         WM_operatortype_append(PARTICLE_OT_brush_edit);
64         WM_operatortype_append(PARTICLE_OT_brush_radial_control);
65
66         WM_operatortype_append(PARTICLE_OT_specials_menu);
67
68         WM_operatortype_append(PARTICLE_OT_particle_edit_toggle);
69         WM_operatortype_append(PARTICLE_OT_edited_clear);
70
71
72         WM_operatortype_append(OBJECT_OT_particle_system_add);
73         WM_operatortype_append(OBJECT_OT_particle_system_remove);
74
75         WM_operatortype_append(PARTICLE_OT_new);
76         WM_operatortype_append(PARTICLE_OT_new_target);
77         WM_operatortype_append(PARTICLE_OT_remove_target);
78         WM_operatortype_append(PARTICLE_OT_target_move_up);
79         WM_operatortype_append(PARTICLE_OT_target_move_down);
80         WM_operatortype_append(PARTICLE_OT_connect_hair);
81         WM_operatortype_append(PARTICLE_OT_disconnect_hair);
82
83         WM_operatortype_append(PARTICLE_OT_dupliob_copy);
84         WM_operatortype_append(PARTICLE_OT_dupliob_remove);
85         WM_operatortype_append(PARTICLE_OT_dupliob_move_up);
86         WM_operatortype_append(PARTICLE_OT_dupliob_move_down);
87 }
88
89 static void keymap_particle(wmKeyConfig *keyconf)
90 {
91         wmKeyMap *keymap;
92         
93         keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
94         keymap->poll= PE_poll;
95         
96         WM_keymap_add_item(keymap, "PARTICLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
97         WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
98         WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
99         WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
100         RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
101
102         WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0);
103         WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0);
104
105         WM_keymap_add_item(keymap, "PARTICLE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
106         WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0);
107         RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
108
109         WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", ACTIONMOUSE, KM_PRESS, 0, 0);
110         WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
111         RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
112         RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
113
114         WM_keymap_add_item(keymap, "PARTICLE_OT_specials_menu", WKEY, KM_PRESS, 0, 0);
115
116         ED_object_generic_keymap(keyconf, keymap, 1);
117 }
118
119 /******************************* boids *************************************/
120
121 static void operatortypes_boids(void)
122 {
123         WM_operatortype_append(BOID_OT_rule_add);
124         WM_operatortype_append(BOID_OT_rule_del);
125         WM_operatortype_append(BOID_OT_rule_move_up);
126         WM_operatortype_append(BOID_OT_rule_move_down);
127
128         WM_operatortype_append(BOID_OT_state_add);
129         WM_operatortype_append(BOID_OT_state_del);
130         WM_operatortype_append(BOID_OT_state_move_up);
131         WM_operatortype_append(BOID_OT_state_move_down);
132 }
133
134 /********************************* fluid ***********************************/
135
136 static void operatortypes_fluid(void)
137 {
138         WM_operatortype_append(FLUID_OT_bake);
139 }
140
141 /**************************** point cache **********************************/
142
143 static void operatortypes_pointcache(void)
144 {
145         WM_operatortype_append(PTCACHE_OT_bake_all);
146         WM_operatortype_append(PTCACHE_OT_free_bake_all);
147         WM_operatortype_append(PTCACHE_OT_bake);
148         WM_operatortype_append(PTCACHE_OT_free_bake);
149         WM_operatortype_append(PTCACHE_OT_bake_from_cache);
150         WM_operatortype_append(PTCACHE_OT_add_new);
151         WM_operatortype_append(PTCACHE_OT_remove);
152 }
153
154 //static void keymap_pointcache(wmWindowManager *wm)
155 //{
156 //      wmKeyMap *keymap= WM_keymap_find(wm, "Pointcache", 0, 0);
157 //      
158 //      WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0);
159 //      WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
160 //      WM_keymap_add_item(keymap, "PHYSICS_OT_bake_particle_system", PADMINUS, KM_PRESS, KM_CTRL, 0);
161 //      WM_keymap_add_item(keymap, "PHYSICS_OT_free_particle_system", LKEY, KM_PRESS, 0, 0);
162 //}
163
164 /****************************** general ************************************/
165
166 void ED_operatortypes_physics(void)
167 {
168         operatortypes_particle();
169         operatortypes_boids();
170         operatortypes_fluid();
171         operatortypes_pointcache();
172 }
173
174 void ED_keymap_physics(wmKeyConfig *keyconf)
175 {
176         keymap_particle(keyconf);
177         //keymap_pointcache(keyconf);
178 }
179
180
181