Inspectors "Show Normals" for a Mesh don't work anymore in Babylon 4.1 and 4.0.3

When using “Show Normals” from Debug tab when selected a Mesh in Inspector, Babylon crashes with following error msg

normalMaterial.ts:144 Uncaught TypeError: this._isReadyForSubMesh is not a function at NormalMaterial../normal/normalMaterial.ts.NormalMaterial.isReadyForSubMesh (normalMaterial.ts:144)

We are running Babylon v4.1 and it has been working fine both in v4.1 and v4.0.3.

But I think I know what the problem is :smiley:! Here it goes:

Inspector uses normalMaterial from a preview version of Babylon (I’m guessing it’s 4.2-alpha): see line 151 in meshPropertyGridComponent.tsx (full path is inspector/src/components/actionTabs/tabs/propertyGrids/meshes/meshPropertyGridComponent.tsx, cant post more than two links since I’m a new user).

normalMaterial has a new update from 4 days ago which added a call to this._isReadyForSubMesh(submesh).
_isReadyForSubMesh seems to be added on pushMaterial in 4.2-alpha however does not exist on pushMaterial in 4.1. I’m guessing the normalMaterial from preview.babylonjs.... inherits from the pushMaterial on the installed version of Babylon, and that’s the reason why it crashes with the error message above.

Unfortunately not reproducible in playground, (I’m guessing inspector for v 4.1 in playground does not use normalMaterial from https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.js)

If this is not a bug, or if my guess at whats happening is not right, please tell, I’m curious what is happening, I tried to figure it out when debugging. Really like the inspector by the way :smiley:

Hello it actually depends how you invoke the inspector. If you are using 4.1, you must make sure to reference the inspector from 4.1 cdn:
https://cdn.jsdelivr.net/gh/BabylonJS/Babylon.js@4.1.0/dist/inspector/babylon.inspector.bundle.js

If you do not do that, the system will pull it from preview (hence the 4.2 version)

1 Like

That makes sense. We have not added the inspector as a dependency. I will try it tomorrow. Thanks!

EDIT: I realized that I just need to set InspectorURL to the URL you posted.

Correct!

Unfourtually, Still don’t work.

Changed the inspector URL and confirm that I run the 4.1 version of the inspector.

However, it seems v4.1 of the inspector still download preview-version of materialLibrary. Resulting in the error from the first post. It looks to me that meshPropertyGridComponent in 4.1 release line 149 downloads preview materials.

Can I set the URL for which materialLibrary the inspector use as well?

Could you add the materials.js in your scripts tag as well ? so that you would be sure to use the right version ?

http://cdn.babylonjs.com/materialsLibrary/babylonjs.materials.js

1 Like

Thanks, missed the fact that the inspector checked if NormalMaterial was loaded before loading preview version. Now is both inspector and MaterialLib correct version. Thanks for the help!

1 Like