Using Sketchfab API to search and download glTF (to be integrated in Castle Game Engine)

Posted on

Knight glTF model from https://sketchfab.com/3d-models/chunky-knight-f1722ab650ad4d8dbe6fc4bf44e33d38 by thanhtp
Cthulhu model from https://sketchfab.com/3d-models/flying-cthulhu-4737a3b84e00415b9d8bb42ae44285b2 by TooManyDemons
Cthulhu model from https://sketchfab.com/3d-models/flying-cthulhu-4737a3b84e00415b9d8bb42ae44285b2 by TooManyDemons
Apple model from https://sketchfab.com/3d-models/apple-macintosh-608e0f6ce5e9487eb859f48248e1fac4 by tzeshi

This was super-fun and super-quick to develop (thanks to GitHub Copilot) 🙂

I present a sample application that searches Sketchfab and downloads glTF model matching given query string. For extra effect, it even opens the model with view3dscene if it is present on $PATH.

By default it looks for cthutlhu and happily downloads the first result, extracting the ZIP and running view3dscene. From nothing -> Cthulhu 3D model!

Run with some command-line parameter to change the search string, to anything.

The code contains a simple class that downloads from Sketchfab. If you want, you can easily tweak it to download a particular model instead of the first search result. Read the “Usage” description for details.

Start the discussion at Castle Game Engine Forum