Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2009 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * Contributor(s): Blender Foundation 00022 * 00023 * ***** END GPL LICENSE BLOCK ***** 00024 */ 00025 00031 #include <stdlib.h> 00032 00033 00034 #include "RNA_access.h" 00035 00036 #include "WM_api.h" 00037 #include "WM_types.h" 00038 00039 #include "ED_physics.h" 00040 #include "ED_object.h" 00041 00042 #include "BLI_utildefines.h" 00043 00044 #include "physics_intern.h" // own include 00045 00046 00047 /***************************** particles ***********************************/ 00048 00049 static void operatortypes_particle(void) 00050 { 00051 WM_operatortype_append(PARTICLE_OT_select_all); 00052 WM_operatortype_append(PARTICLE_OT_select_roots); 00053 WM_operatortype_append(PARTICLE_OT_select_tips); 00054 WM_operatortype_append(PARTICLE_OT_select_linked); 00055 WM_operatortype_append(PARTICLE_OT_select_less); 00056 WM_operatortype_append(PARTICLE_OT_select_more); 00057 00058 WM_operatortype_append(PARTICLE_OT_hide); 00059 WM_operatortype_append(PARTICLE_OT_reveal); 00060 00061 WM_operatortype_append(PARTICLE_OT_rekey); 00062 WM_operatortype_append(PARTICLE_OT_subdivide); 00063 WM_operatortype_append(PARTICLE_OT_remove_doubles); 00064 WM_operatortype_append(PARTICLE_OT_weight_set); 00065 WM_operatortype_append(PARTICLE_OT_delete); 00066 WM_operatortype_append(PARTICLE_OT_mirror); 00067 00068 WM_operatortype_append(PARTICLE_OT_brush_edit); 00069 00070 WM_operatortype_append(PARTICLE_OT_particle_edit_toggle); 00071 WM_operatortype_append(PARTICLE_OT_edited_clear); 00072 00073 00074 WM_operatortype_append(OBJECT_OT_particle_system_add); 00075 WM_operatortype_append(OBJECT_OT_particle_system_remove); 00076 00077 WM_operatortype_append(PARTICLE_OT_new); 00078 WM_operatortype_append(PARTICLE_OT_new_target); 00079 WM_operatortype_append(PARTICLE_OT_target_remove); 00080 WM_operatortype_append(PARTICLE_OT_target_move_up); 00081 WM_operatortype_append(PARTICLE_OT_target_move_down); 00082 WM_operatortype_append(PARTICLE_OT_connect_hair); 00083 WM_operatortype_append(PARTICLE_OT_disconnect_hair); 00084 00085 WM_operatortype_append(PARTICLE_OT_dupliob_copy); 00086 WM_operatortype_append(PARTICLE_OT_dupliob_remove); 00087 WM_operatortype_append(PARTICLE_OT_dupliob_move_up); 00088 WM_operatortype_append(PARTICLE_OT_dupliob_move_down); 00089 } 00090 00091 static void keymap_particle(wmKeyConfig *keyconf) 00092 { 00093 wmKeyMapItem *kmi; 00094 wmKeyMap *keymap; 00095 00096 keymap= WM_keymap_find(keyconf, "Particle", 0, 0); 00097 keymap->poll= PE_poll; 00098 00099 kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0); 00100 RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); 00101 kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); 00102 RNA_enum_set(kmi->ptr, "action", SEL_INVERT); 00103 00104 WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); 00105 WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); 00106 00107 kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0); 00108 RNA_boolean_set(kmi->ptr, "deselect", FALSE); 00109 kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0); 00110 RNA_boolean_set(kmi->ptr, "deselect", TRUE); 00111 00112 WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0); 00113 WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0); 00114 00115 WM_keymap_add_item(keymap, "PARTICLE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); 00116 kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0); 00117 RNA_boolean_set(kmi->ptr, "unselected", FALSE); 00118 kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0); 00119 RNA_boolean_set(kmi->ptr, "unselected", TRUE); 00120 00121 kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0); 00122 RNA_boolean_set(kmi->ptr, "release_confirm", TRUE); 00123 00124 WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, 0, 0); 00125 WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); 00126 00127 /* size radial control */ 00128 kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0); 00129 RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.particle_edit.brush.size"); 00130 00131 /* size radial control */ 00132 kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0); 00133 RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.particle_edit.brush.strength"); 00134 00135 WM_keymap_add_menu(keymap, "VIEW3D_MT_particle_specials", WKEY, KM_PRESS, 0, 0); 00136 00137 WM_keymap_add_item(keymap, "PARTICLE_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0); 00138 00139 ED_object_generic_keymap(keyconf, keymap, 2); 00140 } 00141 00142 /******************************* boids *************************************/ 00143 00144 static void operatortypes_boids(void) 00145 { 00146 WM_operatortype_append(BOID_OT_rule_add); 00147 WM_operatortype_append(BOID_OT_rule_del); 00148 WM_operatortype_append(BOID_OT_rule_move_up); 00149 WM_operatortype_append(BOID_OT_rule_move_down); 00150 00151 WM_operatortype_append(BOID_OT_state_add); 00152 WM_operatortype_append(BOID_OT_state_del); 00153 WM_operatortype_append(BOID_OT_state_move_up); 00154 WM_operatortype_append(BOID_OT_state_move_down); 00155 } 00156 00157 /********************************* fluid ***********************************/ 00158 00159 static void operatortypes_fluid(void) 00160 { 00161 WM_operatortype_append(FLUID_OT_bake); 00162 } 00163 00164 /**************************** point cache **********************************/ 00165 00166 static void operatortypes_pointcache(void) 00167 { 00168 WM_operatortype_append(PTCACHE_OT_bake_all); 00169 WM_operatortype_append(PTCACHE_OT_free_bake_all); 00170 WM_operatortype_append(PTCACHE_OT_bake); 00171 WM_operatortype_append(PTCACHE_OT_free_bake); 00172 WM_operatortype_append(PTCACHE_OT_bake_from_cache); 00173 WM_operatortype_append(PTCACHE_OT_add); 00174 WM_operatortype_append(PTCACHE_OT_remove); 00175 } 00176 00177 /********************************* dynamic paint ***********************************/ 00178 00179 static void operatortypes_dynamicpaint(void) 00180 { 00181 WM_operatortype_append(DPAINT_OT_bake); 00182 WM_operatortype_append(DPAINT_OT_surface_slot_add); 00183 WM_operatortype_append(DPAINT_OT_surface_slot_remove); 00184 WM_operatortype_append(DPAINT_OT_type_toggle); 00185 WM_operatortype_append(DPAINT_OT_output_toggle); 00186 } 00187 00188 //static void keymap_pointcache(wmWindowManager *wm) 00189 //{ 00190 // wmKeyMap *keymap= WM_keymap_find(wm, "Pointcache", 0, 0); 00191 // 00192 // WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0); 00193 // WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); 00194 // WM_keymap_add_item(keymap, "PHYSICS_OT_bake_particle_system", PADMINUS, KM_PRESS, KM_CTRL, 0); 00195 // WM_keymap_add_item(keymap, "PHYSICS_OT_free_particle_system", LKEY, KM_PRESS, 0, 0); 00196 //} 00197 00198 /****************************** general ************************************/ 00199 00200 void ED_operatortypes_physics(void) 00201 { 00202 operatortypes_particle(); 00203 operatortypes_boids(); 00204 operatortypes_fluid(); 00205 operatortypes_pointcache(); 00206 operatortypes_dynamicpaint(); 00207 } 00208 00209 void ED_keymap_physics(wmKeyConfig *keyconf) 00210 { 00211 keymap_particle(keyconf); 00212 //keymap_pointcache(keyconf); 00213 } 00214 00215 00216