Page MenuHome

Fix T92402: copy_particle_systems use_active fails outside the Properties Editor
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Oct 26 2021, 9:59 AM.

Details

Summary

Similar to rBf9308a585ecd, use psys_get_current if we cant get the
active psys from context (which is only defined for the Properties
Editor). Other solution would be to define a "particle_system" context
member in other editors, but for now, stick with the simplest solution.

Diff Detail

Repository
rB Blender
Branch
T92402 (branched from master)
Build Status
Buildable 18219
Build 18219: arc lint + arc unit

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Oct 26 2021, 9:59 AM
Philipp Oeser (lichtwerk) created this revision.
This revision is now accepted and ready to land.Oct 26 2021, 3:59 PM

To ensure a small optimization, it might be good to check whether the active "particle_system" is required:

ParticleSystem *psys_from = NULL;
if (use_active) {
  psys_from = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
  if (psys_from == NULL) {
    /* Particle System context pointer is only valid in the Properties Editor. */
    psys_from = psys_get_current(ob_from);
  }
}