Merge with trunk r38619
authorMiika Hamalainen <blender@miikah.org>
Fri, 22 Jul 2011 18:51:53 +0000 (18:51 +0000)
committerMiika Hamalainen <blender@miikah.org>
Fri, 22 Jul 2011 18:51:53 +0000 (18:51 +0000)
13 files changed:
1  2 
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/makesrna/intern/CMakeLists.txt
source/blender/modifiers/CMakeLists.txt
source/blender/modifiers/intern/MOD_util.c
source/blender/render/intern/source/voxeldata.c

index 32bb01110e9635af77d6e2a55069f9c6abde0acd,b8f4b2d302f503a517f79ef6651b2a785045d433..e347e3896b092924d1b4b0f96de2de1581a686e8
@@@ -653,88 -652,13 +654,93 @@@ static int ptcache_smoke_read(PTCacheFi
                        ptcache_file_compressed_read(pf, (unsigned char*)tcw, out_len);
                }
        }
 +
 +      return 1;
  }
+ #else // WITH_SMOKE
+ static int  ptcache_smoke_totpoint(void *UNUSED(smoke_v), int UNUSED(cfra)) { return 0; };
+ static void ptcache_smoke_read(PTCacheFile *UNUSED(pf), void *UNUSED(smoke_v)) {}
+ static int  ptcache_smoke_write(PTCacheFile *UNUSED(pf), void *UNUSED(smoke_v)) { return 0; }
+ #endif // WITH_SMOKE
  
 +static int ptcache_dynamicpaint_totpoint(void *sd, int cfra)
 +{
 +      DynamicPaintSurface *surface = (DynamicPaintSurface*)sd;
 +
 +      if (!surface->data) return 0;
 +      else return surface->data->total_points;
 +}
 +
 +#define DP_CACHE_VERSION "1.01"
 +
 +static int  ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
 +{     
 +      DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v;
 +      int cache_compress = 1;
 +
 +      /* version header */
 +      ptcache_file_write(pf, DP_CACHE_VERSION, 1, sizeof(char)*4);
 +
 +      if(surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
 +              unsigned int total_points=surface->data->total_points;
 +              unsigned int in_len;
 +              unsigned char *out;
 +
 +              /* cache type */
 +              ptcache_file_write(pf, &surface->type, 1, sizeof(int));
 +
 +              if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
 +                      in_len = sizeof(PaintPoint)*total_points;
 +              else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
 +                               surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)
 +                      in_len = sizeof(float)*total_points;
 +              else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE)
 +                      in_len = sizeof(PaintWavePoint)*total_points;
 +              else return 0;
 +
 +              out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer");
 +
 +              ptcache_file_compressed_write(pf, (unsigned char *)surface->data->type_data, in_len, out, cache_compress);
 +              MEM_freeN(out);
 +
 +      }
 +      return 1;
 +}
 +static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
 +{
 +      DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v;
 +      char version[4];
 +      
 +      /* version header */
 +      ptcache_file_read(pf, version, 1, sizeof(char)*4);
 +      if (strncmp(version, DP_CACHE_VERSION,4)) {printf("Dynamic Paint: Invalid cache version: %s!\n",version); return 0;}
 +
 +      if(surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
 +              unsigned int data_len;
 +              int surface_type;
 +
 +              /* cache type */
 +              ptcache_file_read(pf, &surface_type, 1, sizeof(int));
 +
 +              if (surface_type != surface->type)
 +                      return 0;
 +
 +              /* read surface data */
 +              if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
 +                      data_len = sizeof(PaintPoint);
 +              else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
 +                               surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)
 +                      data_len = sizeof(float);
 +              else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE)
 +                      data_len = sizeof(PaintWavePoint);
 +              else return 0;
 +
 +              ptcache_file_compressed_read(pf, (unsigned char*)surface->data->type_data, data_len*surface->data->total_points);
 +
 +      }
 +      return 1;
 +}
 +
  /* Creating ID's */
  void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb)
  {
index 511c03b424ef479ce8b445839085fd9ba5da7af9,232f7fdeede822e3573df9fe82e80b1d713f7ffe..693eb4a9893c354d7e61499168ae7e39be05ad51
@@@ -300,10 -301,16 +301,16 @@@ static void init_frame_smoke(VoxelData 
        }
        
        vd->ok = 1;
-       return;
+ #else // WITH_SMOKE
+       (void)vd;
+       (void)cfra;
+       vd->dataset= NULL;
+ #endif
  }
  
 -static void cache_voxeldata(struct Render *re, Tex *tex)
 +void cache_voxeldata(Tex *tex, int scene_frame)
  {     
        VoxelData *vd = tex->vd;
        FILE *fp;