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-07-26 22:38:37 +0300
committerJeroen Bakker <jeroen@blender.org>2021-08-09 09:17:34 +0300
commit4e14fe167dcc90bcd0f3710f23ac378e883b07ec (patch)
tree4741431efaa17e633882b65a59bbedeedb15863d
parent2ae04254b374f3648a121f654cd2ecf8c79d8428 (diff)
Fix particle system duplication duplicates all systems
Followup to rB3834dc2f7b38 (where getting the proper particle system was fixed for the Adjust Last Operation panel in the Properties Editor). But since this operator can also be called from the 3DView, get a current particle system there as well. Without this, _all_ particle systems would be copied when executing from the 3DView (which was never really intended [operator description uses singular] -- it just happens to use `copy_particle_systems_to_object` internally as well -- same as the `Copy Active/All to Selected Objects` operators)). ref. T83317 Maniphest Tasks: T83317 Differential Revision: https://developer.blender.org/D12033
-rw-r--r--source/blender/editors/physics/particle_object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 6bcc9df16bf..279befbadd4 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -1330,7 +1330,12 @@ static int duplicate_particle_systems_exec(bContext *C, wmOperator *op)
const bool duplicate_settings = RNA_boolean_get(op->ptr, "use_duplicate_settings");
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
+ /* Context pointer is only valid in the Properties Editor. */
ParticleSystem *psys = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
+ if (psys == NULL) {
+ psys = psys_get_current(ob);
+ }
+
copy_particle_systems_to_object(
C, scene, ob, psys, ob, PAR_COPY_SPACE_OBJECT, duplicate_settings);
return OPERATOR_FINISHED;