Fix T75210: Frame range does not go down to 0 in the physics tab for mantaflow when clicking the left arrow

Added nore flexibility to cache frame range and ensured validity of frame range.
This commit is contained in:
Sebastián Barschkis
2020-03-31 12:18:03 +02:00
parent 155f917403
commit b74e388617
3 changed files with 28 additions and 2 deletions

View File

@@ -75,6 +75,9 @@ void BKE_fluid_particle_system_create(struct Main *bmain,
const int psys_type);
void BKE_fluid_particle_system_destroy(struct Object *ob, const int particle_type);
void BKE_fluid_cache_startframe_set(struct FluidDomainSettings *settings, int value);
void BKE_fluid_cache_endframe_set(struct FluidDomainSettings *settings, int value);
void BKE_fluid_cachetype_mesh_set(struct FluidDomainSettings *settings, int cache_mesh_format);
void BKE_fluid_cachetype_data_set(struct FluidDomainSettings *settings, int cache_data_format);
void BKE_fluid_cachetype_particle_set(struct FluidDomainSettings *settings,

View File

@@ -4471,6 +4471,16 @@ void BKE_fluid_particle_system_destroy(struct Object *ob, const int particle_typ
* Use for versioning, even when fluids are disabled.
* \{ */
void BKE_fluid_cache_startframe_set(FluidDomainSettings *settings, int value)
{
settings->cache_frame_start = (value > settings->cache_frame_end) ? settings->cache_frame_end : value;
}
void BKE_fluid_cache_endframe_set(FluidDomainSettings *settings, int value)
{
settings->cache_frame_end = (value < settings->cache_frame_start) ? settings->cache_frame_start : value;
}
void BKE_fluid_cachetype_mesh_set(FluidDomainSettings *settings, int cache_mesh_format)
{
if (cache_mesh_format == settings->cache_mesh_format) {

View File

@@ -391,6 +391,18 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR
}
}
static void rna_Fluid_cache_startframe_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
BKE_fluid_cache_startframe_set(settings, value);
}
static void rna_Fluid_cache_endframe_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
BKE_fluid_cache_endframe_set(settings, value);
}
static void rna_Fluid_cachetype_mesh_set(struct PointerRNA *ptr, int value)
{
FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
@@ -1925,12 +1937,13 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "cache_frame_start", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_start");
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
RNA_def_property_int_funcs(prop, NULL, "rna_Fluid_cache_startframe_set", NULL);
RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
prop = RNA_def_property(srna, "cache_frame_end", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "cache_frame_end");
RNA_def_property_range(prop, 1, MAXFRAME);
RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
RNA_def_property_int_funcs(prop, NULL, "rna_Fluid_cache_endframe_set", NULL);
RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
prop = RNA_def_property(srna, "cache_frame_pause_data", PROP_INT, PROP_TIME);