From 6fbeb6e2e05408af448e9409f8e7e11470f82db6 Mon Sep 17 00:00:00 2001 From: Erik Abrahamsson Date: Mon, 28 Dec 2020 11:17:49 -0600 Subject: Add operator to copy a modifier to all selected objects These two operators (one for grease pencil, one for other objects) copy a single modifier from the active object to all selected objects. The operators are exposed in the dropdown menus in modifier headers. Note that It's currently possible to drag and drop modifiers between objects in the outliner, but that only works for dragging to one object at a time. Modifiers can also be copied with the "Make Links" operator, but that copies *all* modifiers rather than just one. The placement and scope of these new operators allow for more useful poll messages and error messages as well. Every object type that supports modifiers is supported. Although hook and collision modifiers aren't supported because of an unexplained comment in `BKE_object_copy_modifier`, other than that, every modifier type is supported, including particle systems, nodes modifiers, etc. The new modifiers are set active, which required two small tweaks to `object.c` and `particle.c`. Reviewed By: Hans Goudey (with additional edits) Differential Revision: https://developer.blender.org/D9537 --- source/blender/blenkernel/intern/particle.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenkernel/intern/particle.c') diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index dce45f44583..335913c9b8e 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -75,6 +75,7 @@ #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_object.h" #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_scene.h" @@ -3948,6 +3949,7 @@ static ModifierData *object_add_or_copy_particle_system( psmd = (ParticleSystemModifierData *)md; psmd->psys = psys; BLI_addtail(&ob->modifiers, md); + BKE_object_modifier_set_active(ob, md); psys->totpart = 0; psys->flag = PSYS_CURRENT; -- cgit v1.2.3