Blender  V2.59
rna_sensor.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_sensor.c 36924 2011-05-26 13:38:16Z campbellbarton $
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_define.h"
00033 #include "RNA_enum_types.h"
00034 #include "RNA_access.h"
00035 
00036 #include "rna_internal.h"
00037 
00038 #include "DNA_constraint_types.h"
00039 #include "DNA_object_types.h"
00040 #include "DNA_sensor_types.h"
00041 
00042 #include "WM_types.h"
00043 
00044 /* Always keep in alphabetical order */
00045 EnumPropertyItem sensor_type_items[] ={
00046         {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""},
00047         {SENS_ALWAYS, "ALWAYS", 0, "Always", ""},
00048         {SENS_ARMATURE, "ARMATURE", 0, "Armature", ""},
00049         {SENS_COLLISION, "COLLISION", 0, "Collision", ""},
00050         {SENS_DELAY, "DELAY", 0, "Delay", ""},
00051         {SENS_JOYSTICK, "JOYSTICK", 0, "Joystick", ""},
00052         {SENS_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
00053         {SENS_MESSAGE, "MESSAGE", 0, "Message", ""},
00054         {SENS_MOUSE, "MOUSE", 0, "Mouse", ""},
00055         {SENS_NEAR, "NEAR", 0, "Near", ""},
00056         {SENS_PROPERTY, "PROPERTY", 0, "Property", ""},
00057         {SENS_RADAR, "RADAR", 0, "Radar", ""},
00058         {SENS_RANDOM, "RANDOM", 0, "Random", ""},
00059         {SENS_RAY, "RAY", 0, "Ray", ""},
00060         {SENS_TOUCH, "TOUCH", 0, "Touch", ""},
00061         {0, NULL, 0, NULL, NULL}};
00062 
00063 #ifdef RNA_RUNTIME
00064 
00065 #include "BKE_sca.h"
00066 
00067 static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
00068 {
00069         bSensor *sensor= (bSensor*)ptr->data;
00070 
00071         switch(sensor->type) {
00072                 case SENS_ALWAYS:
00073                         return &RNA_AlwaysSensor;
00074                 case SENS_TOUCH:
00075                         return &RNA_TouchSensor;
00076                 case SENS_NEAR:
00077                         return &RNA_NearSensor;
00078                 case SENS_KEYBOARD:
00079                         return &RNA_KeyboardSensor;
00080                 case SENS_PROPERTY:
00081                         return &RNA_PropertySensor;
00082                 case SENS_ARMATURE:
00083                         return &RNA_ArmatureSensor;
00084                 case SENS_MOUSE:
00085                         return &RNA_MouseSensor;
00086                 case SENS_COLLISION:
00087                         return &RNA_CollisionSensor;
00088                 case SENS_RADAR:
00089                         return &RNA_RadarSensor;
00090                 case SENS_RANDOM:
00091                         return &RNA_RandomSensor;
00092                 case SENS_RAY:
00093                         return &RNA_RaySensor;
00094                 case SENS_MESSAGE:
00095                         return &RNA_MessageSensor;
00096                 case SENS_JOYSTICK:
00097                         return &RNA_JoystickSensor;
00098                 case SENS_ACTUATOR:
00099                         return &RNA_ActuatorSensor;
00100                 case SENS_DELAY:
00101                         return &RNA_DelaySensor;
00102                 default:
00103                         return &RNA_Sensor;
00104         }
00105 }
00106 
00107 static void rna_Sensor_type_set(struct PointerRNA *ptr, int value)
00108 {
00109         bSensor *sens= (bSensor *)ptr->data;
00110         if (value != sens->type)
00111         {
00112                 sens->type = value;
00113                 init_sensor(sens);
00114         }
00115 }
00116 
00117 /* Always keep in alphabetical order */
00118 EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
00119 {
00120         EnumPropertyItem *item= NULL;
00121         Object *ob=NULL;
00122         int totitem= 0;
00123 
00124         if (ptr->type == &RNA_Sensor || RNA_struct_is_a(ptr->type, &RNA_Sensor)) {
00125                 ob = (Object *)ptr->id.data;
00126         } else {
00127                 /* can't use ob from ptr->id.data because that enum is also used by operators */
00128                 ob = CTX_data_active_object(C);
00129         }
00130         
00131         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ACTUATOR);
00132         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ALWAYS);
00133 
00134         if (ob != NULL) {
00135                 if (ob->type==OB_ARMATURE) {
00136                         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE);
00137                 }
00138         }
00139         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);   
00140         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY);
00141         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK);
00142         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD);
00143         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MESSAGE);
00144         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MOUSE);
00145         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_NEAR);
00146         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_PROPERTY);
00147         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RADAR);
00148         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RANDOM);
00149         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RAY);
00150         RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH);
00151         
00152         RNA_enum_item_end(&item, &totitem);
00153         *free= 1;
00154         
00155         return item;
00156 }
00157 
00158 static void rna_Sensor_keyboard_key_set(struct PointerRNA *ptr, int value)
00159 {
00160         bSensor *sens= (bSensor *)ptr->data;
00161         bKeyboardSensor *ks = (bKeyboardSensor *)sens->data;
00162         
00163         if (ISKEYBOARD(value))
00164                 ks->key = value;
00165         else
00166                 ks->key = 0;
00167 }
00168 
00169 static void rna_Sensor_keyboard_modifier_set(struct PointerRNA *ptr, int value)
00170 {
00171         bSensor *sens= (bSensor *)ptr->data;
00172         bKeyboardSensor *ks = (bKeyboardSensor *)sens->data;
00173         
00174         if (ISKEYBOARD(value))
00175                 ks->qual = value;
00176         else
00177                 ks->qual = 0;
00178 }
00179                 
00180 static void rna_Sensor_keyboard_modifier2_set(struct PointerRNA *ptr, int value)
00181 {
00182         bSensor *sens= (bSensor *)ptr->data;
00183         bKeyboardSensor *ks = (bKeyboardSensor *)sens->data;
00184         
00185         if (ISKEYBOARD(value))
00186                 ks->qual2 = value;
00187         else
00188                 ks->qual2 = 0;
00189 }
00190 
00191 static void rna_Sensor_tap_set(struct PointerRNA *ptr, int value)
00192 {
00193         bSensor *sens= (bSensor*)ptr->data;
00194 
00195         sens->tap = value;
00196         if(sens->tap == 1)
00197                 sens->level = 0;
00198 }
00199 
00200 static void rna_Sensor_level_set(struct PointerRNA *ptr, int value)
00201 {
00202         bSensor *sens= (bSensor*)ptr->data;
00203 
00204         sens->level = value;
00205         if(sens->level == 1)
00206                 sens->tap = 0;
00207 }
00208 
00209 static void rna_Sensor_Armature_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00210 {
00211         bSensor *sens= (bSensor *)ptr->data;
00212         bArmatureSensor *as = sens->data;
00213         Object *ob = (Object *)ptr->id.data;
00214 
00215         char *posechannel= as->posechannel;
00216         char *constraint= as->constraint;
00217 
00218         /* check that bone exist in the active object */
00219         if (ob->type == OB_ARMATURE && ob->pose) {
00220                 bPoseChannel *pchan;
00221                 bPose *pose = ob->pose;
00222                 for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
00223                         if (!strcmp(pchan->name, posechannel)) {
00224                                 /* found it, now look for constraint channel */
00225                                 bConstraint *con;
00226                                 for (con=pchan->constraints.first; con; con=con->next) {
00227                                         if (!strcmp(con->name, constraint)) {
00228                                                 /* found it, all ok */
00229                                                 return;                                         
00230                                         }
00231                                 }
00232                                 /* didn't find constraint, make empty */
00233                                 constraint[0] = 0;
00234                                 return;
00235                         }
00236                 }
00237         }
00238         /* didn't find any */
00239         posechannel[0] = 0;
00240         constraint[0] = 0;
00241 }
00242 
00243 /* note: the following set functions exists only to avoid id refcounting */
00244 static void rna_Sensor_touch_material_set(PointerRNA *ptr, PointerRNA value)
00245 {
00246         bSensor *sens = (bSensor *)ptr->data;
00247         bTouchSensor *ts = (bTouchSensor *) sens->data;
00248 
00249         ts->ma = value.data;
00250 }
00251 #else
00252 
00253 static void rna_def_sensor(BlenderRNA *brna)
00254 {
00255         StructRNA *srna;
00256         PropertyRNA *prop;
00257 
00258         srna= RNA_def_struct(brna, "Sensor", NULL);
00259         RNA_def_struct_ui_text(srna, "Sensor", "Game engine logic brick to detect events");
00260         RNA_def_struct_sdna(srna, "bSensor");
00261         RNA_def_struct_refine_func(srna, "rna_Sensor_refine");
00262 
00263         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00264         RNA_def_property_ui_text(prop, "Name", "Sensor name");
00265         RNA_def_struct_name_property(srna, prop);
00266         RNA_def_property_update(prop, NC_LOGIC, NULL);
00267 
00268         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
00269         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00270         RNA_def_property_enum_items(prop, sensor_type_items);
00271         RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_type_set", "rna_Sensor_type_itemf");
00272         RNA_def_property_ui_text(prop, "Type", "");
00273         RNA_def_property_update(prop, NC_LOGIC, NULL);
00274 
00275         prop= RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
00276         RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_PIN);
00277         RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller");
00278         RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
00279         RNA_def_property_update(prop, NC_LOGIC, NULL);
00280 
00281         prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
00282         RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_SHOW);
00283         RNA_def_property_ui_text(prop, "Expanded", "Set sensor expanded in the user interface");
00284         RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
00285         RNA_def_property_update(prop, NC_LOGIC, NULL);
00286 
00287         prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
00288         RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor");
00289         RNA_def_property_update(prop, NC_LOGIC, NULL);
00290 
00291         prop= RNA_def_property(srna, "use_level", PROP_BOOLEAN, PROP_NONE);
00292         RNA_def_property_boolean_sdna(prop, NULL, "level", 1);
00293         RNA_def_property_ui_text(prop, "Level", "Level detector, trigger controllers of new states(only applicable upon logic state transition)");
00294         RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_level_set");
00295         RNA_def_property_update(prop, NC_LOGIC, NULL);
00296 
00297         prop= RNA_def_property(srna, "use_pulse_true_level", PROP_BOOLEAN, PROP_NONE);
00298         RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_PULSE_REPEAT);
00299         RNA_def_property_ui_text(prop, "Pulse True Level", "Activate TRUE level triggering (pulse mode)");
00300         RNA_def_property_update(prop, NC_LOGIC, NULL);
00301 
00302         prop= RNA_def_property(srna, "use_pulse_false_level", PROP_BOOLEAN, PROP_NONE);
00303         RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE);
00304         RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)");
00305         RNA_def_property_update(prop, NC_LOGIC, NULL);
00306         
00307         prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
00308         RNA_def_property_int_sdna(prop, NULL, "freq");
00309         RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)");
00310         RNA_def_property_range(prop, 0, 10000);
00311         RNA_def_property_update(prop, NC_LOGIC, NULL);
00312 
00313         prop= RNA_def_property(srna, "use_tap", PROP_BOOLEAN, PROP_NONE);
00314         RNA_def_property_boolean_sdna(prop, NULL, "tap", 1);
00315         RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_tap_set");
00316         RNA_def_property_ui_text(prop, "Tap", "Trigger controllers only for an instant, even while the sensor remains true");
00317         RNA_def_property_update(prop, NC_LOGIC, NULL);
00318 
00319         RNA_api_sensor(srna);
00320 }
00321 
00322 static void rna_def_always_sensor(BlenderRNA *brna)
00323 {
00324         StructRNA *srna;
00325         srna= RNA_def_struct(brna, "AlwaysSensor", "Sensor");
00326         RNA_def_struct_ui_text(srna, "Always Sensor", "Sensor to generate continuous pulses");
00327 }
00328 
00329 static void rna_def_near_sensor(BlenderRNA *brna)
00330 {
00331         StructRNA *srna;
00332         PropertyRNA *prop;
00333 
00334         srna= RNA_def_struct(brna, "NearSensor", "Sensor");
00335         RNA_def_struct_ui_text(srna , "Near Sensor", "Sensor to detect nearby objects");
00336         RNA_def_struct_sdna_from(srna, "bNearSensor", "data");
00337 
00338         prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
00339         RNA_def_property_string_sdna(prop, NULL, "name");
00340         RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)");
00341         RNA_def_property_update(prop, NC_LOGIC, NULL);
00342 
00343         prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
00344         RNA_def_property_float_sdna(prop, NULL, "dist");
00345         RNA_def_property_ui_text(prop, "Distance", "Trigger distance");
00346         RNA_def_property_range(prop, 0.0f, 10000.0f);
00347         RNA_def_property_update(prop, NC_LOGIC, NULL);
00348 
00349         prop= RNA_def_property(srna, "reset_distance", PROP_FLOAT, PROP_NONE);
00350         RNA_def_property_float_sdna(prop, NULL, "resetdist");
00351         RNA_def_property_ui_text(prop, "Reset Distance", "The distance where the sensor forgets the actor");
00352         RNA_def_property_range(prop, 0.0f, 10000.0f);
00353         RNA_def_property_update(prop, NC_LOGIC, NULL);
00354 }
00355 
00356 static void rna_def_mouse_sensor(BlenderRNA *brna)
00357 {
00358         StructRNA *srna;
00359         PropertyRNA *prop;
00360 
00361         static EnumPropertyItem mouse_event_items[] ={
00362                 {BL_SENS_MOUSE_LEFT_BUTTON, "LEFTCLICK", 0, "Left Button", ""},
00363                 {BL_SENS_MOUSE_MIDDLE_BUTTON, "MIDDLECLICK", 0, "Middle Button", ""},
00364                 {BL_SENS_MOUSE_RIGHT_BUTTON, "RIGHTCLICK", 0, "Right Button", ""},
00365                 {BL_SENS_MOUSE_WHEEL_UP, "WHEELUP", 0, "Wheel Up", ""},
00366                 {BL_SENS_MOUSE_WHEEL_DOWN, "WHEELDOWN", 0, "Wheel Down", ""},
00367                 {BL_SENS_MOUSE_MOVEMENT, "MOVEMENT", 0, "Movement", ""},
00368                 {BL_SENS_MOUSE_MOUSEOVER, "MOUSEOVER", 0, "Mouse Over", ""},
00369                 {BL_SENS_MOUSE_MOUSEOVER_ANY, "MOUSEOVERANY", 0, "Mouse Over Any", ""},
00370                 {0, NULL, 0, NULL, NULL}};
00371 
00372         srna= RNA_def_struct(brna, "MouseSensor", "Sensor");
00373         RNA_def_struct_ui_text(srna, "Mouse Sensor", "Sensor to detect mouse events");
00374         RNA_def_struct_sdna_from(srna, "bMouseSensor", "data");
00375 
00376         prop= RNA_def_property(srna, "mouse_event", PROP_ENUM, PROP_NONE);
00377         RNA_def_property_enum_sdna(prop, NULL, "type");
00378         RNA_def_property_enum_items(prop, mouse_event_items);
00379         RNA_def_property_ui_text(prop, "Mouse Event", "Specify the type of event this mouse sensor should trigger on");
00380         RNA_def_property_update(prop, NC_LOGIC, NULL);
00381 }
00382 
00383 static void rna_def_touch_sensor(BlenderRNA *brna)
00384 {
00385         StructRNA *srna;
00386         PropertyRNA *prop;
00387 
00388         srna= RNA_def_struct(brna, "TouchSensor", "Sensor");
00389         RNA_def_struct_ui_text(srna, "Touch Sensor", "Sensor to detect objects colliding with the current object");
00390         RNA_def_struct_sdna_from(srna, "bTouchSensor", "data");
00391 
00392         prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
00393         RNA_def_property_struct_type(prop, "Material");
00394         RNA_def_property_pointer_sdna(prop, NULL, "ma");
00395         RNA_def_property_flag(prop, PROP_EDITABLE);
00396         RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)");
00397         /* note: custom set function is ONLY to avoid rna setting a user for this. */
00398         RNA_def_property_pointer_funcs(prop, NULL, "rna_Sensor_touch_material_set", NULL, NULL);
00399         RNA_def_property_update(prop, NC_LOGIC, NULL);
00400 }
00401 
00402 static void rna_def_keyboard_sensor(BlenderRNA *brna)
00403 {
00404         StructRNA *srna;
00405         PropertyRNA *prop;
00406 
00407         srna= RNA_def_struct(brna, "KeyboardSensor", "Sensor");
00408         RNA_def_struct_ui_text(srna, "Keyboard Sensor", "Sensor to detect keyboard events");
00409         RNA_def_struct_sdna_from(srna, "bKeyboardSensor", "data");
00410 
00411         prop= RNA_def_property(srna, "key", PROP_ENUM, PROP_NONE);
00412         RNA_def_property_enum_sdna(prop, NULL, "key");
00413         RNA_def_property_enum_items(prop, event_type_items);
00414         RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL);
00415         RNA_def_property_ui_text(prop, "Key",  "");
00416         RNA_def_property_update(prop, NC_LOGIC, NULL);
00417         
00418         prop= RNA_def_property(srna, "modifier_key_1", PROP_ENUM, PROP_NONE);
00419         RNA_def_property_enum_sdna(prop, NULL, "qual");
00420         RNA_def_property_enum_items(prop, event_type_items);
00421         RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier_set", NULL);
00422         RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code");
00423         RNA_def_property_update(prop, NC_LOGIC, NULL);
00424         
00425         prop= RNA_def_property(srna, "modifier_key_2", PROP_ENUM, PROP_NONE);
00426         RNA_def_property_enum_sdna(prop, NULL, "qual2");
00427         RNA_def_property_enum_items(prop, event_type_items);
00428         RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier2_set", NULL);
00429         RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code");
00430         RNA_def_property_update(prop, NC_LOGIC, NULL);
00431 
00432         prop= RNA_def_property(srna, "target", PROP_STRING, PROP_NONE);
00433         RNA_def_property_string_sdna(prop, NULL, "targetName");
00434         RNA_def_property_ui_text(prop, "Target", "Property that receive the keystrokes in case a string is logged");
00435         RNA_def_property_update(prop, NC_LOGIC, NULL);
00436 
00437         prop= RNA_def_property(srna, "log", PROP_STRING, PROP_NONE);
00438         RNA_def_property_string_sdna(prop, NULL, "toggleName");
00439         RNA_def_property_ui_text(prop, "Log Toggle", "Property that indicates whether to log keystrokes as a string");
00440         RNA_def_property_update(prop, NC_LOGIC, NULL);
00441 
00442         prop= RNA_def_property(srna, "use_all_keys", PROP_BOOLEAN, PROP_NONE);
00443         RNA_def_property_boolean_sdna(prop, NULL, "type", 1);
00444         RNA_def_property_ui_text(prop, "All Keys", "Trigger this sensor on any keystroke");
00445         RNA_def_property_update(prop, NC_LOGIC, NULL);
00446 }
00447 
00448 static void rna_def_property_sensor(BlenderRNA *brna)
00449 {
00450         StructRNA *srna;
00451         PropertyRNA *prop;
00452         static EnumPropertyItem prop_type_items[] ={
00453                 {SENS_PROP_EQUAL, "PROPEQUAL", 0, "Equal", ""},
00454                 {SENS_PROP_NEQUAL, "PROPNEQUAL", 0, "Not Equal", ""},
00455                 {SENS_PROP_INTERVAL, "PROPINTERVAL", 0, "Interval", ""},
00456                 {SENS_PROP_CHANGED, "PROPCHANGED", 0, "Changed", ""},
00457                 /* {SENS_PROP_EXPRESSION, "PROPEXPRESSION", 0, "Expression", ""},  NOT_USED_IN_UI */
00458                 {0, NULL, 0, NULL, NULL}};
00459 
00460         srna= RNA_def_struct(brna, "PropertySensor", "Sensor");
00461         RNA_def_struct_ui_text(srna, "Property Sensor", "Sensor to detect values and changes in values of properties");
00462         RNA_def_struct_sdna_from(srna, "bPropertySensor", "data");
00463 
00464         prop= RNA_def_property(srna, "evaluation_type", PROP_ENUM, PROP_NONE);
00465         RNA_def_property_enum_sdna(prop, NULL, "type");
00466         RNA_def_property_enum_items(prop, prop_type_items);
00467         RNA_def_property_ui_text(prop, "Evaluation Type", "Type of property evaluation");
00468         RNA_def_property_update(prop, NC_LOGIC, NULL);
00469 
00470         prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
00471         RNA_def_property_string_sdna(prop, NULL, "name");
00472         RNA_def_property_ui_text(prop, "Property", "");
00473         RNA_def_property_update(prop, NC_LOGIC, NULL);
00474 
00475         prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
00476         RNA_def_property_string_sdna(prop, NULL, "value");
00477         RNA_def_property_ui_text(prop, "Value", "Check for this value in types in Equal or Not Equal types");
00478         RNA_def_property_update(prop, NC_LOGIC, NULL);
00479 
00480         prop= RNA_def_property(srna, "value_min", PROP_STRING, PROP_NONE);
00481         RNA_def_property_string_sdna(prop, NULL, "value");
00482         RNA_def_property_ui_text(prop, "Minimum Value", "Specify minimum value in Interval type");
00483         RNA_def_property_update(prop, NC_LOGIC, NULL);
00484 
00485         prop= RNA_def_property(srna, "value_max", PROP_STRING, PROP_NONE);
00486         RNA_def_property_string_sdna(prop, NULL, "maxvalue");
00487         RNA_def_property_ui_text(prop, "Maximum Value", "Specify maximum value in Interval type");
00488         RNA_def_property_update(prop, NC_LOGIC, NULL);
00489 }
00490 
00491 static void rna_def_armature_sensor(BlenderRNA *brna)
00492 {
00493         StructRNA *srna;
00494         PropertyRNA *prop;
00495         static EnumPropertyItem prop_type_items[] ={
00496                 {SENS_ARM_STATE_CHANGED, "STATECHG", 0, "State Changed", ""},
00497                 {SENS_ARM_LIN_ERROR_BELOW, "LINERRORBELOW", 0, "Lin error below", ""},
00498                 {SENS_ARM_LIN_ERROR_ABOVE, "LINERRORABOVE", 0, "Lin error above", ""},
00499                 {SENS_ARM_ROT_ERROR_BELOW, "ROTERRORBELOW", 0, "Rot error below", ""},
00500                 {SENS_ARM_ROT_ERROR_ABOVE, "ROTERRORABOVE", 0, "Rot error above", ""},
00501                 {0, NULL, 0, NULL, NULL}};
00502 
00503         srna= RNA_def_struct(brna, "ArmatureSensor", "Sensor");
00504         RNA_def_struct_ui_text(srna, "Armature Sensor", "Sensor to detect values and changes in values of IK solver");
00505         RNA_def_struct_sdna_from(srna, "bArmatureSensor", "data");
00506 
00507         prop= RNA_def_property(srna, "test_type", PROP_ENUM, PROP_NONE);
00508         RNA_def_property_enum_sdna(prop, NULL, "type");
00509         RNA_def_property_enum_items(prop, prop_type_items);
00510         RNA_def_property_ui_text(prop, "Test", "Type of value and test");
00511         RNA_def_property_update(prop, NC_LOGIC, NULL);
00512 
00513         prop= RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
00514         RNA_def_property_string_sdna(prop, NULL, "posechannel");
00515         RNA_def_property_ui_text(prop, "Bone Name", "Identify the bone to check value from");
00516         RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update");
00517 
00518         prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
00519         RNA_def_property_string_sdna(prop, NULL, "constraint");
00520         RNA_def_property_ui_text(prop, "Constraint Name", "Identify the bone constraint to check value from");
00521         RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update");
00522 
00523         prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
00524         RNA_def_property_float_sdna(prop, NULL, "value");
00525         RNA_def_property_ui_text(prop, "Compare Value", "Specify value to be used in comparison");
00526         RNA_def_property_update(prop, NC_LOGIC, NULL);
00527 }
00528 
00529 static void rna_def_actuator_sensor(BlenderRNA *brna)
00530 {
00531         StructRNA *srna;
00532         PropertyRNA *prop;
00533 
00534         srna= RNA_def_struct(brna, "ActuatorSensor", "Sensor");
00535         RNA_def_struct_ui_text(srna, "Actuator Sensor", "Sensor to detect state modifications of actuators");
00536         RNA_def_struct_sdna_from(srna, "bActuatorSensor", "data");
00537 
00538         // XXX if eventually have Logics using RNA 100%, we could use the actuator datablock isntead of its name
00539         prop= RNA_def_property(srna, "actuator", PROP_STRING, PROP_NONE);
00540         RNA_def_property_string_sdna(prop, NULL, "name");
00541         RNA_def_property_ui_text(prop, "Actuator", "Actuator name, actuator active state modifications will be detected");
00542         RNA_def_property_update(prop, NC_LOGIC, NULL);
00543 }
00544 
00545 static void rna_def_delay_sensor(BlenderRNA *brna)
00546 {
00547         StructRNA *srna;
00548         PropertyRNA *prop;
00549 
00550         srna= RNA_def_struct(brna, "DelaySensor", "Sensor");
00551         RNA_def_struct_ui_text(srna, "Delay Sensor", "Sensor to send delayed events");
00552         RNA_def_struct_sdna_from(srna, "bDelaySensor", "data");
00553 
00554         prop= RNA_def_property(srna, "delay", PROP_INT, PROP_NONE);
00555         RNA_def_property_ui_text(prop, "Delay", "Delay in number of logic tics before the positive trigger (default 60 per second)");
00556         RNA_def_property_range(prop, 0, 5000);
00557         RNA_def_property_update(prop, NC_LOGIC, NULL);
00558 
00559         prop= RNA_def_property(srna, "duration", PROP_INT, PROP_NONE);
00560         RNA_def_property_ui_text(prop, "Duration", "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
00561         RNA_def_property_range(prop, 0, 5000);
00562         RNA_def_property_update(prop, NC_LOGIC, NULL);
00563 
00564         prop= RNA_def_property(srna, "use_repeat", PROP_BOOLEAN, PROP_NONE);
00565         RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_DELAY_REPEAT);
00566         RNA_def_property_ui_text(prop, "Repeat", "Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics");
00567         RNA_def_property_update(prop, NC_LOGIC, NULL);
00568 }
00569 
00570 static void rna_def_collision_sensor(BlenderRNA *brna)
00571 {
00572         StructRNA *srna;
00573         PropertyRNA *prop;
00574 
00575         srna= RNA_def_struct(brna, "CollisionSensor", "Sensor");
00576         RNA_def_struct_ui_text(srna, "Collision Sensor", "Sensor to detect objects colliding with the current object, with more settings than the Touch sensor");
00577         RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data");
00578 
00579         prop= RNA_def_property(srna, "use_pulse", PROP_BOOLEAN, PROP_NONE);
00580         RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_PULSE);
00581         RNA_def_property_ui_text(prop, "Pulse", "Changes to the set of colliding objects generates pulse");
00582         RNA_def_property_update(prop, NC_LOGIC, NULL);
00583 
00584         prop= RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
00585         RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL);
00586         RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property");
00587         RNA_def_property_update(prop, NC_LOGIC, NULL);
00588 
00589         prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
00590         RNA_def_property_string_sdna(prop, NULL, "name");
00591         RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property (blank = all objects)");
00592         RNA_def_property_update(prop, NC_LOGIC, NULL);
00593 
00594         //XXX to make a setFunction to create a lookup with all materials in Blend File (not only this object mat.)
00595         prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
00596         RNA_def_property_string_sdna(prop, NULL, "materialName");
00597         RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material (blank = all objects)");
00598         RNA_def_property_update(prop, NC_LOGIC, NULL);
00599 
00600 /*//XXX either use a datablock look up to store the string name (material)
00601   // or to do a doversion and use a material pointer.
00602         prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
00603         RNA_def_property_struct_type(prop, "Material");
00604         RNA_def_property_flag(prop, PROP_EDITABLE);
00605         RNA_def_property_pointer_sdna(prop, NULL, "ma");
00606         RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material (blank = all objects)");
00607 */
00608 }
00609 
00610 static void rna_def_radar_sensor(BlenderRNA *brna)
00611 {
00612         StructRNA *srna;
00613         PropertyRNA *prop;
00614         static EnumPropertyItem axis_items[] ={
00615                 {SENS_RADAR_X_AXIS, "XAXIS", 0, "+X axis", ""},
00616                 {SENS_RADAR_Y_AXIS, "YAXIS", 0, "+Y axis", ""},
00617                 {SENS_RADAR_Z_AXIS, "ZAXIS", 0, "+Z axis", ""},
00618                 {SENS_RADAR_NEG_X_AXIS, "NEGXAXIS", 0, "-X axis", ""},
00619                 {SENS_RADAR_NEG_Y_AXIS, "NEGYAXIS", 0, "-Y axis", ""},
00620                 {SENS_RADAR_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""},
00621                 {0, NULL, 0, NULL, NULL}};
00622 
00623         srna= RNA_def_struct(brna, "RadarSensor", "Sensor");
00624         RNA_def_struct_ui_text(srna, "Radar Sensor", "Sensor to detect objects in a cone shaped radar emanating from the current object");
00625         RNA_def_struct_sdna_from(srna, "bRadarSensor", "data");
00626 
00627         prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
00628         RNA_def_property_string_sdna(prop, NULL, "name");
00629         RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property (blank = all objects)");
00630         RNA_def_property_update(prop, NC_LOGIC, NULL);
00631 
00632         prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
00633         RNA_def_property_enum_items(prop, axis_items);
00634         RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the radar cone is cast");
00635         RNA_def_property_update(prop, NC_LOGIC, NULL);
00636 
00637         //XXX TODO - use radians internally then change to PROP_ANGLE
00638         prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
00639         RNA_def_property_range(prop, 0.0, 179.9);
00640         RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone (in degrees)");
00641         RNA_def_property_update(prop, NC_LOGIC, NULL);
00642 
00643         prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
00644         RNA_def_property_float_sdna(prop, NULL, "range");
00645         RNA_def_property_range(prop, 0.0, 10000.0);
00646         RNA_def_property_ui_text(prop, "Distance", "Depth of the radar cone");
00647         RNA_def_property_update(prop, NC_LOGIC, NULL);
00648 }
00649 
00650 static void rna_def_random_sensor(BlenderRNA *brna)
00651 {
00652         StructRNA *srna;
00653         PropertyRNA *prop;
00654 
00655         srna= RNA_def_struct(brna, "RandomSensor", "Sensor");
00656         RNA_def_struct_ui_text(srna, "Random Sensor", "Sensor to send random events");
00657         RNA_def_struct_sdna_from(srna, "bRandomSensor", "data");
00658 
00659         prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
00660         RNA_def_property_range(prop, 0, 1000);
00661         RNA_def_property_ui_text(prop, "Seed", "Initial seed of the generator. (Choose 0 for not random)");
00662         RNA_def_property_update(prop, NC_LOGIC, NULL);
00663 }
00664 
00665 static void rna_def_ray_sensor(BlenderRNA *brna)
00666 {
00667         StructRNA *srna;
00668         PropertyRNA *prop;
00669         static EnumPropertyItem axis_items[] ={
00670                 {SENS_RAY_X_AXIS, "XAXIS", 0, "+X axis", ""},
00671                 {SENS_RAY_Y_AXIS, "YAXIS", 0, "+Y axis", ""},
00672                 {SENS_RAY_Z_AXIS, "ZAXIS", 0, "+Z axis", ""},
00673                 {SENS_RAY_NEG_X_AXIS, "NEGXAXIS", 0, "-X axis", ""},
00674                 {SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", 0, "-Y axis", ""},
00675                 {SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""},
00676                 {0, NULL, 0, NULL, NULL}};
00677         
00678         static const EnumPropertyItem prop_ray_type_items[]= {
00679                 {SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a material for ray intersections"},
00680                 {SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a property for ray intersections"},
00681                 {0, NULL, 0, NULL, NULL}};
00682 
00683         srna= RNA_def_struct(brna, "RaySensor", "Sensor");
00684         RNA_def_struct_ui_text(srna, "Ray Sensor", "Sensor to detect intersections with a ray emanating from the current object");
00685         RNA_def_struct_sdna_from(srna, "bRaySensor", "data");
00686         
00687         prop= RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE);
00688         RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
00689         RNA_def_property_enum_items(prop, prop_ray_type_items);
00690         RNA_def_property_ui_text(prop, "Ray Type", "Toggle collision on material or property");
00691         RNA_def_property_update(prop, NC_LOGIC, NULL);
00692 
00693         prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
00694         RNA_def_property_string_sdna(prop, NULL, "propname");
00695         RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property (blank = all objects)");
00696         RNA_def_property_update(prop, NC_LOGIC, NULL);
00697 
00698         prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
00699         RNA_def_property_string_sdna(prop, NULL, "matname");
00700         RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material (blank = all objects)");
00701         RNA_def_property_update(prop, NC_LOGIC, NULL);
00702 
00703         /* //XXX either use a datablock look up to store the string name (material)
00704            // or to do a doversion and use a material pointer.
00705         prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
00706         RNA_def_property_struct_type(prop, "Material");
00707         RNA_def_property_flag(prop, PROP_EDITABLE);
00708         RNA_def_property_pointer_sdna(prop, NULL, "ma");
00709         RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material (blank = all objects)");
00710 */
00711 
00712         prop= RNA_def_property(srna, "use_x_ray", PROP_BOOLEAN, PROP_NONE);
00713         RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY);
00714         RNA_def_property_ui_text(prop, "X-Ray Mode", "Toggle X-Ray option (see through objects that don't have the property)");
00715         RNA_def_property_update(prop, NC_LOGIC, NULL);
00716 
00717         prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
00718         RNA_def_property_range(prop, 0.01, 10000.0);
00719         RNA_def_property_ui_text(prop, "Range", "Sense objects no farther than this distance");
00720         RNA_def_property_update(prop, NC_LOGIC, NULL);
00721 
00722         prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
00723         RNA_def_property_enum_sdna(prop, NULL, "axisflag");
00724         RNA_def_property_enum_items(prop, axis_items);
00725         RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the ray is cast");
00726         RNA_def_property_update(prop, NC_LOGIC, NULL);
00727 }
00728 
00729 static void rna_def_message_sensor(BlenderRNA *brna)
00730 {
00731         StructRNA *srna;
00732         PropertyRNA *prop;
00733 
00734         srna= RNA_def_struct(brna, "MessageSensor", "Sensor");
00735         RNA_def_struct_ui_text(srna, "Message Sensor", "Sensor to detect incoming messages");
00736         RNA_def_struct_sdna_from(srna, "bMessageSensor", "data");
00737 
00738         prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
00739         RNA_def_property_ui_text(prop, "Subject", "Optional subject filter: only accept messages with this subject, or empty for all");
00740         RNA_def_property_update(prop, NC_LOGIC, NULL);
00741 }
00742 
00743 static void rna_def_joystick_sensor(BlenderRNA *brna)
00744 {
00745         StructRNA *srna;
00746         PropertyRNA *prop;
00747 
00748         static EnumPropertyItem event_type_items[] ={
00749                 {SENS_JOY_BUTTON, "BUTTON", 0, "Button", ""},
00750                 {SENS_JOY_AXIS, "AXIS", 0, "Axis", ""},
00751                 {SENS_JOY_HAT, "HAT", 0, "Hat", ""},
00752                 {SENS_JOY_AXIS_SINGLE, "AXIS_SINGLE", 0, "Single Axis", ""},
00753                 {0, NULL, 0, NULL, NULL}};
00754 
00755         static EnumPropertyItem axis_direction_items[] ={
00756                 {SENS_JOY_X_AXIS, "RIGHTAXIS", 0, "Right Axis", ""},
00757                 {SENS_JOY_Y_AXIS, "UPAXIS", 0, "Up Axis", ""},
00758                 {SENS_JOY_NEG_X_AXIS, "LEFTAXIS", 0, "Left Axis", ""},
00759                 {SENS_JOY_NEG_Y_AXIS, "DOWNAXIS", 0, "Down Axis", ""},
00760                 {0, NULL, 0, NULL, NULL}};
00761 
00762         static EnumPropertyItem hat_direction_items[] ={
00763                 {SENS_JOY_HAT_UP, "UP", 0, "Up", ""},
00764                 {SENS_JOY_HAT_DOWN, "DOWN", 0, "Down", ""},
00765                 {SENS_JOY_HAT_LEFT, "LEFT", 0, "Left", ""},
00766                 {SENS_JOY_HAT_RIGHT, "RIGHT", 0, "Right", ""},
00767 
00768                 {SENS_JOY_HAT_UP_RIGHT, "UPRIGHT", 0, "Up/Right", ""},
00769                 {SENS_JOY_HAT_DOWN_LEFT, "DOWNLEFT", 0, "Down/Left", ""},
00770                 {SENS_JOY_HAT_UP_LEFT, "UPLEFT", 0, "Up/Left", ""},
00771                 {SENS_JOY_HAT_DOWN_RIGHT, "DOWNRIGHT", 0, "Down/Right", ""},
00772                 {0, NULL, 0, NULL, NULL}};
00773 
00774         srna= RNA_def_struct(brna, "JoystickSensor", "Sensor");
00775         RNA_def_struct_ui_text(srna, "Joystick Sensor", "Sensor to detect joystick events");
00776         RNA_def_struct_sdna_from(srna, "bJoystickSensor", "data");
00777         
00778         prop= RNA_def_property(srna, "joystick_index", PROP_INT, PROP_NONE);
00779         RNA_def_property_int_sdna(prop, NULL, "joyindex");
00780         RNA_def_property_ui_text(prop, "Index", "Specify which joystick to use");
00781         RNA_def_property_range(prop, 0, SENS_JOY_MAXINDEX-1);
00782         RNA_def_property_update(prop, NC_LOGIC, NULL);
00783 
00784         prop= RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE);
00785         RNA_def_property_enum_sdna(prop, NULL, "type");
00786         RNA_def_property_enum_items(prop, event_type_items);
00787         RNA_def_property_ui_text(prop, "Event Type", "The type of event this joystick sensor is triggered on");
00788         RNA_def_property_update(prop, NC_LOGIC, NULL);
00789 
00790         prop= RNA_def_property(srna, "use_all_events", PROP_BOOLEAN, PROP_NONE);
00791         RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_JOY_ANY_EVENT);
00792         RNA_def_property_ui_text(prop, "All Events", "Triggered by all events on this joysticks current type (axis/button/hat)");
00793         RNA_def_property_update(prop, NC_LOGIC, NULL);
00794 
00795         /* Button */
00796         prop= RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE);
00797         RNA_def_property_int_sdna(prop, NULL, "button");
00798         RNA_def_property_ui_text(prop, "Button Number", "Specify which button to use");
00799         RNA_def_property_range(prop, 0, 18);
00800         RNA_def_property_update(prop, NC_LOGIC, NULL);
00801 
00802         /* Axis */
00803         prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE);
00804         RNA_def_property_int_sdna(prop, NULL, "axis");
00805         RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input");
00806         RNA_def_property_range(prop, 1, 2);
00807         RNA_def_property_update(prop, NC_LOGIC, NULL);
00808 
00809         prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE);
00810         RNA_def_property_int_sdna(prop, NULL, "precision");
00811         RNA_def_property_ui_text(prop, "Axis Threshold", "Specify the precision of the axis");
00812         RNA_def_property_range(prop, 0, 32768);
00813         RNA_def_property_update(prop, NC_LOGIC, NULL);
00814 
00815         prop= RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE);
00816         RNA_def_property_enum_sdna(prop, NULL, "axisf");
00817         RNA_def_property_enum_items(prop, axis_direction_items);
00818         RNA_def_property_ui_text(prop, "Axis Direction", "The direction of the axis");
00819         RNA_def_property_update(prop, NC_LOGIC, NULL);
00820 
00821         /* Single Axis */
00822         prop= RNA_def_property(srna, "single_axis_number", PROP_INT, PROP_NONE);
00823         RNA_def_property_int_sdna(prop, NULL, "axis_single");
00824         RNA_def_property_ui_text(prop, "Axis Number", "Specify a single axis (verticle/horizontal/other) to detect");
00825         RNA_def_property_range(prop, 1, 16);
00826         RNA_def_property_update(prop, NC_LOGIC, NULL);
00827 
00828         /* Hat */
00829         prop= RNA_def_property(srna, "hat_number", PROP_INT, PROP_NONE);
00830         RNA_def_property_int_sdna(prop, NULL, "hat");
00831         RNA_def_property_ui_text(prop, "Hat Number", "Specify which hat to use");
00832         RNA_def_property_range(prop, 1, 2);
00833         RNA_def_property_update(prop, NC_LOGIC, NULL);
00834 
00835         prop= RNA_def_property(srna, "hat_direction", PROP_ENUM, PROP_NONE);
00836         RNA_def_property_enum_sdna(prop, NULL, "hatf");
00837         RNA_def_property_enum_items(prop, hat_direction_items);
00838         RNA_def_property_ui_text(prop, "Hat Direction", "Specify hat direction");
00839         RNA_def_property_update(prop, NC_LOGIC, NULL);
00840 }
00841 
00842 void RNA_def_sensor(BlenderRNA *brna)
00843 {
00844         rna_def_sensor(brna);
00845 
00846         rna_def_always_sensor(brna);
00847         rna_def_near_sensor(brna);
00848         rna_def_mouse_sensor(brna);
00849         rna_def_touch_sensor(brna);
00850         rna_def_keyboard_sensor(brna);
00851         rna_def_property_sensor(brna);
00852         rna_def_armature_sensor(brna);
00853         rna_def_actuator_sensor(brna);
00854         rna_def_delay_sensor(brna);
00855         rna_def_collision_sensor(brna);
00856         rna_def_radar_sensor(brna);
00857         rna_def_random_sensor(brna);
00858         rna_def_ray_sensor(brna);
00859         rna_def_message_sensor(brna);
00860         rna_def_joystick_sensor(brna);
00861 }
00862 
00863 #endif
00864