[Bf-committers] A small bugfix in voxeldata (Farsthary)

echelon at infomail.upr.edu.cu echelon at infomail.upr.edu.cu
Tue Apr 7 19:57:16 CEST 2009


Hi again!

  I have sended today to Matt Ebb the small fix to a bug in the
voxeldata.c file.
  I post it publically in order to people that are currently using that
module don´t have to wait for review and commit

   That bug in the voxeldata file that cause crashing when loading datasets

  the problem was in the order of the functions in the voxelcache code ,
that try to read the header without first open the file for reading:

   ------ Sim_physics--------

 --  read_voxeldata_header(fp, vd);
 --  size = (vd->resolX)*(vd->resolY)*(vd->resolZ);
 --  vd->dataset = MEM_mallocN(sizeof(float)*size, "voxel dataset");

 --  if (!BLI_exists(vd->source_path)) return;
 --  fp = fopen(vd->source_path,"rb");
 --  if (!fp) return;

   ----------------------------------
   that code will fail always , the fix is very simple, just swap the order:

   ---------- Fix--------------

  ++ if (!BLI_exists(vd->source_path)) return;
  ++ fp = fopen(vd->source_path,"rb");
  ++ if (!fp) return;

  ++ read_voxeldata_header(fp, vd);
  ++ size = (vd->resolX)*(vd->resolY)*(vd->resolZ);
  ++ vd->dataset = MEM_mallocN(sizeof(float)*size, "voxel dataset");


  Now everything work ok :)

          I will post soon a video showing how to use the voxeldata module
to load smoke/fire simulators.



More information about the Bf-committers mailing list