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