Back to the Shapespark home page

Material and scene info

Hi,

I have several questions considering the data which can be extracted from API.

1.a) When we set the Material picker for an object, is it possible to somehow get the information about how many times users clicked on certain material?
1.b) Same question goes for Scenes. Is there a way to get info about how many times users clicked on certain scene?
2. Other related question is can we get the info about last users settings (materials selected by Material picker for each object and/or last clicked Scene)?

If there is any way to do these please provide some instructions how it can be done. We couldn’t figure it out form this documentation https://github.com/shapespark/shapespark-viewer-api

Thanks!

1a. This is not documented but you can use the following code https://gist.github.com/wrr/8d24a0004d2cf8d34537bcdcea3e2019 to be notified about material selection.

2b. I understand that by Scenes you refer to Views from the Shapespark editor. Is this the case? The onViewSwitchStarted function from the API documentation: https://github.com/shapespark/shapespark-viewer-api#view-switch allows to detect when the user clicks on a view.

Based on these two callback you would need to implement own counting logic to gather information how many times each material/view was selected. The same applies to 2, if you would like to store the last user selection, you would need to implement the storing logic based on the information from the two callbacks.

Thanks Jan! We will try that and see how it works.

p.s. Yes, I meant Views.