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:
authorJoseph Eagar <joeedh@gmail.com>2022-08-31 18:33:23 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-08-31 18:33:23 +0300
commitf987d9b7583c1ce45c6c19eec054d023e12a0f57 (patch)
tree96d0397d430dbfaae539f830982d0bf0dc7876af
parent2a13ce1e61d8881d445293a132d087eb8c14bdc3 (diff)
parenta6ba8e5f38dbf62392088c3020aab549b7c80554 (diff)
Merge branch 'blender-v3.3-release'
-rw-r--r--source/blender/blenkernel/intern/customdata.cc16
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.cc7
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c34
-rw-r--r--source/blender/draw/intern/draw_hair_private.h6
-rw-r--r--source/blender/editors/mesh/mesh_data.cc20
-rw-r--r--source/blender/io/alembic/intern/abc_customdata.cc4
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h1
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c545
8 files changed, 308 insertions, 325 deletions
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index 51edf8308c3..9a9128387b1 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -1008,11 +1008,6 @@ static void layerInterp_mloopcol(const void **sources,
mc->a = round_fl_to_uchar_clamp(col.a);
}
-static int layerMaxNum_mloopcol()
-{
- return MAX_MCOL;
-}
-
/** \} */
/* -------------------------------------------------------------------- */
@@ -1517,11 +1512,6 @@ static void layerInterp_propcol(const void **sources,
copy_v4_v4(mc->color, col);
}
-static int layerMaxNum_propcol()
-{
- return MAX_MCOL;
-}
-
/** \} */
/* -------------------------------------------------------------------- */
@@ -1697,7 +1687,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
- nullptr, nullptr, layerMaxNum_mloopcol},
+ nullptr, nullptr, nullptr},
/* 7: CD_ORIGINDEX */
{sizeof(int), "", 0, nullptr, nullptr, nullptr, nullptr, nullptr, layerDefault_origindex},
/* 8: CD_NORMAL */
@@ -1810,7 +1800,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
nullptr,
nullptr,
nullptr,
- layerMaxNum_mloopcol},
+ nullptr},
/* 18: CD_TANGENT */
{sizeof(float[4][4]), "", 0, N_("Tangent"), nullptr, nullptr, nullptr, nullptr, nullptr},
/* 19: CD_MDISPS */
@@ -2008,7 +1998,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
nullptr,
nullptr,
nullptr,
- layerMaxNum_propcol},
+ nullptr},
/* 48: CD_PROP_FLOAT3 */
{sizeof(float[3]),
"vec3f",
diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc
index 3d8bbe3d6f8..bc56120ca57 100644
--- a/source/blender/blenkernel/intern/mesh_validate.cc
+++ b/source/blender/blenkernel/intern/mesh_validate.cc
@@ -1029,13 +1029,6 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata,
MAX_MTFACE,
tot_uvloop - MAX_MTFACE);
}
- if (tot_vcolloop > MAX_MCOL) {
- PRINT_ERR(
- "\tMore VCol layers than %d allowed, %d last ones won't be available for render, shaders, "
- "etc.\n",
- MAX_MCOL,
- tot_vcolloop - MAX_MCOL);
- }
/* check indices of clone/stencil */
if (do_fixes && CustomData_get_clone_layer(ldata, CD_MLOOPUV) >= tot_uvloop) {
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index dee7a8cec37..02afbab6899 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -11,6 +11,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_alloca.h"
#include "BLI_ghash.h"
#include "BLI_math_vector.h"
#include "BLI_string.h"
@@ -182,10 +183,11 @@ static void particle_batch_cache_clear_hair(ParticleHairCache *hair_cache)
GPU_VERTBUF_DISCARD_SAFE(hair_cache->proc_uv_buf[i]);
DRW_TEXTURE_FREE_SAFE(hair_cache->uv_tex[i]);
}
- for (int i = 0; i < MAX_MCOL; i++) {
+ for (int i = 0; i < hair_cache->num_col_layers; i++) {
GPU_VERTBUF_DISCARD_SAFE(hair_cache->proc_col_buf[i]);
DRW_TEXTURE_FREE_SAFE(hair_cache->col_tex[i]);
}
+
for (int i = 0; i < MAX_HAIR_SUBDIV; i++) {
GPU_VERTBUF_DISCARD_SAFE(hair_cache->final[i].proc_buf);
DRW_TEXTURE_FREE_SAFE(hair_cache->final[i].proc_tex);
@@ -218,9 +220,24 @@ static void particle_batch_cache_clear(ParticleSystem *psys)
GPU_VERTBUF_DISCARD_SAFE(cache->edit_tip_pos);
}
+static void particle_batch_cache_free_hair(ParticleHairCache *hair)
+{
+ MEM_SAFE_FREE(hair->proc_col_buf);
+ MEM_SAFE_FREE(hair->col_tex);
+ MEM_SAFE_FREE(hair->col_layer_names);
+}
+
void DRW_particle_batch_cache_free(ParticleSystem *psys)
{
particle_batch_cache_clear(psys);
+
+ ParticleBatchCache *cache = psys->batch_cache;
+
+ if (cache) {
+ particle_batch_cache_free_hair(&cache->hair);
+ particle_batch_cache_free_hair(&cache->edit_hair);
+ }
+
MEM_SAFE_FREE(psys->batch_cache);
}
@@ -833,10 +850,10 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
GPUVertBufRaw data_step, seg_step;
GPUVertBufRaw uv_step[MAX_MTFACE];
- GPUVertBufRaw col_step[MAX_MCOL];
+ GPUVertBufRaw *col_step = BLI_array_alloca(col_step, cache->num_col_layers);
const MTFace *mtfaces[MAX_MTFACE] = {NULL};
- const MCol *mcols[MAX_MCOL] = {NULL};
+ const MCol **mcols = BLI_array_alloca(mcols, cache->num_col_layers);
float(**parent_uvs)[2] = NULL;
MCol **parent_mcol = NULL;
@@ -854,7 +871,6 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
&format_col, "col", GPU_COMP_U16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
memset(cache->uv_layer_names, 0, sizeof(cache->uv_layer_names));
- memset(cache->col_layer_names, 0, sizeof(cache->col_layer_names));
/* Strand Data */
cache->proc_strand_buf = GPU_vertbuf_create_with_format(&format_data);
@@ -885,6 +901,16 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
BLI_strncpy(cache->uv_layer_names[i][n++], "a", MAX_LAYER_NAME_LEN);
}
}
+
+ MEM_SAFE_FREE(cache->proc_col_buf);
+ MEM_SAFE_FREE(cache->col_tex);
+ MEM_SAFE_FREE(cache->col_layer_names);
+
+ cache->proc_col_buf = MEM_calloc_arrayN(cache->num_col_layers, sizeof(void *), "proc_col_buf");
+ cache->col_tex = MEM_calloc_arrayN(cache->num_col_layers, sizeof(void *), "col_tex");
+ cache->col_layer_names = MEM_calloc_arrayN(
+ cache->num_col_layers, sizeof(*cache->col_layer_names), "col_layer_names");
+
/* Vertex colors */
for (int i = 0; i < cache->num_col_layers; i++) {
cache->proc_col_buf[i] = GPU_vertbuf_create_with_format(&format_col);
diff --git a/source/blender/draw/intern/draw_hair_private.h b/source/blender/draw/intern/draw_hair_private.h
index 5d84c8863f2..c7e9e1e22de 100644
--- a/source/blender/draw/intern/draw_hair_private.h
+++ b/source/blender/draw/intern/draw_hair_private.h
@@ -61,9 +61,9 @@ typedef struct ParticleHairCache {
GPUTexture *uv_tex[MAX_MTFACE];
char uv_layer_names[MAX_MTFACE][MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN];
- GPUVertBuf *proc_col_buf[MAX_MCOL];
- GPUTexture *col_tex[MAX_MCOL];
- char col_layer_names[MAX_MCOL][MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN];
+ GPUVertBuf **proc_col_buf;
+ GPUTexture **col_tex;
+ char (*col_layer_names)[MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN];
int num_uv_layers;
int num_col_layers;
diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc
index e394f8a7251..8e6723f5f0c 100644
--- a/source/blender/editors/mesh/mesh_data.cc
+++ b/source/blender/editors/mesh/mesh_data.cc
@@ -381,10 +381,6 @@ int ED_mesh_color_add(
em = me->edit_mesh;
layernum = CustomData_number_of_layers(&em->bm->ldata, CD_PROP_BYTE_COLOR);
- if (layernum >= MAX_MCOL) {
- BKE_reportf(reports, RPT_WARNING, "Cannot add more than %i vertex color layers", MAX_MCOL);
- return -1;
- }
/* CD_PROP_BYTE_COLOR */
BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_PROP_BYTE_COLOR, name);
@@ -399,10 +395,6 @@ int ED_mesh_color_add(
}
else {
layernum = CustomData_number_of_layers(&me->ldata, CD_PROP_BYTE_COLOR);
- if (layernum >= MAX_MCOL) {
- BKE_reportf(reports, RPT_WARNING, "Cannot add more than %i vertex color layers", MAX_MCOL);
- return -1;
- }
if (me->mloopcol && do_init) {
CustomData_add_layer_named(
@@ -468,11 +460,6 @@ int ED_mesh_sculpt_color_add(Mesh *me, const char *name, const bool do_init, Rep
em = me->edit_mesh;
layernum = CustomData_number_of_layers(&em->bm->vdata, CD_PROP_COLOR);
- if (layernum >= MAX_MCOL) {
- BKE_reportf(
- reports, RPT_WARNING, "Cannot add more than %i sculpt vertex color layers", MAX_MCOL);
- return -1;
- }
/* CD_PROP_COLOR */
BM_data_layer_add_named(em->bm, &em->bm->vdata, CD_PROP_COLOR, name);
@@ -487,12 +474,7 @@ int ED_mesh_sculpt_color_add(Mesh *me, const char *name, const bool do_init, Rep
}
else {
layernum = CustomData_number_of_layers(&me->vdata, CD_PROP_COLOR);
- if (layernum >= MAX_MCOL) {
- BKE_reportf(
- reports, RPT_WARNING, "Cannot add more than %i sculpt vertex color layers", MAX_MCOL);
- return -1;
- }
-
+
if (CustomData_has_layer(&me->vdata, CD_PROP_COLOR) && do_init) {
const MPropCol *color_data = (const MPropCol *)CustomData_get_layer(&me->vdata,
CD_PROP_COLOR);
diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
index 9c71944fc92..60d593c1684 100644
--- a/source/blender/io/alembic/intern/abc_customdata.cc
+++ b/source/blender/io/alembic/intern/abc_customdata.cc
@@ -583,10 +583,6 @@ void read_custom_data(const std::string &iobject_full_name,
/* Read vertex colors according to convention. */
if (IC3fGeomParam::matches(prop_header) || IC4fGeomParam::matches(prop_header)) {
- if (++num_colors > MAX_MCOL) {
- continue;
- }
-
read_custom_data_mcols(iobject_full_name, prop, prop_header, config, iss);
continue;
}
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index bc29de66cf9..f51b1c790b0 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -256,7 +256,6 @@ enum {
/* Limits */
#define MAX_MTFACE 8
-#define MAX_MCOL 8
#define DYNTOPO_NODE_NONE -1
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index c84d1b56cec..fb28c08d60b 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -373,117 +373,114 @@ static Mesh *doOcean(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mes
/* add vcols before displacement - allows lookup based on position */
if (omd->flag & MOD_OCEAN_GENERATE_FOAM) {
- if (CustomData_number_of_layers(&result->ldata, CD_PROP_BYTE_COLOR) < MAX_MCOL) {
- const int polys_num = result->totpoly;
- const int loops_num = result->totloop;
- MLoop *mloops = result->mloop;
- MLoopCol *mloopcols = CustomData_add_layer_named(
- &result->ldata, CD_PROP_BYTE_COLOR, CD_SET_DEFAULT, NULL, loops_num, omd->foamlayername);
-
- MLoopCol *mloopcols_spray = NULL;
- if (omd->flag & MOD_OCEAN_GENERATE_SPRAY) {
- mloopcols_spray = CustomData_add_layer_named(&result->ldata,
- CD_PROP_BYTE_COLOR,
- CD_SET_DEFAULT,
- NULL,
- loops_num,
- omd->spraylayername);
- }
+ const int polys_num = result->totpoly;
+ const int loops_num = result->totloop;
+ MLoop *mloops = result->mloop;
+ MLoopCol *mloopcols = CustomData_add_layer_named(
+ &result->ldata, CD_PROP_BYTE_COLOR, CD_SET_DEFAULT, NULL, loops_num, omd->foamlayername);
+
+ MLoopCol *mloopcols_spray = NULL;
+ if (omd->flag & MOD_OCEAN_GENERATE_SPRAY) {
+ mloopcols_spray = CustomData_add_layer_named(&result->ldata,
+ CD_PROP_BYTE_COLOR,
+ CD_SET_DEFAULT,
+ NULL,
+ loops_num,
+ omd->spraylayername);
+ }
- if (mloopcols) { /* unlikely to fail */
- MPoly *mpolys = result->mpoly;
- MPoly *mp;
+ if (mloopcols) { /* unlikely to fail */
+ MPoly *mpolys = result->mpoly;
+ MPoly *mp;
- for (i = 0, mp = mpolys; i < polys_num; i++, mp++) {
- MLoop *ml = &mloops[mp->loopstart];
- MLoopCol *mlcol = &mloopcols[mp->loopstart];
+ for (i = 0, mp = mpolys; i < polys_num; i++, mp++) {
+ MLoop *ml = &mloops[mp->loopstart];
+ MLoopCol *mlcol = &mloopcols[mp->loopstart];
- MLoopCol *mlcolspray = NULL;
- if (omd->flag & MOD_OCEAN_GENERATE_SPRAY) {
- mlcolspray = &mloopcols_spray[mp->loopstart];
+ MLoopCol *mlcolspray = NULL;
+ if (omd->flag & MOD_OCEAN_GENERATE_SPRAY) {
+ mlcolspray = &mloopcols_spray[mp->loopstart];
+ }
+
+ for (j = mp->totloop; j--; ml++, mlcol++) {
+ const float *vco = mverts[ml->v].co;
+ const float u = OCEAN_CO(size_co_inv, vco[0]);
+ const float v = OCEAN_CO(size_co_inv, vco[1]);
+ float foam;
+
+ if (omd->oceancache && omd->cached == true) {
+ BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra_for_cache, u, v);
+ foam = ocr.foam;
+ CLAMP(foam, 0.0f, 1.0f);
+ }
+ else {
+ BKE_ocean_eval_uv(omd->ocean, &ocr, u, v);
+ foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage);
}
- for (j = mp->totloop; j--; ml++, mlcol++) {
- const float *vco = mverts[ml->v].co;
- const float u = OCEAN_CO(size_co_inv, vco[0]);
- const float v = OCEAN_CO(size_co_inv, vco[1]);
- float foam;
+ mlcol->r = mlcol->g = mlcol->b = (char)(foam * 255);
+ /* This needs to be set (render engine uses) */
+ mlcol->a = 255;
- if (omd->oceancache && omd->cached == true) {
- BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra_for_cache, u, v);
- foam = ocr.foam;
- CLAMP(foam, 0.0f, 1.0f);
+ if (omd->flag & MOD_OCEAN_GENERATE_SPRAY) {
+ if (omd->flag & MOD_OCEAN_INVERT_SPRAY) {
+ mlcolspray->r = ocr.Eminus[0] * 255;
}
else {
- BKE_ocean_eval_uv(omd->ocean, &ocr, u, v);
- foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage);
+ mlcolspray->r = ocr.Eplus[0] * 255;
}
-
- mlcol->r = mlcol->g = mlcol->b = (char)(foam * 255);
- /* This needs to be set (render engine uses) */
- mlcol->a = 255;
-
- if (omd->flag & MOD_OCEAN_GENERATE_SPRAY) {
- if (omd->flag & MOD_OCEAN_INVERT_SPRAY) {
- mlcolspray->r = ocr.Eminus[0] * 255;
- }
- else {
- mlcolspray->r = ocr.Eplus[0] * 255;
- }
- mlcolspray->g = 0;
- if (omd->flag & MOD_OCEAN_INVERT_SPRAY) {
- mlcolspray->b = ocr.Eminus[2] * 255;
- }
- else {
- mlcolspray->b = ocr.Eplus[2] * 255;
- }
- mlcolspray->a = 255;
+ mlcolspray->g = 0;
+ if (omd->flag & MOD_OCEAN_INVERT_SPRAY) {
+ mlcolspray->b = ocr.Eminus[2] * 255;
+ }
+ else {
+ mlcolspray->b = ocr.Eplus[2] * 255;
}
+ mlcolspray->a = 255;
}
}
}
}
- }
- /* displace the geometry */
+ /* displace the geometry */
- /* NOTE: tried to parallelized that one and previous foam loop,
- * but gives 20% slower results... odd. */
- {
- const int verts_num = result->totvert;
+ /* NOTE: tried to parallelized that one and previous foam loop,
+ * but gives 20% slower results... odd. */
+ {
+ const int verts_num = result->totvert;
- for (i = 0; i < verts_num; i++) {
- float *vco = mverts[i].co;
- const float u = OCEAN_CO(size_co_inv, vco[0]);
- const float v = OCEAN_CO(size_co_inv, vco[1]);
+ for (i = 0; i < verts_num; i++) {
+ float *vco = mverts[i].co;
+ const float u = OCEAN_CO(size_co_inv, vco[0]);
+ const float v = OCEAN_CO(size_co_inv, vco[1]);
- if (omd->oceancache && omd->cached == true) {
- BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra_for_cache, u, v);
- }
- else {
- BKE_ocean_eval_uv(omd->ocean, &ocr, u, v);
- }
+ if (omd->oceancache && omd->cached == true) {
+ BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra_for_cache, u, v);
+ }
+ else {
+ BKE_ocean_eval_uv(omd->ocean, &ocr, u, v);
+ }
- vco[2] += ocr.disp[1];
+ vco[2] += ocr.disp[1];
- if (omd->chop_amount > 0.0f) {
- vco[0] += ocr.disp[0];
- vco[1] += ocr.disp[2];
+ if (omd->chop_amount > 0.0f) {
+ vco[0] += ocr.disp[0];
+ vco[1] += ocr.disp[2];
+ }
}
}
- }
- BKE_mesh_tag_coords_changed(mesh);
+ BKE_mesh_tag_coords_changed(mesh);
- if (allocated_ocean) {
- BKE_ocean_free(omd->ocean);
- omd->ocean = NULL;
- }
+ if (allocated_ocean) {
+ BKE_ocean_free(omd->ocean);
+ omd->ocean = NULL;
+ }
# undef OCEAN_CO
- return result;
-}
+ return result;
+ }
#else /* WITH_OCEANSIM */
static Mesh *doOcean(ModifierData *UNUSED(md), const ModifierEvalContext *UNUSED(ctx), Mesh *mesh)
{
@@ -491,249 +488,249 @@ static Mesh *doOcean(ModifierData *UNUSED(md), const ModifierEvalContext *UNUSED
}
#endif /* WITH_OCEANSIM */
-static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
-{
- return doOcean(md, ctx, mesh);
-}
-// #define WITH_OCEANSIM
-static void panel_draw(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *layout = panel->layout;
+ static Mesh *modifyMesh(ModifierData * md, const ModifierEvalContext *ctx, Mesh *mesh)
+ {
+ return doOcean(md, ctx, mesh);
+ }
+ // #define WITH_OCEANSIM
+ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *layout = panel->layout;
#ifdef WITH_OCEANSIM
- uiLayout *col, *sub;
+ uiLayout *col, *sub;
- PointerRNA ob_ptr;
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr);
+ PointerRNA ob_ptr;
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr);
- uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(layout, false);
- uiItemR(col, ptr, "geometry_mode", 0, NULL, ICON_NONE);
- if (RNA_enum_get(ptr, "geometry_mode") == MOD_OCEAN_GEOM_GENERATE) {
- sub = uiLayoutColumn(col, true);
- uiItemR(sub, ptr, "repeat_x", 0, IFACE_("Repeat X"), ICON_NONE);
- uiItemR(sub, ptr, "repeat_y", 0, IFACE_("Y"), ICON_NONE);
- }
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, ptr, "geometry_mode", 0, NULL, ICON_NONE);
+ if (RNA_enum_get(ptr, "geometry_mode") == MOD_OCEAN_GEOM_GENERATE) {
+ sub = uiLayoutColumn(col, true);
+ uiItemR(sub, ptr, "repeat_x", 0, IFACE_("Repeat X"), ICON_NONE);
+ uiItemR(sub, ptr, "repeat_y", 0, IFACE_("Y"), ICON_NONE);
+ }
- sub = uiLayoutColumn(col, true);
- uiItemR(sub, ptr, "viewport_resolution", 0, IFACE_("Resolution Viewport"), ICON_NONE);
- uiItemR(sub, ptr, "resolution", 0, IFACE_("Render"), ICON_NONE);
+ sub = uiLayoutColumn(col, true);
+ uiItemR(sub, ptr, "viewport_resolution", 0, IFACE_("Resolution Viewport"), ICON_NONE);
+ uiItemR(sub, ptr, "resolution", 0, IFACE_("Render"), ICON_NONE);
- uiItemR(col, ptr, "time", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "time", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "depth", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "size", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "spatial_size", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "depth", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "size", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "spatial_size", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "random_seed", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "random_seed", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "use_normals", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "use_normals", 0, NULL, ICON_NONE);
- modifier_panel_end(layout, ptr);
+ modifier_panel_end(layout, ptr);
#else /* WITH_OCEANSIM */
uiItemL(layout, TIP_("Built without Ocean modifier"), ICON_NONE);
#endif /* WITH_OCEANSIM */
-}
+ }
#ifdef WITH_OCEANSIM
-static void waves_panel_draw(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *col, *sub;
- uiLayout *layout = panel->layout;
+ static void waves_panel_draw(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *col, *sub;
+ uiLayout *layout = panel->layout;
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
- uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(layout, false);
- uiItemR(col, ptr, "wave_scale", 0, IFACE_("Scale"), ICON_NONE);
- uiItemR(col, ptr, "wave_scale_min", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "choppiness", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "wind_velocity", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, ptr, "wave_scale", 0, IFACE_("Scale"), ICON_NONE);
+ uiItemR(col, ptr, "wave_scale_min", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "choppiness", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "wind_velocity", 0, NULL, ICON_NONE);
- uiItemS(layout);
+ uiItemS(layout);
- col = uiLayoutColumn(layout, false);
- uiItemR(col, ptr, "wave_alignment", UI_ITEM_R_SLIDER, IFACE_("Alignment"), ICON_NONE);
- sub = uiLayoutColumn(col, false);
- uiLayoutSetActive(sub, RNA_float_get(ptr, "wave_alignment") > 0.0f);
- uiItemR(sub, ptr, "wave_direction", 0, IFACE_("Direction"), ICON_NONE);
- uiItemR(sub, ptr, "damping", 0, NULL, ICON_NONE);
-}
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, ptr, "wave_alignment", UI_ITEM_R_SLIDER, IFACE_("Alignment"), ICON_NONE);
+ sub = uiLayoutColumn(col, false);
+ uiLayoutSetActive(sub, RNA_float_get(ptr, "wave_alignment") > 0.0f);
+ uiItemR(sub, ptr, "wave_direction", 0, IFACE_("Direction"), ICON_NONE);
+ uiItemR(sub, ptr, "damping", 0, NULL, ICON_NONE);
+ }
-static void foam_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *layout = panel->layout;
+ static void foam_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *layout = panel->layout;
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
- uiItemR(layout, ptr, "use_foam", 0, IFACE_("Foam"), ICON_NONE);
-}
+ uiItemR(layout, ptr, "use_foam", 0, IFACE_("Foam"), ICON_NONE);
+ }
-static void foam_panel_draw(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *col;
- uiLayout *layout = panel->layout;
+ static void foam_panel_draw(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
- bool use_foam = RNA_boolean_get(ptr, "use_foam");
+ bool use_foam = RNA_boolean_get(ptr, "use_foam");
- uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, use_foam);
- uiItemR(col, ptr, "foam_layer_name", 0, IFACE_("Data Layer"), ICON_NONE);
- uiItemR(col, ptr, "foam_coverage", 0, IFACE_("Coverage"), ICON_NONE);
-}
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetActive(col, use_foam);
+ uiItemR(col, ptr, "foam_layer_name", 0, IFACE_("Data Layer"), ICON_NONE);
+ uiItemR(col, ptr, "foam_coverage", 0, IFACE_("Coverage"), ICON_NONE);
+ }
-static void spray_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *row;
- uiLayout *layout = panel->layout;
+ static void spray_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *row;
+ uiLayout *layout = panel->layout;
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
- bool use_foam = RNA_boolean_get(ptr, "use_foam");
+ bool use_foam = RNA_boolean_get(ptr, "use_foam");
- row = uiLayoutRow(layout, false);
- uiLayoutSetActive(row, use_foam);
- uiItemR(row, ptr, "use_spray", 0, IFACE_("Spray"), ICON_NONE);
-}
+ row = uiLayoutRow(layout, false);
+ uiLayoutSetActive(row, use_foam);
+ uiItemR(row, ptr, "use_spray", 0, IFACE_("Spray"), ICON_NONE);
+ }
-static void spray_panel_draw(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *col;
- uiLayout *layout = panel->layout;
+ static void spray_panel_draw(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
- bool use_foam = RNA_boolean_get(ptr, "use_foam");
- bool use_spray = RNA_boolean_get(ptr, "use_spray");
+ bool use_foam = RNA_boolean_get(ptr, "use_foam");
+ bool use_spray = RNA_boolean_get(ptr, "use_spray");
- uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, use_foam && use_spray);
- uiItemR(col, ptr, "spray_layer_name", 0, IFACE_("Data Layer"), ICON_NONE);
- uiItemR(col, ptr, "invert_spray", 0, IFACE_("Invert"), ICON_NONE);
-}
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetActive(col, use_foam && use_spray);
+ uiItemR(col, ptr, "spray_layer_name", 0, IFACE_("Data Layer"), ICON_NONE);
+ uiItemR(col, ptr, "invert_spray", 0, IFACE_("Invert"), ICON_NONE);
+ }
-static void spectrum_panel_draw(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *col;
- uiLayout *layout = panel->layout;
+ static void spectrum_panel_draw(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
- int spectrum = RNA_enum_get(ptr, "spectrum");
+ int spectrum = RNA_enum_get(ptr, "spectrum");
- uiLayoutSetPropSep(layout, true);
+ uiLayoutSetPropSep(layout, true);
- col = uiLayoutColumn(layout, false);
- uiItemR(col, ptr, "spectrum", 0, NULL, ICON_NONE);
- if (ELEM(spectrum, MOD_OCEAN_SPECTRUM_TEXEL_MARSEN_ARSLOE, MOD_OCEAN_SPECTRUM_JONSWAP)) {
- uiItemR(col, ptr, "sharpen_peak_jonswap", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- uiItemR(col, ptr, "fetch_jonswap", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, false);
+ uiItemR(col, ptr, "spectrum", 0, NULL, ICON_NONE);
+ if (ELEM(spectrum, MOD_OCEAN_SPECTRUM_TEXEL_MARSEN_ARSLOE, MOD_OCEAN_SPECTRUM_JONSWAP)) {
+ uiItemR(col, ptr, "sharpen_peak_jonswap", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+ uiItemR(col, ptr, "fetch_jonswap", 0, NULL, ICON_NONE);
+ }
}
-}
-static void bake_panel_draw(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *col;
- uiLayout *layout = panel->layout;
-
- PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
-
- uiLayoutSetPropSep(layout, true);
-
- bool is_cached = RNA_boolean_get(ptr, "is_cached");
- bool use_foam = RNA_boolean_get(ptr, "use_foam");
-
- if (is_cached) {
- PointerRNA op_ptr;
- uiItemFullO(layout,
- "OBJECT_OT_ocean_bake",
- IFACE_("Delete Bake"),
- ICON_NONE,
- NULL,
- WM_OP_EXEC_DEFAULT,
- 0,
- &op_ptr);
- RNA_boolean_set(&op_ptr, "free", true);
- }
- else {
- uiItemO(layout, NULL, ICON_NONE, "OBJECT_OT_ocean_bake");
- }
+ static void bake_panel_draw(const bContext *UNUSED(C), Panel *panel)
+ {
+ uiLayout *col;
+ uiLayout *layout = panel->layout;
+
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
+
+ uiLayoutSetPropSep(layout, true);
+
+ bool is_cached = RNA_boolean_get(ptr, "is_cached");
+ bool use_foam = RNA_boolean_get(ptr, "use_foam");
+
+ if (is_cached) {
+ PointerRNA op_ptr;
+ uiItemFullO(layout,
+ "OBJECT_OT_ocean_bake",
+ IFACE_("Delete Bake"),
+ ICON_NONE,
+ NULL,
+ WM_OP_EXEC_DEFAULT,
+ 0,
+ &op_ptr);
+ RNA_boolean_set(&op_ptr, "free", true);
+ }
+ else {
+ uiItemO(layout, NULL, ICON_NONE, "OBJECT_OT_ocean_bake");
+ }
- uiItemR(layout, ptr, "filepath", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "filepath", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, true);
- uiLayoutSetEnabled(col, !is_cached);
- uiItemR(col, ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE);
- uiItemR(col, ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
+ col = uiLayoutColumn(layout, true);
+ uiLayoutSetEnabled(col, !is_cached);
+ uiItemR(col, ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE);
+ uiItemR(col, ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, use_foam);
- uiItemR(col, ptr, "bake_foam_fade", 0, NULL, ICON_NONE);
-}
+ col = uiLayoutColumn(layout, false);
+ uiLayoutSetActive(col, use_foam);
+ uiItemR(col, ptr, "bake_foam_fade", 0, NULL, ICON_NONE);
+ }
#endif /* WITH_OCEANSIM */
-static void panelRegister(ARegionType *region_type)
-{
- PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Ocean, panel_draw);
+ static void panelRegister(ARegionType * region_type)
+ {
+ PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Ocean, panel_draw);
#ifdef WITH_OCEANSIM
- modifier_subpanel_register(region_type, "waves", "Waves", NULL, waves_panel_draw, panel_type);
- PanelType *foam_panel = modifier_subpanel_register(
- region_type, "foam", "", foam_panel_draw_header, foam_panel_draw, panel_type);
- modifier_subpanel_register(
- region_type, "spray", "", spray_panel_draw_header, spray_panel_draw, foam_panel);
- modifier_subpanel_register(
- region_type, "spectrum", "Spectrum", NULL, spectrum_panel_draw, panel_type);
- modifier_subpanel_register(region_type, "bake", "Bake", NULL, bake_panel_draw, panel_type);
+ modifier_subpanel_register(region_type, "waves", "Waves", NULL, waves_panel_draw, panel_type);
+ PanelType *foam_panel = modifier_subpanel_register(
+ region_type, "foam", "", foam_panel_draw_header, foam_panel_draw, panel_type);
+ modifier_subpanel_register(
+ region_type, "spray", "", spray_panel_draw_header, spray_panel_draw, foam_panel);
+ modifier_subpanel_register(
+ region_type, "spectrum", "Spectrum", NULL, spectrum_panel_draw, panel_type);
+ modifier_subpanel_register(region_type, "bake", "Bake", NULL, bake_panel_draw, panel_type);
#else
UNUSED_VARS(panel_type);
#endif /* WITH_OCEANSIM */
-}
+ }
-static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md)
-{
- OceanModifierData *omd = (OceanModifierData *)md;
- omd->oceancache = NULL;
- omd->ocean = NULL;
-}
+ static void blendRead(BlendDataReader * UNUSED(reader), ModifierData * md)
+ {
+ OceanModifierData *omd = (OceanModifierData *)md;
+ omd->oceancache = NULL;
+ omd->ocean = NULL;
+ }
-ModifierTypeInfo modifierType_Ocean = {
- /* name */ N_("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,
-
- /* deformMatrices */ NULL,
- /* deformVertsEM */ NULL,
- /* deformMatricesEM */ NULL,
- /* modifyMesh */ modifyMesh,
- /* modifyGeometrySet */ NULL,
-
- /* initData */ initData,
- /* requiredDataMask */ requiredDataMask,
- /* freeData */ freeData,
- /* isDisabled */ NULL,
- /* updateDepsgraph */ NULL,
- /* dependsOnTime */ NULL,
- /* dependsOnNormals */ dependsOnNormals,
- /* foreachIDLink */ NULL,
- /* foreachTexLink */ NULL,
- /* freeRuntimeData */ NULL,
- /* panelRegister */ panelRegister,
- /* blendWrite */ NULL,
- /* blendRead */ blendRead,
-};
+ ModifierTypeInfo modifierType_Ocean = {
+ /* name */ N_("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,
+
+ /* deformMatrices */ NULL,
+ /* deformVertsEM */ NULL,
+ /* deformMatricesEM */ NULL,
+ /* modifyMesh */ modifyMesh,
+ /* modifyGeometrySet */ NULL,
+
+ /* initData */ initData,
+ /* requiredDataMask */ requiredDataMask,
+ /* freeData */ freeData,
+ /* isDisabled */ NULL,
+ /* updateDepsgraph */ NULL,
+ /* dependsOnTime */ NULL,
+ /* dependsOnNormals */ dependsOnNormals,
+ /* foreachIDLink */ NULL,
+ /* foreachTexLink */ NULL,
+ /* freeRuntimeData */ NULL,
+ /* panelRegister */ panelRegister,
+ /* blendWrite */ NULL,
+ /* blendRead */ blendRead,
+ };