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:
authorRobert Guetzkow <rjg>2021-08-24 19:38:28 +0300
committerRobert Guetzkow <gitcommit@outlook.de>2021-08-24 19:41:22 +0300
commit38bdde852f1c38a2eaba2b8efc15b49f226baffd (patch)
treeea971797cd041a03a40eb39a8d0b1940fa13b5d5 /source/blender/blenkernel/intern/particle.c
parent551521cfa48022d4cc32ea337ad3f9147a49e887 (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/blenkernel/intern/particle.c')
-rw-r--r--source/blender/blenkernel/intern/particle.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 29849c69b6f..50b0fb1c9f5 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3967,16 +3967,18 @@ ModifierData *object_copy_particle_system(Main *bmain,
return object_add_or_copy_particle_system(bmain, scene, ob, NULL, psys_orig);
}
-void object_remove_particle_system(Main *bmain, Scene *UNUSED(scene), Object *ob)
+void object_remove_particle_system(Main *bmain,
+ Scene *UNUSED(scene),
+ Object *ob,
+ ParticleSystem *psys)
{
- ParticleSystem *psys = psys_get_current(ob);
- ParticleSystemModifierData *psmd;
- ModifierData *md;
-
- if (!psys) {
+ if (!ob || !psys) {
return;
}
+ ParticleSystemModifierData *psmd;
+ ModifierData *md;
+
/* Clear particle system in fluid modifier. */
if ((md = BKE_modifiers_findby_type(ob, eModifierType_Fluid))) {
FluidModifierData *fmd = (FluidModifierData *)md;