Search code examples
autodesk-viewer

Removing textures from Forge model


I am trying to remove textures from my Forge model as in my case I don't need them. I tried following this blog post but none of my materials are returning a "map" parameter, even though there are textures shown in the model. Has there been a change to the API since this was written?


Solution

  • Tested with the latest Viewer (v6.5) and can confirm that API is still valid:

    viewer.addEventListener(viewer.addEventListener( Autodesk.Viewing.TEXTURES_LOADED_EVENT, ()=>{
                let mats = viewer.impl.matman()._materials;
                Object.keys(mats).forEach(k=>console.log(mats[k].map))
    }))
    

    See live sample here.

    Did you wait till all textures are loaded to call the API?