Bug - assignMaterial error

Hi,

I’m trying to assign a material to a node and have been unsuccessful, when passing the arguments to assignMaterial in accordance with the docs (Viewer API - Functions - Sketchfab) i always get the following error: ‘Couldn’t find node, make sure node.instanceID is set with a proper value’.

After digging through the minified source it seems that the function is expecting a node instead of a nodes instanceId. Trying to pass in the node, no error is returned however nothing happens.

Ive made a codepen with a modified version of the configurator example to demonstrate the problem. Which you can find here:

edit: spelling

Thanks

1 Like

Hi, any news on this it seems the API to AssignMaterial is not working as expected.

Documentation was fixed, thanks for the report!

1 Like

There was a bug on this that was fixed a couple of month ago, does it still have no effect when you use the function with a node?

Thanks thats working now!

Ive updated the codepen. One slight problem is the node doesnt re-render until the camera is moved. Is there any way of forcing a render without a camera move hack? Ive looked though the docs and examples and dont seem to see one.

Thanks again

@will.calderbank in that case you can use api.refreshDraw();
(thanks for the report, We will have to fix so that it’s done by the assignMaterial)