Back to the Shapespark home page

How Can I manipulate `MaterialPciker` By Javascript

as an example, I had the MaterialPicker extension in cover.json

{
      "name": "ChangeSytle",
      "toPick": [
        "StyleA"
      ],
      "toReplace": "StyleB",
      "trigger": {
        "color": "#4c9ed9",
        "height": 0.2,
        "icon": "eye-dropper",
        "nodeType": null,
        "opacity": 1,
        "position": [
          -91.72825667632516,
          104.9617961413156,
          5.539977644929642
        ],
        "radius": 0.07,
        "textColor": "#ffffff",
        "type": "sphere"
      },
      "type": "MaterialPicker"
    }

It works fine if I manually click, but as I have a requirement that I need to do the selection of MaterialPicker via javascript, using walk.js, I didn’t find any docs in shapespark-viewer-api. I’d like to know if this is possible, and how exactly, I mean which method(s) I should use?

We are working on adding a new API that will allow to trigger extensions via JavaScript. This API will only allow to open the material picker extension, we don’t have plans to have an API for making the selections via JavaScript.

1 Like