diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-03 02:45:11 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-03 02:45:11 +0300 |
commit | 8f1847e4c33f4276c6aaf123e658f9d2043f7dcb (patch) | |
tree | 76fc524250b9a54069931c3d50e8c379fc6b982f /source/blender/makesrna/intern/rna_sensor.c | |
parent | d27c9f9d76752bffdcdf60812ee05f48482bccfc (diff) |
RNA: review of commits in the past days, check the diffs for the
many small changes, but the two bigger ones are:
* Sensors and controllers now use inheritance, rather than pointing
to the data in a separate struct. Had to add some new RNA define
functionality to support this better.
* DNA_meta_types.h was marked as done but still missing many things,
now completed.
Diffstat (limited to 'source/blender/makesrna/intern/rna_sensor.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_sensor.c | 243 |
1 files changed, 121 insertions, 122 deletions
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index d311bce54c6..661b813080e 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -34,13 +34,13 @@ #ifdef RNA_RUNTIME -static struct StructRNA* rna_Sensor_data_type(struct PointerRNA *ptr) +static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr) { bSensor *sensor= (bSensor*)ptr->data; switch(sensor->type) { case SENS_ALWAYS: - return &RNA_UnknownType; + return &RNA_AlwaysSensor; case SENS_TOUCH: return &RNA_TouchSensor; case SENS_NEAR: @@ -68,10 +68,8 @@ static struct StructRNA* rna_Sensor_data_type(struct PointerRNA *ptr) case SENS_DELAY: return &RNA_DelaySensor; default: - return &RNA_UnknownType; + return &RNA_Sensor; } - - return &RNA_UnknownType; } #else @@ -80,7 +78,7 @@ void rna_def_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem sensor_types_items[] ={ + static EnumPropertyItem sensor_type_items[] ={ {SENS_ALWAYS, "ALWAYS", "Always", ""}, {SENS_TOUCH, "TOUCH", "Touch", ""}, {SENS_NEAR, "NEAR", "Near", ""}, @@ -97,19 +95,19 @@ void rna_def_sensor(BlenderRNA *brna) {SENS_DELAY, "DELAY", "Delay", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "Sensor", NULL , "Sensor"); + srna= RNA_def_struct(brna, "Sensor", NULL, "Sensor"); RNA_def_struct_sdna(srna, "bSensor"); + RNA_def_struct_funcs(srna, NULL, "rna_Sensor_refine"); - prop= RNA_def_property(srna, "sensor_name", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); + prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Sensor name."); + RNA_def_struct_name_property(srna, prop); /* type is not editable, would need to do proper data free/alloc */ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_NOT_EDITABLE); - RNA_def_property_enum_items(prop, sensor_types_items); - RNA_def_property_ui_text(prop, "Sensor Types", "Sensor types."); + RNA_def_property_enum_items(prop, sensor_type_items); + RNA_def_property_ui_text(prop, "Type", ""); prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor."); @@ -125,17 +123,14 @@ void rna_def_sensor(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE); RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)."); - prop= RNA_def_property(srna, "freq", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)."); RNA_def_property_range(prop, 0, 10000); +} - - //This add data property to Sensor, and because data can be bMouseSensor, bNearSensor, bAlwaysSensor ... - //rna_Sensor_data_type defines above in runtime section to get its type and proper structure for data - prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); - RNA_def_property_ui_text(prop, "Data", "Sensor data."); - RNA_def_property_pointer_funcs(prop, NULL, "rna_Sensor_data_type", NULL); +void rna_def_always_sensor(BlenderRNA *brna) +{ + RNA_def_struct(brna, "AlwaysSensor", "Sensor", "Always Sensor"); } void rna_def_near_sensor(BlenderRNA *brna) @@ -143,12 +138,11 @@ void rna_def_near_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "NearSensor", NULL , "NearSensor"); - RNA_def_struct_sdna(srna, "bNearSensor"); + srna= RNA_def_struct(brna, "NearSensor", "Sensor" , "Near Sensor"); + RNA_def_struct_sdna_from(srna, "bNearSensor", "data"); prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property."); prop= RNA_def_property(srna, "distance", PROP_INT, PROP_NONE); @@ -158,7 +152,7 @@ void rna_def_near_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "reset_distance", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "resetdist"); - RNA_def_property_ui_text(prop, "Reset", "Reset distance."); + RNA_def_property_ui_text(prop, "Reset Distance", ""); RNA_def_property_range(prop, 0, 10000); } @@ -178,10 +172,11 @@ void rna_def_mouse_sensor(BlenderRNA *brna) {BL_SENS_MOUSE_MOUSEOVER_ANY, "MOUSEOVERANY", "Mouse Over Any", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "MouseSensor", NULL , "MouseSensor"); - RNA_def_struct_sdna(srna, "bMouseSensor"); + srna= RNA_def_struct(brna, "MouseSensor", "Sensor", "Mouse Sensor"); + RNA_def_struct_sdna_from(srna, "bMouseSensor", "data"); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "mouse_event", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type", 0); RNA_def_property_enum_items(prop, mouse_event_items); RNA_def_property_ui_text(prop, "Mouse Event", "Specify the type of event this mouse sensor should trigger on."); } @@ -191,14 +186,13 @@ void rna_def_touch_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "TouchSensor", NULL , "TouchSensor"); - RNA_def_struct_sdna(srna, "bTouchSensor"); + srna= RNA_def_struct(brna, "TouchSensor", "Sensor", "Touch Sensor"); + RNA_def_struct_sdna_from(srna, "bTouchSensor", "data"); prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ma"); RNA_def_property_struct_type(prop, "Material"); - RNA_def_property_ui_text(prop, "Material", "only look for floors with this material."); - + RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material."); } void rna_def_keyboard_sensor(BlenderRNA *brna) @@ -206,43 +200,44 @@ void rna_def_keyboard_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "KeyboardSensor", NULL , "KeyboardSensor"); - RNA_def_struct_sdna(srna, "bKeyboardSensor"); + srna= RNA_def_struct(brna, "KeyboardSensor", "Sensor", "Keyboard Sensor"); + RNA_def_struct_sdna_from(srna, "bKeyboardSensor", "data"); prop= RNA_def_property(srna, "key", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Input Key", "Input key code."); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* need better range or enum check */ + RNA_def_property_ui_text(prop, "Key", "Input key code."); RNA_def_property_range(prop, 0, 255); - prop= RNA_def_property(srna, "modifier_key1", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "modifier_key", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* need better range or enum check */ RNA_def_property_int_sdna(prop, NULL, "qual"); - RNA_def_property_ui_text(prop, "First Modifier Key", "Modifier key code."); + RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code."); RNA_def_property_range(prop, 0, 255); - prop= RNA_def_property(srna, "modifier_key2", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "second_modifier_key", PROP_INT, PROP_NONE); + RNA_def_property_flag(prop, PROP_NOT_EDITABLE); /* need better range or enum check */ RNA_def_property_int_sdna(prop, NULL, "qual2"); RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code."); RNA_def_property_range(prop, 0, 255); - prop= RNA_def_property(srna, "target_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "target", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "targetName"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Target Name", "Property that indicates whether to log keystrokes as a string."); + RNA_def_property_ui_text(prop, "Target", "Property that indicates whether to log keystrokes as a string."); - prop= RNA_def_property(srna, "toggle_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "log", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "toggleName"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Toggle Name", "Property that receive the keystrokes in case a string is logged."); + RNA_def_property_ui_text(prop, "Log", "Property that receive the keystrokes in case a string is logged."); - prop= RNA_def_property(srna, "type", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "all_keys", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type", 1); RNA_def_property_ui_text(prop, "All Keys", "Trigger this sensor on any keystroke."); - } void rna_def_property_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_items[] ={ + static EnumPropertyItem prop_type_items[] ={ {SENS_PROP_EQUAL, "PROPEQUAL", "Equal", ""}, {SENS_PROP_NEQUAL, "PROPNEQUAL", "Not Equal", ""}, {SENS_PROP_INTERVAL, "PROPINTERVAL", "Interval", ""}, @@ -250,26 +245,29 @@ void rna_def_property_sensor(BlenderRNA *brna) /* {SENS_PROP_EXPRESSION, "PROPEXPRESSION", "Expression", ""}, NOT_USED_IN_UI */ {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "PropertySensor", NULL , "PropertySensor"); - RNA_def_struct_sdna(srna, "bPropertySensor"); + srna= RNA_def_struct(brna, "PropertySensor", "Sensor", "Property Sensor"); + RNA_def_struct_sdna_from(srna, "bPropertySensor", "data"); - prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_items); - RNA_def_property_ui_text(prop, "Property Type", "Specify the type of property evaluation type."); + prop= RNA_def_property(srna, "evaluation_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type", 0); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Evaluation Type", "Type of property evaluation."); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Property Name", "Property name."); + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Property", ""); + + prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "value"); + RNA_def_property_ui_text(prop, "Value", "Check for this value in types in Equal or Not Equal types."); - prop= RNA_def_property(srna, "first_value", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "min_value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "value"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "First Value", "Specify the value that checked, or minimum value in Interval Type."); + RNA_def_property_ui_text(prop, "Minimum Value", "Specify minimum value in Interval type."); - prop= RNA_def_property(srna, "second_value", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "max_value", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "maxvalue"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Second Value", "Specify maximum value in Interval type."); + RNA_def_property_ui_text(prop, "Maximum Value", "Specify maximum value in Interval type."); } void rna_def_actuator_sensor(BlenderRNA *brna) @@ -277,12 +275,12 @@ void rna_def_actuator_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "ActuatorSensor", NULL , "ActuatorSensor"); - RNA_def_struct_sdna(srna, "bActuatorSensor"); + srna= RNA_def_struct(brna, "ActuatorSensor", "Sensor", "Actuator Sensor"); + RNA_def_struct_sdna_from(srna, "bActuatorSensor", "data"); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Actuator Name", "Actuator name."); + prop= RNA_def_property(srna, "actuator", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_ui_text(prop, "Actuator", "Actuator name, actuator active state modifications will be detected."); } void rna_def_delay_sensor(BlenderRNA *brna) @@ -290,8 +288,8 @@ void rna_def_delay_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "DelaySensor", NULL , "DelaySensor"); - RNA_def_struct_sdna(srna, "bDelaySensor"); + srna= RNA_def_struct(brna, "DelaySensor", "Sensor", "Delay Sensor"); + RNA_def_struct_sdna_from(srna, "bDelaySensor", "data"); prop= RNA_def_property(srna, "delay", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "Delay", "Delay in number of logic tics before the positive trigger (default 60 per second)."); @@ -310,23 +308,26 @@ void rna_def_collision_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem prop_type_items[] ={ + {0, "PROPERTY", "Property", ""}, + {1, "MATERIAL", "Material", ""}, + {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "CollisionSensor", NULL , "CollisionSensor"); - RNA_def_struct_sdna(srna, "bCollisionSensor"); + srna= RNA_def_struct(brna, "CollisionSensor", "Sensor", "Collision Sensor"); + RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data"); - prop= RNA_def_property(srna, "property_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Property Name", "Only look for Objects with this property."); - prop= RNA_def_property(srna, "material_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "materialName"); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Material Name", "Only look for Objects with this material."); - prop= RNA_def_property(srna, "type", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL); - RNA_def_property_ui_text(prop, "Material/Property", "Toggle collision on material or property."); + prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode", 0); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Collision Type", "Toggle collision on material or property."); } void rna_def_radar_sensor(BlenderRNA *brna) @@ -334,20 +335,20 @@ void rna_def_radar_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; static EnumPropertyItem axis_items[] ={ - {SENS_RAY_X_AXIS, "RAYX", "+X axis", ""}, - {SENS_RAY_Y_AXIS, "RAYY", "+Y axis", ""}, - {SENS_RAY_Z_AXIS, "RAYZ", "+Z axis", ""}, - {SENS_RAY_NEG_X_AXIS, "RAYNX", "-X axis", ""}, - {SENS_RAY_NEG_Y_AXIS, "RAYNY", "-Y axis", ""}, - {SENS_RAY_NEG_Z_AXIS, "RAYNZ", "-Z axis", ""}, + {SENS_RAY_X_AXIS, "XAXIS", "+X axis", ""}, + {SENS_RAY_Y_AXIS, "YAXIS", "+Y axis", ""}, + {SENS_RAY_Z_AXIS, "ZAXIS", "+Z axis", ""}, + {SENS_RAY_NEG_X_AXIS, "NEGXAXIS", "-X axis", ""}, + {SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", "-Y axis", ""}, + {SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", "-Z axis", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "RadarSensor", NULL , "RadarSensor"); - RNA_def_struct_sdna(srna, "bRadarSensor"); - prop= RNA_def_property(srna, "property_name", PROP_STRING, PROP_NONE); + srna= RNA_def_struct(brna, "RadarSensor", "Sensor", "Radar Sensor"); + RNA_def_struct_sdna_from(srna, "bRadarSensor", "data"); + + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Property Name", "Only look for Objects with this property."); + RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property."); prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, axis_items); @@ -368,59 +369,59 @@ void rna_def_random_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "RandomSensor", NULL , "RandomSensor"); - RNA_def_struct_sdna(srna, "bRandomSensor"); + srna= RNA_def_struct(brna, "RandomSensor", "Sensor", "Random Sensor"); + RNA_def_struct_sdna_from(srna, "bRandomSensor", "data"); prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); RNA_def_property_ui_text(prop, "Seed", "Initial seed of the generator. (Choose 0 for not random)."); - } void rna_def_ray_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem axis_items[] ={ - {SENS_RAY_X_AXIS, "RAYX", "+X axis", ""}, - {SENS_RAY_Y_AXIS, "RAYY", "+Y axis", ""}, - {SENS_RAY_Z_AXIS, "RAYZ", "+Z axis", ""}, - {SENS_RAY_NEG_X_AXIS, "RAYNX", "-X axis", ""}, - {SENS_RAY_NEG_Y_AXIS, "RAYNY", "-Y axis", ""}, - {SENS_RAY_NEG_Z_AXIS, "RAYNZ", "-Z axis", ""}, + {SENS_RAY_X_AXIS, "XAXIS", "+X axis", ""}, + {SENS_RAY_Y_AXIS, "YAXIS", "+Y axis", ""}, + {SENS_RAY_Z_AXIS, "ZAXIS", "+Z axis", ""}, + {SENS_RAY_NEG_X_AXIS, "NEGXAXIS", "-X axis", ""}, + {SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", "-Y axis", ""}, + {SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", "-Z axis", ""}, + {0, NULL, NULL, NULL}}; + static EnumPropertyItem prop_type_items[] ={ + {0, "PROPERTY", "Property", ""}, + {1, "MATERIAL", "Material", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "RaySensor", NULL , "RaySensor"); - RNA_def_struct_sdna(srna, "bRaySensor"); + srna= RNA_def_struct(brna, "RaySensor", "Sensor", "Ray Sensor"); + RNA_def_struct_sdna_from(srna, "bRaySensor", "data"); - prop= RNA_def_property(srna, "property_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "propname"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Property Name", "Only look for Objects with this property."); + RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property."); - prop= RNA_def_property(srna, "material_name", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "matname"); - RNA_def_property_string_maxlength(prop, 31); - RNA_def_property_ui_text(prop, "Material Name", "Only look for Objects with this material."); + RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material."); - prop= RNA_def_property(srna, "type", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL); - RNA_def_property_ui_text(prop, "Material/Property", "Toggle collision on material or property."); + prop= RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode", 0); + RNA_def_property_enum_items(prop, prop_type_items); + RNA_def_property_ui_text(prop, "Collision Type", "Toggle collision on material or property."); prop= RNA_def_property(srna, "x_ray_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY); RNA_def_property_ui_text(prop, "X-Ray Mode", "Toggle X-Ray option (see through objects that don't have the property)."); prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 10000.0); + RNA_def_property_range(prop, 0.01, 10000.0); RNA_def_property_ui_text(prop, "Range", "Sense objects no farther than this distance."); prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axisflag", PROP_DEF_ENUM_BITFLAGS); + RNA_def_property_enum_sdna(prop, NULL, "axisflag", 0); RNA_def_property_enum_items(prop, axis_items); RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the ray is cast."); - } void rna_def_message_sensor(BlenderRNA *brna) @@ -428,11 +429,10 @@ void rna_def_message_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "MessageSensor", NULL , "MessageSensor"); - RNA_def_struct_sdna(srna, "bMessageSensor"); + srna= RNA_def_struct(brna, "MessageSensor", "Sensor", "Message Sensor"); + RNA_def_struct_sdna_from(srna, "bMessageSensor", "data"); prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE); - RNA_def_property_string_maxlength(prop, 31); RNA_def_property_ui_text(prop, "Subject", "Optional subject filter: only accept messages with this subject, or empty for all."); } @@ -454,23 +454,22 @@ void rna_def_joystick_sensor(BlenderRNA *brna) {SENS_JOY_NEG_Y_AXIS, "DOWNAXIS", "Down Axis", ""}, {0, NULL, NULL, NULL}}; - srna= RNA_def_struct(brna, "JoystickSensor", NULL , "JoystickSensor"); - RNA_def_struct_sdna(srna, "bJoystickSensor"); + srna= RNA_def_struct(brna, "JoystickSensor", "Sensor", "Joystick Sensor"); + RNA_def_struct_sdna_from(srna, "bJoystickSensor", "data"); prop= RNA_def_property(srna, "joystick_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "joyindex"); - RNA_def_property_ui_text(prop, "Index", "Specify which joystick to use."); + RNA_def_property_ui_text(prop, "Joystick Index", "Specify which joystick to use."); RNA_def_property_range(prop, 0, SENS_JOY_MAXINDEX-1); - prop= RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type", PROP_DEF_ENUM_BITFLAGS); + RNA_def_property_enum_sdna(prop, NULL, "type", 0); RNA_def_property_enum_items(prop, event_type_items); RNA_def_property_ui_text(prop, "Event Type", "The type of event this joystick sensor is triggered on."); - prop= RNA_def_property(srna, "any_event", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "all_events", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_JOY_ANY_EVENT); - RNA_def_property_ui_text(prop, "All (Button/Axis/Hat) Events", "Triggered by all events on this joysticks current type (axis/button/hat)."); + RNA_def_property_ui_text(prop, "All Events", "Triggered by all events on this joysticks current type (axis/button/hat)."); /* Button */ prop= RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE); @@ -490,7 +489,7 @@ void rna_def_joystick_sensor(BlenderRNA *brna) RNA_def_property_range(prop, 0, 32768); prop= RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axisf", PROP_DEF_ENUM_BITFLAGS); + RNA_def_property_enum_sdna(prop, NULL, "axisf", 0); RNA_def_property_enum_items(prop, axis_direction_items); RNA_def_property_ui_text(prop, "Axis Direction", "The direction of the axis."); @@ -506,11 +505,11 @@ void rna_def_joystick_sensor(BlenderRNA *brna) RNA_def_property_range(prop, 0, 12); } - void RNA_def_sensor(BlenderRNA *brna) { rna_def_sensor(brna); + rna_def_always_sensor(brna); rna_def_near_sensor(brna); rna_def_mouse_sensor(brna); rna_def_touch_sensor(brna); |