diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-05-06 23:12:08 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-05-06 23:12:08 +0400 |
commit | 6e3812d7bc645b0731cf17a0d7d82d1bdac7d678 (patch) | |
tree | 6823cbf5556c438e439ad12f39d7fdd8d7abf66c | |
parent | c9ca41c6f1dd4734ea6c7566ebd61f82bd41633f (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.
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 91 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_actuator.c | 118 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_controller.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sensor.c | 49 |
4 files changed, 222 insertions, 48 deletions
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 6b24cb06b30..9bc8a944fe1 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3213,10 +3213,14 @@ static void draw_sensor_actuator(uiLayout *layout, PointerRNA *ptr) static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "armature_type", 0, NULL, 0); - uiItemR(layout, ptr, "channel_name", 0, NULL, 0); - uiItemR(layout, ptr, "constraint_name", 0, NULL, 0); - uiItemR(layout, ptr, "value", 0, NULL, 0); + uiLayout *row; + row = uiLayoutRow(layout, 1); + uiItemR(row, ptr, "channel_name", 0, NULL, 0); + uiItemR(row, ptr, "constraint_name", 0, NULL, 0); + + row = uiLayoutRow(layout, 1); + uiItemR(row, ptr, "test_type", 0, NULL, 0); + uiItemR(row, ptr, "value", 0, NULL, 0); } static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr) @@ -3688,27 +3692,94 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr) break; } uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0); + split = uiLayoutSplit(layout, 0.15, 0); uiItemR(split, ptr, "detect_material", UI_ITEM_R_TOGGLE, NULL, 0); - if (RNA_boolean_get(ptr, "detect_material")) uiItemR(split, ptr, "material", 0, NULL, 0); else uiItemR(split, ptr, "property", 0, NULL, 0); - uiItemR(layout, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0); + split = uiLayoutSplit(layout, 0.15, 0); + uiItemR(split, ptr, "persistent", UI_ITEM_R_TOGGLE, NULL, 0); + + row = uiLayoutRow(split, 1); + uiItemR(row, ptr, "time", 0, NULL, 0); + uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0); break; case ACT_CONST_TYPE_ORI: - uiItemL(layout, "to be done", 0); + uiItemR(layout, ptr, "direction_axis", 0, NULL, 0); + + row=uiLayoutRow(layout, 1); + uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0); + uiItemR(row, ptr, "time", 0, NULL, 0); + + row=uiLayoutRow(layout, 0); + uiItemR(row, ptr, "max_rotation", 0, NULL, 0); + + row=uiLayoutRow(layout, 1); + uiItemR(row, ptr, "min_angle", 0, NULL, 0); + uiItemR(row, ptr, "max_angle", 0, NULL, 0); break; case ACT_CONST_TYPE_FH: - uiItemL(layout, "to be done", 0); + split=uiLayoutSplit(layout, 0.75, 0); + row= uiLayoutRow(split, 0); + uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER , NULL, 0); + switch(RNA_enum_get(ptr, "direction_axis")){ + case ACT_CONST_DIRPX: + case ACT_CONST_DIRNX: + uiItemR(row, ptr, "fh_height_x", 0, NULL, 0); + uiItemR(split, ptr, "fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "direction_axis", 0, NULL, 0); + split = uiLayoutSplit(row, 0.9, 0); + uiItemR(split, ptr, "spring_x", 0, NULL, 0); + uiItemR(split, ptr, "fh_normal", UI_ITEM_R_TOGGLE , NULL, 0); + break; + + case ACT_CONST_DIRPY: + case ACT_CONST_DIRNY: + uiItemR(row, ptr, "fh_height_y", 0, NULL, 0); + uiItemR(split, ptr, "fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "direction_axis", 0, NULL, 0); + split = uiLayoutSplit(row, 0.9, 0); + uiItemR(split, ptr, "spring_y", 0, NULL, 0); + uiItemR(split, ptr, "fh_normal", UI_ITEM_R_TOGGLE , NULL, 0); + + default: //ACT_CONST_DIRPZ|ACT_CONST_DIRPZ|ACT_CONST_NONE + uiItemR(row, ptr, "fh_height_z", 0, NULL, 0); + uiItemR(split, ptr, "fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "direction_axis", 0, NULL, 0); + split = uiLayoutSplit(row, 0.9, 0); + uiItemR(split, ptr, "spring_z", 0, NULL, 0); + uiItemR(split, ptr, "fh_normal", UI_ITEM_R_TOGGLE , NULL, 0); + break; + } + + split = uiLayoutSplit(layout, 0.15, 0); + uiItemR(split, ptr, "detect_material", UI_ITEM_R_TOGGLE, NULL, 0); + if (RNA_boolean_get(ptr, "detect_material")) + uiItemR(split, ptr, "material", 0, NULL, 0); + else + uiItemR(split, ptr, "property", 0, NULL, 0); + + split = uiLayoutSplit(layout, 0.15, 0); + uiItemR(split, ptr, "persistent", UI_ITEM_R_TOGGLE, NULL, 0); + + row = uiLayoutRow(split, 0); + uiItemR(row, ptr, "time", 0, NULL, 0); + uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0); break; } - - //XXXACTUATOR STILL HAVE TO DO THE RNA + //XXXACTUATOR to do: to replace all maxloc and minloc by a single one with get/set funcs + //i.e. remove the switch direction, mode and axis_direction } static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index d99ec78dfb9..ab2999129c0 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -111,24 +111,15 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr) return &RNA_Actuator; } } -// -//static StructRNA* rna_ActionActuator_refine(struct PointerRNA *ptr) -//{ -// bActuator *actuator= (bActuator*)ptr->data; -// -// switch(actuator->type) { -// case ACT_ACTION: -// return &RNA_ActionActuator; -// case ACT_SHAPEACTION: -// return &RNA_ShapeActionActuator; -// } -//} - -static void rna_Actuator_type_update(Main *bmain, Scene *scene, PointerRNA *ptr) + +static void rna_Actuator_type_set(struct PointerRNA *ptr, int value) { bActuator *act= (bActuator *)ptr->data; - - init_actuator(act); + if (value != act->type) + { + act->type = value; + init_actuator(act); + } } static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value) @@ -186,7 +177,6 @@ static EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, i RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_OBJECT); RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PARENT); RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM); RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SCENE); RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SOUND); @@ -216,17 +206,14 @@ void rna_def_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Actuator_type_itemf"); RNA_def_property_enum_items(prop, actuator_type_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_Actuator_type_set", "rna_Actuator_type_itemf"); RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_update(prop, 0, "rna_Actuator_type_update"); - prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SHOW); RNA_def_property_ui_text(prop, "Expanded", "Set actuator expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); - } static void rna_def_action_actuator(BlenderRNA *brna) @@ -248,8 +235,6 @@ static void rna_def_action_actuator(BlenderRNA *brna) srna= RNA_def_struct(brna, "ActionActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to control the object movement"); RNA_def_struct_sdna_from(srna, "bActionActuator", "data"); -// RNA_def_struct_sdna(srna, "bActionActuator"); -// RNA_def_struct_refine_func(srna, "rna_ActionActuator_refine"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); @@ -372,7 +357,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[0]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1); - RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE); @@ -384,7 +369,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[1]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1); - RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE); @@ -396,7 +381,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "drot[2]"); RNA_def_property_ui_range(prop, -100.0, 100.0, 1.0, 0.1); - RNA_def_property_ui_text(prop, "Max", "Set the lower limit for force"); + RNA_def_property_ui_text(prop, "Min", "Set the lower limit for force"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* floats 3 Arrays*/ @@ -814,6 +799,12 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Direction", "Set the direction of the ray"); RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, prop_direction_items); + RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + /* ACT_CONST_TYPE_LOC */ prop= RNA_def_property(srna, "limit_loc_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); @@ -918,6 +909,69 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "rotDamp", "Use a different damping for orientation"); RNA_def_property_update(prop, NC_LOGIC, NULL); + /* ACT_CONST_TYPE_ORI */ + prop= RNA_def_property(srna, "max_rotation", PROP_FLOAT, PROP_TRANSLATION); + RNA_def_property_float_sdna(prop, NULL, "maxrot"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_range(prop, -2000.0, 2000.0, 0.1, 0.001); + RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "min_angle", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); + RNA_def_property_ui_range(prop, 0.0, 180.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "max_angle", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxloc[0]"); + RNA_def_property_ui_range(prop, 0.0, 180.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + /* ACT_CONST_TYPE_FH */ + prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxrot[0]"); + RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 1); + RNA_def_property_ui_text(prop, "Damping", "Damping factor of the Fh spring force"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "fh_height_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); + RNA_def_property_ui_range(prop, 0.01, 2000.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Distance", "Height of the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "fh_height_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minloc[1]"); + RNA_def_property_ui_range(prop, 0.01, 2000.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Distance", "Height of the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "fh_height_z", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minloc[2]"); + RNA_def_property_ui_range(prop, 0.01, 2000.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Distance", "Height of the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "spring_x", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxloc[0]"); + RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Fh", "Spring force within the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "spring_y", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxloc[1]"); + RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Fh", "Spring force within the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "spring_z", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxloc[2]"); + RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 0.01); + RNA_def_property_ui_text(prop, "Fh", "Spring force within the Fh area"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + /* booleans */ prop= RNA_def_property(srna, "force_distance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DISTANCE); @@ -945,6 +999,16 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "M/P", "Detect material instead of property"); RNA_def_property_update(prop, NC_LOGIC, NULL); + prop= RNA_def_property(srna, "fh_paralel_axis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DOROTFH); + RNA_def_property_ui_text(prop, "Rot Fh", "Keep object axis parallel to normal"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop= RNA_def_property(srna, "fh_normal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL); + RNA_def_property_ui_text(prop, "N", "Add a horizontal spring force on slopes"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + //XXX to replace all maxloc and minloc by a single one with get/set funcs } @@ -1451,8 +1515,6 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna) srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator"); RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to control shape key animations"); RNA_def_struct_sdna_from(srna, "bActionActuator", "data"); - //RNA_def_struct_sdna(srna, "bActionActuator"); - //RNA_def_struct_refine_func(srna, "rna_ActionActuator_refine"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index fe68fbc6b7c..3d44730cf76 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -71,11 +71,14 @@ static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr) } } -static void rna_Controller_type_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Controller_type_set(struct PointerRNA *ptr, int value) { bController *cont= (bController *)ptr->data; - - init_controller(cont); + if (value != cont->type) + { + cont->type = value; + init_controller(cont); + } } #else @@ -102,11 +105,10 @@ void RNA_def_controller(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_funcs(prop, NULL, "rna_Controller_type_set", NULL); RNA_def_property_enum_items(prop, controller_type_items); RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_update(prop, 0, "rna_Controller_type_update"); - prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_SHOW); RNA_def_property_ui_text(prop, "Expanded", "Set controller expanded in the user interface"); 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"); |