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:
authorMatt Ebb <matt@mke3.net>2010-04-29 11:01:48 +0400
committerMatt Ebb <matt@mke3.net>2010-04-29 11:01:48 +0400
commitb008f044505b0955318b13733f34ade7f2a688e5 (patch)
treefb5c5d31c42a0a550933a125ca8385d846fc1cfe /source/blender/makesrna/intern/rna_sensor.c
parent09f2b457f89da84bd1d335112acb6becec80401a (diff)
Rewrite of Logic editor UI to use layout engine
This commit puts the ground work in place, swapping out the crusty old Logic Editor UI code for the new RNA-based layout engine. It's disabled with ifdefs at the moment because it's incomplete, but Dalai can now do the grunt work to fill it all out and get it running. Also includes a bug fix to LINK buttons, and two new logic operators to add and delete sensors. Dalai, just switch the #if 0 and #if 1 in logic_window.c:3412 and 3469
Diffstat (limited to 'source/blender/makesrna/intern/rna_sensor.c')
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index 533aab1a317..3159591625a 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -30,8 +30,28 @@
#include "DNA_sensor_types.h"
+EnumPropertyItem sensor_type_items[] ={
+ {SENS_ALWAYS, "ALWAYS", 0, "Always", ""},
+ {SENS_TOUCH, "TOUCH", 0, "Touch", ""},
+ {SENS_NEAR, "NEAR", 0, "Near", ""},
+ {SENS_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
+ {SENS_PROPERTY, "PROPERTY", 0, "Property", ""},
+ {SENS_MOUSE, "MOUSE", 0, "Mouse", ""},
+ {SENS_COLLISION, "COLLISION", 0, "Collision", ""},
+ {SENS_RADAR, "RADAR", 0, "Radar", ""},
+ {SENS_RANDOM, "RANDOM", 0, "Random", ""},
+ {SENS_RAY, "RAY", 0, "Ray", ""},
+ {SENS_MESSAGE, "MESSAGE", 0, "Message", ""},
+ {SENS_JOYSTICK, "JOYSTICK", 0, "joystick", ""},
+ {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""},
+ {SENS_DELAY, "DELAY", 0, "Delay", ""},
+ {SENS_ARMATURE, "ARMATURE", 0, "Armature", ""},
+ {0, NULL, 0, NULL, NULL}};
+
#ifdef RNA_RUNTIME
+#include "BKE_sca.h"
+
static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
{
bSensor *sensor= (bSensor*)ptr->data;
@@ -72,29 +92,19 @@ static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
}
}
+static void rna_Sensor_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ bSensor *sens= (bSensor *)ptr->data;
+
+ init_sensor(sens);
+}
+
#else
static void rna_def_sensor(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem sensor_type_items[] ={
- {SENS_ALWAYS, "ALWAYS", 0, "Always", ""},
- {SENS_TOUCH, "TOUCH", 0, "Touch", ""},
- {SENS_NEAR, "NEAR", 0, "Near", ""},
- {SENS_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
- {SENS_PROPERTY, "PROPERTY", 0, "Property", ""},
- {SENS_MOUSE, "MOUSE", 0, "Mouse", ""},
- {SENS_COLLISION, "COLLISION", 0, "Collision", ""},
- {SENS_RADAR, "RADAR", 0, "Radar", ""},
- {SENS_RANDOM, "RANDOM", 0, "Random", ""},
- {SENS_RAY, "RAY", 0, "Ray", ""},
- {SENS_MESSAGE, "MESSAGE", 0, "Message", ""},
- {SENS_JOYSTICK, "JOYSTICK", 0, "joystick", ""},
- {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""},
- {SENS_DELAY, "DELAY", 0, "Delay", ""},
- {SENS_ARMATURE, "ARMATURE", 0, "Armature", ""},
- {0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "Sensor", NULL);
RNA_def_struct_ui_text(srna, "Sensor", "Game engine logic brick to detect events");
@@ -105,12 +115,17 @@ static void rna_def_sensor(BlenderRNA *brna)
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_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, sensor_type_items);
RNA_def_property_ui_text(prop, "Type", "");
-
+ RNA_def_property_update(prop, 0, "rna_Sensor_type_update");
+
+ 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);
+
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");