diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-18 10:00:30 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-18 10:00:30 +0400 |
commit | 73079730638f1f21c04b075839d87377315e8f86 (patch) | |
tree | cb00518c3e35b0e73ba3998585fa3bd3a8ee33e6 /source/blender/makesrna/intern/rna_sensor.c | |
parent | 841ade32bee1ce9128b98c11d0fc3ae6d74aaf86 (diff) |
BGE: Add property/material detection and X-Ray for mouse over any sensor
This patch adds a Property/Material detection and a X-Ray mode to the mouse over any sensor like on the ray sensor.
Proposal:
http://blenderartists.org/forum/showthread.php?261847-BGE-proposal-Mouse-Over-Any-sensor-with-Property-and-X-Ray&highlight=proposal
Reviewers: moguri
Reviewed By: moguri
Differential Revision: https://developer.blender.org/D653
Diffstat (limited to 'source/blender/makesrna/intern/rna_sensor.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_sensor.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index aeef04f4ac7..3944b59dff7 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -405,6 +405,12 @@ static void rna_def_mouse_sensor(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static const EnumPropertyItem prop_mouse_type_items[] = { + {SENS_COLLISION_PROPERTY, "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, "MouseSensor", "Sensor"); RNA_def_struct_ui_text(srna, "Mouse Sensor", "Sensor to detect mouse events"); RNA_def_struct_sdna_from(srna, "bMouseSensor", "data"); @@ -419,6 +425,27 @@ static void rna_def_mouse_sensor(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_MOUSE_FOCUS_PULSE); RNA_def_property_ui_text(prop, "Pulse", "Moving the mouse over a different object generates a pulse"); RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop = RNA_def_property(srna, "use_material", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, prop_mouse_type_items); + 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, "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 (blank = all objects)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "matname"); + RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); + + prop = RNA_def_property(srna, "use_x_ray", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_RAY_XRAY); + RNA_def_property_ui_text(prop, "X-Ray", "Toggle X-Ray option (see through objects that don't have the property)"); + RNA_def_property_update(prop, NC_LOGIC, NULL); } static void rna_def_keyboard_sensor(BlenderRNA *brna) |