Fix #114047: Use correct collection during USD import

Ensure that the view layer is properly synced before trying to get the
active collection.

Without the sync, imported objects typically get placed in the global
Scene Collection rather than the new collection that was just created
for the import.

Pull Request: https://projects.blender.org/blender/blender/pulls/114650
This commit is contained in:
Jesse Yurkovich 2023-11-09 20:07:51 +01:00 committed by Jesse Yurkovich
parent 13171183fa
commit 360684d5a4
1 changed files with 1 additions and 0 deletions

View File

@ -173,6 +173,7 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
WM_main_add_notifier(NC_SCENE | ND_LAYER, nullptr);
BKE_view_layer_synced_ensure(data->scene, data->view_layer);
data->view_layer->active_collection = BKE_layer_collection_first_from_scene_collection(
data->view_layer, import_collection);
}