what version use require and b4w.require?
09 September 2015 06:00
I noted :
B4W documentation For Application Developers use :
var m_main = b4w.require("main");
var m_data = b4w.require("data");
but blend4web_sdk_free/apps_dev/code_snippets/scripts/camera_animation.js use:
var m_data = require("data");
var m_app = require("app");
var m_cam = require("camera");
var m_cfg = require("config");
var m_ctl = require("controls");
var m_scenes = require("scenes");
var m_main = require("main");
var m_transform = require("transform");
var m_vec3 = require("vec3");
B4W documentation For Application Developers use :
var m_main = b4w.require("main");
var m_data = b4w.require("data");
but blend4web_sdk_free/apps_dev/code_snippets/scripts/camera_animation.js use:
var m_data = require("data");
var m_app = require("app");
var m_cam = require("camera");
var m_cfg = require("config");
var m_ctl = require("controls");
var m_scenes = require("scenes");
var m_main = require("main");
var m_transform = require("transform");
var m_vec3 = require("vec3");
09 September 2015 10:45
Hi.
You can use b4w.require or require (without b4w).
b4w is a global object, it's available from all modules. Also it has got the "require" function to get a module by name.
In the camera_animation.js a new user's module has registered.
In this case you've got the "require" function in you module.
In this example the "hello" function is wrote without a new module registration. In this case you should use b4w.require because you have got no the "require" function.
You can use b4w.require or require (without b4w).
b4w is a global object, it's available from all modules. Also it has got the "require" function to get a module by name.
In the camera_animation.js a new user's module has registered.
b4w.register("camera_animation", function(exports, require) {
var m_data = require("data");
var m_app = require("app");
var m_cam = require("camera");
In this case you've got the "require" function in you module.
In this example the "hello" function is wrote without a new module registration. In this case you should use b4w.require because you have got no the "require" function.
<script>
function hello() {
var m_version = b4w.require("version");
document.body.innerHTML = "Hello, Blend4Web " + m_version.version() + "!";
}
</script>