Annotation title instead of number


(Mastwyk42) #1

My current project has a requirement to show the title of the annotation instead of its index number. Is this possible to do?


#2

Not with the native annotations, but you could potentially do something with the Viewer API

https://sketchfab.com/developers/viewer

Here's an example syncing other information with annotations:

https://labs.sketchfab.com/experiments/annotations-sync/


(Shaderbytes) #3

I have some nice abstractions for annotations in my viewer API Utility as well. My Utility only takes one line of code and sets up the viewer and calls all the functions in the api to cache the materials, objects, annotations and animations etc..

I created methods to cycle through the annotations that dont require you to know or pass in any index , also the paging logic is cyclic by default. I also wrote the annotation description onto a new variable on the returned annotation object since by default sketchfab did not engineer that in a user friendly manner. they have the "name" available directly on the object by not the description, for that you have to access another object named content and a variable named "raw" . So I simply wrote that value onto the object with the variable named "description". I also made sure to convert null values to empty strings.

here is an example page :

http://www.shaderbytes.co.za/sketchfab/development/api/examples/example_4.html

you can grab the utility here :

https://github.com/shaderbytes/Sketchfab-Viewer-API-Utility