Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2010-05-08 23:52:13 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-05-08 23:52:13 +0400
commit2909a4988b2895d067a3626b47a68aaa9b61c737 (patch)
treeff3f90b9d8e08258eddb11a454bcb266ba787fae /source/blender/makesrna/intern/rna_sensor.c
parent79d5d623e05e43e0102fe734312d0cfce815f6ad (diff)
Logic UI: add notifiers for sensors and controllers (so the ui updates if you change the value through script) + some layout adjusments.
Diffstat (limited to 'source/blender/makesrna/intern/rna_sensor.c')
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index edae9ab36b6..3621d6bb6d0 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -195,40 +195,49 @@ static void rna_def_sensor(BlenderRNA *brna)
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);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, sensor_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_type_set", "rna_Sensor_type_itemf");
RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_SHOW);
RNA_def_property_ui_text(prop, "Expanded", "Set sensor expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
-
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
+
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");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "level", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Level", "Level detector, trigger controllers of new states(only applicable upon logic state transition)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "pulse_true_level", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_PULSE_REPEAT);
RNA_def_property_ui_text(prop, "Pulse True Level", "Activate TRUE level triggering (pulse mode)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "pulse_false_level", PROP_BOOLEAN, PROP_NONE);
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)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "freq");
RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)");
RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "tap", PROP_BOOLEAN, PROP_NONE);\
RNA_def_property_boolean_sdna(prop, NULL, "tap", 1);
RNA_def_property_ui_text(prop, "Tap", "Trigger controllers only for an instant, even while the sensor remains true");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_always_sensor(BlenderRNA *brna)
@@ -250,16 +259,19 @@ static void rna_def_near_sensor(BlenderRNA *brna)
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", "Only look for objects with this property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_ui_text(prop, "Distance", "Trigger distance");
RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "reset_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "resetdist");
RNA_def_property_ui_text(prop, "Reset Distance", "");
RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_mouse_sensor(BlenderRNA *brna)
@@ -286,6 +298,7 @@ static void rna_def_mouse_sensor(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "type");
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");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_touch_sensor(BlenderRNA *brna)
@@ -302,6 +315,7 @@ static void rna_def_touch_sensor(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "ma");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Material", "Only look for floors with this material");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_keyboard_sensor(BlenderRNA *brna)
@@ -318,30 +332,36 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna)
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL);
RNA_def_property_ui_text(prop, "Key", "");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "modifier_key", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "qual");
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier_set", NULL);
RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "second_modifier_key", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "qual2");
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier2_set", NULL);
RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "target", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "targetName");
RNA_def_property_ui_text(prop, "Target", "Property that indicates whether to log keystrokes as a string");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "log", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "toggleName");
RNA_def_property_ui_text(prop, "Log Toggle", "Property that receive the keystrokes in case a string is logged");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
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");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_property_sensor(BlenderRNA *brna)
@@ -364,22 +384,27 @@ static void rna_def_property_sensor(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_ui_text(prop, "Evaluation Type", "Type of property evaluation");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
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", "");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
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");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "min_value", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "value");
RNA_def_property_ui_text(prop, "Minimum Value", "Specify minimum value in Interval type");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "max_value", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "maxvalue");
RNA_def_property_ui_text(prop, "Maximum Value", "Specify maximum value in Interval type");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_armature_sensor(BlenderRNA *brna)
@@ -402,18 +427,22 @@ static void rna_def_armature_sensor(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_ui_text(prop, "Test Type", "Type of value and test");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "channel_name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "posechannel");
RNA_def_property_ui_text(prop, "Bone name", "Identify the bone to check value from");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "constraint_name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "constraint");
RNA_def_property_ui_text(prop, "Constraint name", "Identify the bone constraint to check value from");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "value");
RNA_def_property_ui_text(prop, "Compare Value", "Specify value to be used in comparison");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_actuator_sensor(BlenderRNA *brna)
@@ -429,6 +458,7 @@ static void rna_def_actuator_sensor(BlenderRNA *brna)
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");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_delay_sensor(BlenderRNA *brna)
@@ -443,14 +473,17 @@ static void rna_def_delay_sensor(BlenderRNA *brna)
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)");
RNA_def_property_range(prop, 0, 5000);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "duration", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "Duration", "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
RNA_def_property_range(prop, 0, 5000);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "repeat", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_DELAY_REPEAT);
RNA_def_property_ui_text(prop, "Repeat", "Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_collision_sensor(BlenderRNA *brna)
@@ -465,19 +498,23 @@ static void rna_def_collision_sensor(BlenderRNA *brna)
prop= RNA_def_property(srna, "pulse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_PULSE);
RNA_def_property_ui_text(prop, "Pulse", "Changes to the set of colliding objects generates pulse");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "collision_type", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL);
RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
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", "Only look for Objects with this property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
//XXX to make a setFunction to create a lookup with all materials in Blend File (not only this object mat.)
prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "materialName");
RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/*//XXX either use a datablock look up to store the string name (material)
// or to do a doversion and use a material pointer.
@@ -509,19 +546,23 @@ static void rna_def_radar_sensor(BlenderRNA *brna)
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", "Only look for Objects with this property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, axis_items);
RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the radar cone is cast");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 179.9);
RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "range");
RNA_def_property_range(prop, 0.0, 10000.0);
RNA_def_property_ui_text(prop, "Distance", "Depth of the radar cone");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_random_sensor(BlenderRNA *brna)
@@ -536,6 +577,7 @@ static void rna_def_random_sensor(BlenderRNA *brna)
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)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_ray_sensor(BlenderRNA *brna)
@@ -558,10 +600,12 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "propname");
RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "matname");
RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* //XXX either use a datablock look up to store the string name (material)
// or to do a doversion and use a material pointer.
@@ -575,19 +619,23 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
prop= RNA_def_property(srna, "ray_type", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL);
RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
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)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01, 10000.0);
RNA_def_property_ui_text(prop, "Range", "Sense objects no farther than this distance");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "axisflag");
RNA_def_property_enum_items(prop, axis_items);
RNA_def_property_ui_text(prop, "Axis", "Specify along which axis the ray is cast");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_message_sensor(BlenderRNA *brna)
@@ -601,6 +649,7 @@ static void rna_def_message_sensor(BlenderRNA *brna)
prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Subject", "Optional subject filter: only accept messages with this subject, or empty for all");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_joystick_sensor(BlenderRNA *brna)
@@ -642,54 +691,64 @@ static void rna_def_joystick_sensor(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "joyindex");
RNA_def_property_ui_text(prop, "Index", "Specify which joystick to use");
RNA_def_property_range(prop, 0, SENS_JOY_MAXINDEX-1);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
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");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
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 Events", "Triggered by all events on this joysticks current type (axis/button/hat)");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Button */
prop= RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "button");
RNA_def_property_ui_text(prop, "Button Number", "Specify which button to use");
RNA_def_property_range(prop, 0, 18);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Axis */
prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "axis");
RNA_def_property_ui_text(prop, "Axis Number", "Specify which axis pair to use, 1 is usually the main direction input");
RNA_def_property_range(prop, 1, 2);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "precision");
RNA_def_property_ui_text(prop, "Axis Threshold", "Specify the precision of the axis");
RNA_def_property_range(prop, 0, 32768);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "axisf");
RNA_def_property_enum_items(prop, axis_direction_items);
RNA_def_property_ui_text(prop, "Axis Direction", "The direction of the axis");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Single Axis */
prop= RNA_def_property(srna, "single_axis_number", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "axis_single");
RNA_def_property_ui_text(prop, "Axis Number", "Specify a single axis (verticle/horizontal/other) to detect");
RNA_def_property_range(prop, 1, 16);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
/* Hat */
prop= RNA_def_property(srna, "hat_number", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "hat");
RNA_def_property_ui_text(prop, "Hat Number", "Specify which hat to use");
RNA_def_property_range(prop, 1, 2);
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "hat_direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "hatf");
RNA_def_property_enum_items(prop, hat_direction_items);
RNA_def_property_ui_text(prop, "Hat Direction", "Specify hat direction");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
void RNA_def_sensor(BlenderRNA *brna)