Improved the Ray Sensor UI in the updated Logic Editor.

This commit is contained in:
William Reynish 2010-05-10 00:12:36 +00:00
parent 5afb24cedb
commit e8a2059b84
2 changed files with 17 additions and 11 deletions

@ -3405,19 +3405,19 @@ static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr)
uiLayout *split, *row;
split= uiLayoutSplit(layout, 0.3, 0);
uiItemR(split, ptr, "ray_type", UI_ITEM_R_TOGGLE, NULL, 0);
uiItemR(split, ptr, "ray_type", 0, "", 0);
switch (RNA_enum_get(ptr, "ray_type")) {
case SENS_RAY_PROPERTY:
uiItemR(split, ptr, "property", 0, NULL, 0); break;
uiItemR(split, ptr, "property", 0, "", 0); break;
case SENS_RAY_MATERIAL:
uiItemR(split, ptr, "material", 0, NULL, 0); break;
uiItemR(split, ptr, "material", 0, "", 0); break;
}
split= uiLayoutSplit(layout, 0.3, 0);
uiItemR(split, ptr, "x_ray_mode", UI_ITEM_R_TOGGLE, NULL, 0);
uiItemR(split, ptr, "axis", 0, "", 0);
row= uiLayoutRow(split, 0);
uiItemR(row, ptr, "range", 0, NULL, 0);
uiItemR(row, ptr, "axis", 0, NULL, 0);
uiItemR(row, ptr, "x_ray_mode", UI_ITEM_R_TOGGLE, NULL, 0);
}
static void draw_sensor_touch(uiLayout *layout, PointerRNA *ptr)

@ -593,10 +593,21 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
{SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem prop_ray_type_items[]= {
{0, "PROPERTY", ICON_LOGIC, "Property", "Use a material for ray intersections"},
{SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a property for ray intersections"},
{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");
RNA_def_struct_sdna_from(srna, "bRaySensor", "data");
prop= RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
RNA_def_property_enum_items(prop, prop_ray_type_items);
RNA_def_property_ui_text(prop, "Ray Type", "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, "propname");
RNA_def_property_ui_text(prop, "Property", "Only look for Objects with this property");
@ -616,11 +627,6 @@ 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_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)");