diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2018-05-18 13:58:46 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2018-05-18 15:34:27 +0300 |
commit | 5e7a21a5f549f5db73385820cafcd8f2bb9c91da (patch) | |
tree | cfcc13dcf817079ec022d97d6ebd72494a4e9781 | |
parent | 1cc4ab481e87c0e3f459302bffbdf029545fd42d (diff) |
Fix T55115: crash when iterating SmokeDomainSettings color_grid property
through python
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 38c297def32..b860ad303f0 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -286,20 +286,27 @@ static void rna_SmokeModifier_color_grid_get(PointerRNA *ptr, float *values) { #ifdef WITH_SMOKE SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; + int length[RNA_MAX_ARRAY_DIMENSION]; + int size = rna_SmokeModifier_grid_get_length(ptr, length); BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); - if (sds->flags & MOD_SMOKE_HIGHRES) { - if (smoke_turbulence_has_colors(sds->wt)) - smoke_turbulence_get_rgba(sds->wt, values, 0); - else - smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, values, 0); + if (!sds->fluid) { + memset(values, 0, size * sizeof(float)); } else { - if (smoke_has_colors(sds->fluid)) - smoke_get_rgba(sds->fluid, values, 0); - else - smoke_get_rgba_from_density(sds->fluid, sds->active_color, values, 0); + if (sds->flags & MOD_SMOKE_HIGHRES) { + if (smoke_turbulence_has_colors(sds->wt)) + smoke_turbulence_get_rgba(sds->wt, values, 0); + else + smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, values, 0); + } + else { + if (smoke_has_colors(sds->fluid)) + smoke_get_rgba(sds->fluid, values, 0); + else + smoke_get_rgba_from_density(sds->fluid, sds->active_color, values, 0); + } } BLI_rw_mutex_unlock(sds->fluid_mutex); |