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 * 00022 * Contributor(s): Blender Foundation 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00032 #include <stdlib.h> 00033 #include <stdio.h> 00034 00035 #include "RNA_define.h" 00036 #include "RNA_enum_types.h" 00037 00038 #include "DNA_screen_types.h" 00039 #include "DNA_space_types.h" 00040 #include "DNA_windowmanager_types.h" 00041 00042 #ifdef RNA_RUNTIME 00043 00044 #include "BKE_context.h" 00045 00046 static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C) 00047 { 00048 wmWindowManager *wm = CTX_wm_manager(C); 00049 return WM_keymap_active(wm, km); 00050 } 00051 00052 static void rna_keymap_restore_item_to_default(wmKeyMap *km, bContext *C, wmKeyMapItem *kmi) 00053 { 00054 WM_keymap_restore_item_to_default(C, km, kmi); 00055 } 00056 00057 static void rna_Operator_report(wmOperator *op, int type, const char *msg) 00058 { 00059 BKE_report(op->reports, type, msg); 00060 } 00061 00062 /* since event isnt needed... */ 00063 static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op) 00064 { 00065 WM_enum_search_invoke(C, op, NULL); 00066 00067 } 00068 00069 static int rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator) 00070 { 00071 return WM_event_add_modal_handler(C, operator) != NULL; 00072 } 00073 00074 /* XXX, need a way for python to know event types, 0x0110 is hard coded */ 00075 struct wmTimer *rna_event_timer_add(struct wmWindowManager *wm, float time_step, wmWindow *win) 00076 { 00077 return WM_event_add_timer(wm, win, 0x0110, time_step); 00078 } 00079 00080 void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer) 00081 { 00082 WM_event_remove_timer(wm, timer->win, timer); 00083 } 00084 00085 static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) 00086 { 00087 // wmWindowManager *wm = CTX_wm_manager(C); 00088 char idname_bl[OP_MAX_TYPENAME]; 00089 int modifier= 0; 00090 00091 /* only on non-modal maps */ 00092 if (km->flag & KEYMAP_MODAL) { 00093 BKE_report(reports, RPT_ERROR, "Not a non-modal keymap"); 00094 return NULL; 00095 } 00096 00097 WM_operator_bl_idname(idname_bl, idname); 00098 00099 if(shift) modifier |= KM_SHIFT; 00100 if(ctrl) modifier |= KM_CTRL; 00101 if(alt) modifier |= KM_ALT; 00102 if(oskey) modifier |= KM_OSKEY; 00103 00104 if(any) modifier = KM_ANY; 00105 00106 return WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier); 00107 } 00108 00109 static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports, const char *propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) 00110 { 00111 int modifier= 0; 00112 int propvalue = 0; 00113 00114 /* only modal maps */ 00115 if ((km->flag & KEYMAP_MODAL) == 0) { 00116 BKE_report(reports, RPT_ERROR, "Not a modal keymap"); 00117 return NULL; 00118 } 00119 00120 if (!km->modal_items) { 00121 BKE_report(reports, RPT_ERROR, "No property values defined"); 00122 return NULL; 00123 } 00124 00125 00126 if(RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue)==0) { 00127 BKE_report(reports, RPT_WARNING, "Property value not in enumeration"); 00128 } 00129 00130 if(shift) modifier |= KM_SHIFT; 00131 if(ctrl) modifier |= KM_CTRL; 00132 if(alt) modifier |= KM_ALT; 00133 if(oskey) modifier |= KM_OSKEY; 00134 00135 if(any) modifier = KM_ANY; 00136 00137 return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue); 00138 } 00139 00140 static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal) 00141 { 00142 if (modal == 0) { 00143 return WM_keymap_find(keyconf, idname, spaceid, regionid); 00144 } else { 00145 return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */ 00146 } 00147 } 00148 00149 static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid) 00150 { 00151 return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid); 00152 } 00153 00154 static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char *idname) 00155 { 00156 wmOperatorType *ot = WM_operatortype_find(idname, 0); 00157 00158 if (!ot) 00159 return NULL; 00160 else 00161 return ot->modalkeymap; 00162 } 00163 00164 #else 00165 00166 #define WM_GEN_INVOKE_EVENT (1<<0) 00167 #define WM_GEN_INVOKE_SIZE (1<<1) 00168 #define WM_GEN_INVOKE_RETURN (1<<2) 00169 00170 static void rna_generic_op_invoke(FunctionRNA *func, int flag) 00171 { 00172 PropertyRNA *parm; 00173 00174 RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT); 00175 parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call"); 00176 RNA_def_property_flag(parm, PROP_REQUIRED); 00177 00178 if(flag & WM_GEN_INVOKE_EVENT) { 00179 parm= RNA_def_pointer(func, "event", "Event", "", "Event"); 00180 RNA_def_property_flag(parm, PROP_REQUIRED); 00181 } 00182 00183 if(flag & WM_GEN_INVOKE_SIZE) { 00184 RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX); 00185 RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup", 0, INT_MAX); 00186 } 00187 00188 if(flag & WM_GEN_INVOKE_RETURN) { 00189 parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); 00190 RNA_def_function_return(func, parm); 00191 } 00192 } 00193 00194 void RNA_api_wm(StructRNA *srna) 00195 { 00196 FunctionRNA *func; 00197 PropertyRNA *parm; 00198 00199 func= RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect"); 00200 RNA_def_function_ui_description(func, "Show up the file selector"); 00201 rna_generic_op_invoke(func, 0); 00202 00203 func= RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add"); 00204 RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT); 00205 parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call"); 00206 RNA_def_property_flag(parm, PROP_REQUIRED); 00207 RNA_def_function_return(func, RNA_def_boolean(func, "handle", 1, "", "")); 00208 00209 00210 func= RNA_def_function(srna, "event_timer_add", "rna_event_timer_add"); 00211 parm= RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE); 00212 RNA_def_property_flag(parm, PROP_REQUIRED); 00213 RNA_def_property_range(parm, 0.0, FLT_MAX); 00214 RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events"); 00215 RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to or None"); 00216 parm= RNA_def_pointer(func, "result", "Timer", "", ""); 00217 RNA_def_function_return(func, parm); 00218 00219 00220 func= RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove"); 00221 parm= RNA_def_pointer(func, "timer", "Timer", "", ""); 00222 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00223 00224 00225 /* invoke functions, for use with python */ 00226 func= RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup"); 00227 RNA_def_function_ui_description(func, "Operator popup invoke"); 00228 rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT|WM_GEN_INVOKE_RETURN); 00229 00230 /* invoked dialog opens popup with OK button, does not auto-exec operator. */ 00231 func= RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup"); 00232 RNA_def_function_ui_description(func, "Operator dialog (non-autoexec popup) invoke"); 00233 rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN); 00234 00235 /* invoke enum */ 00236 func= RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke"); 00237 rna_generic_op_invoke(func, 0); 00238 00239 /* invoke functions, for use with python */ 00240 func= RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup"); 00241 RNA_def_function_ui_description(func, "Operator popup invoke"); 00242 rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN); 00243 00244 func= RNA_def_function(srna, "invoke_confirm", "WM_operator_confirm"); 00245 RNA_def_function_ui_description(func, "Operator confirmation"); 00246 rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT|WM_GEN_INVOKE_RETURN); 00247 00248 } 00249 00250 void RNA_api_operator(StructRNA *srna) 00251 { 00252 FunctionRNA *func; 00253 PropertyRNA *parm; 00254 00255 /* utility, not for registering */ 00256 func= RNA_def_function(srna, "report", "rna_Operator_report"); 00257 parm= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", ""); 00258 RNA_def_property_flag(parm, PROP_REQUIRED); 00259 parm= RNA_def_string(func, "message", "", 0, "Report Message", ""); 00260 RNA_def_property_flag(parm, PROP_REQUIRED); 00261 00262 00263 /* Registration */ 00264 00265 /* poll */ 00266 func= RNA_def_function(srna, "poll", NULL); 00267 RNA_def_function_ui_description(func, "Test if the operator can be called or not"); 00268 RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); 00269 RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); 00270 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00271 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00272 00273 /* exec */ 00274 func= RNA_def_function(srna, "execute", NULL); 00275 RNA_def_function_ui_description(func, "Execute the operator"); 00276 RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); 00277 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00278 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00279 00280 parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? 00281 RNA_def_function_return(func, parm); 00282 00283 /* check */ 00284 func= RNA_def_function(srna, "check", NULL); 00285 RNA_def_function_ui_description(func, "Check the operator settings, return True to signal a change to redraw"); 00286 RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); 00287 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00288 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00289 00290 parm= RNA_def_boolean(func, "result", 0, "result", ""); // better name? 00291 RNA_def_function_return(func, parm); 00292 00293 /* invoke */ 00294 func= RNA_def_function(srna, "invoke", NULL); 00295 RNA_def_function_ui_description(func, "Invoke the operator"); 00296 RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); 00297 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00298 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00299 parm= RNA_def_pointer(func, "event", "Event", "", ""); 00300 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00301 00302 parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? 00303 RNA_def_function_return(func, parm); 00304 00305 func= RNA_def_function(srna, "modal", NULL); /* same as invoke */ 00306 RNA_def_function_ui_description(func, "Modal operator function"); 00307 RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); 00308 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00309 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00310 parm= RNA_def_pointer(func, "event", "Event", "", ""); 00311 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00312 00313 parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? 00314 RNA_def_function_return(func, parm); 00315 00316 /* draw */ 00317 func= RNA_def_function(srna, "draw", NULL); 00318 RNA_def_function_ui_description(func, "Draw function for the operator"); 00319 RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); 00320 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00321 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00322 00323 /* cancel */ 00324 func= RNA_def_function(srna, "cancel", NULL); 00325 RNA_def_function_ui_description(func, "Called when the operator is cancelled"); 00326 RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); 00327 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00328 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00329 00330 parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name? 00331 RNA_def_function_return(func, parm); 00332 } 00333 00334 void RNA_api_macro(StructRNA *srna) 00335 { 00336 FunctionRNA *func; 00337 PropertyRNA *parm; 00338 00339 /* utility, not for registering */ 00340 func= RNA_def_function(srna, "report", "rna_Operator_report"); 00341 parm= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", ""); 00342 RNA_def_property_flag(parm, PROP_REQUIRED); 00343 parm= RNA_def_string(func, "message", "", 0, "Report Message", ""); 00344 RNA_def_property_flag(parm, PROP_REQUIRED); 00345 00346 00347 /* Registration */ 00348 00349 /* poll */ 00350 func= RNA_def_function(srna, "poll", NULL); 00351 RNA_def_function_ui_description(func, "Test if the operator can be called or not"); 00352 RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); 00353 RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); 00354 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00355 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00356 00357 /* draw */ 00358 func= RNA_def_function(srna, "draw", NULL); 00359 RNA_def_function_ui_description(func, "Draw function for the operator"); 00360 RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); 00361 parm= RNA_def_pointer(func, "context", "Context", "", ""); 00362 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00363 } 00364 00365 void RNA_api_keyconfig(StructRNA *srna) 00366 { 00367 // FunctionRNA *func; 00368 // PropertyRNA *parm; 00369 } 00370 00371 void RNA_api_keymap(StructRNA *srna) 00372 { 00373 FunctionRNA *func; 00374 PropertyRNA *parm; 00375 00376 func= RNA_def_function(srna, "active", "rna_keymap_active"); 00377 RNA_def_function_flag(func, FUNC_USE_CONTEXT); 00378 parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map"); 00379 RNA_def_function_return(func, parm); 00380 00381 func= RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default"); 00382 RNA_def_function_flag(func, FUNC_USE_CONTEXT); 00383 00384 func= RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default"); 00385 RNA_def_function_flag(func, FUNC_USE_CONTEXT); 00386 parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); 00387 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); 00388 } 00389 00390 void RNA_api_keymapitem(StructRNA *srna) 00391 { 00392 FunctionRNA *func; 00393 PropertyRNA *parm; 00394 00395 func= RNA_def_function(srna, "compare", "WM_keymap_item_compare"); 00396 parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); 00397 RNA_def_property_flag(parm, PROP_REQUIRED); 00398 parm= RNA_def_boolean(func, "result", 0, "Comparison result", ""); 00399 RNA_def_function_return(func, parm); 00400 } 00401 00402 void RNA_api_keymapitems(StructRNA *srna) 00403 { 00404 FunctionRNA *func; 00405 PropertyRNA *parm; 00406 00407 func= RNA_def_function(srna, "new", "rna_KeyMap_item_new"); 00408 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00409 parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", ""); 00410 RNA_def_property_flag(parm, PROP_REQUIRED); 00411 parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); 00412 RNA_def_property_flag(parm, PROP_REQUIRED); 00413 parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); 00414 RNA_def_property_flag(parm, PROP_REQUIRED); 00415 RNA_def_boolean(func, "any", 0, "Any", ""); 00416 RNA_def_boolean(func, "shift", 0, "Shift", ""); 00417 RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); 00418 RNA_def_boolean(func, "alt", 0, "Alt", ""); 00419 RNA_def_boolean(func, "oskey", 0, "OS Key", ""); 00420 RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", ""); 00421 parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item"); 00422 RNA_def_function_return(func, parm); 00423 00424 func= RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal"); 00425 RNA_def_function_flag(func, FUNC_USE_REPORTS); 00426 parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", ""); 00427 RNA_def_property_flag(parm, PROP_REQUIRED); 00428 parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", ""); 00429 RNA_def_property_flag(parm, PROP_REQUIRED); 00430 parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", ""); 00431 RNA_def_property_flag(parm, PROP_REQUIRED); 00432 RNA_def_boolean(func, "any", 0, "Any", ""); 00433 RNA_def_boolean(func, "shift", 0, "Shift", ""); 00434 RNA_def_boolean(func, "ctrl", 0, "Ctrl", ""); 00435 RNA_def_boolean(func, "alt", 0, "Alt", ""); 00436 RNA_def_boolean(func, "oskey", 0, "OS Key", ""); 00437 RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", ""); 00438 parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item"); 00439 RNA_def_function_return(func, parm); 00440 00441 func= RNA_def_function(srna, "remove", "WM_keymap_remove_item"); 00442 parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); 00443 RNA_def_property_flag(parm, PROP_REQUIRED); 00444 00445 func= RNA_def_function(srna, "from_id", "WM_keymap_item_find_id"); 00446 parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE); 00447 RNA_def_property_flag(parm, PROP_REQUIRED); 00448 RNA_def_property_ui_text(parm, "id", "ID of the item"); 00449 parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", ""); 00450 RNA_def_function_return(func, parm); 00451 } 00452 00453 void RNA_api_keymaps(StructRNA *srna) 00454 { 00455 FunctionRNA *func; 00456 PropertyRNA *parm; 00457 00458 func= RNA_def_function(srna, "new", "rna_keymap_new"); // add_keymap 00459 parm= RNA_def_string(func, "name", "", 0, "Name", ""); 00460 RNA_def_property_flag(parm, PROP_REQUIRED); 00461 RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); 00462 RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); 00463 RNA_def_boolean(func, "modal", 0, "Modal", ""); 00464 parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map"); 00465 RNA_def_function_return(func, parm); 00466 00467 func= RNA_def_function(srna, "find", "rna_keymap_find"); // find_keymap 00468 parm= RNA_def_string(func, "name", "", 0, "Name", ""); 00469 RNA_def_property_flag(parm, PROP_REQUIRED); 00470 RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", ""); 00471 RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); 00472 parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map"); 00473 RNA_def_function_return(func, parm); 00474 00475 func= RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); // find_keymap_modal 00476 parm= RNA_def_string(func, "name", "", 0, "Operator Name", ""); 00477 RNA_def_property_flag(parm, PROP_REQUIRED); 00478 parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map"); 00479 RNA_def_function_return(func, parm); 00480 } 00481 00482 void RNA_api_keyconfigs(StructRNA *srna) 00483 { 00484 FunctionRNA *func; 00485 PropertyRNA *parm; 00486 00487 func= RNA_def_function(srna, "new", "WM_keyconfig_new_user"); // add_keyconfig 00488 parm= RNA_def_string(func, "name", "", 0, "Name", ""); 00489 RNA_def_property_flag(parm, PROP_REQUIRED); 00490 parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration"); 00491 RNA_def_function_return(func, parm); 00492 00493 func= RNA_def_function(srna, "remove", "WM_keyconfig_remove"); // remove_keyconfig 00494 parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration"); 00495 RNA_def_property_flag(parm, PROP_REQUIRED); 00496 } 00497 00498 #endif 00499