Merge with trunk r37546
[blender-staging.git] / source / blender / blenloader / intern / readfile.c
index 222c4bcf6fc0a3f29d03d163db8b0f5abe93fa5b..0b3e2dc2577c02ea46df528a43c9a08ca361a17e 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"
@@ -4020,6 +4021,44 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 
                        }
                }
+               else if (md->type==eModifierType_DynamicPaint) {
+                       DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
+
+                       if(pmd->type==MOD_DYNAMICPAINT_TYPE_CANVAS)
+                       {
+                               pmd->brush = NULL;
+
+                               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);
+                                       }
+                               }
+                       }
+                       else if(pmd->type==MOD_DYNAMICPAINT_TYPE_BRUSH)
+                       {
+                               pmd->canvas = NULL;
+
+                               pmd->brush = newdataadr(fd, pmd->brush);
+                               if (pmd->brush) {
+                                       pmd->brush->pmd = pmd;
+                                       pmd->brush->mat = newdataadr(fd, pmd->brush->mat);
+                                       pmd->brush->psys = newdataadr(fd, pmd->brush->psys);
+                                       pmd->brush->paint_ramp = newdataadr(fd, pmd->brush->paint_ramp);
+                                       pmd->brush->dm = NULL;
+                               }
+                       }
+               }
                else if (md->type==eModifierType_Collision) {
                        
                        CollisionModifierData *collmd = (CollisionModifierData*) md;
@@ -11162,7 +11201,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);
                                        }
                                }
                        }