[Bf-blender-cvs] [d70c7c0] master: Removed the cloth preroll feature.

Lukas Tönne noreply at git.blender.org
Thu Feb 12 16:30:58 CET 2015


Commit: d70c7c06e76fe4309f3471d44a75e79f729e16b1
Author: Lukas Tönne
Date:   Thu Feb 12 16:28:15 2015 +0100
Branches: master
https://developer.blender.org/rBd70c7c06e76fe4309f3471d44a75e79f729e16b1

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.

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_cloth.py
M	source/blender/blenkernel/intern/cloth.c
M	source/blender/makesdna/DNA_cloth_types.h
M	source/blender/makesrna/intern/rna_cloth.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index f141c0b..a5cbffb 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -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:
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 14f9473..3173489 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -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);
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index 3144dad..07bc247 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -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 */
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 991020a..bcb3544 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -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");




More information about the Bf-blender-cvs mailing list