Viewer API GetTextureList function always return empty


(Pierre Savoie) #1

I saw from another post that you you must use cors enabled picture to use add texture.

I tried the “hacky” way by adding texture on invisible geometry to call them directly from the viewer but my function always return empty.

Does it just return what was called externally?


(Klaasnienhuis) #2

It should give you all the textures in the scene. I’ve used this hack by applying textures to quads and hiding those when the scene is loading. Those textures can be found just fine. Though you need to call the method once the viewer is ready

api.addEventListener( 'viewerready', function() {
    api.getTextureList( function( err, textures ) {
        //do stuff with the textures
    });
});

(Pierre Savoie) #3

Thank you for your help! I will test this as soon as I get the chance and will update if it work.


#4

@pierre.savoie did you get it working?