User posts LukeVideo
23 August 2017 11:17
Funny enough on this page
https://www.blend4web.com/en/community/article/63/
the app works on my machine…. In Firefox.
For support of webgl in fedora you have to go back in 2012 to find anything. The more recent post all being about firefox changing some GL parameter under the hood to avoid more crashes. I don't think that's it. And i'm running X11 not wayland.
And again it all works perfectly fine as long as they are no for loops in custom.js
https://www.blend4web.com/en/community/article/63/
the app works on my machine…. In Firefox.
For support of webgl in fedora you have to go back in 2012 to find anything. The more recent post all being about firefox changing some GL parameter under the hood to avoid more crashes. I don't think that's it. And i'm running X11 not wayland.
And again it all works perfectly fine as long as they are no for loops in custom.js
22 August 2017 14:42
22 August 2017 14:22
22 August 2017 14:12
Hy i had a really bad time trying to get my scene onloader loop over previously loade scenes and i had to use a while loop. My conclusion B4W doesn't support for loops.
So i started a new porject added a simple for loop and it failed to load.
in the broswers console if i type it directly it work :
but if you add it to app.js it fails and B4W never loads.
I attach a simple app to illustrate the problem.
If it come from my setup let mee know. I'm using B4W 17-06 with B3D 2.8c
So i started a new porject added a simple for loop and it failed to load.
in the broswers console if i type it directly it work :
for (i=0; i<9; i++) {
console.log(i)
}
0
1
2
3
4
5
6
7
8
but if you add it to app.js it fails and B4W never loads.
I attach a simple app to illustrate the problem.
If it come from my setup let mee know. I'm using B4W 17-06 with B3D 2.8c
22 August 2017 12:09
22 August 2017 11:07
I cant seem to make my unloader work…
Could someone take a look. They must be somethng pretty obvious.
Here a my logs in the browser. You'll notice a long a the for loop doesn't start i get the callback. That's what loads the scene. But as soon a it starts looping it fails and the callback functins are not called…
EDIT : i have moved the incrementer for data_id_counter to get the right number. It wasn't called often enough here.
Could someone take a look. They must be somethng pretty obvious.
function unloadPrev(){
data_id_counter += 1
console.log('unload');
console.log(data_id_counter);
console.log( m_scenes.get_all_objects("MESH",data_id_counter).length);
console.log( m_scenes.get_all_objects("MESH",data_id_counter))
console.log('#############');
if (data_id_counter > 1){
for (i=1; i < data_id_counter; i ++){
console.log( m_scenes.get_all_objects("MESH",i));
if ( m_scenes.get_all_objects("MESH",i).length > 0 ) {
m_data.unload(i);
}
}
return
}
else {
return
}
}
Here a my logs in the browser. You'll notice a long a the for loop doesn't start i get the callback. That's what loads the scene. But as soon a it starts looping it fails and the callback functins are not called…
unload character:241:10
1 character:242:10
0 character:243:10
Array [ ] character:244:10
############# character:245:10
callback character:266:10
callbackDone character:273:10
callback character:266:10
callbackDone character:273:10
unload character:241:10
2 character:242:10
1 character:243:10
Array [ Object ] character:244:10
############# character:245:10
unload character:241:10
3 character:242:10
0 character:243:10
Array [ ] character:244:10
############# character:245:10
unload character:241:10
4 character:242:10
0 character:243:10
Array [ ] character:244:10
#############
EDIT : i have moved the incrementer for data_id_counter to get the right number. It wasn't called often enough here.
21 August 2017 14:39
21 August 2017 11:41
OK so i'm solving this nice and gently.
In fact i'm pushing all the logic after the object is loaded in the loaded_cb. The question now is how do i keep trace of the object location variable????
Got to find a way…
There you go !
some python magic (positionObject is a empty object )
AND :
templating JS loops with python and keeping track of the scope isn't the easiest trick i've seen today
In fact i'm pushing all the logic after the object is loaded in the loaded_cb. The question now is how do i keep trace of the object location variable????
Got to find a way…
There you go !
some python magic (positionObject is a empty object )
positionObject.{{artefact}} = m_scenes.get_object_by_name("{{artefact.position}}");
to build a object with all my position objects names after the element that going to that positionAND :
function loaded_cb(data_id) {
var scene_object_list = m_scenes.get_all_objects("MESH",data_id);
var positionName = scene_object_list[0].name
m_const.append_copy_trans(scene_object_list[0], positionObject[positionName])
templating JS loops with python and keeping track of the scope isn't the easiest trick i've seen today
21 August 2017 10:57
Ok so it works only never the first time. I need to click twice my loader link to get someting in
Is there a way of forcing a update of that list. Or should i set it in a callback??
var scene_object_list = m_scenes.get_all_objects("MESH",1);
Is there a way of forcing a update of that list. Or should i set it in a callback??
document.getElementById("rightHandedSwordMan").addEventListener("click", function(e) {
e.preventDefault();
console.log('sword_ACbtDLE');
m_data.load( "../media/artefacts/sword_ACbtDLE.json");
var positionObjectsword_ACbtDLE = m_scenes.get_object_by_name("handRightPos");
var scene_object_list = m_scenes.get_all_objects("MESH",1);
console.log(scene_object_list);