Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ocean.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c49
1 files changed, 7 insertions, 42 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index ccd105f8f69..5aef497c0c4 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -30,6 +30,7 @@
#include "BLT_translation.h"
#include "DNA_customdata_types.h"
+#include "DNA_defaults.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
@@ -87,54 +88,17 @@ static void initData(ModifierData *md)
#ifdef WITH_OCEANSIM
OceanModifierData *omd = (OceanModifierData *)md;
- /* Render resolution */
- omd->resolution = 7;
- /* Display resolution for the non-render case */
- omd->viewport_resolution = 7;
+ BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(omd, modifier));
- omd->spatial_size = 50;
-
- omd->wave_alignment = 0.0;
- omd->wind_velocity = 30.0;
-
- omd->damp = 0.5;
- omd->smallest_wave = 0.01;
- omd->wave_direction = 0.0;
- omd->depth = 200.0;
-
- omd->wave_scale = 1.0;
-
- omd->chop_amount = 1.0;
-
- omd->foam_coverage = 0.0;
-
- omd->seed = 0;
- omd->time = 1.0;
-
- omd->spectrum = MOD_OCEAN_SPECTRUM_PHILLIPS;
- omd->sharpen_peak_jonswap = 0.0f;
- omd->fetch_jonswap = 120.0f;
-
- omd->size = 1.0;
- omd->repeat_x = 1;
- omd->repeat_y = 1;
+ MEMCPY_STRUCT_AFTER(omd, DNA_struct_default_get(OceanModifierData), modifier);
BKE_modifier_path_init(omd->cachepath, sizeof(omd->cachepath), "cache_ocean");
- omd->cached = 0;
- omd->bakestart = 1;
- omd->bakeend = 250;
- omd->oceancache = NULL;
- omd->foam_fade = 0.98;
- omd->foamlayername[0] = '\0'; /* layer name empty by default */
- omd->spraylayername[0] = '\0'; /* layer name empty by default */
-
omd->ocean = BKE_ocean_add();
BKE_ocean_init_from_modifier(omd->ocean, omd, omd->viewport_resolution);
simulate_ocean_modifier(omd);
#else /* WITH_OCEANSIM */
- /* unused */
- (void)md;
+ UNUSED_VARS(md);
#endif /* WITH_OCEANSIM */
}
@@ -409,7 +373,7 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
BKE_mesh_ensure_normals(result);
}
else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) {
- BKE_id_copy_ex(NULL, &mesh->id, (ID **)&result, LIB_ID_COPY_LOCALIZE);
+ result = (Mesh *)BKE_id_copy_ex(NULL, &mesh->id, NULL, LIB_ID_COPY_LOCALIZE);
}
cfra_for_cache = cfra_scene;
@@ -758,9 +722,11 @@ ModifierTypeInfo modifierType_Ocean = {
/* name */ "Ocean",
/* structName */ "OceanModifierData",
/* structSize */ sizeof(OceanModifierData),
+ /* srna */ &RNA_OceanModifier,
/* type */ eModifierTypeType_Constructive,
/* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsEditmode |
eModifierTypeFlag_EnableInEditmode,
+ /* icon */ ICON_MOD_OCEAN,
/* copyData */ copyData,
/* deformMatrices_DM */ NULL,
@@ -780,7 +746,6 @@ ModifierTypeInfo modifierType_Ocean = {
/* updateDepsgraph */ NULL,
/* dependsOnTime */ NULL,
/* dependsOnNormals */ dependsOnNormals,
- /* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
/* freeRuntimeData */ NULL,