diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2012-05-30 00:30:33 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2012-05-30 00:30:33 +0400 |
commit | 58bc424b3c46ee3ee6644ff578671670c2a1c8ec (patch) | |
tree | 147b691cecd0286e750fd73f0c6a2edad8ab9b90 /source/blender/makesrna/intern/rna_scene.c | |
parent | 1d4ab9daf0ef38066469fb86bed0fc24b2e1bbda (diff) |
BGE #30734: add support for physics linear and angular thresholds and deactivation time from python and GUI.
========================
The linear and angular thresholds set the speed limit (in m/s) and rotation limit (in rad/s)
under which a rigid body will go to sleep (stop moving) if it stays below the limits for a
time equal or longer than the deactivation time (sleeping is disabled is deactivation time is
set to 0).
These settings help reducing the processing spent on Physics during the game.
Previously they were only accessible from python but not working because of a bug.
Now the python functions are working and the settings are available in the Physics panel
of the World settings when using the Blender Game render engine.
Python API:
import PhysicsConstraints
PhysicsConstraints.setDeactivationLinearTreshold(float)
PhysicsConstraints.setDeactivationAngularTreshold(float)
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 5b355e56911..17efc25c132 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2577,6 +2577,31 @@ static void rna_def_scene_game_data(BlenderRNA *brna) "higher value give better physics precision"); RNA_def_property_update(prop, NC_SCENE, NULL); + prop = RNA_def_property(srna, "deactivation_linear_threshold", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold"); + RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); + RNA_def_property_range(prop, 0.001, 10000.0); + RNA_def_property_ui_text(prop, "Deactivation Linear Threshold", + "Linear velocity that an object must be below before the deactivation timer can start"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "deactivation_angular_threshold", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold"); + RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); + RNA_def_property_range(prop, 0.001, 10000.0); + RNA_def_property_ui_text(prop, "Deactivation Angular Threshold", + "Angular velocity that an object must be below before the deactivation timer can start"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "deactivation_time", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "deactivationtime"); + RNA_def_property_ui_range(prop, 0.0, 60.0, 1, 1); + RNA_def_property_range(prop, 0.0, 60.0); + RNA_def_property_ui_text(prop, "Deactivation Time", + "Amount of time (in seconds) after objects with a velocity less than than a certain " + "threshold will deactivate. Time 0.0 means deactivation inactive"); + RNA_def_property_update(prop, NC_SCENE, NULL); + /* mode */ prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); /*XXX mode hardcoded *//* WO_DBVT_CULLING */ |