Fix: Assets Browser: asserts on unknown import method values.
Since code expects only known values of `FileAssetSelectParams::import_method`, ensure forward compatibility on file read by defaulting to `FILE_ASSET_IMPORT_FOLLOW_PREFS` when the value is unkown to the current code. ------ Found out while working on forward compatibility for embedded linked IDs project, which introduces a new 'Link Embed' import method. Pull Request: https://projects.blender.org/blender/blender/pulls/139537
This commit is contained in:
committed by
Bastien Montagne
parent
3f97206781
commit
20eff58509
@@ -897,6 +897,18 @@ static void file_space_blend_read_data(BlendDataReader *reader, SpaceLink *sl)
|
||||
}
|
||||
if (sfile->asset_params) {
|
||||
sfile->asset_params->base_params.rename_id = nullptr;
|
||||
/* Code (filebrowser etc.) asserts that this setting is one of the currently known values. So
|
||||
* fallback to FILE_ASSET_IMPORT_FOLLOW_PREFS if it is not (e.g. because of
|
||||
* forward-compatibility while reading a blendfile from the future). */
|
||||
switch (eFileAssetImportMethod(sfile->asset_params->import_method)) {
|
||||
case FILE_ASSET_IMPORT_LINK:
|
||||
case FILE_ASSET_IMPORT_APPEND:
|
||||
case FILE_ASSET_IMPORT_APPEND_REUSE:
|
||||
case FILE_ASSET_IMPORT_FOLLOW_PREFS:
|
||||
break;
|
||||
default:
|
||||
sfile->asset_params->import_method = FILE_ASSET_IMPORT_FOLLOW_PREFS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user