You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.5 KiB
36 lines
1.5 KiB
// see e.g. https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/fot-sloan-companion/public/index.html#L806
|
|
// overall newContent() from that branch of Q3/Q4 2024
|
|
function filterLayoutJSON( contentFilename ){
|
|
let file = filesWithMetadata[contentFilename]
|
|
if (!file) return
|
|
|
|
let contentType = file.contentType
|
|
|
|
if ( contentType.includes("json") && contentFilename.endsWith(".layout.json") ) {
|
|
console.warn('not fully implemented yet, only display file name, not their content with the right pose')
|
|
console.log('it is a JSON layout file', contentFilename)
|
|
fetch( contentFilename ).then( r => r.json() ).then( json => {
|
|
console.log( json )
|
|
// could here rely on showFile for each element but maybe some are NOT files
|
|
// different format than previous save
|
|
// must insure that moved also to the right position/rotation after loading
|
|
json.map( i => {
|
|
showFile( i.filename )
|
|
// AFRAME.scenes[0].emit('layoutjsonloaded', contentFilename)
|
|
// would have to wait for any file to be loaded...
|
|
// el.setAttribute("position", AFRAME.utils.coordinates.stringify( i.position ) )
|
|
// el.setAttribute("rotation", AFRAME.utils.coordinates.stringify( i.rotation ) )
|
|
// el.id = i.id
|
|
|
|
})
|
|
|
|
AFRAME.scenes[0].emit('layoutjsonloaded', contentFilename)
|
|
// to use the event consider :
|
|
//AFRAME.scenes[0].addEventListener("layoutjsonloaded", e => console.log(e))
|
|
})
|
|
}
|
|
|
|
applyNextFilter( contentFilename )
|
|
}
|
|
|
|
sequentialFilters.push( filterLayoutJSON )
|
|
|