diff options
author | Robert Guetzkow <rjg> | 2021-08-24 19:38:28 +0300 |
---|---|---|
committer | Robert Guetzkow <gitcommit@outlook.de> | 2021-08-24 19:41:22 +0300 |
commit | 38bdde852f1c38a2eaba2b8efc15b49f226baffd (patch) | |
tree | ea971797cd041a03a40eb39a8d0b1940fa13b5d5 /source/blender/editors | |
parent | 551521cfa48022d4cc32ea337ad3f9147a49e887 (diff) |
Fix T90715: Remove correct particle modifier through Python API
Before this patch attempting to remove a particle modifier programmatically
through Python would fail, because it deleted the modifier associated with
the currently active particle system instead of the one passed as an argument
to `bpy.types.ObjectModifiers.remove()`.
This fix adds an additional argument for the particle system to
`object_remove_particle_system`. This allows to specify which particle system
and its associated modifier shall be removed. In case of
`particle_system_remove_exec` it will remain the currently active particle
system, whereas `object_remove_particle_system` passes the particle system
of the modifier. Hence, the correct modifier will be removed.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D12234
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_object.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index e9142742d15..e1e0a0600be 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -352,7 +352,7 @@ static bool object_modifier_remove( /* special cases */ if (md->type == eModifierType_ParticleSystem) { - object_remove_particle_system(bmain, scene, ob); + object_remove_particle_system(bmain, scene, ob, ((ParticleSystemModifierData *)md)->psys); return true; } diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 2668846284d..3ac6dca3044 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -124,7 +124,8 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)) } mode_orig = ob->mode; - object_remove_particle_system(bmain, scene, ob); + ParticleSystem *psys = psys_get_current(ob); + object_remove_particle_system(bmain, scene, ob, psys); /* possible this isn't the active object * object_remove_particle_system() clears the mode on the last psys |