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-06 23:12:08 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-05-06 23:12:08 +0400
commit6e3812d7bc645b0731cf17a0d7d82d1bdac7d678 (patch)
tree6823cbf5556c438e439ad12f39d7fdd8d7abf66c /source/blender/makesrna/intern/rna_sensor.c
parentc9ca41c6f1dd4734ea6c7566ebd61f82bd41633f (diff)
Logic UI: constraint actuator+rna 100% (finally !!!) + other fixes/improvements:
- s/c/a type enum update function replaced by set function - rna_Sensor_type_itemf and rna_Actuators_type_itemf implemented (but not working ... it was working yesterday before I updated the set func, so need further investigation). Matt, if you have any clue on that ... Roadmap: i) I definitively gotta unify the maxloc, minloc rna properties. the way it's right now (based on 2.49 makes the layout code really clunky ii) - actuator missing - State Actuator (I'll probably need help on that). iii) - sensor missing - collision and ray (they are partly implemented, but the enums are a mess there). iv) - get/set funcs missing (not many) and default values (not many) v) - have more lookup functions for properties and material (I'll definitively need help on that). Eventually will fix (iii, iv and v) changing bge and dna code and doing a subversion/do_version.
Diffstat (limited to 'source/blender/makesrna/intern/rna_sensor.c')
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index 93eec4cbbdd..5a52a779aee 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -29,6 +29,7 @@
#include "rna_internal.h"
+#include "DNA_object_types.h"
#include "DNA_sensor_types.h"
EnumPropertyItem sensor_type_items[] ={
@@ -93,11 +94,49 @@ static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
}
}
-static void rna_Sensor_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Sensor_type_set(struct PointerRNA *ptr, int value)
{
bSensor *sens= (bSensor *)ptr->data;
+ if (value != sens->type)
+ {
+ sens->type = value;
+ init_sensor(sens);
+ }
+}
+
+static EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ EnumPropertyItem *item= NULL;
+ Object *ob = (Object *)ptr->id.data;
+
+ int totitem= 0;
+
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ACTUATOR);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ALWAYS);
+
+ if (ob->type==OB_ARMATURE)
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE);
+ else if(ob->type==OB_MESH){
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH);
+ }
+
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MESSAGE);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MOUSE);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_NEAR);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_PROPERTY);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RADAR);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RANDOM);
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RAY);
+// RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH);
- init_sensor(sens);
+ RNA_enum_item_end(&item, &totitem);
+ *free= 1;
+
+ return item;
}
#else
@@ -119,9 +158,9 @@ static void rna_def_sensor(BlenderRNA *brna)
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, 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");
@@ -322,7 +361,7 @@ static void rna_def_armature_sensor(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Armature Sensor", "Sensor to detect values and changes in values of IK solver");
RNA_def_struct_sdna_from(srna, "bArmatureSensor", "data");
- prop= RNA_def_property(srna, "armature_type", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "test_type", PROP_ENUM, PROP_NONE);
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");