Blender V2.61 - r43446

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