Skip to content

Instantly share code, notes, and snippets.

@wrr
Last active October 10, 2020 08:54
Show Gist options
  • Save wrr/8d24a0004d2cf8d34537bcdcea3e2019 to your computer and use it in GitHub Desktop.
Save wrr/8d24a0004d2cf8d34537bcdcea3e2019 to your computer and use it in GitHub Desktop.
Detect which material was selected by the material picker
<script>
var viewer = WALK.getViewer();
viewer.onSceneReadyToDisplay(function() {
var setMaterialForMeshOriginal = viewer.setMaterialForMesh;
viewer.setMaterialForMesh = function(material, mesh) {
console.log('Material selected ' + material.name);
setMaterialForMeshOriginal.apply(this, [material, mesh]);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment