Back to the Shapespark home page

I want to implement a batch change of materials

Hi

I want to implement a batch change of materials.
I have a question about the contents of the API in the following article.

How do I run this API before loading the scene?

To set the returned texture in one of the materials in the scene, the material needs to be marked as editable. This needs to be done before the scene is loaded.

  • Viewer.setAllMaterialsEditable() - marks all materials in the scene as editable.

(Can I create a file from Github and enter it in body-end.html?)
Best regards.

Yes, the code placed in the body-end.html will be executed before the scene is loaded.

You can place example body-end.html files from Github in your scene folder. Some of these files are scene-specific and will need modifications to work with your scene. For example, this file: shapespark-viewer-api/body-end.html at master · shapespark/shapespark-viewer-api · GitHub assumes that the scene contains a material with a name rug.

1 Like