从 Url 获取 storageId

Getting the storageId from Url

有人知道如何通过 3d 模型获得 storageID 吗?好像有这样的方法,但是一直告诉我无效url。谢谢!

io3d.storage.getIdFromUrl('https://spaces.archilogic.com/3d/Home_2766/grrodvuu?modelResourceId=cd36dc78-a124-4a4e-9990-35be32415f84')

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

在这种情况下,您可以使用场景 API 找到带有 bakedModelUrl 的 child,这是模型的存储 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)