Fix (unreported) potential assert in viewlayer synchronization.
Some operations, like remapping and ID (Object) to another, can lead to having the same object in more than one base. While this is not a valid state, this is being taken care of by the `BKE_layer_collection_sync` call, so the object-to-base GHash generation itself should be resilient to such issue. Note: another way to fix this would be to make remapping post-process code check explicitely for such doublons, but I would rather avoid adding even more 'specialized' code there, it already has to deal with too many of those corner cases.
This commit is contained in:
parent
626a79204e
commit
339f442a93
|
@ -367,7 +367,13 @@ static void view_layer_bases_hash_create(ViewLayer *view_layer)
|
|||
|
||||
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
|
||||
if (base->object) {
|
||||
BLI_ghash_insert(hash, base->object, base);
|
||||
/* Some processes, like ID remapping, may lead to having several bases with the same
|
||||
* object. So just take the first one here, and ignore all others
|
||||
* (#BKE_layer_collection_sync will clean this up anyway). */
|
||||
void **val_pp;
|
||||
if (!BLI_ghash_ensure_p(hash, base->object, &val_pp)) {
|
||||
*val_pp = base;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue