13 Jul 2017

Viewer Release Notes: v2.16

Default blog image

CHANGED 

A) Default API calls to derivativeservice/v2/

Autodesk is deprecating viewingservice/v1/ API. To support this change, the Viewer will now fetch all model data from derivativeservice/v2/ by default. The next stage is to have the Viewer communicate with the Model Derivative API by default, and thus align ourselves with Forge. To configure Model Derivative API as the default API, use the following code:

var initOptions = Autodesk.Viewing.createInitializerOptions();

initOptions.api = 'modelDerivativeV2';

Autodesk.Viewing.Initialize( initOptions, onSuccessFn );

B) Remove reliance on browser cookie to Authenticate requests

This change doesn't require developers to do any changes to keep the Viewer working. There is, however, a potential issue application developers may encounter in regards to thumbnails.

Thumbnails

A problem might occur to developers that are initializing an <img> tag with an src value that points to a thumbnail (png/jpeg/jpg) generated by the Model Derivative API.

The cookie change included in this release will result in those images to fail loading the thumbnail with a 401 Unauthorized error.

C) Decoupled MarkupsCore Extension from main bundle

In our previous release notes for Viewer v2.15, we introduced a change to decouple some of the extension code from the main build artifact (viewer3D.min.js) into their own ones.

This time, the MarkupsCore extension received the same treatment and is now no longer part of the main build artifact.

As a reminder, code using the MarkupsCore extension will have to be updated to accommodate the change:

Before

var result = viewer.loadExtension('Autodesk.Viewing.MarkupsCore');

if (result === true) {

   var extension = viewer.getExtension('Autodesk.Viewing.MarkupsCore');

   console.log('MarkupsCore extension is ready to be used!');

}

Now

var promise = viewer.loadExtension('Autodesk.Viewing.MarkupsCore'); // async fetch from server

promise.then(function(extension){

   console.log('MarkupsCore extension is ready to be used!');

});

 

ADDED

D) New First Person Walk experience

This release includes a new version of the First Person Walking tool. At this point, we are simply calling it the New First Person Walking too.

The First Person Walk tool exists to help end users navigate BIM models, by providing a combination of keyboard and mouse controls.

The New First Person Walk tool features floor detection, navigation between floors, teleportation (double click) and new UI to display changes in speed. Give it a try and let us know your feedback!

How to use it

The New First Person Walk tool can be enabled by end users through the Navigation Settings checkbox:

Prop

The checkbox setting will persist across sessions.

From there, the same toolbar icon will now enable the New First Person walk tool. The tool-tip will be different:

2

On first usage, end users will be prompted with a guide to help them get started with it:

nav

You can access the guide any time by pressing the top right button while the New First Person Walk tool is active:

4

 

Please try the New First Person Walk tool and give us your feedback!

E) Markup Editing API

In an effort to continue supporting BIM Docs efforts, the Markup extension API has been extended to support editing of loaded markups.

How it works

The MarkupsCore extension exposes method enterEditMode(), which has been enhanced to allow editing of layer that contains loaded markups.

// string with markups data generated with markupsExt.generateData()

var modelMarkups = '...';


// Load the markups extension

viewer.loadExtension('Autodesk.Viewing.MarkupsCore').then(function(markupsExt){

   markupsExt.show();

   markupsExt.loadMarkups(modelMarkups, "layerA"); // Load markups onto "layerA"

   markupsExt.enterEditMode("layerA");             // Allow editing of markups in "layerA"

})

From there, an end user will be able to modify markups!

Developers can get the modified markups data by doing:

var modifiedMarkups = markupsExt.generateData();

markupsExt.leaveEditMode(); // Prevent further modifications to the markups onscreen

There is also a new method that reverts all changes done to a loaded set of markups:

markupsExt.revertLayer("layerA"); // Restores markups from "layerA" to their loaded state

 

F) ViewCube Triad

A new function has been added to the the ViewCube, which allows to display labeled axis lines. 

The code is available at the GuiViewer3D level:

viewer.showViewCubeTriad(true);

And it looks like this:

cubes

G) ViewCube reflects camera projection

Another small improvement to the ViewCube is that it will now get rendered using the same camera projection the Viewer is using:

perview

 

H) Pivot Customization

Whenever a user orbits (rotates) the camera, it does so centered at a point, the pivot point.

The Viewer has always displayed this pivot point as a green dot (small sphere) while the rotation is taking place.

This version includes a couple functions to customize the Pivot.

Customization

Code

Notes

Size viewer.utilities.setSize(2) A size of 1 maps to the default size.
Color viewer.utilities.setPivotColor(0xFF0000, 1) Separate arguments for RGB-color and opacity

See below an image comparing the default pivot and a customized pivot, using the code from the above table.

Default Pivot

Customized Pivot

defa

custom

 

I) Add support for run-time loaded locale files

A new function is being exposed, which allows 3rd party extensions to add additional localization strings for the Viewer to use.

In your extension code, you can now make use of function extendLocalization(), here's how to use it:

// Create a custom extension

function MyAwesomeExtension(viewer, options) {

  Autodesk.Viewing.Extension.call(this, viewer, options);

}

MyAwesomeExtension.prototype = Object.create(Autodesk.Viewing.Extension.prototype);

MyAwesomeExtension.prototype.constructor = MyAwesomeExtension;

// Define what are the localization strings to add...

var locales = {

  en: {

    "Hello": "Hello!",

  },

  es: {

    "Hello": "Hola!",

  },

};

// Add locales during extension's loading phase

MyAwesomeExtension.prototype.load = function() {

  this.extendLocalization(locales);

  return true;

};

 FIXED

  • Fixed some issues with z-fighting
  • Fixed missing info button.
  • Fixed navigation issue where a pan command would result in very big jumps.
  • Fixed issue with sectioning where the 3D UI would incorrectly change size.
  • Fixed issue where some transparent objects disappears on zoom.
  • Fixed issue where some transparent objects would display as opaque right after loading the model.
  • Fixed issue in iOS where rotating the phone while in Fullscreen mode would result in an inconsistent state.
  • Fixed issue where turning ambient shadows on would result in some far-away geometry to disappear.
  • Fixed some rendering issues related to ambient occlusion.

 

 

 

 

 

Related Article