How to replace materials on specific objects

I’m trying to change the materials on specific objects without affecting other objects with the same material.

This is what I’m trying…

const material = viewer.findMaterial("Wood")
const group = viewer.findNodesOfType("Group1")

applyMaterial(material, nodes) {
  nodes.forEach(n => {
    if (n.mesh) {
      viewer.setMaterialForMesh(material, n.mesh)
    applyMaterial(material, n.children)

applyMaterial(material, group)

The code doesn’t seem to change anything. I’m able to change all meshes with a material using findMeshesWithMaterial and then using setMaterialForMesh, but in this case I’d like to target specific meshes instead. I’ve set material and object group to be editable as well.

Is there a step I’m missing? Should this work?

Hi @jan and @wojtek

We’re a bit stuck on this one - is it possible to provide a timeline for a reply? Thanks so much.

It’s not possible to target specific meshes (change material on subset of meshes that use the same material). You would need to create a duplicate materials on meshes that you would like to change before importing your file into shapespark.

Thanks for this reply. Is what we are hoping to achieve something that might be supported by Shapespark in the future? Thanks again.