src/scene/structure/to-aframe-elements.js
function getAframeElementsFromSceneStructure(sceneStructure, parent) {
  var collection = parent ? null : [] // use collection or parent
  sceneStructure.forEach(function(element3d) {
    // check if type is supported in aframe
    if (validTypes.indexOf(element3d.type) > -1) {
      // get html attributes from element3d objects
      var el = addEntity({
        attributes: getAttributes(element3d),
        parent: parent
      })
      // the level scene might be baked
      if (element3d.type === 'level') {
        createBakedElement(el, element3d)
      }
      // recursively proceed through sceneStructure
      if (element3d.children && element3d.children.length) getAframeElementsFromSceneStructure(element3d.children, el)
      if (collection) collection.push(el)
    }
  })

  return collection
}
function getAframeElementsFromSceneStructure(sceneStructure, parent) {
  var collection = parent ? null : [] // use collection or parent
  sceneStructure.forEach(function(element3d) {
    // check if type is supported in aframe
    if (validTypes.indexOf(element3d.type) > -1) {
      // get html attributes from element3d objects
      var el = addEntity({
        attributes: getAttributes(element3d),
        parent: parent
      })
      // the level scene might be baked
      if (element3d.type === 'level') {
        createBakedElement(el, element3d)
      }
      // recursively proceed through sceneStructure
      if (element3d.children && element3d.children.length) getAframeElementsFromSceneStructure(element3d.children, el)
      if (collection) collection.push(el)
    }
  })

  return collection
}
function getAframeElementsFromSceneStructure ( sceneStructure , parent ) { var collection = parent ? null : [ ] // use collection or parent sceneStructure . forEach ( function ( element3d ) { // check if type is supported in aframe if ( validTypes . indexOf ( element3d . type ) > - 1 ) { // get html attributes from element3d objects var el = addEntity ( { attributes : getAttributes ( element3d ) , parent : parent } ) // the level scene might be baked if ( element3d . type === 'level' ) { createBakedElement ( el , element3d ) } // recursively proceed through sceneStructure if ( element3d . children && element3d . children . length ) getAframeElementsFromSceneStructure ( element3d . children , el ) if ( collection ) collection . push ( el ) } } ) return collection }
recursive parsing through sceneStructre
recursive parsing through sceneStructre