Best way load multiple json file in same canvas_container
15 March 2016 16:35
Best way load multiple json file in same canvas_container:
this is a method (not good)
all json file 3Dobjects can be show in canvas , but if you use
I guess 3Dobjects in difference scene , default is first.json scene .
how get sec.json > 3Dobjects or thi.json > 3Dobjects
if load multiple json file in same canvas_container , what is the best way?
thanks ++
this is a method (not good)
function load() {
m_data.load("assets/obj/first.json", load_cb);
}
function load_cb(data_id) {
m_data.load("assets/obj/sec.json", secload_cb);
m_data.load("assets/obj/thi.json", thicload_cb);
m_app.enable_controls();
m_app.enable_camera_controls();
}
all json file 3Dobjects can be show in canvas , but if you use
m_scs.get_object_by_name("first.json > 3Dobjects name "); // ok
m_scs.get_object_by_name("sec.json > 3Dobjects name "); // nothing
I guess 3Dobjects in difference scene , default is first.json scene .
how get sec.json > 3Dobjects or thi.json > 3Dobjects
if load multiple json file in same canvas_container , what is the best way?
thanks ++
15 March 2016 17:45
how get sec.json > 3Dobjects or thi.json > 3DobjectsHello!
if load multiple json file in same canvas_container , what is the best way?
You should use the second parameter in get_object_by_name method:
https://www.blend4web.com/api_doc/module-scenes.html#.get_object_by_name.
m_data.load method will return you data_id of loaded scene which you can use to get object.
sec_data_id = m_data.load("assets/obj/sec.json", secload_cb);
...
m_scs.get_object_by_name("sec.json > 3Dobjects name ", sec_data_id);