Forum

Selected Export or Save

26 October 2014 07:58
I have a scene with a dozen objects in it, laid out in their proper positions. To create a JSON file for each object, I need to SAVE each instrument with a Lamp and a Camera to its own Blend file and then Export as JSON. It would would helpful to tag objects within a scene with a unique id and have a "Batch Export to JSON" or a "Batch Save to Blend" files option, where files saved get named according to the Object's Data.

On another note, is it possible to set an object's location when the JSON is loaded?
26 October 2014 09:25
Hi,

do you actually need to save every single object to separate file? If no dynamic loading is required you could prepare the whole scene in Blender and export all the models in bulk as described here.
The Founder | Twitter | Facebook | Linkedin
26 October 2014 18:34
by separating the models, it leaves them available for other applications. Embedding them into the HTML locks them to that one purpose. As an example, having the set for Junk! the Musical laid out as a walk through with all the instruments, but then also having each instrument as their own HTML (as a JSON load) for details about that instrument. Tagging objectA and objectB as INSTRUMENT A, then Export to Tag(s) as JSON or Blend file would be a great option. If JSON Load had not been an option with B4W, I would not have considered it, but since it is an available option, I like the flexibility it offers and would take advantage of the format as often as possible. I have already test exported the entire scene as an HTML at 72 megs in size http://www.trepaning.com/b4w/2014-10-20-instruments.html but would prefer to load everything as separate JSON files.
26 October 2014 19:10
by separating the models, it leaves them available for other applications. Embedding them into the HTML locks them to that one purpose.

Oh I see.

It would would helpful to tag objects within a scene with a unique id and have a "Batch Export to JSON" or a "Batch Save to Blend" files option, where files saved get named according to the Object's Data.

Upon exporting from a blend file to, say, JSON file the latter remembers what was the source blend file. We use this saved file path for bulk exporting all our models and scenes. Automatic reexport is performed using reexporter python script. The same applied to self-contained HTML files as well.

On another note, is it possible to set an object's location when the JSON is loaded?

Yep please take a look at the tutorial. Search for set_translation_v() function.


The Founder | Twitter | Facebook | Linkedin
 
Please register or log in to leave a reply.