【发布时间】:2017-09-12 20:27:35
【问题描述】:
我正在尝试创建包含带有纹理的 SCNScene 的 pod,但出现错误:
SceneKit Error: Failed loading : C3DImage
src:file:///Users/.../Example.app/Templates.scnassets/grid.png
纹理和场景在同一个文件夹中。
我尝试使用 SCNSceneSource 加载
let sceneData = try Data(contentsOf: sceneUrl)
let options = [.overrideAssetURLs: true,
.assetDirectoryURLs: MYPod.bundle().bundleURL
] as [SCNSceneSource.LoadingOption : Any]
let source = SCNSceneSource(data: sceneData, options:options)
scene = (source?.scene(options: options))!
但得到相同的结果(路径不变)
【问题讨论】:
-
您找到解决此问题的方法了吗?
-
非常原始。加载后,如果材质的内容是字符串(纹理名称),构建正确的路径并手动加载UIImage
-
@Андрей Первушин 你能解释更多细节吗
-
您应该使用代码和 if(抱歉伪代码)浏览所有材料 If material.contents.type == String.type { material.contents = UIImage(named:
/material.contents) } -
@Андрей Первушин 谢谢老兄。最后它的作品
标签: cocoapods textures bundle scenekit scnscene