Particles

=========

- Fix for bug #7840: adding particle system to nurbs, curves crashes.
  Now simply doesn't allow to add a particle system to a non-mesh
  object, the current code does not support it.
- Fix for bug #7834: deleting vertices of an object with a particle
  system crashes. Fixed by disabling particle display for objects in
  editmode.
- Fix for the particle add brush on subsurfed objects.
This commit is contained in:
Brecht Van Lommel
2007-11-27 11:17:52 +00:00
parent e39b5f790d
commit 01e2395e05
6 changed files with 15 additions and 9 deletions

View File

@@ -5164,8 +5164,6 @@ static void particleSystemModifier_deformVerts(
if(psmd->flag & eParticleSystemFlag_Loaded)
psmd->flag &= ~eParticleSystemFlag_Loaded;
else{
/* TODO PARTICLE - Added this so changing subsurf under hair updates it
should it be done elsewhere? - Campbell */
psys->recalc |= PSYS_RECALC_HAIR;
psys->recalc |= PSYS_DISTR;
psmd->flag |= eParticleSystemFlag_DM_changed;
@@ -5179,6 +5177,9 @@ static void particleSystemModifier_deformVerts(
}
}
/* disabled particles in editmode for now, until support for proper derivedmesh
* updates is coded */
#if 0
static void particleSystemModifier_deformVertsEM(
ModifierData *md, Object *ob, EditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
@@ -5191,6 +5192,7 @@ static void particleSystemModifier_deformVertsEM(
if(!derivedData) dm->release(dm);
}
#endif
/* Particle Instance */
static void particleInstanceModifier_initData(ModifierData *md)
@@ -6757,14 +6759,18 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
mti = INIT_TYPE(ParticleSystem);
mti->type = eModifierTypeType_OnlyDeform;
mti->flags = eModifierTypeFlag_AcceptsMesh
mti->flags = eModifierTypeFlag_AcceptsMesh;
#if 0
|eModifierTypeFlag_SupportsEditmode
|eModifierTypeFlag_EnableInEditmode;
#endif
mti->initData = particleSystemModifier_initData;
mti->freeData = particleSystemModifier_freeData;
mti->copyData = particleSystemModifier_copyData;
mti->deformVerts = particleSystemModifier_deformVerts;
#if 0
mti->deformVertsEM = particleSystemModifier_deformVertsEM;
#endif
mti->requiredDataMask = particleSystemModifier_requiredDataMask;
mti = INIT_TYPE(ParticleInstance);

View File

@@ -583,7 +583,7 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float *
if(osface==NULL || origindex==NULL) {
/* Assume we dont need osface data */
if (index <totface) {
printf("\tNO CD_ORIGSPACE, assuming not needed\n");
//printf("\tNO CD_ORIGSPACE, assuming not needed\n");
return index;
} else {
printf("\tNO CD_ORIGSPACE, error out of range\n");
@@ -645,7 +645,7 @@ void psys_particle_on_dm(Object *ob, DerivedMesh *dm, int from, int index, int i
/* this works for meshes with deform verts only - constructive modifiers wont work properly*/
float temp1[3];
if(index_dmcache == DMCACHE_ISCHILD && index >= dm->getNumFaces(dm)) {
if(index >= dm->getNumFaces(dm)) {
PARTICLE_ERROR(nor, vec);
return;
}

View File

@@ -4006,7 +4006,7 @@ static void hair_step(Object *ob, ParticleSystemModifierData *psmd, ParticleSyst
{
ParticleSettings *part = psys->part;
if(psys->recalc & PSYS_DISTR){
if(psys->recalc & PSYS_DISTR) {
/* need this for changing subsurf levels */
psys_calc_dmfaces(ob, psmd->dm, psys);
}

View File

@@ -4656,7 +4656,7 @@ void particle_panels()
ob=OBACT;
if(ob) {
if(ob && ob->type==OB_MESH) {
object_panel_particle_system(ob);
psys=psys_get_current(ob);

View File

@@ -5038,7 +5038,7 @@ void draw_object(Base *base, int flag)
if(ob->pd && ob->pd->forcefield) draw_forcefield(ob);
/* code for new particle system */
if(warning_recursive==0 && (flag & DRAW_PICKING)==0){
if(warning_recursive==0 && (flag & DRAW_PICKING)==0 && ob!=G.obedit){
glDepthMask(GL_FALSE);
if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
if(ob->particlesystem.first) {

View File

@@ -2134,7 +2134,7 @@ static void brush_add(Object *ob, ParticleSystem *psys, short *mval, short numbe
/* warning, returns the derived mesh face */
#if EXPERIMENTAL_DEFORM_ONLY_PAINTING
if(psys_intersect_dm(ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob,dm,add_pars[n].num,add_pars[n].fuv,NULL);
add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,add_pars[n].num,add_pars[n].fuv,NULL);
n++;
}
#else