fix [#29272] Dynamic Paint crashes on duplicating a particle system

smoke had this same bug too
This commit is contained in:
Campbell Barton
2011-11-15 13:45:24 +00:00
parent eb1e24bbe6
commit 3ecb7b951e
2 changed files with 24 additions and 3 deletions

View File

@@ -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;
}
}
}
}
}
}

View File

@@ -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 */