Blender V2.61 - r43446

rna_wm.c

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