How to embed a scene in a html

18 February 2016 23:47
Hi everyone,

I was asked to test Blend4Web as a possible solution for a project idea and I really like blend4web.
But, I stuck at this problem.

I would like to use the exported scene data from blend4web *.html export in a different javascript file.

At the moment, in my javascript file I am loading the project data with:
    function load() {
        m_data.load("myproject.json", load_cb, loading_cb);

Now, I was able to get the data out of a exported *.html-file:

b4w.module["built_in_data"] = function(exports, require) {
    exports["data"] = {
        "main.bin": "...",
        "smaa_area_texture.png": "...",
        "main_file": "main.json",
        "main.json": "...",
        "smaa_search_texture.png": "..."

But, how I deliver the data to b4w, instead loading it by a json file?
I tried to find out, where the data in b4w is given to it, but I didn't find it.
So I really would appreciate your help.

Many soo thanks!

19 February 2016 17:27
Hi and welcome to this forum!

The engine looks whether the built_in_data module exists and will load data from this module automatically.

I copied this from webplayer.js:
var module_name = m_cfg.get("built_in_module_name");
var bd = require(module_name);
var file = bd["data"]["main_file"];
m_data.load(file, loaded_callback, preloader_callback, false);
The Founder | Twitter | Facebook | Linkedin
23 February 2016 17:43
Thanks for you help – works like a charm!
Next time I look twice. Sorry for the hassle.

Please register or log in to leave a reply.