Merge with trunk r39750
authorMiika Hamalainen <blender@miikah.org>
Sun, 28 Aug 2011 16:46:40 +0000 (16:46 +0000)
committerMiika Hamalainen <blender@miikah.org>
Sun, 28 Aug 2011 16:46:40 +0000 (16:46 +0000)
14 files changed:
1  2 
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/space_view3d/drawobject.c
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_space.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/render_texture.c

index 3099b26357aaade512efa12d087449e2634d8e06,86c646fa2571cea7f9b5c786a163ff30ed8d6062..9478f9c65184fdbc2db9039e4c9ed295672ee06d
@@@ -49,7 -49,6 +49,7 @@@
  #include "DNA_particle_types.h"
  #include "DNA_smoke_types.h"
  #include "DNA_scene_types.h"
 +#include "DNA_dynamicpaint_types.h"
  
  #include "BLI_blenlib.h"
  #include "BLI_math.h"
@@@ -3162,7 -3161,7 +3162,7 @@@ void psys_cache_edit_paths(Scene *scene
                        }
                        else {
                                ca->vel[0] = ca->vel[1] = 0.0f;
-                               ca->vel[1] = 1.0f;
+                               ca->vel[2] = 1.0f;
                        }
  
                        /* selection coloring in edit mode */
@@@ -3454,14 -3453,6 +3454,14 @@@ void object_remove_particle_system(Scen
                                smd->flow->psys = NULL;
        }
  
 +      if((md = modifiers_findByType(ob, eModifierType_DynamicPaint)))
 +      {
 +              DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
 +              if(pmd->brush && pmd->brush->psys)
 +                      if(pmd->brush->psys == psys)
 +                              pmd->brush->psys = NULL;
 +      }
 +
        /* clear modifier */
        psmd= psys_get_modifier(ob, psys);
        BLI_remlink(&ob->modifiers, psmd);
index 48c6b49f3199e02900627121b5eaea55866d51d3,0f0afe3039229cc06c86eff1087ad51dc6887509..d761923859e1393bd8a86e3aaa71b5fa5345c22a
@@@ -40,7 -40,6 +40,7 @@@
  
  #include "DNA_ID.h"
  #include "DNA_cloth_types.h"
 +#include "DNA_dynamicpaint_types.h"
  #include "DNA_modifier_types.h"
  #include "DNA_object_types.h"
  #include "DNA_object_force.h"
@@@ -61,7 -60,6 +61,7 @@@
  #include "BKE_blender.h"
  #include "BKE_cloth.h"
  #include "BKE_depsgraph.h"
 +#include "BKE_dynamicpaint.h"
  #include "BKE_global.h"
  #include "BKE_library.h"
  #include "BKE_main.h"
@@@ -605,7 -603,7 +605,7 @@@ static int  ptcache_smoke_write(PTCache
  
        return ret;
  }
 -static void ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
 +static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
  {
        SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
        SmokeDomainSettings *sds = smd->domain;
                        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; };
@@@ -663,84 -659,6 +663,84 @@@ static void ptcache_smoke_read(PTCacheF
  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)
  {
@@@ -893,40 -811,6 +893,40 @@@ void BKE_ptcache_id_from_smoke(PTCacheI
        if(sds->wt)
                pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH);
  }
 +
 +void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSurface *surface)
 +{
 +
 +      memset(pid, 0, sizeof(PTCacheID));
 +
 +      pid->ob= ob;
 +      pid->calldata= surface;
 +      pid->type= PTCACHE_TYPE_DYNAMICPAINT;
 +      pid->cache= surface->pointcache;
 +      pid->cache_ptr= &surface->pointcache;
 +      pid->ptcaches= &surface->ptcaches;
 +      pid->totpoint= pid->totwrite= ptcache_dynamicpaint_totpoint;
 +
 +      pid->write_point                        = NULL;
 +      pid->read_point                         = NULL;
 +      pid->interpolate_point          = NULL;
 +
 +      pid->write_stream                       = ptcache_dynamicpaint_write;
 +      pid->read_stream                        = ptcache_dynamicpaint_read;
 +
 +      pid->write_extra_data           = NULL;
 +      pid->read_extra_data            = NULL;
 +      pid->interpolate_extra_data     = NULL;
 +
 +      pid->write_header                       = ptcache_basic_header_write;
 +      pid->read_header                        = ptcache_basic_header_read;
 +
 +      pid->data_types= BPHYS_DATA_DYNAMICPAINT;
 +      pid->info_types= 0;
 +
 +      pid->stack_index = pid->cache->index;
 +}
 +
  void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis)
  {
        PTCacheID *pid;
                        BKE_ptcache_id_from_cloth(pid, ob, (ClothModifierData*)md);
                        BLI_addtail(lb, pid);
                }
 -              if(md->type == eModifierType_Smoke) {
 +              else if(md->type == eModifierType_Smoke) {
                        SmokeModifierData *smd = (SmokeModifierData *)md;
                        if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
                        {
                                BLI_addtail(lb, pid);
                        }
                }
 +              else if(md->type == eModifierType_DynamicPaint) {
 +                      DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
 +                      if(pmd->canvas)
 +                      {
 +                              DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 +
 +                              for (; surface; surface=surface->next) {
 +                                      pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
 +                                      BKE_ptcache_id_from_dynamicpaint(pid, ob, surface);
 +                                      BLI_addtail(lb, pid);
 +                              }
 +                      }
 +              }
        }
  
        if(scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
@@@ -1096,12 -967,12 +1096,12 @@@ static int ptcache_filename(PTCacheID *
  
                if(pid->cache->flag & PTCACHE_EXTERNAL) {
                        if(pid->cache->index >= 0)
-                               snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+                               snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
                        else
                                snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */
                }
                else {
-                       snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+                       snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
                }
                len += 16;
        }
@@@ -1721,8 -1592,7 +1721,8 @@@ static int ptcache_read_stream(PTCacheI
                ptcache_file_pointers_init(pf);
  
                // we have stream reading here
 -              pid->read_stream(pf, pid->calldata);
 +              if (!pid->read_stream(pf, pid->calldata))
 +                      error = 1;
        }
  
        ptcache_file_close(pf);
@@@ -1858,21 -1728,15 +1858,21 @@@ int BKE_ptcache_read(PTCacheID *pid, fl
                return 0;
  
        if(cfra1) {
 -              if(pid->read_stream)
 -                      ptcache_read_stream(pid, cfra1);
 +              
 +              if(pid->read_stream) {
 +                      if (!ptcache_read_stream(pid, cfra1))
 +                              return 0;
 +              }
                else if(pid->read_point)
                        ptcache_read(pid, cfra1);
        }
  
        if(cfra2) {
 -              if(pid->read_stream)
 -                      ptcache_read_stream(pid, cfra2);
 +              
 +              if(pid->read_stream) {
 +                      if (!ptcache_read_stream(pid, cfra2))
 +                              return 0;
 +              }
                else if(pid->read_point) {
                        if(cfra1 && cfra2 && pid->interpolate_point)
                                ptcache_interpolate(pid, cfra, cfra1, cfra2);
@@@ -2113,9 -1977,6 +2113,9 @@@ void BKE_ptcache_id_clear(PTCacheID *pi
        if(!pid || !pid->cache || pid->cache->flag & PTCACHE_BAKED)
                return;
  
 +      if (pid->cache->flag & PTCACHE_IGNORE_CLEAR)
 +              return;
 +
        sta = pid->cache->startframe;
        end = pid->cache->endframe;
  
                        if (dir==NULL)
                                return;
  
-                       snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
+                       snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
                        
                        while ((de = readdir(dir)) != NULL) {
                                if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@@@ -2343,7 -2204,7 +2343,7 @@@ void BKE_ptcache_id_time(PTCacheID *pid
                        if (dir==NULL)
                                return;
  
-                       snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
+                       snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
                        
                        while ((de = readdir(dir)) != NULL) {
                                if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@@@ -2429,8 -2290,6 +2429,8 @@@ int  BKE_ptcache_id_reset(Scene *scene
                        smokeModifier_reset(pid->calldata);
                else if(pid->type == PTCACHE_TYPE_SMOKE_HIGHRES)
                        smokeModifier_reset_turbulence(pid->calldata);
 +              else if(pid->type == PTCACHE_TYPE_DYNAMICPAINT)
 +                      dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata);
        }
        if(clear)
                BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
@@@ -2487,18 -2346,6 +2487,18 @@@ int  BKE_ptcache_object_reset(Scene *sc
                                reset |= BKE_ptcache_id_reset(scene, &pid, mode);
                        }
                }
 +              if(md->type == eModifierType_DynamicPaint) {
 +                      DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
 +                      if(pmd->canvas)
 +                      {
 +                              DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 +
 +                              for (; surface; surface=surface->next) {
 +                                      BKE_ptcache_id_from_dynamicpaint(&pid, ob, surface);
 +                                      reset |= BKE_ptcache_id_reset(scene, &pid, mode);
 +                              }
 +                      }
 +              }
        }
  
        if (ob->type == OB_ARMATURE)
@@@ -3057,7 -2904,7 +3057,7 @@@ void BKE_ptcache_disk_cache_rename(PTCa
                return;
        }
  
-       snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
+       snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
  
        /* put new name into cache */
        strcpy(pid->cache->name, to);
index 62209e88dc32f2b0d37537063ab6101ada2ab56d,df7e1f80cbd262f91e1af308d18a8fcc59f9236c..24ad41abf66b79365e04110a87eb1a5b5696b645
@@@ -58,7 -58,6 +58,7 @@@
  #include "DNA_cloth_types.h"
  #include "DNA_controller_types.h"
  #include "DNA_constraint_types.h"
 +#include "DNA_dynamicpaint_types.h"
  #include "DNA_effect_types.h"
  #include "DNA_fileglobal_types.h"
  #include "DNA_genfile.h"
@@@ -4060,43 -4059,6 +4060,43 @@@ static void direct_link_modifiers(FileD
  
                        }
                }
 +              else if (md->type==eModifierType_DynamicPaint) {
 +                      DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
 +
 +                      if(pmd->canvas)
 +                      {
 +                              pmd->canvas = newdataadr(fd, pmd->canvas);
 +                              pmd->canvas->pmd = pmd;
 +                              pmd->canvas->dm = NULL;
 +                              pmd->canvas->ui_info[0] = '\0';
 +                              pmd->canvas->flags &= ~MOD_DPAINT_BAKING; /* just in case */
 +
 +                              if (pmd->canvas->surfaces.first) {
 +                                      DynamicPaintSurface *surface;
 +                                      link_list(fd, &pmd->canvas->surfaces);
 +
 +                                      for (surface=pmd->canvas->surfaces.first; surface; surface=surface->next) {
 +                                              surface->canvas = pmd->canvas;
 +                                              surface->data = NULL;
 +                                              direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1);
 +
 +                                              if(!(surface->effector_weights = newdataadr(fd, surface->effector_weights)))
 +                                                      surface->effector_weights = BKE_add_effector_weights(NULL);
 +                                      }
 +                              }
 +                      }
 +                      if(pmd->brush)
 +                      {
 +                              if (pmd->brush) {
 +                                      pmd->brush = newdataadr(fd, pmd->brush);
 +                                      pmd->brush->pmd = pmd;
 +                                      pmd->brush->psys = newdataadr(fd, pmd->brush->psys);
 +                                      pmd->brush->paint_ramp = newdataadr(fd, pmd->brush->paint_ramp);
 +                                      pmd->brush->vel_ramp = newdataadr(fd, pmd->brush->vel_ramp);
 +                                      pmd->brush->dm = NULL;
 +                              }
 +                      }
 +              }
                else if (md->type==eModifierType_Collision) {
                        
                        CollisionModifierData *collmd = (CollisionModifierData*) md;
@@@ -9989,12 -9951,6 +9989,6 @@@ static void do_versions(FileData *fd, L
                        if(ed) {
                                SEQP_BEGIN(ed, seq) {
                                        if (seq->strip && seq->strip->proxy){
-                                               if (sce->r.size != 100.0) {
-                                                       seq->strip->proxy->size
-                                                               = sce->r.size;
-                                               } else {
-                                                       seq->strip->proxy->size = 25;
-                                               }
                                                seq->strip->proxy->quality =90;
                                        }
                                }
                 * to have them show in RNA viewer and accessible otherwise.
                 */
                for(ma= main->mat.first; ma; ma= ma->id.next) {
-                       if(ma->nodetree && strlen(ma->nodetree->id.name)==0)
+                       if(ma->nodetree && ma->nodetree->id.name[0] == '\0')
                                strcpy(ma->nodetree->id.name, "NTShader Nodetree");
                        
                        /* which_output 0 is now "not specified" */
                }
                /* and composit trees */
                for(sce= main->scene.first; sce; sce= sce->id.next) {
-                       if(sce->nodetree && strlen(sce->nodetree->id.name)==0)
+                       if(sce->nodetree && sce->nodetree->id.name[0] == '\0')
                                strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
  
                        /* move to cameras */
                        bNode *node;
  
                        if(tx->nodetree) {
-                               if(strlen(tx->nodetree->id.name)==0)
+                               if(tx->nodetree->id.name[0] == '\0')
                                        strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
  
                                /* which_output 0 is now "not specified" */
                                                /* enable all cache display */
                                                stime->cache_display |= TIME_CACHE_DISPLAY;
                                                stime->cache_display |= (TIME_CACHE_SOFTBODY|TIME_CACHE_PARTICLES);
 -                                              stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE);
 +                                              stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE|TIME_CACHE_DYNAMICPAINT);
                                        }
                                }
                        }
index bba5ff666581dd381e97719c223d077f59e0253b,5b7fcc0e935f28b786ec7c68ac971d9b050229e4..4ee050b57f4066d1705647a226d56d554e020f58
@@@ -99,7 -99,6 +99,7 @@@ Any case: direct data is ALWAYS after t
  #include "DNA_cloth_types.h"
  #include "DNA_constraint_types.h"
  #include "DNA_controller_types.h"
 +#include "DNA_dynamicpaint_types.h"
  #include "DNA_genfile.h"
  #include "DNA_group_types.h"
  #include "DNA_gpencil_types.h"
@@@ -868,10 -867,12 +868,12 @@@ static void write_particlesettings(Writ
                        for(; dw; dw=dw->next) {
                                /* update indices */
                                dw->index = 0;
-                               go = part->dup_group->gobject.first;
-                               while(go && go->ob != dw->ob) {
-                                       go=go->next;
-                                       dw->index++;
+                               if(part->dup_group) { /* can be NULL if lining fails or set to None */
+                                       go = part->dup_group->gobject.first;
+                                       while(go && go->ob != dw->ob) {
+                                               go=go->next;
+                                               dw->index++;
+                                       }
                                }
                                writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
                        }
@@@ -1277,31 -1278,6 +1279,31 @@@ static void write_modifiers(WriteData *
                        FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
                        
                        writestruct(wd, DATA, "FluidsimSettings", 1, fluidmd->fss);
 +              }
 +              else if(md->type==eModifierType_DynamicPaint) {
 +                      DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
 +                      
 +                      if(pmd->canvas)
 +                      {
 +                              DynamicPaintSurface *surface;
 +                              writestruct(wd, DATA, "DynamicPaintCanvasSettings", 1, pmd->canvas);
 +                              
 +                              /* write surfaces */
 +                              for (surface=pmd->canvas->surfaces.first; surface; surface=surface->next)
 +                                      writestruct(wd, DATA, "DynamicPaintSurface", 1, surface);
 +                              /* write caches and effector weights */
 +                              for (surface=pmd->canvas->surfaces.first; surface; surface=surface->next) {
 +                                      write_pointcaches(wd, &(surface->ptcaches));
 +
 +                                      writestruct(wd, DATA, "EffectorWeights", 1, surface->effector_weights);
 +                              }
 +                      }
 +                      if(pmd->brush)
 +                      {
 +                              writestruct(wd, DATA, "DynamicPaintBrushSettings", 1, pmd->brush);
 +                              writestruct(wd, DATA, "ColorBand", 1, pmd->brush->paint_ramp);
 +                              writestruct(wd, DATA, "ColorBand", 1, pmd->brush->vel_ramp);
 +                      }
                } 
                else if (md->type==eModifierType_Collision) {
                        
@@@ -2487,7 -2463,7 +2489,7 @@@ static void write_global(WriteData *wd
        fg.subversion= BLENDER_SUBVERSION;
        fg.minversion= BLENDER_MINVERSION;
        fg.minsubversion= BLENDER_MINSUBVERSION;
- #ifdef NAN_BUILDINFO
+ #ifdef WITH_BUILDINFO
        {
                extern char build_rev[];
                fg.revision= atoi(build_rev);
index fcca3ec7aecaba0f2d0be14ce03118b26b6adfe1,67123476f063be2048d0b16509de43eb200a9edf..a6714fc0457d1b997ea0a14a15693ef9c8d546b4
@@@ -33,7 -33,6 +33,7 @@@
  
  #include "MEM_guardedalloc.h"
  
 +#include "DNA_dynamicpaint_types.h"
  #include "DNA_key_types.h"
  #include "DNA_scene_types.h"
  #include "DNA_userdef_types.h"
@@@ -45,7 -44,6 +45,7 @@@
  #include "BKE_animsys.h"
  #include "BKE_colortools.h"
  #include "BKE_context.h"
 +#include "BKE_dynamicpaint.h"
  #include "BKE_global.h"
  #include "BKE_library.h"
  #include "BKE_main.h"
@@@ -688,7 -686,7 +688,7 @@@ static int modifier_can_delete(Modifier
  static int modifier_is_simulation(ModifierData *md)
  {
        // Physic Tab
 -      if(ELEM6(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface)) {
 +      if(ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint)) {
                return 1;
        }
        // Particle Tab
@@@ -752,7 -750,7 +752,7 @@@ static uiLayout *draw_modifier(uiLayou
                uiBlockBeginAlign(block);
                /* Softbody not allowed in this situation, enforce! */
                if ( ((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) 
 -                      && (md->type!=eModifierType_Surface) ) 
 +                      && !ELEM(md->type, eModifierType_Surface, eModifierType_DynamicPaint) ) 
                {
                        uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
                        uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
                box= uiLayoutBox(column);
                row= uiLayoutRow(box, 0);
                
 -              if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) {
 +              if (!ELEM3(md->type, eModifierType_Collision, eModifierType_Surface, eModifierType_DynamicPaint)) {
                        /* only here obdata, the rest of modifiers is ob level */
                        uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
                        
@@@ -2033,13 -2031,6 +2033,13 @@@ static int list_item_icon_get(bContext 
        else if(RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
                id= RNA_pointer_get(itemptr, "texture").data;
        }
 +      else if(RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
 +              DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
 +
 +              if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) return ICON_TEXTURE_SHADED;
 +              else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) return ICON_OUTLINER_DATA_MESH;
 +              else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return ICON_FILE_IMAGE;
 +      }
  
        /* get icon from ID */
        if(id) {
@@@ -2136,24 -2127,6 +2136,24 @@@ static void list_item_row(bContext *C, 
                //uiItemR(row, itemptr, "mute", 0, "", ICON_MUTE_IPO_OFF);
                uiBlockSetEmboss(block, UI_EMBOSS);
        }
 +      else if(itemptr->type == &RNA_DynamicPaintSurface) {
 +              char name_final[96];
 +              const char *enum_name;
 +              PropertyRNA *prop = RNA_struct_find_property(itemptr, "surface_type");
 +              DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
 +
 +              RNA_property_enum_name(C, itemptr, prop, RNA_property_enum_get(itemptr, prop), &enum_name);
 +
 +              sprintf(name_final, "%s (%s)",name,enum_name);
 +              uiItemL(sub, name_final, icon);
 +              if (dynamicPaint_surfaceHasColorPreview(surface)) {
 +                      uiBlockSetEmboss(block, UI_EMBOSSN);
 +                      uiDefIconButR(block, OPTION, 0, (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON,
 +                              0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL);
 +                      uiBlockSetEmboss(block, UI_EMBOSS);
 +              }
 +              uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "is_active", i, 0, 0, 0, 0,  NULL);
 +      }
        else
                uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
  
@@@ -2396,6 -2369,7 +2396,7 @@@ void uiTemplateOperatorSearch(uiLayout 
  #define B_STOPCAST            2
  #define B_STOPANIM            3
  #define B_STOPCOMPO           4
+ #define B_STOPSEQ             5
  
  static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
  {
                case B_STOPCOMPO:
                        WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
                        break;
+               case B_STOPSEQ:
+                       WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+                       break;
        }
  }
  
@@@ -2433,8 -2410,11 +2437,11 @@@ void uiTemplateRunningJobs(uiLayout *la
                if(WM_jobs_test(wm, sa))
                   owner = sa;
                handle_event= B_STOPCOMPO;
-       } 
-       else {
+       } else if (sa->spacetype==SPACE_SEQ) {
+               if(WM_jobs_test(wm, sa))
+                       owner = sa;
+               handle_event = B_STOPSEQ;
+       } else {
                Scene *scene;
                /* another scene can be rendering too, for example via compositor */
                for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next)
index 62fe8492597c764e97827d206d99e4e56a46b294,638d197ccf7ddca9cc2abe5ef4f960218eea0329..eb2c9d5e6ce51197e6e2c2be824cba7f925662af
@@@ -38,7 -38,6 +38,7 @@@
  #include "DNA_camera_types.h"
  #include "DNA_curve_types.h"
  #include "DNA_constraint_types.h" // for drawing constraint
 +#include "DNA_dynamicpaint_types.h"
  #include "DNA_lamp_types.h"
  #include "DNA_lattice_types.h"
  #include "DNA_material_types.h"
@@@ -2608,29 -2607,13 +2608,29 @@@ static void draw_mesh_fancy(Scene *scen
        Mesh *me = ob->data;
        Material *ma= give_current_material(ob, 1);
        const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO));
 -      const short is_paint_sel= (ob==OBACT && paint_facesel_test(ob));
        int draw_wire = 0;
        int /* totvert,*/ totedge, totface;
        DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
 +      ModifierData *md = NULL;
 +      int draw_flags = (ob==OBACT && paint_facesel_test(ob)) ? DRAW_IS_PAINT_SEL : 0;
  
        if(!dm)
                return;
 +
 +      /* check to draw dynamic paint colors */
 +      if ((md = modifiers_findByType(ob, eModifierType_DynamicPaint)))
 +      {
 +              /* check if target has an active dp modifier    */
 +              if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))                                    
 +              {
 +                      DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
 +                      /* if canvas is ready to preview vertex colors */
 +                      if (pmd->canvas && pmd->canvas->flags & MOD_DPAINT_PREVIEW_READY &&
 +                              DM_get_face_data_layer(dm, CD_WEIGHT_MCOL)) {
 +                              draw_flags |= DRAW_DYNAMIC_PAINT_PREVIEW;
 +                      }
 +              }
 +      }
        
        if (ob->dtx&OB_DRAWWIRE) {
                draw_wire = 2; /* draw wire after solid using zoffset and depth buffer adjusment */
                glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
  
                // Unwanted combination.
 -      if (is_paint_sel) draw_wire = 0;
 +      if (draw_flags & DRAW_IS_PAINT_SEL) draw_wire = 0;
  
        if(dt==OB_BOUNDBOX) {
                if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
        else if(dt==OB_WIRE || totface==0) {
                draw_wire = 1; /* draw wire only, no depth buffer stuff  */
        }
 -      else if(        (is_paint_sel || (ob==OBACT && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
 +      else if(        (draw_flags & DRAW_IS_PAINT_SEL || (ob==OBACT && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
                                CHECK_OB_DRAWTEXTURE(v3d, dt))
        {
 -              if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || is_paint_sel) && !draw_wire) {
 +              if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !(G.f&G_PICKSEL || (draw_flags & DRAW_IS_PAINT_SEL)) && !draw_wire) {
                        draw_mesh_object_outline(v3d, ob, dm);
                }
  
 -              if(draw_glsl_material(scene, ob, v3d, dt)) {
 +              if(draw_glsl_material(scene, ob, v3d, dt) && !(draw_flags & DRAW_DYNAMIC_PAINT_PREVIEW)) {
                        glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
  
                        dm->drawFacesGLSL(dm, GPU_enable_material);
                        glFrontFace(GL_CCW);
                }
                else {
 -                      draw_mesh_textured(scene, v3d, rv3d, ob, dm, is_paint_sel);
 +                      draw_mesh_textured(scene, v3d, rv3d, ob, dm, draw_flags);
                }
  
 -              if(!is_paint_sel) {
 +              if(!(draw_flags & DRAW_IS_PAINT_SEL)) {
                        if(base->flag & SELECT)
                                UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
                        else
                        /* since we already draw wire as wp guide, dont draw over the top */
                        draw_wire= 0;
                }
 +              else if (draw_flags & DRAW_DYNAMIC_PAINT_PREVIEW) {
 +                      /* for object selection draws no shade */
 +                      if (flag & (DRAW_PICKING|DRAW_CONSTCOLOR)) {
 +                              dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 +                      }
 +                      else {
 +                              /* draw outline */
 +                              if((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire && !ob->sculpt)
 +                                      draw_mesh_object_outline(v3d, ob, dm);
 +
 +                              /* materials arent compatible with vertex colors */
 +                              GPU_end_object_materials();
 +
 +                              GPU_enable_material(0, NULL);
 +                              
 +                              /* set default spec */
 +                              glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
 +                              glEnable(GL_COLOR_MATERIAL);    /* according manpages needed */
 +                              glColor3ub(120, 120, 120);
 +                              glDisable(GL_COLOR_MATERIAL);
 +                              /* diffuse */
 +                              glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
 +                              glEnable(GL_LIGHTING);
 +                              glEnable(GL_COLOR_MATERIAL);
 +
 +                              dm->drawMappedFaces(dm, NULL, NULL, 1, GPU_enable_material);
 +                              glDisable(GL_COLOR_MATERIAL);
 +                              glDisable(GL_LIGHTING);
 +
 +                              GPU_disable_material();
 +                      }
 +              }
                else {
                        Paint *p;
  
@@@ -2893,7 -2844,18 +2893,18 @@@ static int draw_mesh_object(Scene *scen
        Object *obedit= scene->obedit;
        Mesh *me= ob->data;
        EditMesh *em= me->edit_mesh;
-       int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha;
+       int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i;
+       /* If we are drawing shadows and any of the materials don't cast a shadow,
+        * then don't draw the object */
+       if (v3d->flag2 & V3D_RENDER_SHADOW) {
+               for(i=0; i<ob->totcol; ++i) {
+                       Material *ma= give_current_material(ob, i);
+                       if (ma && !(ma->mode & MA_SHADBUF)) {
+                               return 1;
+                       }
+               }
+       }
        
        if(obedit && ob!=obedit && ob->data==obedit->data) {
                if(ob_get_key(ob) || ob_get_key(obedit));
@@@ -6162,8 -6124,7 +6173,7 @@@ void draw_object(Scene *scene, ARegion 
        }
  
        /* draw code for smoke */
-       if((md = modifiers_findByType(ob, eModifierType_Smoke)))
-       {
+       if((md = modifiers_findByType(ob, eModifierType_Smoke))) {
                SmokeModifierData *smd = (SmokeModifierData *)md;
  
                // draw collision objects
@@@ -6555,7 -6516,6 +6565,6 @@@ void draw_object_backbufsel(Scene *scen
  
        switch( ob->type) {
        case OB_MESH:
-       {
                if(ob->mode & OB_MODE_EDIT) {
                        Mesh *me= ob->data;
                        EditMesh *em= me->edit_mesh;
  
                        EM_free_index_arrays();
                }
-               else bbs_mesh_solid(scene, ob);
-       }
+               else {
+                       bbs_mesh_solid(scene, ob);
+               }
                break;
        case OB_CURVE:
        case OB_SURF:
index 7baa8f24df40242cfb271b8913ed4a4d036236db,66b10bcbf2162edbe794b0858b93e26161fd3898..4bfaae6f0ba5ac61da656b6841b79fbc4f3ab5de
@@@ -267,7 -267,7 +267,7 @@@ typedef struct SpaceImage 
        float centx, centy;                             /* storage for offset while render drawing */
  
        short curtile; /* the currently active tile of the image when tile is enabled, is kept in sync with the active faces tile */
-       short imtypenr;
+       short pad;
        short lock;
        short pin;
        char dt_uv; /* UV draw type */
@@@ -903,7 -903,6 +903,7 @@@ enum 
  #define TIME_CACHE_PARTICLES  4
  #define TIME_CACHE_CLOTH              8
  #define TIME_CACHE_SMOKE              16
 +#define TIME_CACHE_DYNAMICPAINT       32
  
  /* sseq->mainb */
  #define SEQ_DRAW_SEQUENCE         0
  #define SEQ_PROXY_RENDER_SIZE_25        25
  #define SEQ_PROXY_RENDER_SIZE_50        50
  #define SEQ_PROXY_RENDER_SIZE_75        75
+ #define SEQ_PROXY_RENDER_SIZE_100       99
  #define SEQ_PROXY_RENDER_SIZE_FULL      100
  
  
index e40f2358794bda9adacaefea32593c4862232b1b,3e5e7bbdc0e48324f36e278ca3467ced01c95b1f..67a9f98f35ba429f33a09a4ed2d9e621801a951e
@@@ -132,24 -132,23 +132,24 @@@ const char *includefiles[] = 
        "DNA_anim_types.h",
        "DNA_boid_types.h",
        "DNA_smoke_types.h",
 +      "DNA_dynamicpaint_types.h",
  
        // empty string to indicate end of includefiles
        ""
  };
  
- int maxdata= 500000, maxnr= 50000;
- int nr_names=0;
- int nr_types=0;
- int nr_structs=0;
char **names, *namedata;              /* at address names[a] is string a */
char **types, *typedata;              /* at address types[a] is string a */
- short *typelens;                              /* at typelens[a] is de length of type a */
- short *alphalens;                         /* contains sizes as they are calculated on the DEC Alpha (64 bits) */
- short **structs, *structdata; /* at sp= structs[a] is the first address of a struct definition
-                                                                  sp[0] is type number
-                                                                  sp[1] is amount of elements
-                                                                  sp[2] sp[3] is typenr,  namenr (etc) */
static int maxdata= 500000, maxnr= 50000;
static int nr_names=0;
static int nr_types=0;
static int nr_structs=0;
static char **names, *namedata;               /* at address names[a] is string a */
static char **types, *typedata;               /* at address types[a] is string a */
+ static short *typelens;                               /* at typelens[a] is de length of type a */
+ static short *alphalens;                      /* contains sizes as they are calculated on the DEC Alpha (64 bits), infact any 64bit system */
+ static short **structs, *structdata;/* at sp= structs[a] is the first address of a struct definition
+                                                                      sp[0] is type number
+                                                                  sp[1] is amount of elements
+                                                                  sp[2] sp[3] is typenr,  namenr (etc) */
  /**
   * Variable to control debug output of makesdna.
   * debugSDNA:
   *  - 2 = full trace, tell which names and types were found
   *  - 4 = full trace, plus all gritty details
   */
- int debugSDNA = 0;
- int additional_slen_offset;
static int debugSDNA = 0;
static int additional_slen_offset;
  
  /* ************************************************************************** */
  /* Functions                                                                  */
@@@ -890,7 -889,7 +890,7 @@@ void printStructLenghts(void
  }
  
  
- int make_structDNA(char *baseDirectory, FILE *file)
static int make_structDNA(char *baseDirectory, FILE *file)
  {
        int len, i;
        short *sp;
@@@ -1197,5 -1196,4 +1197,5 @@@ int main(int argc, char ** argv
  #include "DNA_anim_types.h"
  #include "DNA_boid_types.h"
  #include "DNA_smoke_types.h"
 +#include "DNA_dynamicpaint_types.h"
  /* end of list */
index e4ad58d5f03632b185818ee5c933871693080d57,c82a43e371ccdfcd6785ab9eba5c1ad3504c0328..c68a29f560470d16686ee07b7fb397e224d5d318
@@@ -54,6 -54,7 +54,7 @@@ extern EnumPropertyItem constraint_type
  extern EnumPropertyItem boidrule_type_items[];
  
  extern EnumPropertyItem image_type_items[];
+ extern EnumPropertyItem image_color_mode_items[];
  
  extern EnumPropertyItem beztriple_keyframe_type_items[];
  extern EnumPropertyItem beztriple_handle_type_items[];
@@@ -110,8 -111,6 +111,8 @@@ extern EnumPropertyItem node_filter_ite
  
  extern EnumPropertyItem ramp_blend_items[];
  
 +extern EnumPropertyItem prop_dynamicpaint_type_items[];
 +
  struct bContext;
  struct PointerRNA;
  struct PropertyRNA;
index 3af4e8308d6a44d3b2a18ee46c3cfa2cf50fb503,b95bd2b208769bbfaa9e90edd6188ca1fc69879f..47b3a105db2968fcd270cafcb4696f394f57789b
@@@ -66,7 -66,7 +66,7 @@@ static int file_older(const char *file1
  
        return (st1.st_mtime < st2.st_mtime);
  }
- const char *makesrna_path= NULL;
static const char *makesrna_path= NULL;
  
  static int replace_if_different(char *tmpfile, const char *dep_files[])
  {
@@@ -569,7 -569,7 +569,7 @@@ static char *rna_def_property_get_func(
                                if(prop->flag & PROP_DYNAMIC)
                                        fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop));
                                else
-                                       fprintf(f, "void %s(PointerRNA *ptr, %s values[%d])\n", func, rna_type_type(prop), prop->totarraylength);
+                                       fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
                                fprintf(f, "{\n");
  
                                if(manualfunc) {
                                        }
                                        else {
                                                fprintf(f, "    int i;\n\n");
-                                               fprintf(f, "    for(i=0; i<%d; i++) {\n", prop->totarraylength);
+                                               fprintf(f, "    for(i=0; i<%u; i++) {\n", prop->totarraylength);
                                        }
  
                                        if(dp->dnaarraylength == 1) {
@@@ -783,7 -783,7 +783,7 @@@ static char *rna_def_property_set_func(
                                if(prop->flag & PROP_DYNAMIC)
                                        fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop));
                                else
-                                       fprintf(f, "void %s(PointerRNA *ptr, const %s values[%d])\n", func, rna_type_type(prop), prop->totarraylength);
+                                       fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
                                fprintf(f, "{\n");
  
                                if(manualfunc) {
                                        else {
                                                fprintf(f, "    int i;\n\n");
                                                rna_clamp_value_range(f, prop);
-                                               fprintf(f, "    for(i=0; i<%d; i++) {\n", prop->totarraylength);
+                                               fprintf(f, "    for(i=0; i<%u; i++) {\n", prop->totarraylength);
                                        }
  
                                        if(dp->dnaarraylength == 1) {
@@@ -1324,7 -1324,7 +1324,7 @@@ static void rna_def_property_funcs_head
                                //fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
                        }
                        else if(prop->arraydimension && prop->totarraylength) {
-                               fprintf(f, "void %sget(PointerRNA *ptr, int values[%d]);\n", func, prop->totarraylength);
+                               fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength);
                                //fprintf(f, "void %sset(PointerRNA *ptr, const int values[%d]);\n", func, prop->arraylength);
                        }
                        else {
                                //fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func);
                        }
                        else if(prop->arraydimension && prop->totarraylength) {
-                               fprintf(f, "void %sget(PointerRNA *ptr, float values[%d]);\n", func, prop->totarraylength);
+                               fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength);
                                //fprintf(f, "void %sset(PointerRNA *ptr, const float values[%d]);\n", func, prop->arraylength);
                        }
                        else {
@@@ -1420,21 -1420,21 +1420,21 @@@ static void rna_def_property_funcs_head
                        if(!prop->arraydimension)
                                fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier));
                        else
-                               fprintf(f, "\tinline Array<int, %d> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
                case PROP_INT: {
                        if(!prop->arraydimension)
                                fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier));
                        else
-                               fprintf(f, "\tinline Array<int, %d> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
                case PROP_FLOAT: {
                        if(!prop->arraydimension)
                                fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier));
                        else
-                               fprintf(f, "\tinline Array<float, %d> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tinline Array<float, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
                case PROP_ENUM: {
@@@ -1495,21 -1495,21 +1495,21 @@@ static void rna_def_property_funcs_impl
                        if(!prop->arraydimension)
                                fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
                        else
-                               fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
                case PROP_INT: {
                        if(!prop->arraydimension)
                                fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
                        else
-                               fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
                case PROP_FLOAT: {
                        if(!prop->arraydimension)
                                fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
                        else
-                               fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+                               fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
                case PROP_ENUM: {
@@@ -2028,7 -2028,7 +2028,7 @@@ static void rna_generate_static_paramet
                        fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
  
                if(!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
-                       fprintf(f, "%s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength);
+                       fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength);
                else
                        fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
  
@@@ -2129,7 -2129,7 +2129,7 @@@ static void rna_generate_property(FILE 
                                unsigned int i;
  
                                if(prop->arraydimension && prop->totarraylength) {
-                                       fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+                                       fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
  
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(bprop->defaultarray)
                                unsigned int i;
  
                                if(prop->arraydimension && prop->totarraylength) {
-                                       fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+                                       fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
  
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(iprop->defaultarray)
                                unsigned int i;
  
                                if(prop->arraydimension && prop->totarraylength) {
-                                       fprintf(f, "static float rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+                                       fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
  
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(fprop->defaultarray)
        rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
        rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
        fprintf(f, "%d,\n", prop->icon);
-       fprintf(f, "\t%s, %s|%s, %s, %d, {%d, %d, %d}, %d,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
+       fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
        fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));
  
        if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
@@@ -2432,7 -2432,6 +2432,7 @@@ static RNAProcessItem PROCESS_ITEMS[]= 
        {"rna_context.c", NULL, RNA_def_context},
        {"rna_controller.c", "rna_controller_api.c", RNA_def_controller},
        {"rna_curve.c", NULL, RNA_def_curve},
 +      {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint},
        {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve},
        {"rna_fluidsim.c", NULL, RNA_def_fluidsim},
        {"rna_gpencil.c", NULL, RNA_def_gpencil},
index 61ebe216b53022f56c594cbaf000a1d1e863bf49,490d9c38840fc501832c9670fccf388d2aab36ab..39c08e0385a1af0cd620a126ad500ef984a41149
@@@ -43,7 -43,7 +43,7 @@@
  #include "WM_api.h"
  #include "WM_types.h"
  
- EnumPropertyItem effector_shape_items[] = {
static EnumPropertyItem effector_shape_items[] = {
        {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
        {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
        {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", ""},
        {0, NULL, 0, NULL, NULL}
  };
  
- EnumPropertyItem curve_shape_items[] = {
+ #ifdef RNA_RUNTIME
+ /* type spesific return values only used from functions */
+ static EnumPropertyItem curve_shape_items[] = {
        {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
        {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
        {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", ""},
        {0, NULL, 0, NULL, NULL}
  };
  
- EnumPropertyItem empty_shape_items[] = {
static EnumPropertyItem empty_shape_items[] = {
        {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
        {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
        {0, NULL, 0, NULL, NULL}
  };
  
- EnumPropertyItem vortex_shape_items[] = {
static EnumPropertyItem vortex_shape_items[] = {
        {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
        {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
        {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""},
        {0, NULL, 0, NULL, NULL}
  };
  
- EnumPropertyItem curve_vortex_shape_items[] = {
static EnumPropertyItem curve_vortex_shape_items[] = {
        {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
        {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
        {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""},
        {0, NULL, 0, NULL, NULL}
  };
  
- EnumPropertyItem empty_vortex_shape_items[] = {
static EnumPropertyItem empty_vortex_shape_items[] = {
        {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
        {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
        {0, NULL, 0, NULL, NULL}
  };
  
- #ifdef RNA_RUNTIME
  #include "MEM_guardedalloc.h"
  
  #include "DNA_modifier_types.h"
@@@ -643,22 -644,6 +644,22 @@@ static char *rna_EffectorWeight_path(Po
                        if (smd->domain->effector_weights == ew)
                                return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", md->name);
                }
 +
 +              /* check dynamic paint modifier */
 +              md = (ModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
 +              if (md) {
 +                      DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
 +
 +                      if (pmd->canvas) {
 +                              DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 +
 +                              for(; surface; surface=surface->next) {
 +                                      if (surface->effector_weights == ew)
 +                                              return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"].effector_weights",
 +                                                      md->name, surface->name);
 +                              }
 +                      }
 +              }
        }
        return NULL;
  }
index 3e71a0e4811d2ab9bc334cab0efd2c626e90c0f5,0166baa84434a3de522044508a5997690ff5ed9e..0e1d638960823507e41a05776bc4038baf8c0bac
@@@ -1674,6 -1674,7 +1674,7 @@@ static void rna_def_space_sequencer(Ble
                {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
                {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
                {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
+               {SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
                {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
                {0, NULL, 0, NULL, NULL}};
        
@@@ -2163,11 -2164,6 +2164,11 @@@ static void rna_def_space_time(BlenderR
        RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SMOKE);
        RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");        
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 +              
 +      prop= RNA_def_property(srna, "cache_dynamicpaint", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DYNAMICPAINT);
 +      RNA_def_property_ui_text(prop, "Dynamic PAint", "Show the active object's Dynamic Paint cache");        
 +      RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
  }
  
  static void rna_def_console_line(BlenderRNA *brna)
index 8211c9c0f72f3b8d95a026871285c34c04fbd360,980f6b6af1e55371c193e3d6bd5a117468e4c528..28406732b9d88ac72c30946dc0ae0fc9917738f0
@@@ -104,7 -104,7 +104,7 @@@ static void pointdensity_cache_psys(Ren
  {
        DerivedMesh* dm;
        ParticleKey state;
-       ParticleSimulationData sim= {0};
+       ParticleSimulationData sim= {NULL};
        ParticleData *pa=NULL;
        float cfra = BKE_curframe(re->scene);
        int i, childexists;
@@@ -237,7 -237,7 +237,7 @@@ static void pointdensity_cache_object(R
        dm->release(dm);
  
  }
 -static void cache_pointdensity(Render *re, Tex *tex)
 +void cache_pointdensity(Render *re, Tex *tex)
  {
        PointDensity *pd = tex->pd;
        
index 88f1f2f5e71d9cb6d8fa3d32377f3e8b22827a2e,fbbb33d01721bf742fb83edf77f257d2c836edea..138eca2dd9b6cd66021c09b6044d0d58ecfa4c5f
@@@ -1164,7 -1164,7 +1164,7 @@@ static void do_2d_mapping(MTex *mtex, f
  
  /* ************************************** */
  
 -static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
 +int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
  {
        float tmpvec[3];
        int retval=0; /* return value, int:0, col:1, nor:2, everything:3 */
@@@ -1672,21 -1672,6 +1672,21 @@@ static void texco_mapping(ShadeInput* s
        }
  }
  
 +void texco_mapping_ext(float *facenor, Tex* tex, MTex* mtex, float* co, float* dx, float* dy, float* texvec)
 +{
 +      ShadeInput dum_shi;
 +      float null_v3[3] = {0.0f, 0.0f, 0.0f};
 +      memset (&dum_shi,0,sizeof(ShadeInput));
 +
 +      // Make sure values used by texco_mapping() are correct
 +      dum_shi.osatex = 0;
 +      dum_shi.vlr = NULL;
 +      VECCOPY(dum_shi.facenor, facenor);
 +
 +      texco_mapping(&dum_shi, tex, mtex, co, dx, dy, texvec, null_v3, null_v3);
 +}
 +
 +
  /* Bump code from 2.5 development cycle, has a number of bugs, but here for compatibility */
  
  typedef struct CompatibleBump {
@@@ -1804,7 -1789,7 +1804,7 @@@ static int compatible_bump_compute(Comp
                        const float adx[3] = {fabsf(dx[0]), fabsf(dx[1]), fabsf(dx[2])};
                        const float ady[3] = {fabsf(dy[0]), fabsf(dy[1]), fabsf(dy[2])};
                        du = MAX3(adx[0], adx[1], adx[2]);
-                       dv = MAX3(ady[1], ady[1], ady[2]);
+                       dv = MAX3(ady[0], ady[1], ady[2]);
                }
        }
  
@@@ -1920,11 -1905,13 +1920,13 @@@ static int ntap_bump_compute(NTapBump *
  
        const int fromrgb = ((tex->type == TEX_IMAGE) || ((tex->flag & TEX_COLORBAND)!=0));
        float Hscale = Tnor*mtex->norfac;
+       int dimx=512, dimy=512;
  
        // 2 channels for 2D texture and 3 for 3D textures.
        const int nr_channels = (mtex->texco == TEXCO_UV)? 2 : 3;
        int c, rgbnor, iBumpSpace;
        float dHdx, dHdy;
+       int found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP);
  
        // disable internal bump eval in sampler, save pointer
        float *nvec = texres->nor;
                
                ntap_bump->init_done = 1;
        }
+       // resolve image dimensions
+       if(found_deriv_map || (mtex->texflag&MTEX_BUMP_TEXTURESPACE)!=0) {
+               ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
+               if (ibuf) {
+                       dimx = ibuf->x;
+                       dimy = ibuf->y;
+               }
+       }
        
-       if(!(mtex->texflag & MTEX_5TAP_BUMP)) {
+       if(found_deriv_map) {
+               float dBdu, dBdv;
+               float s = 1;            // negate this if flipped texture coordinate
+               texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
+               rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres);
+               
+               // this variant using a derivative map is described here
+               // http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html
+               dBdu = Hscale*dimx*(2*texres->tr-1);
+               dBdv = Hscale*dimy*(2*texres->tg-1);
+               dHdx = dBdu*dxt[0] + s * dBdv*dxt[1];
+               dHdy = dBdu*dyt[0] + s * dBdv*dyt[1];
+       }
+       else if(!(mtex->texflag & MTEX_5TAP_BUMP)) {
                // compute height derivatives with respect to output image pixel coordinates x and y
                float STll[3], STlr[3], STul[3];
                float Hll, Hlr, Hul;
  
        if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
                if(tex->ima) {
-                       float vec[2];
-                       int dimx=512, dimy=512; 
-                       ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
-                       if (ibuf) {
-                               dimx = ibuf->x;
-                               dimy = ibuf->y;
-                       }
                        // crazy hack solution that gives results similar to normal mapping - part 2
+                       float vec[2];
                        
                        vec[0] = dimx*dxt[0];
                        vec[1] = dimy*dxt[1];
@@@ -2141,7 -2144,7 +2159,7 @@@ void do_material_tex(ShadeInput *shi
        float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3], warpvec[3]={0.0f, 0.0f, 0.0f}, Tnor=1.0;
        int tex_nr, rgbnor= 0, warpdone=0;
        int use_compat_bump = 0, use_ntap_bump = 0;
-       int found_nmapping = 0;
+       int found_nmapping = 0, found_deriv_map = 0;
        int iFirstTimeNMap=1;
  
        compatible_bump_init(&compat_bump);
                        tex= mtex->tex;
                        if(tex==0) continue;
  
+                       found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP);
                        use_compat_bump= (mtex->texflag & MTEX_COMPAT_BUMP);
-                       use_ntap_bump= (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP));
+                       use_ntap_bump= ((mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP))!=0 || found_deriv_map!=0) ? 1 : 0;
  
                        /* XXX texture node trees don't work for this yet */
                        if(tex->nodetree && tex->use_nodes) {
                                                f1= shi->vn[0];
                                                f2= shi->vn[1];
                                                texres.nor[0]= f1*co_nor+f2*si;
-                                               texres.nor[1]= f2*co_nor-f1*si;
                                                f1= shi->vn[1];
                                                f2= shi->vn[2];
                                                texres.nor[1]= f1*co_nor+f2*si;