docs: sync mesh renderer component docs

This commit is contained in:
2026-04-03 11:50:13 +08:00
parent 6636834b35
commit 2138195b69
13 changed files with 324 additions and 84 deletions

View File

@@ -0,0 +1,34 @@
# MeshRendererComponent::GetMaterialAssetRefs
获取当前所有材质槽的资产引用数组。
```cpp
const std::vector<Resources::AssetRef>& GetMaterialAssetRefs() const;
```
## 返回值
- 返回内部 `m_materialRefs` 的常量引用。
## 行为说明
每个槽位的 `AssetRef` 可能在以下路径里被更新:
- [SetMaterialPath](SetMaterialPath.md) 成功把路径映射到项目资产时
- [SetMaterial](SetMaterial.md) / [SetMaterials](SetMaterials.md) 成功从材质路径回填时
- [Deserialize](Deserialize.md) 直接读到 `materialRefs=` 字段时
- 异步材质兑现后,再按最终路径回填时
## 注意事项
- 这是只读元数据访问器,不会触发加载。
- 数组长度和材质槽数量保持对齐,但某些槽位的 `AssetRef` 可能是无效的。
- `builtin://` 这类虚拟路径、普通运行时路径或当前无法解析到项目资产的路径,通常都不会得到有效 `AssetRef`
## 相关文档
- [返回类型总览](MeshRendererComponent.md)
- [GetMaterialPaths](GetMaterialPaths.md)
- [GetMaterialPath](GetMaterialPath.md)
- [Serialize](Serialize.md)
- [Deserialize](Deserialize.md)