Removed the cloth preroll feature.

This feature has been totally broken for a long time. It was added
originally because negative frames were not supported.

Giving simulations (cloth and others) time to settle before animation
starts needs to be solved in a much better and more generic way.
This commit is contained in:
Lukas Tönne 2015-02-12 16:28:15 +01:00
parent 912b4659ec
commit d70c7c06e7
4 changed files with 5 additions and 43 deletions

@ -92,9 +92,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="")
sub.prop(cloth, "pin_stiffness", text="Stiffness")
col.label(text="Pre roll:")
col.prop(cloth, "pre_roll", text="Frames")
# Disabled for now
"""
if cloth.vertex_group_mass:

@ -88,7 +88,6 @@ void cloth_init(ClothModifierData *clmd )
clmd->sim_parms->stepsPerFrame = 5;
clmd->sim_parms->flags = 0;
clmd->sim_parms->solver_type = 0;
clmd->sim_parms->preroll = 0;
clmd->sim_parms->maxspringlen = 10;
clmd->sim_parms->vgroup_mass = 0;
clmd->sim_parms->vgroup_shrink = 0;
@ -463,10 +462,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
clmd->sim_parms->timescale= timescale;
if (clmd->sim_parms->reset ||
(framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) ||
(clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
{
if (clmd->sim_parms->reset || (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts)) {
clmd->sim_parms->reset = 0;
cache->flag |= PTCACHE_OUTDATED;
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
@ -478,22 +474,6 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
// unused in the moment, calculated separately in implicit.c
clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
/* handle continuous simulation with the play button */
if ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe)) {
BKE_ptcache_invalidate(cache);
/* do simulation */
if (!do_init_cloth(ob, clmd, dm, framenr))
return;
do_step_cloth(ob, clmd, dm, framenr);
cloth_to_object(ob, clmd, vertexCos);
clmd->clothObject->last_frame= framenr;
return;
}
/* simulation is only active during a specific period */
if (framenr < startframe) {
BKE_ptcache_invalidate(cache);
@ -507,7 +487,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
if (!do_init_cloth(ob, clmd, dm, framenr))
return;
if ((framenr == startframe) && (clmd->sim_parms->preroll == 0)) {
if (framenr == startframe) {
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
do_init_cloth(ob, clmd, dm, framenr);
BKE_ptcache_validate(cache, framenr);

@ -32,6 +32,8 @@
#ifndef __DNA_CLOTH_TYPES_H__
#define __DNA_CLOTH_TYPES_H__
#include "DNA_defs.h"
/**
* This struct contains all the global data required to run a simulation.
* At the time of this writing, this structure contains data appropriate
@ -85,7 +87,7 @@ typedef struct ClothSimSettings {
int stepsPerFrame; /* Number of time steps per frame. */
int flags; /* flags, see CSIMSETT_FLAGS enum above. */
int preroll; /* How many frames of simulation to do before we start. */
int preroll DNA_DEPRECATED; /* How many frames of simulation to do before we start. */
int maxspringlen; /* in percent!; if tearing enabled, a spring will get cut */
short solver_type; /* which solver should be used? txold */
short vgroup_bend; /* vertex group for scaling bending stiffness */

@ -68,17 +68,6 @@ static void rna_cloth_pinning_changed(Main *UNUSED(bmain), Scene *UNUSED(scene),
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
static void rna_cloth_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object *)ptr->id.data;
ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
settings->reset = 1;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value)
{
@ -559,12 +548,6 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Weights", "");
prop = RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "preroll");
RNA_def_property_range(prop, 0, MAXFRAME);
RNA_def_property_ui_text(prop, "Pre Roll", "Start simulation a number of frames earlier to let the cloth settle in");
RNA_def_property_update(prop, 0, "rna_cloth_reset");
prop = RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "ShapeKey");