[Bf-blender-cvs] [cbd3827] master: Fix T49460: Particle group instance 'Use Count' value gets reset on file-load.
Bastien Montagne
noreply at git.blender.org
Wed Sep 28 15:08:54 CEST 2016
Commit: cbd3827d839b2ff28ae535f674e63611cb1c2c6c
Author: Bastien Montagne
Date: Wed Sep 28 15:06:50 2016 +0200
Branches: master
https://developer.blender.org/rBcbd3827d839b2ff28ae535f674e63611cb1c2c6c
Fix T49460: Particle group instance 'Use Count' value gets reset on file-load.
Regression caused rBbcc863993ad, write code was assuming dw->ob was always valid,
wich is no more the case right after reading file e.g.
Another good example of how bad it is to use 'hidden' dependencies between datablocks. :(
And another fix to be backported to 2.78a. :(((
===================================================================
M source/blender/blenloader/intern/writefile.c
===================================================================
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 49e5255..6678189 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1306,13 +1306,11 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
dw = part->dupliweights.first;
for (; dw; dw = dw->next) {
- /* update indices */
- dw->index = 0;
- if (part->dup_group) { /* can be NULL if lining fails or set to None */
- go = part->dup_group->gobject.first;
- while (go && go->ob != dw->ob) {
- go = go->next;
- dw->index++;
+ /* update indices, but only if dw->ob is set (can be NULL after loading e.g.) */
+ if (dw->ob != NULL) {
+ dw->index = 0;
+ if (part->dup_group) { /* can be NULL if lining fails or set to None */
+ for (go = part->dup_group->gobject.first; go && go->ob != dw->ob; go = go->next, dw->index++);
}
}
writestruct(wd, DATA, ParticleDupliWeight, 1, dw);
More information about the Bf-blender-cvs
mailing list