[Bf-blender-cvs] [fec3be6b545] blender2.8: T53610: Crash opening file with linked particles
Dalai Felinto
noreply at git.blender.org
Fri Dec 22 02:26:18 CET 2017
Commit: fec3be6b5455c8847df0910f1086be4bdcab8dc1
Author: Dalai Felinto
Date: Thu Dec 21 23:24:29 2017 -0200
Branches: blender2.8
https://developer.blender.org/rBfec3be6b5455c8847df0910f1086be4bdcab8dc1
T53610: Crash opening file with linked particles
I could done a subversion bump, but I found a safe way to avoid it.
It leads a bit of an ugly code, but once we bump the subversion
next time we can clean it up easily.
===================================================================
M source/blender/blenloader/intern/versioning_280.c
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 547ae6709b2..ba5beb7993d 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -603,6 +603,38 @@ void do_versions_after_linking_280(Main *main)
}
}
}
+
+ {
+ for (Object *object = main->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
+ }
+ }
+ }
+ else if (object->transflag & OB_DUPLI){
+ object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
+ }
+ else {
+ object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT | OB_DUPLI_FLAG_RENDER;
+ }
+ }
+ }
}
static void do_version_layer_collections_idproperties(ListBase *lb)
@@ -856,28 +888,4 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
-
- {
- if (!DNA_struct_elem_find(fd->filesdna, "Object", "char", "duplicator_visibility_flag")) {
- for (Object *object = main->object.first; object; object = object->id.next) {
- if (object->particlesystem.first) {
- bool show_emitter = false;
- for (ParticleSystem *psys = object->particlesystem.first; psys; psys=psys->next) {
- show_emitter |= (psys->part->draw & PART_DRAW_EMITTER) != 0;
- }
-
- object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
- if (show_emitter) {
- object->duplicator_visibility_flag |= OB_DUPLI_FLAG_RENDER;
- }
- }
- else if (object->transflag & OB_DUPLI){
- object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT;
- }
- else {
- object->duplicator_visibility_flag = OB_DUPLI_FLAG_VIEWPORT | OB_DUPLI_FLAG_RENDER;
- }
- }
- }
- }
}
More information about the Bf-blender-cvs
mailing list