From ec77228f0f6a6205fea9437c85e618f7d779064c Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 26 Oct 2021 09:55:50 +0200 Subject: Fix T92402: copy_particle_systems use_active fails outside the Properties Editor 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. thx @mano-wii for additional input Maniphest Tasks: T92402 Differential Revision: https://developer.blender.org/D13000 --- source/blender/editors/physics/particle_object.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/physics') diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 3ac6dca3044..367d72b0ad7 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -1235,9 +1235,15 @@ static int copy_particle_systems_exec(bContext *C, wmOperator *op) const bool use_active = RNA_boolean_get(op->ptr, "use_active"); Scene *scene = CTX_data_scene(C); Object *ob_from = ED_object_active_context(C); - ParticleSystem *psys_from = - use_active ? CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data : - NULL; + + 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); + } + } int changed_tot = 0; int fail = 0; -- cgit v1.2.3