|
Blender
V2.59
|
00001 /* 00002 * $Id: rna_wm.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 * Contributor(s): Blender Foundation (2008). 00021 * 00022 * ***** END GPL LICENSE BLOCK ***** 00023 */ 00024 00030 #include <stdlib.h> 00031 00032 #include "RNA_access.h" 00033 #include "RNA_define.h" 00034 #include "RNA_enum_types.h" 00035 00036 #include "rna_internal.h" 00037 00038 #include "DNA_screen_types.h" 00039 #include "DNA_space_types.h" 00040 #include "DNA_userdef_types.h" 00041 #include "DNA_windowmanager_types.h" 00042 00043 #include "WM_types.h" 00044 00045 EnumPropertyItem event_keymouse_value_items[] = { 00046 {KM_ANY, "ANY", 0, "Any", ""}, 00047 {KM_PRESS, "PRESS", 0, "Press", ""}, 00048 {KM_RELEASE, "RELEASE", 0, "Release", ""}, 00049 {KM_CLICK, "CLICK", 0, "Click", ""}, 00050 {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""}, 00051 {0, NULL, 0, NULL, NULL}}; 00052 00053 EnumPropertyItem event_tweak_value_items[]= { 00054 {KM_ANY, "ANY", 0, "Any", ""}, 00055 {EVT_GESTURE_N, "NORTH", 0, "North", ""}, 00056 {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""}, 00057 {EVT_GESTURE_E, "EAST", 0, "East", ""}, 00058 {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""}, 00059 {EVT_GESTURE_S, "SOUTH", 0, "South", ""}, 00060 {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""}, 00061 {EVT_GESTURE_W, "WEST", 0, "West", ""}, 00062 {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""}, 00063 {0, NULL, 0, NULL, NULL}}; 00064 00065 EnumPropertyItem event_value_items[] = { 00066 {KM_ANY, "ANY", 0, "Any", ""}, 00067 {KM_NOTHING, "NOTHING", 0, "Nothing", ""}, 00068 {KM_PRESS, "PRESS", 0, "Press", ""}, 00069 {KM_RELEASE, "RELEASE", 0, "Release", ""}, 00070 {KM_CLICK, "CLICK", 0, "Click", ""}, 00071 {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""}, 00072 {0, NULL, 0, NULL, NULL}}; 00073 00074 EnumPropertyItem event_tweak_type_items[]= { 00075 {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""}, 00076 {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""}, 00077 {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""}, 00078 {EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Action", ""}, 00079 {EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Select", ""}, 00080 {0, NULL, 0, NULL, NULL}}; 00081 00082 EnumPropertyItem event_mouse_type_items[]= { 00083 {LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""}, 00084 {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""}, 00085 {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""}, 00086 {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""}, 00087 {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""}, 00088 {ACTIONMOUSE, "ACTIONMOUSE", 0, "Action", ""}, 00089 {SELECTMOUSE, "SELECTMOUSE", 0, "Select", ""}, 00090 {0, "", 0, NULL, NULL}, 00091 {MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""}, 00092 {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""}, 00093 {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""}, 00094 {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""}, 00095 {0, "", 0, NULL, NULL}, 00096 {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""}, 00097 {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""}, 00098 {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""}, 00099 {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""}, 00100 {0, NULL, 0, NULL, NULL}}; 00101 00102 EnumPropertyItem event_timer_type_items[]= { 00103 {TIMER, "TIMER", 0, "Timer", ""}, 00104 {TIMER0, "TIMER0", 0, "Timer 0", ""}, 00105 {TIMER1, "TIMER1", 0, "Timer 1", ""}, 00106 {TIMER2, "TIMER2", 0, "Timer 2", ""}, 00107 {0, NULL, 0, NULL, NULL}}; 00108 00109 EnumPropertyItem event_ndof_type_items[]= { 00110 /* buttons on all 3dconnexion devices */ 00111 {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""}, 00112 {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""}, 00113 /* view buttons */ 00114 {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "Top", ""}, 00115 {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "Bottom", ""}, 00116 {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "Left", ""}, 00117 {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "Right", ""}, 00118 {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""}, 00119 {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""}, 00120 /* more views */ 00121 {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "ISO 1", ""}, 00122 {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "ISO 2", ""}, 00123 /* 90 degree rotations */ 00124 {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""}, 00125 {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""}, 00126 {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "Spin CW", ""}, 00127 {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "Spin CCW", ""}, 00128 {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "Tilt CW", ""}, 00129 {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "Tilt CCW", ""}, 00130 /* device control */ 00131 {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "Rotate", ""}, 00132 {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "Pan/Zoom", ""}, 00133 {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""}, 00134 {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""}, 00135 {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""}, 00136 /* general-purpose buttons */ 00137 {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""}, 00138 {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""}, 00139 {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "Button 3", ""}, 00140 {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "Button 4", ""}, 00141 {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "Button 5", ""}, 00142 {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "Button 6", ""}, 00143 {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "Button 7", ""}, 00144 {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""}, 00145 {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""}, 00146 {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""}, 00147 {0, NULL, 0, NULL, NULL}}; 00148 00149 /* not returned: CAPSLOCKKEY, UNKNOWNKEY */ 00150 EnumPropertyItem event_type_items[] = { 00151 00152 {0, "NONE", 0, "", ""}, 00153 {LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", ""}, 00154 {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", ""}, 00155 {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", ""}, 00156 {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4 Mouse", ""}, 00157 {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", ""}, 00158 {ACTIONMOUSE, "ACTIONMOUSE", 0, "Action Mouse", ""}, 00159 {SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", ""}, 00160 {0, "", 0, NULL, NULL}, 00161 {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", ""}, 00162 {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "Inbetween Move", ""}, 00163 {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""}, 00164 {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""}, 00165 {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""}, 00166 {0, "", 0, NULL, NULL}, 00167 {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""}, 00168 {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""}, 00169 {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""}, 00170 {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""}, 00171 {0, "", 0, NULL, NULL}, 00172 {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", ""}, 00173 {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", ""}, 00174 {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", ""}, 00175 {EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Tweak Action", ""}, 00176 {EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Tweak Select", ""}, 00177 {0, "", 0, NULL, NULL}, 00178 {AKEY, "A", 0, "A", ""}, 00179 {BKEY, "B", 0, "B", ""}, 00180 {CKEY, "C", 0, "C", ""}, 00181 {DKEY, "D", 0, "D", ""}, 00182 {EKEY, "E", 0, "E", ""}, 00183 {FKEY, "F", 0, "F", ""}, 00184 {GKEY, "G", 0, "G", ""}, 00185 {HKEY, "H", 0, "H", ""}, 00186 {IKEY, "I", 0, "I", ""}, 00187 {JKEY, "J", 0, "J", ""}, 00188 {KKEY, "K", 0, "K", ""}, 00189 {LKEY, "L", 0, "L", ""}, 00190 {MKEY, "M", 0, "M", ""}, 00191 {NKEY, "N", 0, "N", ""}, 00192 {OKEY, "O", 0, "O", ""}, 00193 {PKEY, "P", 0, "P", ""}, 00194 {QKEY, "Q", 0, "Q", ""}, 00195 {RKEY, "R", 0, "R", ""}, 00196 {SKEY, "S", 0, "S", ""}, 00197 {TKEY, "T", 0, "T", ""}, 00198 {UKEY, "U", 0, "U", ""}, 00199 {VKEY, "V", 0, "V", ""}, 00200 {WKEY, "W", 0, "W", ""}, 00201 {XKEY, "X", 0, "X", ""}, 00202 {YKEY, "Y", 0, "Y", ""}, 00203 {ZKEY, "Z", 0, "Z", ""}, 00204 {0, "", 0, NULL, NULL}, 00205 {ZEROKEY, "ZERO", 0, "0", ""}, 00206 {ONEKEY, "ONE", 0, "1", ""}, 00207 {TWOKEY, "TWO", 0, "2", ""}, 00208 {THREEKEY, "THREE", 0, "3", ""}, 00209 {FOURKEY, "FOUR", 0, "4", ""}, 00210 {FIVEKEY, "FIVE", 0, "5", ""}, 00211 {SIXKEY, "SIX", 0, "6", ""}, 00212 {SEVENKEY, "SEVEN", 0, "7", ""}, 00213 {EIGHTKEY, "EIGHT", 0, "8", ""}, 00214 {NINEKEY, "NINE", 0, "9", ""}, 00215 {0, "", 0, NULL, NULL}, 00216 {LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", ""}, 00217 {LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", ""}, 00218 {LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", ""}, 00219 {RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", ""}, 00220 {RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", ""}, 00221 {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", ""}, 00222 {0, "", 0, NULL, NULL}, 00223 {OSKEY, "OSKEY", 0, "OS Key", ""}, 00224 {GRLESSKEY, "GRLESS", 0, "Grless", ""}, 00225 {ESCKEY, "ESC", 0, "Esc", ""}, 00226 {TABKEY, "TAB", 0, "Tab", ""}, 00227 {RETKEY, "RET", 0, "Return", ""}, 00228 {SPACEKEY, "SPACE", 0, "Spacebar", ""}, 00229 {LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""}, 00230 {BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", ""}, 00231 {DELKEY, "DEL", 0, "Delete", ""}, 00232 {SEMICOLONKEY, "SEMI_COLON", 0, ";", ""}, 00233 {PERIODKEY, "PERIOD", 0, ".", ""}, 00234 {COMMAKEY, "COMMA", 0, ",", ""}, 00235 {QUOTEKEY, "QUOTE", 0, "\"", ""}, 00236 {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""}, 00237 {MINUSKEY, "MINUS", 0, "-", ""}, 00238 {SLASHKEY, "SLASH", 0, "/", ""}, 00239 {BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""}, 00240 {EQUALKEY, "EQUAL", 0, "=", ""}, 00241 {LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""}, 00242 {RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""}, 00243 {LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", ""}, 00244 {DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", ""}, 00245 {RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", ""}, 00246 {UPARROWKEY, "UP_ARROW", 0, "Up Arrow", ""}, 00247 {PAD2, "NUMPAD_2", 0, "Numpad 2", ""}, 00248 {PAD4, "NUMPAD_4", 0, "Numpad 4", ""}, 00249 {PAD6, "NUMPAD_6", 0, "Numpad 6", ""}, 00250 {PAD8, "NUMPAD_8", 0, "Numpad 8", ""}, 00251 {PAD1, "NUMPAD_1", 0, "Numpad 1", ""}, 00252 {PAD3, "NUMPAD_3", 0, "Numpad 3", ""}, 00253 {PAD5, "NUMPAD_5", 0, "Numpad 5", ""}, 00254 {PAD7, "NUMPAD_7", 0, "Numpad 7", ""}, 00255 {PAD9, "NUMPAD_9", 0, "Numpad 9", ""}, 00256 {PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", ""}, 00257 {PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", ""}, 00258 {PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", ""}, 00259 {PAD0, "NUMPAD_0", 0, "Numpad 0", ""}, 00260 {PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", ""}, 00261 {PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", ""}, 00262 {PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", ""}, 00263 {F1KEY, "F1", 0, "F1", ""}, 00264 {F2KEY, "F2", 0, "F2", ""}, 00265 {F3KEY, "F3", 0, "F3", ""}, 00266 {F4KEY, "F4", 0, "F4", ""}, 00267 {F5KEY, "F5", 0, "F5", ""}, 00268 {F6KEY, "F6", 0, "F6", ""}, 00269 {F7KEY, "F7", 0, "F7", ""}, 00270 {F8KEY, "F8", 0, "F8", ""}, 00271 {F9KEY, "F9", 0, "F9", ""}, 00272 {F10KEY, "F10", 0, "F10", ""}, 00273 {F11KEY, "F11", 0, "F11", ""}, 00274 {F12KEY, "F12", 0, "F12", ""}, 00275 {F13KEY, "F13", 0, "F13", ""}, 00276 {F14KEY, "F14", 0, "F14", ""}, 00277 {F15KEY, "F15", 0, "F15", ""}, 00278 {F16KEY, "F16", 0, "F16", ""}, 00279 {F17KEY, "F17", 0, "F17", ""}, 00280 {F18KEY, "F18", 0, "F18", ""}, 00281 {F19KEY, "F19", 0, "F19", ""}, 00282 {PAUSEKEY, "PAUSE", 0, "Pause", ""}, 00283 {INSERTKEY, "INSERT", 0, "Insert", ""}, 00284 {HOMEKEY, "HOME", 0, "Home", ""}, 00285 {PAGEUPKEY, "PAGE_UP", 0, "Page Up", ""}, 00286 {PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", ""}, 00287 {ENDKEY, "END", 0, "End", ""}, 00288 {0, "", 0, NULL, NULL}, 00289 {MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ""}, 00290 {MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", ""}, 00291 {MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", ""}, 00292 {MEDIALAST, "MEDIA_LAST", 0, "Media Last", ""}, 00293 {0, "", 0, NULL, NULL}, 00294 {WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""}, 00295 {TIMER, "TIMER", 0, "Timer", ""}, 00296 {TIMER0, "TIMER0", 0, "Timer 0", ""}, 00297 {TIMER1, "TIMER1", 0, "Timer 1", ""}, 00298 {TIMER2, "TIMER2", 0, "Timer 2", ""}, 00299 {0, "", 0, NULL, NULL}, 00300 /* buttons on all 3dconnexion devices */ 00301 {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""}, 00302 {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""}, 00303 /* view buttons */ 00304 {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "Top", ""}, 00305 {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "Bottom", ""}, 00306 {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "Left", ""}, 00307 {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "Right", ""}, 00308 {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""}, 00309 {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""}, 00310 /* more views */ 00311 {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "ISO 1", ""}, 00312 {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "ISO 2", ""}, 00313 /* 90 degree rotations */ 00314 {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""}, 00315 {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""}, 00316 {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "Spin CW", ""}, 00317 {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "Spin CCW", ""}, 00318 {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "Tilt CW", ""}, 00319 {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "Tilt CCW", ""}, 00320 /* device control */ 00321 {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "Rotate", ""}, 00322 {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "Pan/Zoom", ""}, 00323 {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""}, 00324 {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""}, 00325 {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""}, 00326 /* general-purpose buttons */ 00327 {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""}, 00328 {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""}, 00329 {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "Button 3", ""}, 00330 {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "Button 4", ""}, 00331 {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "Button 5", ""}, 00332 {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "Button 6", ""}, 00333 {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "Button 7", ""}, 00334 {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""}, 00335 {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""}, 00336 {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""}, 00337 {0, NULL, 0, NULL, NULL}}; 00338 00339 EnumPropertyItem keymap_propvalue_items[] = { 00340 {0, "NONE", 0, "", ""}, 00341 {0, NULL, 0, NULL, NULL}}; 00342 00343 EnumPropertyItem keymap_modifiers_items[] = { 00344 {KM_ANY, "ANY", 0, "Any", ""}, 00345 {0, "NONE", 0, "None", ""}, 00346 {1, "FIRST", 0, "First", ""}, 00347 {2, "SECOND", 0, "Second", ""}, 00348 {0, NULL, 0, NULL, NULL}}; 00349 00350 EnumPropertyItem operator_flag_items[] = { 00351 {OPTYPE_REGISTER, "REGISTER", 0, "Register", ""}, 00352 {OPTYPE_UNDO, "UNDO", 0, "Undo", ""}, 00353 {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", ""}, 00354 {OPTYPE_MACRO, "MACRO", 0, "Macro", ""}, 00355 {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""}, 00356 {OPTYPE_PRESET, "PRESET", 0, "Preset", ""}, 00357 {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", ""}, 00358 {0, NULL, 0, NULL, NULL}}; 00359 00360 EnumPropertyItem operator_return_items[] = { 00361 {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", ""}, 00362 {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", ""}, 00363 {OPERATOR_FINISHED, "FINISHED", 0, "Finished", ""}, 00364 {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", ""}, // used as a flag 00365 {0, NULL, 0, NULL, NULL}}; 00366 00367 /* flag/enum */ 00368 EnumPropertyItem wm_report_items[] = { 00369 {RPT_DEBUG, "DEBUG", 0, "Debug", ""}, 00370 {RPT_INFO, "INFO", 0, "Info", ""}, 00371 {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""}, 00372 {RPT_WARNING, "WARNING", 0, "Warning", ""}, 00373 {RPT_ERROR, "ERROR", 0, "Error", ""}, 00374 {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},\ 00375 {RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""}, 00376 {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""}, 00377 {0, NULL, 0, NULL, NULL}}; 00378 00379 #define KMI_TYPE_KEYBOARD 0 00380 #define KMI_TYPE_MOUSE 1 00381 #define KMI_TYPE_TWEAK 2 00382 #define KMI_TYPE_TEXTINPUT 3 00383 #define KMI_TYPE_TIMER 4 00384 #define KMI_TYPE_NDOF 5 00385 00386 #ifdef RNA_RUNTIME 00387 00388 #include <assert.h> 00389 00390 #include "WM_api.h" 00391 00392 #include "BKE_idprop.h" 00393 00394 #include "MEM_guardedalloc.h" 00395 00396 static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr) 00397 { 00398 wmWindowManager *wm= ptr->id.data; 00399 IDProperty *properties= (IDProperty*)ptr->data; 00400 wmOperator *op; 00401 00402 if(wm) 00403 for(op=wm->operators.first; op; op=op->next) 00404 if(op->properties == properties) 00405 return op; 00406 00407 return NULL; 00408 } 00409 00410 static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr) 00411 { 00412 wmOperator *op= rna_OperatorProperties_find_operator(ptr); 00413 00414 if(op) 00415 return op->type->srna; 00416 else 00417 return ptr->type; 00418 } 00419 00420 static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, int create) 00421 { 00422 if(create && !ptr->data) { 00423 IDPropertyTemplate val = {0}; 00424 ptr->data= IDP_New(IDP_GROUP, val, "RNA_OperatorProperties group"); 00425 } 00426 00427 return ptr->data; 00428 } 00429 00430 static void rna_Operator_name_get(PointerRNA *ptr, char *value) 00431 { 00432 wmOperator *op= (wmOperator*)ptr->data; 00433 strcpy(value, op->type->name); 00434 } 00435 00436 static int rna_Operator_name_length(PointerRNA *ptr) 00437 { 00438 wmOperator *op= (wmOperator*)ptr->data; 00439 return strlen(op->type->name); 00440 } 00441 00442 static int rna_Operator_has_reports_get(PointerRNA *ptr) 00443 { 00444 wmOperator *op= (wmOperator*)ptr->data; 00445 return (op->reports && op->reports->list.first); 00446 } 00447 00448 static PointerRNA rna_Operator_properties_get(PointerRNA *ptr) 00449 { 00450 wmOperator *op= (wmOperator*)ptr->data; 00451 return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties); 00452 } 00453 00454 static PointerRNA rna_OperatorTypeMacro_properties_get(PointerRNA *ptr) 00455 { 00456 wmOperatorTypeMacro *otmacro= (wmOperatorTypeMacro*)ptr->data; 00457 wmOperatorType *ot = WM_operatortype_find(otmacro->idname, TRUE); 00458 return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties); 00459 } 00460 00461 static void rna_Event_ascii_get(PointerRNA *ptr, char *value) 00462 { 00463 wmEvent *event= (wmEvent*)ptr->id.data; 00464 value[0]= event->ascii; 00465 value[1]= '\0'; 00466 } 00467 00468 static int rna_Event_ascii_length(PointerRNA *ptr) 00469 { 00470 wmEvent *event= (wmEvent*)ptr->id.data; 00471 return (event->ascii)? 1 : 0; 00472 } 00473 00474 static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value) 00475 { 00476 wmWindow *win= (wmWindow*)ptr->data; 00477 00478 if(value.data == NULL) 00479 return; 00480 00481 /* exception: can't set screens inside of area/region handers */ 00482 win->newscreen= value.data; 00483 } 00484 00485 static void rna_Window_screen_update(bContext *C, PointerRNA *ptr) 00486 { 00487 wmWindow *win= (wmWindow*)ptr->data; 00488 00489 /* exception: can't set screens inside of area/region handers */ 00490 if(win->newscreen) { 00491 WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, win->newscreen); 00492 win->newscreen= NULL; 00493 } 00494 } 00495 00496 static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr) 00497 { 00498 wmKeyMapItem *kmi= ptr->data; 00499 00500 if(kmi->ptr) 00501 return *(kmi->ptr); 00502 00503 //return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); 00504 return PointerRNA_NULL; 00505 } 00506 00507 static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr) 00508 { 00509 wmKeyMapItem *kmi= ptr->data; 00510 00511 if(ISTIMER(kmi->type)) return KMI_TYPE_TIMER; 00512 if(ISKEYBOARD(kmi->type)) return KMI_TYPE_KEYBOARD; 00513 if(ISTWEAK(kmi->type)) return KMI_TYPE_TWEAK; 00514 if(ISMOUSE(kmi->type)) return KMI_TYPE_MOUSE; 00515 if(ISNDOF(kmi->type)) return KMI_TYPE_NDOF; 00516 if(kmi->type == KM_TEXTINPUT) return KMI_TYPE_TEXTINPUT; 00517 return KMI_TYPE_KEYBOARD; 00518 } 00519 00520 static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value) 00521 { 00522 wmKeyMapItem *kmi= ptr->data; 00523 int map_type= rna_wmKeyMapItem_map_type_get(ptr); 00524 00525 if(value != map_type) { 00526 switch(value) { 00527 case KMI_TYPE_KEYBOARD: 00528 kmi->type= AKEY; 00529 kmi->val= KM_PRESS; 00530 break; 00531 case KMI_TYPE_TWEAK: 00532 kmi->type= EVT_TWEAK_L; 00533 kmi->val= KM_ANY; 00534 break; 00535 case KMI_TYPE_MOUSE: 00536 kmi->type= LEFTMOUSE; 00537 kmi->val= KM_PRESS; 00538 break; 00539 case KMI_TYPE_TEXTINPUT: 00540 kmi->type= KM_TEXTINPUT; 00541 kmi->val= KM_NOTHING; 00542 break; 00543 case KMI_TYPE_TIMER: 00544 kmi->type= TIMER; 00545 kmi->val= KM_NOTHING; 00546 break; 00547 case KMI_TYPE_NDOF: 00548 kmi->type = NDOF_BUTTON_MENU; 00549 kmi->val = KM_NOTHING; 00550 break; 00551 } 00552 } 00553 } 00554 00555 static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) 00556 { 00557 int map_type= rna_wmKeyMapItem_map_type_get(ptr); 00558 00559 if(map_type == KMI_TYPE_MOUSE) return event_mouse_type_items; 00560 if(map_type == KMI_TYPE_TWEAK) return event_tweak_type_items; 00561 if(map_type == KMI_TYPE_TIMER) return event_timer_type_items; 00562 if(map_type == KMI_TYPE_NDOF) return event_ndof_type_items; 00563 else return event_type_items; 00564 } 00565 00566 static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) 00567 { 00568 int map_type= rna_wmKeyMapItem_map_type_get(ptr); 00569 00570 if(map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) return event_keymouse_value_items; 00571 if(map_type == KMI_TYPE_TWEAK) return event_tweak_value_items; 00572 else return event_value_items; 00573 } 00574 00575 static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) 00576 { 00577 wmWindowManager *wm = CTX_wm_manager(C); 00578 wmKeyConfig *kc; 00579 wmKeyMap *km; 00580 00581 for(kc=wm->keyconfigs.first; kc; kc=kc->next) { 00582 for(km=kc->keymaps.first; km; km=km->next) { 00583 /* only check if it's a modal keymap */ 00584 if (km->modal_items) { 00585 wmKeyMapItem *kmi; 00586 for (kmi=km->items.first; kmi; kmi=kmi->next) { 00587 if (kmi == ptr->data) { 00588 return km->modal_items; 00589 } 00590 } 00591 } 00592 } 00593 } 00594 00595 00596 return keymap_propvalue_items; /* ERROR */ 00597 } 00598 00599 static int rna_KeyMapItem_any_getf(PointerRNA *ptr) 00600 { 00601 wmKeyMapItem *kmi = (wmKeyMapItem*)ptr->data; 00602 00603 if (kmi->shift == KM_ANY && 00604 kmi->ctrl == KM_ANY && 00605 kmi->alt == KM_ANY && 00606 kmi->oskey == KM_ANY) 00607 00608 return 1; 00609 else 00610 return 0; 00611 } 00612 00613 static void rna_KeyMapItem_any_setf(PointerRNA *ptr, int value) 00614 { 00615 wmKeyMapItem *kmi = (wmKeyMapItem*)ptr->data; 00616 00617 if(value) { 00618 kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= KM_ANY; 00619 } 00620 else { 00621 kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= 0; 00622 } 00623 } 00624 00625 00626 static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr) 00627 { 00628 wmWindowManager *wm= ptr->data; 00629 wmKeyConfig *kc; 00630 00631 for(kc=wm->keyconfigs.first; kc; kc=kc->next) 00632 if(strcmp(kc->idname, U.keyconfigstr) == 0) 00633 break; 00634 00635 if(!kc) 00636 kc= wm->defaultconf; 00637 00638 return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc); 00639 } 00640 00641 static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value) 00642 { 00643 wmWindowManager *wm= ptr->data; 00644 wmKeyConfig *kc= value.data; 00645 00646 if(kc) 00647 WM_keyconfig_set_active(wm, kc->idname); 00648 } 00649 00650 static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value) 00651 { 00652 wmKeyMapItem *kmi= ptr->data; 00653 WM_operator_py_idname(value, kmi->idname); 00654 } 00655 00656 static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr) 00657 { 00658 wmKeyMapItem *kmi= ptr->data; 00659 char pyname[OP_MAX_TYPENAME]; 00660 00661 WM_operator_py_idname(pyname, kmi->idname); 00662 return strlen(pyname); 00663 } 00664 00665 static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value) 00666 { 00667 wmKeyMapItem *kmi= ptr->data; 00668 char idname[OP_MAX_TYPENAME]; 00669 00670 WM_operator_bl_idname(idname, value); 00671 00672 if(strcmp(idname, kmi->idname) != 0) { 00673 BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname)); 00674 00675 WM_keymap_properties_reset(kmi, NULL); 00676 } 00677 } 00678 00679 static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value) 00680 { 00681 wmKeyMapItem *kmi= ptr->data; 00682 wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1); 00683 00684 if (ot) 00685 strcpy(value, ot->name); 00686 } 00687 00688 static int rna_wmKeyMapItem_name_length(PointerRNA *ptr) 00689 { 00690 wmKeyMapItem *kmi= ptr->data; 00691 wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1); 00692 00693 if (ot) 00694 return strlen(ot->name); 00695 else 00696 return 0; 00697 } 00698 00699 static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr) 00700 { 00701 wmKeyMapItem *kmi= ptr->data; 00702 return kmi->id < 0; 00703 } 00704 00705 static void rna_wmClipboard_get(PointerRNA *UNUSED(ptr), char *value) 00706 { 00707 char *pbuf; 00708 00709 pbuf= WM_clipboard_text_get(FALSE); 00710 if(pbuf) { 00711 strcpy(value, pbuf); 00712 MEM_freeN(pbuf); 00713 } 00714 else { 00715 value[0]= '\0'; 00716 } 00717 } 00718 00719 static int rna_wmClipboard_length(PointerRNA *UNUSED(ptr)) 00720 { 00721 char *pbuf; 00722 int length; 00723 00724 pbuf = WM_clipboard_text_get(FALSE); 00725 if(pbuf) { 00726 length = strlen(pbuf); 00727 MEM_freeN(pbuf); 00728 } 00729 else { 00730 length= 0; 00731 } 00732 00733 00734 return length; 00735 } 00736 00737 static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value) 00738 { 00739 WM_clipboard_text_set((void *) value, FALSE); 00740 } 00741 00742 #ifdef WITH_PYTHON 00743 static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) 00744 { 00745 const char *idname; 00746 wmOperatorType *ot= RNA_struct_blender_type_get(type); 00747 wmWindowManager *wm; 00748 00749 if(!ot) 00750 return; 00751 00752 /* update while blender is running */ 00753 wm= bmain->wm.first; 00754 if(wm) 00755 WM_operator_stack_clear(wm); 00756 WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); 00757 00758 RNA_struct_free_extension(type, &ot->ext); 00759 00760 idname= ot->idname; 00761 WM_operatortype_remove(ot->idname); 00762 MEM_freeN((void *)idname); 00763 00764 /* not to be confused with the RNA_struct_free that WM_operatortype_remove calls, they are 2 different srna's */ 00765 RNA_struct_free(&BLENDER_RNA, type); 00766 } 00767 00768 static int operator_poll(bContext *C, wmOperatorType *ot) 00769 { 00770 PointerRNA ptr; 00771 ParameterList list; 00772 FunctionRNA *func; 00773 void *ret; 00774 int visible; 00775 00776 RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */ 00777 func= RNA_struct_find_function(&ptr, "poll"); 00778 00779 RNA_parameter_list_create(&list, &ptr, func); 00780 RNA_parameter_set_lookup(&list, "context", &C); 00781 ot->ext.call(C, &ptr, func, &list); 00782 00783 RNA_parameter_get_lookup(&list, "visible", &ret); 00784 visible= *(int*)ret; 00785 00786 RNA_parameter_list_free(&list); 00787 00788 return visible; 00789 } 00790 00791 static int operator_execute(bContext *C, wmOperator *op) 00792 { 00793 PointerRNA opr; 00794 ParameterList list; 00795 FunctionRNA *func; 00796 void *ret; 00797 int result; 00798 00799 RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); 00800 func= RNA_struct_find_function(&opr, "execute"); 00801 00802 RNA_parameter_list_create(&list, &opr, func); 00803 RNA_parameter_set_lookup(&list, "context", &C); 00804 op->type->ext.call(C, &opr, func, &list); 00805 00806 RNA_parameter_get_lookup(&list, "result", &ret); 00807 result= *(int*)ret; 00808 00809 RNA_parameter_list_free(&list); 00810 00811 return result; 00812 } 00813 00814 /* same as execute() but no return value */ 00815 static int operator_check(bContext *C, wmOperator *op) 00816 { 00817 PointerRNA opr; 00818 ParameterList list; 00819 FunctionRNA *func; 00820 void *ret; 00821 int result; 00822 00823 RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); 00824 func= RNA_struct_find_function(&opr, "check"); 00825 00826 RNA_parameter_list_create(&list, &opr, func); 00827 RNA_parameter_set_lookup(&list, "context", &C); 00828 op->type->ext.call(C, &opr, func, &list); 00829 00830 RNA_parameter_get_lookup(&list, "result", &ret); 00831 result= *(int*)ret; 00832 00833 RNA_parameter_list_free(&list); 00834 00835 return result; 00836 } 00837 00838 static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) 00839 { 00840 PointerRNA opr; 00841 ParameterList list; 00842 FunctionRNA *func; 00843 void *ret; 00844 int result; 00845 00846 RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); 00847 func= RNA_struct_find_function(&opr, "invoke"); 00848 00849 RNA_parameter_list_create(&list, &opr, func); 00850 RNA_parameter_set_lookup(&list, "context", &C); 00851 RNA_parameter_set_lookup(&list, "event", &event); 00852 op->type->ext.call(C, &opr, func, &list); 00853 00854 RNA_parameter_get_lookup(&list, "result", &ret); 00855 result= *(int*)ret; 00856 00857 RNA_parameter_list_free(&list); 00858 00859 return result; 00860 } 00861 00862 /* same as invoke */ 00863 static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) 00864 { 00865 PointerRNA opr; 00866 ParameterList list; 00867 FunctionRNA *func; 00868 void *ret; 00869 int result; 00870 00871 RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); 00872 func= RNA_struct_find_function(&opr, "modal"); 00873 00874 RNA_parameter_list_create(&list, &opr, func); 00875 RNA_parameter_set_lookup(&list, "context", &C); 00876 RNA_parameter_set_lookup(&list, "event", &event); 00877 op->type->ext.call(C, &opr, func, &list); 00878 00879 RNA_parameter_get_lookup(&list, "result", &ret); 00880 result= *(int*)ret; 00881 00882 RNA_parameter_list_free(&list); 00883 00884 return result; 00885 } 00886 00887 static void operator_draw(bContext *C, wmOperator *op) 00888 { 00889 PointerRNA opr; 00890 ParameterList list; 00891 FunctionRNA *func; 00892 00893 RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); 00894 func= RNA_struct_find_function(&opr, "draw"); 00895 00896 RNA_parameter_list_create(&list, &opr, func); 00897 RNA_parameter_set_lookup(&list, "context", &C); 00898 op->type->ext.call(C, &opr, func, &list); 00899 00900 RNA_parameter_list_free(&list); 00901 } 00902 00903 /* same as exec(), but call cancel */ 00904 static int operator_cancel(bContext *C, wmOperator *op) 00905 { 00906 PointerRNA opr; 00907 ParameterList list; 00908 FunctionRNA *func; 00909 void *ret; 00910 int result; 00911 00912 RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); 00913 func= RNA_struct_find_function(&opr, "cancel"); 00914 00915 RNA_parameter_list_create(&list, &opr, func); 00916 RNA_parameter_set_lookup(&list, "context", &C); 00917 op->type->ext.call(C, &opr, func, &list); 00918 00919 RNA_parameter_get_lookup(&list, "result", &ret); 00920 result= *(int*)ret; 00921 00922 RNA_parameter_list_free(&list); 00923 00924 return result; 00925 } 00926 00927 void operator_wrapper(wmOperatorType *ot, void *userdata); 00928 void macro_wrapper(wmOperatorType *ot, void *userdata); 00929 00930 static char _operator_idname[OP_MAX_TYPENAME]; 00931 static char _operator_name[OP_MAX_TYPENAME]; 00932 static char _operator_descr[1024]; 00933 static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) 00934 { 00935 wmOperatorType dummyot = {NULL}; 00936 wmOperator dummyop= {NULL}; 00937 PointerRNA dummyotr; 00938 int have_function[7]; 00939 00940 /* setup dummy operator & operator type to store static properties in */ 00941 dummyop.type= &dummyot; 00942 dummyot.idname= _operator_idname; /* only assigne the pointer, string is NULL'd */ 00943 dummyot.name= _operator_name; /* only assigne the pointer, string is NULL'd */ 00944 dummyot.description= _operator_descr; /* only assigne the pointer, string is NULL'd */ 00945 RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr); 00946 00947 /* clear incase they are left unset */ 00948 _operator_idname[0]= _operator_name[0]= _operator_descr[0]= '\0'; 00949 00950 /* validate the python class */ 00951 if(validate(&dummyotr, data, have_function) != 0) 00952 return NULL; 00953 00954 { /* convert foo.bar to FOO_OT_bar 00955 * allocate the description and the idname in 1 go */ 00956 00957 /* inconveniently long name sanity check */ 00958 { 00959 char *ch= _operator_idname; 00960 int i; 00961 int dot= 0; 00962 for(i=0; *ch; i++) { 00963 if((*ch >= 'a' && *ch <= 'z') || (*ch >= '0' && *ch <= '9') || *ch == '_') { 00964 /* pass */ 00965 } 00966 else if(*ch == '.') { 00967 dot++; 00968 } 00969 else { 00970 BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', at position %d", identifier, _operator_idname, i); 00971 return NULL; 00972 } 00973 00974 ch++; 00975 } 00976 00977 if(i > ((int)sizeof(dummyop.idname)) - 3) { 00978 BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', is too long, maximum length is %d.", identifier, _operator_idname, (int)sizeof(dummyop.idname) - 3); 00979 return NULL; 00980 } 00981 00982 if(dot != 1) { 00983 BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', must contain 1 '.' character", identifier, _operator_idname); 00984 return NULL; 00985 } 00986 } 00987 /* end sanity check */ 00988 00989 { 00990 int idlen = strlen(_operator_idname) + 4; 00991 int namelen = strlen(_operator_name) + 1; 00992 int desclen = strlen(_operator_descr) + 1; 00993 char *ch; 00994 ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ 00995 WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ 00996 dummyot.idname= ch; 00997 ch += idlen; 00998 strcpy(ch, _operator_name); 00999 dummyot.name = ch; 01000 ch += namelen; 01001 strcpy(ch, _operator_descr); 01002 dummyot.description = ch; 01003 } 01004 } 01005 01006 /* check if we have registered this operator type before, and remove it */ 01007 { 01008 wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE); 01009 if(ot && ot->ext.srna) 01010 rna_Operator_unregister(bmain, ot->ext.srna); 01011 } 01012 01013 /* create a new operator type */ 01014 dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator"); 01015 RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */ 01016 dummyot.ext.data= data; 01017 dummyot.ext.call= call; 01018 dummyot.ext.free= free; 01019 01020 dummyot.pyop_poll= (have_function[0])? operator_poll: NULL; 01021 dummyot.exec= (have_function[1])? operator_execute: NULL; 01022 dummyot.check= (have_function[2])? operator_check: NULL; 01023 dummyot.invoke= (have_function[3])? operator_invoke: NULL; 01024 dummyot.modal= (have_function[4])? operator_modal: NULL; 01025 dummyot.ui= (have_function[5])? operator_draw: NULL; 01026 dummyot.cancel= (have_function[6])? operator_cancel: NULL; 01027 WM_operatortype_append_ptr(operator_wrapper, (void *)&dummyot); 01028 01029 /* update while blender is running */ 01030 WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); 01031 01032 return dummyot.ext.srna; 01033 } 01034 01035 void **rna_Operator_instance(PointerRNA *ptr) 01036 { 01037 wmOperator *op = ptr->data; 01038 return &op->py_instance; 01039 } 01040 01041 static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) 01042 { 01043 wmOperatorType dummyot = {NULL}; 01044 wmOperator dummyop= {NULL}; 01045 PointerRNA dummyotr; 01046 int have_function[4]; 01047 01048 /* setup dummy operator & operator type to store static properties in */ 01049 dummyop.type= &dummyot; 01050 dummyot.idname= _operator_idname; /* only assigne the pointer, string is NULL'd */ 01051 dummyot.name= _operator_name; /* only assigne the pointer, string is NULL'd */ 01052 dummyot.description= _operator_descr; /* only assigne the pointer, string is NULL'd */ 01053 RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr); 01054 01055 /* validate the python class */ 01056 if(validate(&dummyotr, data, have_function) != 0) 01057 return NULL; 01058 01059 { /* convert foo.bar to FOO_OT_bar 01060 * allocate the description and the idname in 1 go */ 01061 int idlen = strlen(_operator_idname) + 4; 01062 int namelen = strlen(_operator_name) + 1; 01063 int desclen = strlen(_operator_descr) + 1; 01064 char *ch; 01065 ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */ 01066 WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */ 01067 dummyot.idname= ch; 01068 ch += idlen; 01069 strcpy(ch, _operator_name); 01070 dummyot.name = ch; 01071 ch += namelen; 01072 strcpy(ch, _operator_descr); 01073 dummyot.description = ch; 01074 } 01075 01076 if(strlen(identifier) >= sizeof(dummyop.idname)) { 01077 BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummyop.idname)); 01078 return NULL; 01079 } 01080 01081 /* check if we have registered this operator type before, and remove it */ 01082 { 01083 wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE); 01084 if(ot && ot->ext.srna) 01085 rna_Operator_unregister(bmain, ot->ext.srna); 01086 } 01087 01088 /* create a new menu type */ 01089 dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator"); 01090 dummyot.ext.data= data; 01091 dummyot.ext.call= call; 01092 dummyot.ext.free= free; 01093 01094 dummyot.pyop_poll= (have_function[0])? operator_poll: NULL; 01095 dummyot.ui= (have_function[3])? operator_draw: NULL; 01096 01097 WM_operatortype_append_macro_ptr(macro_wrapper, (void *)&dummyot); 01098 01099 /* update while blender is running */ 01100 WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); 01101 01102 return dummyot.ext.srna; 01103 } 01104 #endif /* WITH_PYTHON */ 01105 01106 static StructRNA* rna_Operator_refine(PointerRNA *opr) 01107 { 01108 wmOperator *op= (wmOperator*)opr->data; 01109 return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Operator; 01110 } 01111 01112 static StructRNA* rna_MacroOperator_refine(PointerRNA *opr) 01113 { 01114 wmOperator *op= (wmOperator*)opr->data; 01115 return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Macro; 01116 } 01117 01118 /* just to work around 'const char *' warning and to ensure this is a python op */ 01119 static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value) 01120 { 01121 wmOperator *data= (wmOperator*)(ptr->data); 01122 char *str= (char *)data->type->idname; 01123 if(!str[0]) strcpy(str, value); 01124 else assert(!"setting the bl_idname on a non-builtin operator"); 01125 } 01126 01127 static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value) 01128 { 01129 wmOperator *data= (wmOperator*)(ptr->data); 01130 char *str= (char *)data->type->name; 01131 if(!str[0]) strcpy(str, value); 01132 else assert(!"setting the bl_label on a non-builtin operator"); 01133 } 01134 01135 static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value) 01136 { 01137 wmOperator *data= (wmOperator*)(ptr->data); 01138 char *str= (char *)data->type->description; 01139 if(!str[0]) strcpy(str, value); 01140 else assert(!"setting the bl_description on a non-builtin operator"); 01141 } 01142 01143 static void rna_KeyMapItem_update(Main *bmain, Scene *scene, PointerRNA *ptr) 01144 { 01145 wmKeyMapItem *kmi= ptr->data; 01146 WM_keyconfig_update_tag(NULL, kmi); 01147 } 01148 01149 #else /* RNA_RUNTIME */ 01150 01151 static void rna_def_operator(BlenderRNA *brna) 01152 { 01153 StructRNA *srna; 01154 PropertyRNA *prop; 01155 01156 srna= RNA_def_struct(brna, "Operator", NULL); 01157 RNA_def_struct_ui_text(srna, "Operator", "Storage of an operator being executed, or registered after execution"); 01158 RNA_def_struct_sdna(srna, "wmOperator"); 01159 RNA_def_struct_refine_func(srna, "rna_Operator_refine"); 01160 #ifdef WITH_PYTHON 01161 RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance"); 01162 #endif 01163 01164 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 01165 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01166 RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL); 01167 RNA_def_property_ui_text(prop, "Name", ""); 01168 01169 prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); 01170 RNA_def_property_flag(prop, PROP_NEVER_NULL); 01171 RNA_def_property_struct_type(prop, "OperatorProperties"); 01172 RNA_def_property_ui_text(prop, "Properties", ""); 01173 RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL); 01174 01175 prop= RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE); 01176 RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */ 01177 RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL); 01178 RNA_def_property_ui_text(prop, "Has Reports", "Operator has a set of reports (warnings and errors) from last execution"); 01179 01180 prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); 01181 RNA_def_property_struct_type(prop, "UILayout"); 01182 01183 /* Registration */ 01184 prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); 01185 RNA_def_property_string_sdna(prop, NULL, "type->idname"); 01186 RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME-3); /* else it uses the pointer size!. -3 because '.' -> '_OT_' */ 01187 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set"); 01188 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01189 RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); 01190 RNA_def_struct_name_property(srna, prop); 01191 01192 prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); 01193 RNA_def_property_string_sdna(prop, NULL, "type->name"); 01194 RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ 01195 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); 01196 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01197 RNA_def_property_flag(prop, PROP_REGISTER); 01198 01199 prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); 01200 RNA_def_property_string_sdna(prop, NULL, "type->description"); 01201 RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ 01202 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); 01203 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01204 RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); 01205 01206 prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); 01207 RNA_def_property_enum_sdna(prop, NULL, "type->flag"); 01208 RNA_def_property_enum_items(prop, operator_flag_items); 01209 RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG); 01210 RNA_def_property_ui_text(prop, "Options", "Options for this operator type"); 01211 01212 RNA_api_operator(srna); 01213 01214 srna= RNA_def_struct(brna, "OperatorProperties", NULL); 01215 RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator"); 01216 RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine"); 01217 RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops"); 01218 } 01219 01220 static void rna_def_macro_operator(BlenderRNA *brna) 01221 { 01222 StructRNA *srna; 01223 PropertyRNA *prop; 01224 01225 srna= RNA_def_struct(brna, "Macro", NULL); 01226 RNA_def_struct_ui_text(srna, "Macro Operator", "Storage of a macro operator being executed, or registered after execution"); 01227 RNA_def_struct_sdna(srna, "wmOperator"); 01228 RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine"); 01229 #ifdef WITH_PYTHON 01230 RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance"); 01231 #endif 01232 01233 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 01234 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01235 RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL); 01236 RNA_def_property_ui_text(prop, "Name", ""); 01237 01238 prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); 01239 RNA_def_property_flag(prop, PROP_NEVER_NULL); 01240 RNA_def_property_struct_type(prop, "OperatorProperties"); 01241 RNA_def_property_ui_text(prop, "Properties", ""); 01242 RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL); 01243 01244 /* Registration */ 01245 prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); 01246 RNA_def_property_string_sdna(prop, NULL, "type->idname"); 01247 RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ 01248 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set"); 01249 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01250 RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); 01251 RNA_def_struct_name_property(srna, prop); 01252 01253 prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); 01254 RNA_def_property_string_sdna(prop, NULL, "type->name"); 01255 RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ 01256 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); 01257 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01258 RNA_def_property_flag(prop, PROP_REGISTER); 01259 01260 prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); 01261 RNA_def_property_string_sdna(prop, NULL, "type->description"); 01262 RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ 01263 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); 01264 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01265 RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); 01266 01267 prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); 01268 RNA_def_property_enum_sdna(prop, NULL, "type->flag"); 01269 RNA_def_property_enum_items(prop, operator_flag_items); 01270 RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG); 01271 RNA_def_property_ui_text(prop, "Options", "Options for this operator type"); 01272 01273 RNA_api_macro(srna); 01274 } 01275 01276 static void rna_def_operator_type_macro(BlenderRNA *brna) 01277 { 01278 StructRNA *srna; 01279 PropertyRNA *prop; 01280 01281 srna= RNA_def_struct(brna, "OperatorTypeMacro", NULL); 01282 RNA_def_struct_ui_text(srna, "OperatorTypeMacro", "Storage of a sub operator in a macro after it has been added"); 01283 RNA_def_struct_sdna(srna, "wmOperatorTypeMacro"); 01284 01285 // prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 01286 // RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01287 // RNA_def_property_string_sdna(prop, NULL, "idname"); 01288 // RNA_def_property_ui_text(prop, "Name", "Name of the sub operator"); 01289 // RNA_def_struct_name_property(srna, prop); 01290 01291 prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); 01292 RNA_def_property_flag(prop, PROP_NEVER_NULL); 01293 RNA_def_property_struct_type(prop, "OperatorProperties"); 01294 RNA_def_property_ui_text(prop, "Properties", ""); 01295 RNA_def_property_pointer_funcs(prop, "rna_OperatorTypeMacro_properties_get", NULL, NULL, NULL); 01296 } 01297 01298 static void rna_def_operator_utils(BlenderRNA *brna) 01299 { 01300 StructRNA *srna; 01301 PropertyRNA *prop; 01302 01303 srna= RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup"); 01304 RNA_def_struct_ui_text(srna, "Operator Mouse Path", "Mouse path values for operators that record such paths"); 01305 01306 prop= RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ); 01307 RNA_def_property_flag(prop, PROP_IDPROPERTY); 01308 RNA_def_property_array(prop, 2); 01309 RNA_def_property_ui_text(prop, "Location", "Mouse location"); 01310 01311 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE); 01312 RNA_def_property_flag(prop, PROP_IDPROPERTY); 01313 RNA_def_property_ui_text(prop, "Time", "Time of mouse location"); 01314 } 01315 01316 static void rna_def_operator_filelist_element(BlenderRNA *brna) 01317 { 01318 StructRNA *srna; 01319 PropertyRNA *prop; 01320 01321 srna= RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup"); 01322 RNA_def_struct_ui_text(srna, "Operator File List Element", ""); 01323 01324 01325 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME); 01326 RNA_def_property_flag(prop, PROP_IDPROPERTY); 01327 RNA_def_property_ui_text(prop, "Name", "the name of a file or directory within a file list"); 01328 } 01329 01330 static void rna_def_event(BlenderRNA *brna) 01331 { 01332 StructRNA *srna; 01333 PropertyRNA *prop; 01334 01335 srna= RNA_def_struct(brna, "Event", NULL); 01336 RNA_def_struct_ui_text(srna, "Event", "Window Manager Event"); 01337 RNA_def_struct_sdna(srna, "wmEvent"); 01338 01339 RNA_define_verify_sdna(0); // not in sdna 01340 01341 /* strings */ 01342 prop= RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE); 01343 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01344 RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL); 01345 RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event"); 01346 01347 01348 /* enums */ 01349 prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE); 01350 RNA_def_property_enum_sdna(prop, NULL, "val"); 01351 RNA_def_property_enum_items(prop, event_value_items); 01352 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01353 RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some"); 01354 01355 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 01356 RNA_def_property_enum_sdna(prop, NULL, "type"); 01357 RNA_def_property_enum_items(prop, event_type_items); 01358 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01359 RNA_def_property_ui_text(prop, "Type", ""); 01360 01361 01362 /* mouse */ 01363 prop= RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE); 01364 RNA_def_property_int_sdna(prop, NULL, "x"); 01365 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01366 RNA_def_property_ui_text(prop, "Mouse X Position", "The window relative vertical location of the mouse"); 01367 01368 prop= RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE); 01369 RNA_def_property_int_sdna(prop, NULL, "y"); 01370 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01371 RNA_def_property_ui_text(prop, "Mouse Y Position", "The window relative horizontal location of the mouse"); 01372 01373 prop= RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE); 01374 RNA_def_property_int_sdna(prop, NULL, "mval[0]"); 01375 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01376 RNA_def_property_ui_text(prop, "Mouse X Position", "The region relative vertical location of the mouse"); 01377 01378 prop= RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE); 01379 RNA_def_property_int_sdna(prop, NULL, "mval[1]"); 01380 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01381 RNA_def_property_ui_text(prop, "Mouse Y Position", "The region relative horizontal location of the mouse"); 01382 01383 prop= RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE); 01384 RNA_def_property_int_sdna(prop, NULL, "prevx"); 01385 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01386 RNA_def_property_ui_text(prop, "Mouse Previous X Position", "The window relative vertical location of the mouse"); 01387 01388 prop= RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE); 01389 RNA_def_property_int_sdna(prop, NULL, "prevy"); 01390 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01391 RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative horizontal location of the mouse"); 01392 01393 01394 /* modifiers */ 01395 prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE); 01396 RNA_def_property_boolean_sdna(prop, NULL, "shift", 1); 01397 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01398 RNA_def_property_ui_text(prop, "Shift", "True when the Shift key is held"); 01399 01400 prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE); 01401 RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1); 01402 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01403 RNA_def_property_ui_text(prop, "Ctrl", "True when the Ctrl key is held"); 01404 01405 prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE); 01406 RNA_def_property_boolean_sdna(prop, NULL, "alt", 1); 01407 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01408 RNA_def_property_ui_text(prop, "Alt", "True when the Alt/Option key is held"); 01409 01410 prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE); 01411 RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1); 01412 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01413 RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held"); 01414 01415 RNA_define_verify_sdna(1); // not in sdna 01416 } 01417 01418 static void rna_def_timer(BlenderRNA *brna) 01419 { 01420 StructRNA *srna; 01421 PropertyRNA *prop; 01422 01423 srna= RNA_def_struct(brna, "Timer", NULL); 01424 RNA_def_struct_ui_text(srna, "Timer", "Window event timer"); 01425 RNA_def_struct_sdna(srna, "wmTimer"); 01426 01427 RNA_define_verify_sdna(0); // not in sdna 01428 01429 /* could wrap more, for now this is enough */ 01430 prop= RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE); 01431 RNA_def_property_float_sdna(prop, NULL, "timestep"); 01432 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01433 RNA_def_property_ui_text(prop, "Time Step", ""); 01434 01435 prop= RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE); 01436 RNA_def_property_float_sdna(prop, NULL, "delta"); 01437 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01438 RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds"); 01439 01440 prop= RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE); 01441 RNA_def_property_float_sdna(prop, NULL, "duration"); 01442 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01443 RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds"); 01444 01445 RNA_define_verify_sdna(1); // not in sdna 01446 } 01447 01448 static void rna_def_window(BlenderRNA *brna) 01449 { 01450 StructRNA *srna; 01451 PropertyRNA *prop; 01452 01453 srna= RNA_def_struct(brna, "Window", NULL); 01454 RNA_def_struct_ui_text(srna, "Window", "Open window"); 01455 RNA_def_struct_sdna(srna, "wmWindow"); 01456 01457 prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE); 01458 RNA_def_property_flag(prop, PROP_NEVER_NULL); 01459 RNA_def_property_struct_type(prop, "Screen"); 01460 RNA_def_property_ui_text(prop, "Screen", "Active screen showing in the window"); 01461 RNA_def_property_flag(prop, PROP_EDITABLE); 01462 RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_screen_set", NULL, NULL); 01463 RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); 01464 RNA_def_property_update(prop, 0, "rna_Window_screen_update"); 01465 } 01466 01467 /* curve.splines */ 01468 static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop) 01469 { 01470 StructRNA *srna; 01471 PropertyRNA *prop; 01472 01473 RNA_def_property_srna(cprop, "KeyConfigurations"); 01474 srna= RNA_def_struct(brna, "KeyConfigurations", NULL); 01475 RNA_def_struct_sdna(srna, "wmWindowManager"); 01476 RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs"); 01477 01478 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); 01479 RNA_def_property_struct_type(prop, "KeyConfig"); 01480 RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL); 01481 RNA_def_property_flag(prop, PROP_EDITABLE); 01482 RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)"); 01483 01484 prop= RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL); 01485 RNA_def_property_pointer_sdna(prop, NULL, "defaultconf"); 01486 RNA_def_property_struct_type(prop, "KeyConfig"); 01487 RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration"); 01488 01489 prop= RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL); 01490 RNA_def_property_pointer_sdna(prop, NULL, "addonconf"); 01491 RNA_def_property_struct_type(prop, "KeyConfig"); 01492 RNA_def_property_ui_text(prop, "Addon Key Configuration", "Key configuration that can be extended by addons, and is added to the active configuration when handling events"); 01493 01494 prop= RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL); 01495 RNA_def_property_pointer_sdna(prop, NULL, "userconf"); 01496 RNA_def_property_struct_type(prop, "KeyConfig"); 01497 RNA_def_property_ui_text(prop, "User Key Configuration", "Final key configuration that combines keymaps from the active and addon configurations, and can be edited by the user"); 01498 01499 RNA_api_keyconfigs(srna); 01500 } 01501 01502 static void rna_def_windowmanager(BlenderRNA *brna) 01503 { 01504 StructRNA *srna; 01505 PropertyRNA *prop; 01506 01507 srna= RNA_def_struct(brna, "WindowManager", "ID"); 01508 RNA_def_struct_ui_text(srna, "Window Manager", "Window manager datablock defining open windows and other user interface data"); 01509 RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); 01510 RNA_def_struct_sdna(srna, "wmWindowManager"); 01511 01512 prop= RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE); 01513 RNA_def_property_struct_type(prop, "Operator"); 01514 RNA_def_property_ui_text(prop, "Operators", "Operator registry"); 01515 01516 prop= RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE); 01517 RNA_def_property_struct_type(prop, "Window"); 01518 RNA_def_property_ui_text(prop, "Windows", "Open windows"); 01519 01520 prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE); 01521 RNA_def_property_struct_type(prop, "KeyConfig"); 01522 RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations"); 01523 rna_def_wm_keyconfigs(brna, prop); 01524 01525 prop= RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE); 01526 RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set"); 01527 RNA_def_property_ui_text(prop, "Text Clipboard", ""); 01528 01529 RNA_api_wm(srna); 01530 } 01531 01532 /* keyconfig.items */ 01533 static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop) 01534 { 01535 StructRNA *srna; 01536 01537 RNA_def_property_srna(cprop, "KeyMapItems"); 01538 srna= RNA_def_struct(brna, "KeyMapItems", NULL); 01539 RNA_def_struct_sdna(srna, "wmKeyMap"); 01540 RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items"); 01541 01542 RNA_api_keymapitems(srna); 01543 } 01544 01545 static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop) 01546 { 01547 StructRNA *srna; 01548 01549 RNA_def_property_srna(cprop, "KeyMaps"); 01550 srna= RNA_def_struct(brna, "KeyMaps", NULL); 01551 RNA_def_struct_sdna(srna, "wmKeyConfig"); 01552 RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps"); 01553 01554 RNA_api_keymaps(srna); 01555 } 01556 01557 static void rna_def_keyconfig(BlenderRNA *brna) 01558 { 01559 StructRNA *srna; 01560 PropertyRNA *prop; 01561 01562 static EnumPropertyItem map_type_items[] = { 01563 {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""}, 01564 {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""}, 01565 {KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""}, 01566 {KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""}, 01567 {KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""}, 01568 {KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""}, 01569 {0, NULL, 0, NULL, NULL}}; 01570 01571 /* KeyConfig */ 01572 srna= RNA_def_struct(brna, "KeyConfig", NULL); 01573 RNA_def_struct_sdna(srna, "wmKeyConfig"); 01574 RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps"); 01575 01576 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 01577 RNA_def_property_string_sdna(prop, NULL, "idname"); 01578 RNA_def_property_ui_text(prop, "Name", "Name of the key configuration"); 01579 RNA_def_struct_name_property(srna, prop); 01580 01581 prop= RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE); 01582 RNA_def_property_struct_type(prop, "KeyMap"); 01583 RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration"); 01584 rna_def_wm_keymaps(brna, prop); 01585 01586 prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE); 01587 RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER); 01588 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01589 RNA_def_property_ui_text(prop, "User Defined", "Indicates that a keyconfig was defined by the user"); 01590 01591 RNA_api_keyconfig(srna); 01592 01593 /* KeyMap */ 01594 srna= RNA_def_struct(brna, "KeyMap", NULL); 01595 RNA_def_struct_sdna(srna, "wmKeyMap"); 01596 RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps"); 01597 01598 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 01599 RNA_def_property_string_sdna(prop, NULL, "idname"); 01600 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01601 RNA_def_property_ui_text(prop, "Name", "Name of the key map"); 01602 RNA_def_struct_name_property(srna, prop); 01603 01604 prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE); 01605 RNA_def_property_enum_sdna(prop, NULL, "spaceid"); 01606 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01607 RNA_def_property_enum_items(prop, space_type_items); 01608 RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with"); 01609 01610 prop= RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE); 01611 RNA_def_property_enum_sdna(prop, NULL, "regionid"); 01612 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01613 RNA_def_property_enum_items(prop, region_type_items); 01614 RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with"); 01615 01616 prop= RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE); 01617 RNA_def_property_collection_sdna(prop, NULL, "items", NULL); 01618 RNA_def_property_struct_type(prop, "KeyMapItem"); 01619 RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event"); 01620 rna_def_keymap_items(brna, prop); 01621 01622 prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NEVER_NULL); 01623 RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER_MODIFIED); 01624 RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user"); 01625 01626 prop= RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE); 01627 RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL); 01628 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01629 RNA_def_property_ui_text(prop, "Modal Keymap", "Indicates that a keymap is used for translate modal events for an operator"); 01630 01631 prop= RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE); 01632 RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED); 01633 RNA_def_property_ui_text(prop, "Items Expanded", "Expanded in the user interface"); 01634 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); 01635 01636 prop= RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE); 01637 RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_CHILDREN_EXPANDED); 01638 RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in the user interface"); 01639 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); 01640 01641 01642 RNA_api_keymap(srna); 01643 01644 /* KeyMapItem */ 01645 srna= RNA_def_struct(brna, "KeyMapItem", NULL); 01646 RNA_def_struct_sdna(srna, "wmKeyMapItem"); 01647 RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map"); 01648 01649 prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE); 01650 RNA_def_property_string_sdna(prop, NULL, "idname"); 01651 RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event"); 01652 RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set"); 01653 RNA_def_struct_name_property(srna, prop); 01654 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01655 01656 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); 01657 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01658 RNA_def_property_ui_text(prop, "Name", "Name of operator to call on input event"); 01659 RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL); 01660 01661 prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); 01662 RNA_def_property_struct_type(prop, "OperatorProperties"); 01663 RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL); 01664 RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called"); 01665 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01666 01667 prop= RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE); 01668 RNA_def_property_enum_sdna(prop, NULL, "maptype"); 01669 RNA_def_property_enum_items(prop, map_type_items); 01670 RNA_def_property_enum_funcs(prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL); 01671 RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping"); 01672 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01673 01674 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 01675 RNA_def_property_enum_sdna(prop, NULL, "type"); 01676 RNA_def_property_enum_items(prop, event_type_items); 01677 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf"); 01678 RNA_def_property_ui_text(prop, "Type", "Type of event"); 01679 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01680 01681 prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE); 01682 RNA_def_property_enum_sdna(prop, NULL, "val"); 01683 RNA_def_property_enum_items(prop, event_value_items); 01684 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf"); 01685 RNA_def_property_ui_text(prop, "Value", ""); 01686 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01687 01688 prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE); 01689 RNA_def_property_int_sdna(prop, NULL, "id"); 01690 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01691 RNA_def_property_ui_text(prop, "id", "ID of the item"); 01692 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01693 01694 prop= RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE); 01695 RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_getf", "rna_KeyMapItem_any_setf"); 01696 RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed"); 01697 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01698 01699 prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE); 01700 RNA_def_property_boolean_sdna(prop, NULL, "shift", 0); 01701 // RNA_def_property_enum_sdna(prop, NULL, "shift"); 01702 // RNA_def_property_enum_items(prop, keymap_modifiers_items); 01703 RNA_def_property_ui_text(prop, "Shift", "Shift key pressed"); 01704 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01705 01706 prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE); 01707 RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0); 01708 // RNA_def_property_enum_sdna(prop, NULL, "ctrl"); 01709 // RNA_def_property_enum_items(prop, keymap_modifiers_items); 01710 RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed"); 01711 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01712 01713 prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE); 01714 RNA_def_property_boolean_sdna(prop, NULL, "alt", 0); 01715 // RNA_def_property_enum_sdna(prop, NULL, "alt"); 01716 // RNA_def_property_enum_items(prop, keymap_modifiers_items); 01717 RNA_def_property_ui_text(prop, "Alt", "Alt key pressed"); 01718 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01719 01720 prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE); 01721 RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0); 01722 // RNA_def_property_enum_sdna(prop, NULL, "oskey"); 01723 // RNA_def_property_enum_items(prop, keymap_modifiers_items); 01724 RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed"); 01725 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01726 01727 prop= RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE); 01728 RNA_def_property_enum_sdna(prop, NULL, "keymodifier"); 01729 RNA_def_property_enum_items(prop, event_type_items); 01730 RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier"); 01731 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01732 01733 prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); 01734 RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED); 01735 RNA_def_property_ui_text(prop, "Expanded", "Show key map event and property details in the user interface"); 01736 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); 01737 01738 prop= RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE); 01739 RNA_def_property_enum_sdna(prop, NULL, "propvalue"); 01740 RNA_def_property_enum_items(prop, keymap_propvalue_items); 01741 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf"); 01742 RNA_def_property_ui_text(prop, "Property Value", "The value this event translates to in a modal keymap"); 01743 RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); 01744 01745 prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); 01746 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE); 01747 RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item"); 01748 RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1); 01749 01750 prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE); 01751 RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED); 01752 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01753 RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user"); 01754 01755 prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE); 01756 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 01757 RNA_def_property_ui_text(prop, "User Defined", "Is this keymap item user defined (doesn't just replace a builtin item)"); 01758 RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL); 01759 01760 RNA_api_keymapitem(srna); 01761 } 01762 01763 void RNA_def_wm(BlenderRNA *brna) 01764 { 01765 rna_def_operator(brna); 01766 rna_def_operator_utils(brna); 01767 rna_def_operator_filelist_element(brna); 01768 rna_def_macro_operator(brna); 01769 rna_def_operator_type_macro(brna); 01770 rna_def_event(brna); 01771 rna_def_timer(brna); 01772 rna_def_window(brna); 01773 rna_def_windowmanager(brna); 01774 rna_def_keyconfig(brna); 01775 } 01776 01777 #endif /* RNA_RUNTIME */