diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-05 23:22:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-05 23:22:12 +0400 |
commit | 8a5e3a8425d1dad7da98926901b9b2adc2db0535 (patch) | |
tree | 73f859f9b851470fadde73e1f97ca2887d1dc5ae /source | |
parent | f681ce08c43b838f0141e8b4875bb10d0d6b1a69 (diff) |
fix [#35628] Dynamic paint waves over ocean modifier doesn't work
Caused by my recent normal calculation changes, added dependsOnNormals callback which was missing for ocean modifier (it assumed input normals were set).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_ocean.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 125d4bc3789..d8f2d227778 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -232,6 +232,12 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) } #endif /* WITH_OCEANSIM */ +static bool dependsOnNormals(ModifierData *md) +{ + OceanModifierData *omd = (OceanModifierData *)md; + return (omd->geometry_mode != MOD_OCEAN_GEOM_GENERATE); +} + #if 0 static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, float *oy) { @@ -437,8 +443,10 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob, simulate_ocean_modifier(omd); } - if (omd->geometry_mode == MOD_OCEAN_GEOM_GENERATE) + if (omd->geometry_mode == MOD_OCEAN_GEOM_GENERATE) { dm = generate_ocean_geometry(omd); + DM_ensure_normals(dm); + } else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) { dm = CDDM_copy(derivedData); } @@ -542,6 +550,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, { DerivedMesh *result; + CDDM_calc_normals(derivedData); + result = doOcean(md, ob, derivedData, 0); if (result != derivedData) @@ -573,7 +583,7 @@ ModifierTypeInfo modifierType_Ocean = { /* isDisabled */ NULL, /* updateDepgraph */ NULL, /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnNormals */ dependsOnNormals, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, }; |