Fix compile error when building without smoke support.

Also fixes possible NULL pointer dereference.

Fixes T49445.
This commit is contained in:
Kévin Dietrich 2016-09-25 00:26:21 +02:00
parent 14e825aa1f
commit d35bf3f421
Notes: blender-bot 2023-05-31 04:43:10 +02:00
Referenced by issue #49445, does not compile WITH_MOD_SMOKE disabled
1 changed files with 14 additions and 4 deletions

View File

@ -648,6 +648,20 @@ typedef void (*vector_draw_func)(float(*)[3], float(*)[3], float*, float*, float
void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
{
#ifdef WITH_SMOKE
const float *vel_x = smoke_get_velocity_x(domain->fluid);
const float *vel_y = smoke_get_velocity_y(domain->fluid);
const float *vel_z = smoke_get_velocity_z(domain->fluid);
#else
const float *vel_x = NULL;
const float *vel_y = NULL;
const float *vel_z = NULL;
#endif
if (ELEM(NULL, vel_x, vel_y, vel_z)) {
return;
}
const int *base_res = domain->base_res;
const int *res = domain->res;
const int *res_min = domain->res_min;
@ -655,10 +669,6 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
int res_max[3];
copy_v3_v3_int(res_max, domain->res_max);
const float *vel_x = smoke_get_velocity_x(domain->fluid);
const float *vel_y = smoke_get_velocity_y(domain->fluid);
const float *vel_z = smoke_get_velocity_z(domain->fluid);
const float *cell_size = domain->cell_size;
const float step_size = ((float)max_iii(base_res[0], base_res[1], base_res[2])) / 16.0f;