Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_fluidsim_util.c
| Show All 30 Lines | |||||
| /** \file blender/modifiers/intern/MOD_fluidsim_util.c | /** \file blender/modifiers/intern/MOD_fluidsim_util.c | ||||
| * \ingroup modifiers | * \ingroup modifiers | ||||
| */ | */ | ||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include <zlib.h> | #include <zlib.h> | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_object_fluidsim_types.h" | #include "DNA_object_fluidsim_types.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_fluidsim.h" /* ensure definitions here match */ | #include "BKE_fluidsim.h" /* ensure definitions here match */ | ||||
| #ifdef WITH_MOD_FLUID | #ifdef WITH_MOD_FLUID | ||||
| # include "CLG_log.h" | |||||
| # include "BLI_blenlib.h" | # include "BLI_blenlib.h" | ||||
| # include "BLI_math.h" | # include "BLI_math.h" | ||||
| # include "BKE_global.h" | # include "BKE_global.h" | ||||
| # include "BKE_library.h" | # include "BKE_library.h" | ||||
| #endif | #endif | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "MOD_fluidsim_util.h" | #include "MOD_fluidsim_util.h" | ||||
| #include "MOD_modifiertypes.h" | #include "MOD_modifiertypes.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| // headers for fluidsim bobj meshes | // headers for fluidsim bobj meshes | ||||
| #include "LBM_fluidsim.h" | #include "LBM_fluidsim.h" | ||||
| #ifdef WITH_MOD_FLUID | |||||
| static CLG_LogRef LOG = {"mod.fluidsim"}; | |||||
| #endif | |||||
| void fluidsim_init(FluidsimModifierData *fluidmd) | void fluidsim_init(FluidsimModifierData *fluidmd) | ||||
| { | { | ||||
| #ifdef WITH_MOD_FLUID | #ifdef WITH_MOD_FLUID | ||||
| if (fluidmd) { | if (fluidmd) { | ||||
| FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); | FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); | ||||
| fluidmd->fss = fss; | fluidmd->fss = fss; | ||||
| ▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | for (i = numverts, no_s = normals; i > 0; i--, no_s += 3) { | ||||
| gotBytes = gzread(gzf, no, sizeof(float) * 3); | gotBytes = gzread(gzf, no, sizeof(float) * 3); | ||||
| normal_float_to_short_v3(no_s, no); | normal_float_to_short_v3(no_s, no); | ||||
| } | } | ||||
| /* read no. of triangles */ | /* read no. of triangles */ | ||||
| gotBytes = gzread(gzf, &wri, sizeof(wri)); | gotBytes = gzread(gzf, &wri, sizeof(wri)); | ||||
| if (wri != numfaces) { | if (wri != numfaces) { | ||||
| printf("Fluidsim: error in reading data from file.\n"); | CLOG_ERROR(&LOG, "error in reading data from file."); | ||||
| if (mesh) | if (mesh) | ||||
| BKE_id_free(NULL, mesh); | BKE_id_free(NULL, mesh); | ||||
| gzclose(gzf); | gzclose(gzf); | ||||
| MEM_freeN(normals); | MEM_freeN(normals); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* read triangles from file */ | /* read triangles from file */ | ||||
| ▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | static Mesh *fluidsim_read_cache( | ||||
| if (!newmesh) { | if (!newmesh) { | ||||
| /* switch, abort background rendering when fluidsim mesh is missing */ | /* switch, abort background rendering when fluidsim mesh is missing */ | ||||
| const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp | const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp | ||||
| if (G.background == 1) { | if (G.background == 1) { | ||||
| if (BLI_getenv(strEnvName2)) { | if (BLI_getenv(strEnvName2)) { | ||||
| int elevel = atoi(BLI_getenv(strEnvName2)); | int elevel = atoi(BLI_getenv(strEnvName2)); | ||||
| if (elevel > 0) { | if (elevel > 0) { | ||||
| printf("Env. var %s set, fluid sim mesh '%s' not found, aborting render...\n", | CLG_FATAL(&LOG, "Env. var %s set, fluid sim mesh '%s' not found, aborting render...", | ||||
| strEnvName2, targetFile); | strEnvName2, targetFile); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* display org. object upon failure which is in new mesh */ | /* display org. object upon failure which is in new mesh */ | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||