Fix: Send more appropriate notification at end of USD/Alembic import

A recent change[1] caused the `NC_SCENE | ND_FRAME` combination to no
longer perform a full Outliner rebuild. However, both Alembic and USD
importers were using this combination. The end result was that the
outliner would not show any of the newly imported objects/collections
until a rebuild was forced some other way (like going into Edit mode on
an object).

Change to use a more appropriate notification that corresponds to the
concept of new IDs being added to the scene instead: `NC_ID | NA_ADDED`

Also, remove the notification being sent from the startjob callback when
creating a new collection. It's unneeded in this situation and it could
be problematic being called from the callback.

[1] b549260aa4

Pull Request: https://projects.blender.org/blender/blender/pulls/115883
This commit is contained in:
Jesse Yurkovich
2023-12-07 10:45:58 +01:00
committed by Jesse Yurkovich
parent 45dcc61fd2
commit 2f0633f5fa
2 changed files with 2 additions and 4 deletions

View File

@@ -664,7 +664,7 @@ static void import_endjob(void *user_data)
break;
}
WM_main_add_notifier(NC_SCENE | ND_FRAME, data->scene);
WM_main_add_notifier(NC_ID | NA_ADDED, nullptr);
report_job_duration(data);
}

View File

@@ -220,8 +220,6 @@ static void import_startjob(void *customdata, wmJobWorkerStatus *worker_status)
DEG_id_tag_update(&import_collection->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(data->bmain);
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);
@@ -454,7 +452,7 @@ static void import_endjob(void *customdata)
MEM_SAFE_FREE(data->params.prim_path_mask);
WM_main_add_notifier(NC_SCENE | ND_FRAME, data->scene);
WM_main_add_notifier(NC_ID | NA_ADDED, nullptr);
report_job_duration(data);
}