docs: sync editor viewport host docs
This commit is contained in:
42
docs/api/XCEngine/Editor/Application/ReimportProjectAsset.md
Normal file
42
docs/api/XCEngine/Editor/Application/ReimportProjectAsset.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Application::ReimportProjectAsset
|
||||
|
||||
强制重导单个 project asset,并刷新当前项目的资产索引状态。
|
||||
|
||||
```cpp
|
||||
bool ReimportProjectAsset(const std::string& assetPath);
|
||||
```
|
||||
|
||||
## 当前行为
|
||||
|
||||
- `assetPath` 为空时直接返回 `false`
|
||||
- 否则先取全局 `ResourceManager`
|
||||
- 调用 `resourceManager.Initialize()`
|
||||
- 最后转发到:
|
||||
|
||||
```cpp
|
||||
resourceManager.ReimportProjectAsset(assetPath.c_str())
|
||||
```
|
||||
|
||||
## 底层影响
|
||||
|
||||
`Application` 本身只是宿主层薄包装,真正的重导逻辑在 `ResourceManager` 内部完成。按当前实现,底层会:
|
||||
|
||||
1. `UnloadAll()` 清空已加载资源对象
|
||||
2. 调用 `AssetImportService::ReimportAsset(...)` 强制重建单个资产的 artifact
|
||||
3. 刷新 `ProjectAssetIndex`
|
||||
4. 若能解析出有效 `AssetGUID + relativePath`,则更新 GUID 到路径的记忆映射
|
||||
|
||||
因此这不是“只重写磁盘文件”的静默操作,而是会影响 editor 当前资源查找状态的一次显式缓存维护。
|
||||
|
||||
## 返回值语义
|
||||
|
||||
- 重导链路成功完成时返回 `true`
|
||||
- 路径为空、项目根无效、importer 无法处理该路径或底层导入失败时返回 `false`
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Application](Application.md)
|
||||
- [CanReimportProjectAsset](CanReimportProjectAsset.md)
|
||||
- [ReimportAllProjectAssets](ReimportAllProjectAssets.md)
|
||||
- [AssetDatabase::ReimportAsset](../../Core/Asset/AssetDatabase/ReimportAsset.md)
|
||||
- [ResourceManager](../../Core/Asset/ResourceManager/ResourceManager.md)
|
||||
Reference in New Issue
Block a user