Форум

Сообщения, созданные пользователем danielsvane
13 мая 2016 18:55
Thanks, I should be able to use this
11 мая 2016 23:06
I have a file upload system, where the files are renamed to a md5 hash to avoid naming conflicts. My problem is that the .bin file has to be the same name as the .json file (also same location). Is there some way to specify the .bin file location? I am loading the .json using this code:

    let m_app    = b4w.require("app");
    let m_data   = b4w.require("data");

    m_app.init({
        canvas_container_id: "canvas_cont",
        callback: init_cb,
        physics_enabled: false,
        media_auto_activation: false
    });

    function init_cb(canvas_elem, success) {
        m_data.load("../"+jsonFile, load_cb);
    }

    function load_cb(root) {
        m_app.enable_camera_controls();
    }
11 мая 2016 00:12
Okay I managed to solve it using:
b4w.require("main").reset()

It's a documented feature, though very hard to find:
https://www.blend4web.com/api_doc/module-main.html#.reset
10 мая 2016 21:50
The problem is, unlike traditional webpages, the user actually never leaves. HTML is just removed and added using JS. This code is run every time someone visits a page in my app:

b4w.register("example_main", function(exports, require) {

    var m_app    = require("app");
    var m_data   = require("data");

    exports.init = function() {
        m_app.init({
            canvas_container_id: "canvas_cont",
            callback: init_cb,
            physics_enabled: false,
            media_auto_activation: false
        });
    }

    function init_cb(canvas_elem, success) {
        m_data.load("../"+jsonFile, load_cb);
    }

    function load_cb(root) {
        m_app.enable_camera_controls();
    }

});

b4w.require("example_main").init();


Instead of registering "example_main", should I just maybe remove the loaded scene, and load another one when user enters a different page?
10 мая 2016 21:40
Okay, thanks. I will take a look at it
07 мая 2016 14:36
In my React app, when I go to a page with b4w initiated, then go back and enter the page again, I get multiple errors and warnings in chrome.



This is probably because I run the
b4w.require("example_main")
multiple times. How do i clean the b4w object when changing between pages?
07 мая 2016 04:08
First off, thanks for this great project.

I'm trying to export an animation from Blender, and have it start the whole scene animation when it's loaded. So far I've only been able to start the animation on individual objects using "Apply Default Animation" through Blender.

Any help is appreciated.