Changed the particle physics "timetweak" value to a more descriptive "timestep" value, which is in seconds.

* Done purely in rna, internally particles still use the timetweak value.
This commit is contained in:
Janne Karhu 2011-03-21 10:53:29 +00:00
parent e1a44e9ae6
commit 28d39473fc
2 changed files with 22 additions and 1 deletions

@ -474,7 +474,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
col = split.column() col = split.column()
col.label(text="Integration:") col.label(text="Integration:")
col.prop(part, "integrator", text="") col.prop(part, "integrator", text="")
col.prop(part, "time_tweak") col.prop(part, "timestep")
col.prop(part, "subframes") col.prop(part, "subframes")
row = layout.row() row = layout.row()

@ -407,6 +407,20 @@ static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
settings->end = value; settings->end = value;
} }
static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
{
ParticleSettings *settings = (ParticleSettings*)ptr->data;
settings->timetweak = value/0.04f;
}
static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
{
ParticleSettings *settings = (ParticleSettings*)ptr->data;
return settings->timetweak * 0.04f;
}
static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value) static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
{ {
ParticleSettings *settings = (ParticleSettings*)ptr->data; ParticleSettings *settings = (ParticleSettings*)ptr->data;
@ -1986,6 +2000,13 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0, 10, 1, 3); RNA_def_property_ui_range(prop, 0, 10, 1, 3);
RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)"); RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
RNA_def_property_update(prop, 0, "rna_Particle_reset"); RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop= RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
RNA_def_property_range(prop, 0.0001, 100.0);
RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (in seconds)");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 1000); RNA_def_property_range(prop, 0, 1000);