Viewer API Changelog

We occasionally update the Viewer API to fix issues and add new features.

You can always find the latest in the Viewer API documentation:

No commenting on this thread

We disabled commenting to keep this thread compact. To reply to a specific change log entry, hover over it and click the ‘Reply as Linked Topic’ link:

image

Subscribe to this thread to receive updates

Would you like to receive an email when we post new entries? Scroll to the bottom of this page, click the ‘Tracking’ button and change it to ‘Watching’.

image

Or use the button below the timeline/scrollbar. That’s all!

16 May 2018 - Version 1.2.0

https://sketchfab.com/developers/viewer/functions

  • New Annotation Events

    • annotationMouseEnter
    • annotationMouseLeaves
    • annotationSelect
  • New Camera Movement Events

    • cameraStart
    • cameraStop
  • New Viewer Events

    • Viewerplay
    • ViewerStop
  • Updated click Event: now fires with null values when clicking on nothing

  • New unselectAnnotation() method: unselect current selected annotation


Subscribe to this thread to receive updates:

6 August 2018 - Version 1.3.0

Viewer API v 1.3 is a pretty big update. You’ll be able to create and edit annotations on the fly, perform raycasting calculations, use new easing options for animations, add video textures, and more!

New

Changes

  • Removes “noAnnotation” event (i.e. returning -1 when entering/leaving an annotation)
  • Hidden nodes can now be transformed while remaining hidden
  • An error will be thrown if the browser has WebGL disabled and the “fallback” 360° viewer loads

Fixes

  • Annotation events now fire correctly from annotation menu clicks
  • Mouse event pick option is now optional (defaults to fast)

Subscribe to this thread to receive updates:

2 Likes

17 December 2018 - Version 1.4.0

New

  • Lights / Env

    • setLight
    • getLight
    • setEnvironment
    • getEnvironment
  • Camera

    • getFov
  • Inspector

    • setShadingStyle
    • getShadingStyle
    • setWireframe
    • getWireframe

Changes

  • The click event is no longer sent if the user drags the camera.
  • Nodes now use stable IDs, so applications are resilient to models being re-uploaded/reprocessed.
  • You can now go to the Static Pose of an animation by passing -1 as the animation ID.

Subscribe to this thread to receive updates:

1 Like

27 March 2019 - Version 1.5.0

:sparkles: :sparkles: :sparkles:

We added some shiny new demos to the documentation pages. You can see each mini-application in action, edit the code in real time, test on your own model, and fork the code to JSFiddle and CodePen to continue working on it.

Check it out here!

:sparkles: :sparkles: :sparkles:

New

Changes

  • addVideoTexture now includes a muted parameter. This allows the video to autoplay by default without being blocked by browsers’ audio policy that require user interaction to play audio.
  • gotoAnnotation now includes a preventCameraMove parameter. This allows you to open an annotation without moving the camera to its position.
  • Added one to setCycleMode, which will play the current animation once and stop.

Subscribe to this thread to receive updates:

4 Likes

10 September 2019 - 1.5.1

Changes

  • Attempting to initialize a deleted or non-existent model URL will correctly throw the client error callback, which is passed a relevant error message

Subscribe to this thread to receive updates:

22 January 2020 - Version 1.6.0

:sparkles: :sparkles: :sparkles:

This version includes quite a lot of changes, mostly focussed on allowing a more customizable annotation and camera limit experience.

We’ve fixed and added several samples, including a fully custom annotation experience with camera limits at each annotation position.

Check it out here!

:sparkles: :sparkles: :sparkles:

New

New URL Parameters

  • Use the annotation_tooltip_visible=0 option to hide annotation tooltips (but not the clickable annotations themselves).
  • Use the api_log=1 option to help find values you need during development. When enabled, data such as background UIDs, environment UIDs, annotation UIDs, and camera limit coordinates will be logged to the browser console.
  • Use the dof_circle=0 option to hide the circle animation / feedback from a click to refocus the camera. This is useful if you are making screenshots or screen recordings from the viewer and you do not want the DoF input feedback visible.
  • Use the wireframe_preload=1 option to force the wireframe to be downloaded, even if it’s not needed as determined by other options (if ui_inspector=0` and the wireframe is not explicitly enabled in 3D Settings, the wireframe file not be downloaded, by default).

New API Methods

  • recenterCamera() - Re-centers the camera based on the model/scene bounding box (the same as double-clicking the background or pressing spacebar in the viewer. Among other things, this can be useful for handing portrait/landscape changes on mobile.
  • setCameraConstraints() - Defines camera limits. To get the camera options as a JS object, try using the ?api_log=1 URL parameter in 3D Settings, for example:
{
   position: [0, -5, 1.7],
   target: [0, 0, 0]
   fov: 45,
   nearFarRatio: 0.005,
   useCameraConstraints: true,
   usePanConstraints: true,
   useZoomConstraints: false,
   usePitchConstraints: false,
   useYawConstraints: false,
   zoomIn: 0,
   zoomOut: 34,
   left: -Math.PI,
   right: Math.PI,
   up: Math.PI/2,
   down: -Math.PI/2
}

New events

  • An error is now sent to the Viewer API in the case of a “WebGL Context Lost” event in the browser.
  • The API will properly handle various 4xx and 5xx HTTP responses and send an appropriate message to the error callback.

Changes

  • getAnimations() - Now returns a list of animations with their uid, name, and duration, in the same order as the animations are saved in 3D Settings.

Fixes

  • The removeAnnotation() method and its callback failed if the index of the annotation to remove was the currently selected annotation.
  • Removes getBackgroundList() and getEnvironmentList() - these functions did not work as expected. Use the ?api_log=1 URL parameter instead.

Subscribe to this thread to receive updates:

5 Likes

6 February 2020 - Version 1.7.0

This version includes UV transformations as well as the ability to highlight a material in the scene with an outline :open_mouth: :rocket:

Check it out here!

New

New API Methods

  • setUVOffset() - Sets an offset for the texture coordinates of the given channel for the given material

  • setUVRotation() - Sets a rotation for the texture coordinates of the given channel for the given material

  • setUVScale() - Sets a scale for the texture coordinates of the given channel for the given material

  • setHighlightOptions() - Sets the outline options

  • highlightMaterial() - Highlights the given material providing the options set with setHighlightOptions


Subscribe to this thread to receive updates:

2 Likes