Merge with trunk r39000
[blender.git] / source / blender / blenloader / intern / readfile.c
index 0633794c6edf5571f06412d05a8f823b97416caf..050ceda0bf437fe7b6c90d545a6933ce488737fb 100644 (file)
@@ -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"
@@ -4059,6 +4060,43 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 
                        }
                }
+               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;
@@ -11198,7 +11236,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                                /* 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);
                                        }
                                }
                        }