docs: update resources API docs
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# GetAllDependencies
|
||||
|
||||
获取资源的完整依赖链(递归)。
|
||||
|
||||
## 方法签名
|
||||
|
||||
```cpp
|
||||
Containers::Array<ResourceGUID> GetAllDependencies(ResourceGUID guid) const;
|
||||
```
|
||||
|
||||
## 详细描述
|
||||
|
||||
使用深度优先搜索递归获取指定资源的所有传递依赖项,返回完整的依赖链。返回结果不包括 `guid` 自身,且每个资源 GUID 只出现一次(即使有多个路径依赖该资源)。
|
||||
|
||||
搜索算法使用栈实现 DFS,遍历所有依赖项及其子依赖项。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `guid` | `ResourceGUID` | 要查询的资源的全局唯一标识符 |
|
||||
|
||||
## 返回值
|
||||
|
||||
`Containers::Array<ResourceGUID>` - 完整依赖链的 GUID 数组
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
// 假设依赖关系: A -> B -> C -> D
|
||||
graph.AddNode("A"_guid, ResourceType::Material);
|
||||
graph.AddNode("B"_guid, ResourceType::Texture);
|
||||
graph.AddNode("C"_guid, ResourceType::Image);
|
||||
graph.AddNode("D"_guid, ResourceType::File);
|
||||
graph.AddDependency("A"_guid, "B"_guid);
|
||||
graph.AddDependency("B"_guid, "C"_guid);
|
||||
graph.AddDependency("C"_guid, "D"_guid);
|
||||
|
||||
auto allDeps = graph.GetAllDependencies("A"_guid);
|
||||
// allDeps 包含 ["B", "C", "D"](顺序可能因实现而异)
|
||||
```
|
||||
Reference in New Issue
Block a user