Fix T61787: Duplicating a collection instance does not duplicate the dupli_group.

Transfomr init code called just after duplication (presumably before
regular depsgraph update is executed) would erase new objects'
transflags.

This is more like a hack than a real fix, but since that transform piece
of code is already a hack... Other solution would have been to force DEG
to run after object duplication, think it's better to go with that
solution for now.

Not to mention to fact that dupli flags are put into transflag... ;)
This commit is contained in:
Bastien Montagne 2019-02-21 15:37:28 +01:00
parent 3b88e30181
commit 0625a10efb
Notes: blender-bot 2023-02-14 03:38:48 +01:00
Referenced by issue #61787, Duplicating a collection instance does not duplicate the dupli_group
1 changed files with 4 additions and 1 deletions

View File

@ -5801,7 +5801,10 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
/* Copy newly evaluated fields to the original object, similar to how
* active dependency graph will do it. */
copy_m4_m4(ob->obmat, object_eval->obmat);
ob->transflag = object_eval->transflag;
/* Hack over hack, looks like in some cases eval object has not yet been fully flushed or so?
* In some cases, macro operators starting transform just after creating a new object (OBJECT_OT_duplicate),
* if dupli flags are not protected, they can be erased here (see T61787). */
ob->transflag = (object_eval->transflag & ~(OB_DUPLI | OB_DUPLIFACES_SCALE | OB_DUPLIROT));
td->ob = ob;