Interaction with model - Adding material pickers programatically

Hi guys,

I have been testing Shapespark for couple hours and I am really excited about it.
I just wanted to ask if there is some possibility to work with the data programmatically?

I would like to prepare about 80 rooms and each room is going to have about 20 material pickers.

Is it possible to add the material pickers programmatically?

Thank you
Martin

The material picker configuration is stored in a cover.json file in the scene folder (in Documents/Shapespark). We don’t have any direct support for it, but you can write some helper script that would read the cover.json and that would replicate the material picker configs between different pickers.

Hi,

About the cover.json;

Its good that we can do small modifications with updating just this file.

Scenario: We upload the bundles to our FTP, client wants small changes on the picker butons icons, content or placement, We do apply the changes and bundle the tour again, Then we update only the cover.json file online so, we do not need to upload the whole bundle again and again.

In the same scenario;

It is still a time consuming task to bundle the tour with updated icons and just use the cover.json from it.

Is there a way to update cover.json just by doing the changes in editor and saving it? Do we really need to bunle it to get the updated cover.json? @jan

I have tried to use the cove.json which is placed in documents/shapespark/project- but as far as i see, its not being updating realtime by saving the settings in editor?

Thanks!

Hello. Save button from the editor should save new cover.json. Just checked to confirm that icon changes are also correctly stored by Save, and it seems to be the case. Could you check again that you don’t see these changes?

Hi @jan

Here is one screenshot,

I did the change, saved, updated the cover.json on ftp but the result is not similar what i see on editor and online.

The server from the screenshot returns the cover.json with Content-Encoding: gzip header, but the json is not gziped. You can check this in the Chrome developer tools Network tab. The browser fails to load this file and the viewer uses default cover.

The solution is to either gzip cover.json before uploading it (but keeping the name cover.json not cover.json.gz), or chaning the server config in .htaccess to return cover.json without Content-Encoding: gzip.

Hi Jan, thanks for fast solution

Im afraid i am not too much familiar gzip thing. Trying to sortout on my side.

Is it any software which is doing this automaticaly?

You could create a bundle, unzip it and take cover.json from it, it will be gziped. It this acceptable approach, or is creating bundle taking too long in your use case?

Yes, actually for now we are creating bundle if we need to update cover.json or scene.json

Just wanted to know how can we do it faster and simplier.

Creating bundle each and everytime is time consuming and files are getting in mess after a while.

You can upload only cover.json from the bundle to the server, to reduce upload time.

To avoid creating bundle altogether, you could gzip cover.json using some compression program for Windows, for example: https://www.7-zip.org/, rename compressed cover.json.gz back to cover.json, and upload it.

Hi @malo, how did you go with programatically setting up the 80 rooms? Is it possiable?

I’d love to be able to import as many elements as possible from other another software package so that the shapespark workflow is a bit more streamlined.