Metaballs were searching through particle systems on all layers,
This caused a crash (T46622), where the ParticleSystem was on a hidden layer, The iterator would attempt to generate dupli-particles, crashing when accessing psmd->dm which was NULL.
now restrict this to objects on scene layers, so we can be sure data for them is generated.
As far as I can see, alternative solutions could be...
- Calculate all particle-system-derived-meshes on all layers (when metaballs with duplis are used). - (overkill, but would work so including for completeness)
- Calculate DerivedMesh for particle systems on demand (would likely need to lock the thread) - (this is similar to calculating meshes on draw, which we try to avoid).
- Add NULL check for psmd->dm to avoid the crash (will give unpredictable results... since the data may have been calculated previously).