Merge with trunk r37849
[blender.git] / source / blender / blenkernel / intern / particle.c
index 72c92eed3127cc6f4c57345712883afc7c0d532f..5b7442fe5bce64e1738f56bc001d19e8c1f2e1a2 100644 (file)
@@ -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"
@@ -3455,6 +3456,14 @@ void object_remove_particle_system(Scene *scene, Object *ob)
                                smd->flow->psys = NULL;
        }
 
+       if((md = modifiers_findByType(ob, eModifierType_DynamicPaint)))
+       {
+               DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
+               if((pmd->type == MOD_DYNAMICPAINT_TYPE_BRUSH) && 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);