[Bf-blender-cvs] [2d3b6b5ad7c] id_copy_refactor: Fix (unreported) bad copying of Ocean modifier.

Bastien Montagne noreply at git.blender.org
Tue Jun 20 17:56:34 CEST 2017


Commit: 2d3b6b5ad7cdd8a8ecf5f32f21f99bd0ca3fcf0d
Author: Bastien Montagne
Date:   Mon Jun 19 14:40:08 2017 +0200
Branches: id_copy_refactor
https://developer.blender.org/rB2d3b6b5ad7cdd8a8ecf5f32f21f99bd0ca3fcf0d

Fix (unreported) bad copying of Ocean modifier.

Was needlessly complicated code, forgot to copy a value (foam_fade), and
was utterly leaking memory!

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

M	source/blender/modifiers/intern/MOD_ocean.c

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

diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index e77cc655c16..2c0bfc86e7d 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -160,40 +160,19 @@ static void freeData(ModifierData *md)
 static void copyData(ModifierData *md, ModifierData *target)
 {
 #ifdef WITH_OCEANSIM
+#if 0
 	OceanModifierData *omd = (OceanModifierData *) md;
+#endif
 	OceanModifierData *tomd = (OceanModifierData *) target;
 
-	tomd->geometry_mode = omd->geometry_mode;
-	tomd->resolution = omd->resolution;
-	tomd->spatial_size = omd->spatial_size;
-
-	tomd->wind_velocity = omd->wind_velocity;
-
-	tomd->damp = omd->damp;
-	tomd->smallest_wave = omd->smallest_wave;
-	tomd->depth = omd->depth;
+	freeData(target);
 
-	tomd->wave_alignment = omd->wave_alignment;
-	tomd->wave_direction = omd->wave_direction;
-	tomd->wave_scale = omd->wave_scale;
-
-	tomd->chop_amount = omd->chop_amount;
-	tomd->foam_coverage = omd->foam_coverage;
-	tomd->time = omd->time;
-
-	tomd->seed = omd->seed;
-	tomd->flag = omd->flag;
+	modifier_copyData_generic(md, target);
 
 	tomd->refresh = 0;
 
-	tomd->size = omd->size;
-	tomd->repeat_x = omd->repeat_x;
-	tomd->repeat_y = omd->repeat_y;
-
 	/* XXX todo: copy cache runtime too */
 	tomd->cached = 0;
-	tomd->bakestart = omd->bakestart;
-	tomd->bakeend = omd->bakeend;
 	tomd->oceancache = NULL;
 
 	tomd->ocean = BKE_ocean_add();




More information about the Bf-blender-cvs mailing list