Fix T57796: bad 'draw emitter' conversion, importing shared particle systems from 2.79b to 2.80

Not sure what those #ifdef's were supposed to do exactly... But one
thing is for sure, clearing that flag in particlesettings after first
encounter would prevent transferring it properly to other objects that
would use same particlesettings.
This commit is contained in:
Bastien Montagne 2018-11-29 16:23:27 +01:00
parent 51c85a23ca
commit 1c0bc19e3f
Notes: blender-bot 2023-02-14 05:02:28 +01:00
Referenced by issue #57796, bug importing shared particle systems from 2.79b to 2.80
1 changed files with 5 additions and 12 deletions

View File

@ -723,24 +723,12 @@ void do_versions_after_linking_280(Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 4)) {
for (Object *object = bmain->object.first; object; object = object->id.next) {
#ifndef VERSION_280_SUBVERSION_4
/* If any object already has an initialized value for
* duplicator_visibility_flag it means we've already doversioned it.
* TODO(all) remove the VERSION_280_SUBVERSION_4 code once the subversion was bumped. */
if (object->duplicator_visibility_flag != 0) {
break;
}
#endif
if (object->particlesystem.first) {
object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
for (ParticleSystem *psys = object->particlesystem.first; psys; psys = psys->next) {
if (psys->part->draw & PART_DRAW_EMITTER) {
object->duplicator_visibility_flag |= OB_DUPLI_FLAG_RENDER;
#ifndef VERSION_280_SUBVERSION_4
psys->part->draw &= ~PART_DRAW_EMITTER;
#else
break;
#endif
}
}
}
@ -751,6 +739,11 @@ void do_versions_after_linking_280(Main *bmain)
object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT | OB_DUPLI_FLAG_RENDER;
}
}
/* Cleanup deprecated flag from particlesettings data-blocks. */
for (ParticleSettings *part = bmain->particle.first; part; part = part->id.next) {
part->draw &= ~PART_DRAW_EMITTER;
}
}
/* SpaceTime & SpaceLogic removal/replacing */