从Url获​​取storageId

时间:2018-02-15 16:23:48

标签: aframe archilogic 3d.io

有人知道如何从三维模型中获取io3d.storage.getIdFromUrl('https://spaces.archilogic.com/3d/Home_2766/grrodvuu?modelResourceId=cd36dc78-a124-4a4e-9990-35be32415f84') 吗?似乎有这样的方法,但它一直告诉我无效的网址。谢谢!

{{1}}

1 个答案:

答案 0 :(得分:2)

我假设您正在寻找整个烘焙模型的存储ID?

在这种情况下,您可以使用Scene API查找具有bakedModelUrl的子项,该子项是模型的存储ID:

// this is the modelResourceId from the URL you gave in your question
io3d.scene.getStructure('cd36dc78-a124-4a4e-9990-35be32415f84')
  // we select the children
  .then(scene => scene.children)
  // find the child that has a bakedModelUrl
  .then(children => children.find(child => child.bakedModelUrl))
  // read the bakedModelUrl
  .then(level => level.bakedModelUrl)
  // and log it (or do whatever you need to do with it)
  .then(console.log)