diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 17:45:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 17:45:24 +0400 |
commit | 3ecb7b951e76388cca68ed07ce1aaf09265ad272 (patch) | |
tree | f7ec2e8d69971a8f3a29664de4f9d5fa728269a6 /source | |
parent | eb1e24bbe61f2f00ad37063bb10dd306f521fbd2 (diff) |
fix [#29272] Dynamic Paint crashes on duplicating a particle system
smoke had this same bug too
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 22 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_particle_types.h | 5 |
2 files changed, 24 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ffd49ecc57d..dedf2675ff6 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -50,6 +50,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_sequence_types.h" +#include "DNA_smoke_types.h" #include "DNA_sound_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" @@ -961,7 +962,6 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys) void copy_object_particlesystems(Object *obn, Object *ob) { - ParticleSystemModifierData *psmd; ParticleSystem *psys, *npsys; ModifierData *md; @@ -974,10 +974,28 @@ void copy_object_particlesystems(Object *obn, Object *ob) /* need to update particle modifiers too */ for(md=obn->modifiers.first; md; md=md->next) { if(md->type==eModifierType_ParticleSystem) { - psmd= (ParticleSystemModifierData*)md; + ParticleSystemModifierData *psmd= (ParticleSystemModifierData*)md; if(psmd->psys==psys) psmd->psys= npsys; } + else if(md->type==eModifierType_DynamicPaint) { + DynamicPaintModifierData *pmd= (DynamicPaintModifierData*)md; + if (pmd->brush) { + if(pmd->brush->psys==psys) { + pmd->brush->psys= npsys; + } + } + } + else if (md->type==eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData*) md; + + if(smd->type==MOD_SMOKE_TYPE_FLOW) { + if (smd->flow) { + if (smd->flow->psys == psys) + smd->flow->psys= npsys; + } + } + } } } } diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index f4736add66c..11a6460b1fc 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -233,7 +233,10 @@ typedef struct ParticleSettings { struct PartDeflect *pd2; } ParticleSettings; -typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in copy_particlesystem */ +typedef struct ParticleSystem +{ /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */ + /* note2: make sure any uses of this struct in DNA are accounted for in 'copy_object_particlesystems' */ + struct ParticleSystem *next, *prev; ParticleSettings *part; /* particle settings */ |