Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-10-26 10:55:50 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-10-27 09:50:37 +0300
commitec77228f0f6a6205fea9437c85e618f7d779064c (patch)
tree1a2ef98f07f859943c264810277a09c637e3dc5d /source/blender/editors/physics
parentb3b2cd1fa9f28f698e385a96fbc137db8c9415af (diff)
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
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/particle_object.c12
1 files changed, 9 insertions, 3 deletions
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;