Logic UI: All Sensors, Controllers and Actuators are ported now... (let's the tests begin)

* get/set funcs
* unifying rna_props for Constraint Actuator
* Collision sensor
* Ray sensor
* State Actuator

* We need icons! at least one for Sensor, one for Controller and one for Actuator

* Layout artists:
Keyboard sensor really need some help :)
The other as well. I mainly copied the layout from 2.49 with some adjustments here and there.

* some get/set functions in rna_actuator.c are exactly the same (e.g. rna_ConstraintActuator_range_get, rna_ConstraintActuator_spring_get) and other could be easily distributed. maybe something for later.
This commit is contained in:
Dalai Felinto
2010-05-07 07:31:39 +00:00
parent 6bc28e97c1
commit 27acb95cad
3 changed files with 285 additions and 241 deletions

View File

@@ -3225,21 +3225,21 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr)
{
uiItemL(layout, "Not ported back yet", 0);
//XXXSENSOR
/* // need to solve problems in rna_sensor.c
uiItemR(layout, ptr, "pulse", 0, NULL, 0);
uiItemR(layout, ptr, "collision_type", 0, NULL, 0);
uiLayout *row, *split;
split = uiLayoutSplit(layout, 0.3, 0);
row = uiLayoutRow(split, 1);
uiItemR(row, ptr, "pulse", UI_ITEM_R_TOGGLE, NULL, 0);
uiItemR(row, ptr, "collision_type", UI_ITEM_R_TOGGLE, NULL, 0);
switch (RNA_enum_get(ptr, "collision_type")) {
case SENS_COLLISION_PROPERTY:
uiItemR(layout, ptr, "property", 0, NULL, 0);
uiItemR(split, ptr, "property", 0, NULL, 0);
break;
case SENS_COLLISION_MATERIAL:
uiItemR(layout, ptr, "material", 0, NULL, 0);
uiItemR(split, ptr, "material", 0, NULL, 0);
break;
}
*/
}
static void draw_sensor_delay(uiLayout *layout, PointerRNA *ptr)
@@ -3296,18 +3296,23 @@ static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr)
static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *row;
uiLayout *row, *col;
row = uiLayoutRow(layout, 0);
uiItemL(row, "Key:", 0);
uiItemR(row, ptr, "key", UI_ITEM_R_EVENT, "", 0);
uiItemR(layout, ptr, "all_keys", 0, NULL, 0);
col = uiLayoutColumn(row, 0);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "all_keys")==0);
uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", 0);
col = uiLayoutColumn(row, 0);
uiItemR(col, ptr, "all_keys", UI_ITEM_R_TOGGLE, NULL, 0);
row = uiLayoutRow(layout, 0);
col = uiLayoutColumn(layout, 0);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "all_keys")==0);
row = uiLayoutRow(col, 0);
uiItemL(row, "First Modifier:", 0);
uiItemR(row, ptr, "modifier_key", UI_ITEM_R_EVENT, "", 0);
row = uiLayoutRow(layout, 0);
row = uiLayoutRow(col, 0);
uiItemL(row, "Second Modifier:", 0);
uiItemR(row, ptr, "second_modifier_key", UI_ITEM_R_EVENT, "", 0);
@@ -3378,20 +3383,22 @@ static void draw_sensor_random(uiLayout *layout, PointerRNA *ptr)
static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr)
{
uiItemL(layout, "Not ported back yet", 0);
/*
uiItemR(layout, ptr, "ray_type", 0, NULL, 0);
uiLayout *split, *row;
split= uiLayoutSplit(layout, 0.3, 0);
uiItemR(split, ptr, "ray_type", UI_ITEM_R_TOGGLE, NULL, 0);
switch (RNA_enum_get(ptr, "ray_type")) {
case SENS_RAY_PROPERTY:
uiItemR(layout, ptr, "property", 0, NULL, 0); break;
uiItemR(split, ptr, "property", 0, NULL, 0); break;
case SENS_RAY_MATERIAL:
uiItemR(layout, ptr, "material", 0, NULL, 0); break;
uiItemR(split, ptr, "material", 0, NULL, 0); break;
}
uiItemR(layout, ptr, "x_ray_mode", 0, NULL, 0);
uiItemR(layout, ptr, "range", 0, NULL, 0);
uiItemR(layout, ptr, "axis", 0, NULL, 0);
*/
//XXXSENSOR - same problem as collision. enums badly used by UI code
split= uiLayoutSplit(layout, 0.3, 0);
uiItemR(split, ptr, "x_ray_mode", UI_ITEM_R_TOGGLE, NULL, 0);
row= uiLayoutRow(split, 0);
uiItemR(row, ptr, "range", 0, NULL, 0);
uiItemR(row, ptr, "axis", 0, NULL, 0);
}
static void draw_sensor_touch(uiLayout *layout, PointerRNA *ptr)
@@ -3636,25 +3643,10 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr)
case ACT_CONST_TYPE_LOC:
uiItemR(layout, ptr, "limit", 0, NULL, 0);
switch(RNA_enum_get(ptr, "limit")){
case ACT_CONST_LOCX:
row = uiLayoutRow(layout, 1);
uiItemR(row, ptr, "limit_loc_min_x", 0, NULL, 0);
uiItemR(row, ptr, "limit_loc_max_x", 0, NULL, 0);
break;
row = uiLayoutRow(layout, 1);
uiItemR(row, ptr, "limit_min", 0, NULL, 0);
uiItemR(row, ptr, "limit_max", 0, NULL, 0);
case ACT_CONST_LOCY:
row = uiLayoutRow(layout, 1);
uiItemR(row, ptr, "limit_loc_min_y", 0, NULL, 0);
uiItemR(row, ptr, "limit_loc_max_y", 0, NULL, 0);
break;
case ACT_CONST_LOCZ:
row = uiLayoutRow(layout, 1);
uiItemR(row, ptr, "limit_loc_min_z", 0, NULL, 0);
uiItemR(row, ptr, "limit_loc_max_z", 0, NULL, 0);
break;
}
uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, 0);
break;
@@ -3663,34 +3655,12 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr)
if(RNA_enum_get(ptr, "direction")!=0)
uiItemR(layout, ptr, "force_distance", 0, NULL, 0);
switch(RNA_enum_get(ptr, "direction")){
case ACT_CONST_DIRPX:
case ACT_CONST_DIRNX:
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "range_x", 0, NULL, 0);
subrow = uiLayoutRow(row, 0);
uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "force_distance")==1);
uiItemR(subrow, ptr, "distance_x", 0, NULL, 0);
break;
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "range", 0, NULL, 0);
subrow = uiLayoutRow(row, 0);
uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "force_distance")==1);
uiItemR(subrow, ptr, "distance", 0, NULL, 0);
case ACT_CONST_DIRPY:
case ACT_CONST_DIRNY:
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "range_y", 0, NULL, 0);
subrow = uiLayoutRow(row, 0);
uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "force_distance")==1);
uiItemR(subrow, ptr, "distance_y", 0, NULL, 0);
break;
case ACT_CONST_DIRPZ:
case ACT_CONST_DIRNZ:
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "range_z", 0, NULL, 0);
subrow = uiLayoutRow(row, 0);
uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "force_distance")==1);
uiItemR(subrow, ptr, "distance_z", 0, NULL, 0);
break;
}
uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0);
split = uiLayoutSplit(layout, 0.15, 0);
@@ -3727,41 +3697,15 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr)
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;
uiItemR(row, ptr, "fh_height", 0, NULL, 0);
uiItemR(split, ptr, "fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0);
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;
}
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "direction_axis", 0, NULL, 0);
split = uiLayoutSplit(row, 0.9, 0);
uiItemR(split, ptr, "spring", 0, NULL, 0);
uiItemR(split, ptr, "fh_normal", UI_ITEM_R_TOGGLE , NULL, 0);
split = uiLayoutSplit(layout, 0.15, 0);
uiItemR(split, ptr, "detect_material", UI_ITEM_R_TOGGLE, NULL, 0);
@@ -3778,8 +3722,6 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0);
break;
}
//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)
@@ -3859,16 +3801,17 @@ static void draw_actuator_game(uiLayout *layout, PointerRNA *ptr)
static void draw_actuator_ipo(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *row, *col;
uiLayout *row, *subrow, *col;
row= uiLayoutRow(layout, 0);
uiItemR(row, ptr, "play_type", 0, NULL, 0);
uiItemR(row, ptr, "force", 0, NULL, 0);
uiItemR(row, ptr, "add", 0, NULL, 0);
subrow= uiLayoutRow(row, 1);
uiItemR(subrow, ptr, "force", UI_ITEM_R_TOGGLE, NULL, 0);
uiItemR(subrow, ptr, "add", UI_ITEM_R_TOGGLE, NULL, 0);
col = uiLayoutColumn(row, 0);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "add"));
uiItemR(col, ptr, "local", 0, NULL, 0);
col = uiLayoutColumn(subrow, 0);
uiLayoutSetActive(col, (RNA_boolean_get(ptr, "add") || RNA_boolean_get(ptr, "force")));
uiItemR(col, ptr, "local", UI_ITEM_R_TOGGLE, NULL, 0);
row= uiLayoutRow(layout, 0);
if((RNA_enum_get(ptr, "play_type") == ACT_IPO_FROM_PROP))

View File

@@ -122,6 +122,198 @@ static void rna_Actuator_type_set(struct PointerRNA *ptr, int value)
}
}
static float rna_ConstraintActuator_limitmin_get(struct PointerRNA *ptr)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
else fp= ca->minrot+2;
return *fp;
}
static void rna_ConstraintActuator_limitmin_set(struct PointerRNA *ptr, float value)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
else fp= ca->minrot+2;
*fp = value;
}
static float rna_ConstraintActuator_limitmax_get(struct PointerRNA *ptr)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
else fp= ca->maxrot+2;
return *fp;
}
static void rna_ConstraintActuator_limitmax_set(struct PointerRNA *ptr, float value)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
else fp= ca->maxrot+2;
*fp = value;
}
static float rna_ConstraintActuator_distance_get(struct PointerRNA *ptr)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
else fp= ca->minloc+2;
return *fp;
}
static void rna_ConstraintActuator_distance_set(struct PointerRNA *ptr, float value)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
else fp= ca->minloc+2;
*fp = value;
}
static float rna_ConstraintActuator_range_get(struct PointerRNA *ptr)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
else fp= ca->maxloc+2;
return *fp;
}
static void rna_ConstraintActuator_range_set(struct PointerRNA *ptr, float value)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
else fp= ca->maxloc+2;
*fp = value;
}
static float rna_ConstraintActuator_fhheight_get(struct PointerRNA *ptr)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
else fp= ca->minloc+2;
return *fp;
}
static void rna_ConstraintActuator_fhheight_set(struct PointerRNA *ptr, float value)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
else fp= ca->minloc+2;
*fp = value;
}
static float rna_ConstraintActuator_spring_get(struct PointerRNA *ptr)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
else fp= ca->maxloc+2;
return *fp;
}
static void rna_ConstraintActuator_spring_set(struct PointerRNA *ptr, float value)
{
bActuator *act = (bActuator*)ptr->data;
bConstraintActuator *ca = act->data;
float *fp;
if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
else fp= ca->maxloc+2;
*fp = value;
}
static void rna_IpoActuator_add_set(struct PointerRNA *ptr, int value)
{
bActuator *act = (bActuator *)ptr->data;
bIpoActuator *ia = act->data;
if(value == 1){
ia->flag &= ~ACT_IPOFORCE;
ia->flag |= ACT_IPOADD;
}else
ia->flag &= ~ACT_IPOADD;
}
static void rna_IpoActuator_force_set(struct PointerRNA *ptr, int value)
{
bActuator *act = (bActuator *)ptr->data;
bIpoActuator *ia = act->data;
if(value == 1){
ia->flag &= ~ACT_IPOADD;
ia->flag |= ACT_IPOFORCE;
}else
ia->flag &= ~ACT_IPOFORCE;
}
static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value)
{
bActuator *act = (bActuator*)ptr->data;
@@ -555,12 +747,17 @@ static void rna_def_ipo_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
/* booleans */
prop= RNA_def_property(srna, "add", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD);
RNA_def_property_boolean_funcs(prop, NULL, "rna_IpoActuator_add_set", NULL);
RNA_def_property_ui_text(prop, "Add", "Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "force", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_IpoActuator_force_set", NULL);
RNA_def_property_ui_text(prop, "Force", "Apply IPO as a global or local force depending on the local option (dynamic objects only)");
RNA_def_property_update(prop, NC_LOGIC, NULL);
//XXX logic_window::change_ipo_actuator
// RNA_def_property_boolean_funcs(prop, "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_range");
prop= RNA_def_property(srna, "local", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOLOCAL);
@@ -571,13 +768,6 @@ static void rna_def_ipo_actuator(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOCHILD);
RNA_def_property_ui_text(prop, "Child", "Update IPO on all children Objects as well");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "add", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD);
RNA_def_property_ui_text(prop, "Add", "Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag");
RNA_def_property_update(prop, NC_LOGIC, NULL);
//XXX logic_window::change_ipo_actuator
// RNA_def_property_boolean_funcs(prop, "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_get", "rna_Actuator_Ipo_range");
}
static void rna_def_camera_actuator(BlenderRNA *brna)
@@ -835,40 +1025,16 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
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]");
prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get", "rna_ConstraintActuator_limitmin_set", NULL);
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Min", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "limit_loc_min_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minloc[1]");
prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get", "rna_ConstraintActuator_limitmax_set", NULL);
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Min", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "limit_loc_min_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minloc[2]");
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Min", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "limit_loc_max_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxloc[0]");
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Min", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "limit_loc_max_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxloc[1]");
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Min", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "limit_loc_max_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxloc[2]");
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Min", "");
RNA_def_property_ui_text(prop, "Max", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "damping", PROP_INT, PROP_PERCENTAGE);
@@ -878,39 +1044,15 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
RNA_def_property_update(prop, NC_LOGIC, NULL);
/* ACT_CONST_TYPE_DIST */
prop= RNA_def_property(srna, "range_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxloc[0]");
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_range_get", "rna_ConstraintActuator_range_set", NULL);
RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Range", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "range_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxloc[1]");
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", "rna_ConstraintActuator_distance_set", NULL);
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Range", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "range_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxloc[2]");
RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Range", "");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "distance_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minloc[0]");
RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Distance", "Set the maximum length of ray");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "distance_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minloc[1]");
RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Distance", "Set the maximum length of ray");
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "distance_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minloc[2]");
RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2);
RNA_def_property_ui_text(prop, "Distance", "Set the maximum length of ray");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -959,48 +1101,24 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
RNA_def_property_update(prop, NC_LOGIC, NULL);
/* ACT_CONST_TYPE_FH */
prop= RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", "rna_ConstraintActuator_fhheight_set", NULL);
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", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL);
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, "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);
@@ -1037,8 +1155,6 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
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
}
static void rna_def_edit_object_actuator(BlenderRNA *brna)

View File

@@ -432,37 +432,27 @@ static void rna_def_collision_sensor(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem prop_type_items[] ={
// {SENS_COLLISION_PULSE, "PULSE", 0, "Property", ""},
{SENS_COLLISION_PROPERTY, "PROPERTY", 0, "Property", ""},
{SENS_COLLISION_MATERIAL, "MATERIAL", 0, "Material", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "CollisionSensor", "Sensor");
RNA_def_struct_ui_text(srna, "Collision Sensor", "Sensor to detect objects colliding with the current object, with more settings than the Touch sensor");
RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data");
prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
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, "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");
/*
//XXX bad, ugly. pulse in 2.49 is part of the same "enum" of collision type
//to investigate: is pulse exclusive? or it works with mat/prop?
prop= RNA_def_property(srna, "pulse", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "mode");
RNA_def_property_ui_text(prop, "Property Name", "changes to the set of colliding objects generates pulse");
*/
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");
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 Name", "Only look for Objects with this property");
RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property");
//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 Name", "Only look for Objects with this material");
RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material");
/*//XXX either use a datablock look up to store the string name (material)
// or to do a doversion and use a material pointer.
@@ -535,10 +525,6 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
{SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", 0, "-Y axis", ""},
{SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_type_items[] ={
{SENS_RAY_PROPERTY, "PROPERTY", 0, "Property", ""},
{SENS_RAY_MATERIAL, "MATERIAL", 0, "Material", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "RaySensor", "Sensor");
RNA_def_struct_ui_text(srna, "Ray Sensor", "Sensor to detect intersections with a ray emanating from the current object");
@@ -561,10 +547,9 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Material", "Only look for Objects with this material");
*/
prop= RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
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, "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");
prop= RNA_def_property(srna, "x_ray_mode", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY);