Forum

Javascript changes don't update the fast preview

14 July 2016 20:48
Hi, I'm wondering what I'm doing wrong. I'm stuck with this all afternoon.

I'm working in a project that is in the apps_dev folder and when I change the Javascript code in the file in that folder the result doesn't change at all. Have anyone came up with the same problem? I have tried to reexport and compile but nothing seems to work.

14 July 2016 22:40
Hi,

can be browser cache - make sure it is disabled
The Founder | Twitter | Facebook | Linkedin
15 July 2016 00:40
Well, I'm a bit confused what is happening.

If I try to init the app from the fast preview inside blender it seems to be using and old javascript file but if I start the app from the link in the project manager 'dev:my_app.html' it starts correctly and uses the right js file (the one in the apps_dev/my_app folder). Even then I'm having a strange problem, if I try to import the logic_nodes module (
var m_ln = require("logic_nodes");
) the app fails to initialize and the app hangs on startup with error: Error: Module "logic_nodes" not found. I don't know if I'm asking for a wrong module or what. I'll keep trying…
15 July 2016 11:49
If I try to init the app from the fast preview inside blender it seems to be using and old javascript file
The Fast Preview button only exports your scenes in a tmp folder and loads it in the Scene Viewer, it doesn't touch your JS code.

if I try to import the logic_nodes module (
var m_ln = require("logic_nodes");
) the app fails to initialize and the app hangs on startup with error: Error: Module "logic_nodes" not found.
You can use command "check modules" of the Project Manager to find out missing modules. Your app can fail finding modules if you are using too old version of the Blend4Web engine.
The Founder | Twitter | Facebook | Linkedin
15 July 2016 17:58
I'm still stucked with this issue, tonight I'll give it a try. I'll probably try starting a new project from scratch and then copying the blender file inside the blender/app/folder. I haven't really implemented anything inside the javascript but it just stopped working, I had tried a little debugging to the console and everything was working fine, so I thought it would be a piece of cake to start adding the logic, I'm trying to make a presentation with the parts of a guitar as I am a guitar teacher so I thought it would be easy to just create the logic to clicking a part of the scene the camera zooming to the object (guitar part or whatever) and unhide an annotation with the name and clicking on it get a little explanation… I've been playing with the logic editor and it's fun and easy to do the tricks but now I wanted to get deeper with the javascript, as I think at the end of the day you get more control and in fact is easier to create the overall logic… But… Well, I don't give up and I hope you will soon see a demo over here.
I have a couple of doubts that I still don't get yet:
· Where is the javascript file that is causing the problem? I think it's the way I should go. I'm using Mozilla and I'm gonna try to find the file and delete it. I'm pretty newbie to Windows 7 and I'm a bit lost. Maybe I should change temporarily to Chrome to find out if it's efectively the cache what is messing the thing up.
· The other thing is why the dev:app.html link in the Project Manager loads the proper modified file and doesn't load the logic_nodes module. I have test the modules in the project manager and it does appear. And the other requires that come before load the right way. I'm confused about that.

By the way, thank you very much Yuri for your attention and the greatest congratulations for the blend4web project, I think it's awesome, I've been for years enjoying (and suffering) the Blender software but your work is indeed better in some aspects than the rendering in the Blender Game Engine, which is incredible. I think this approach can change the web completely, I'm a believer, hahaha… Great work, thank you
15 July 2016 18:18
Where is the javascript file that is causing the problem?
it should be located in the blend4web_ce/apps_dev/your_project folder

The other thing is why the dev:app.html link in the Project Manager loads the proper modified file and doesn't load the logic_nodes module.
can you export your project with the Project Manager and attach here for us to take a look?

blend4web project, I think it's awesome
Thanks for your kind words!
The Founder | Twitter | Facebook | Linkedin
15 July 2016 23:57
Hi,

The file is exported in here . I hope the assets are ok and everything…

The thing is: if you look in the apps_dev javascript file there is a log to the console with the present time. When I open the blender file in Blender and start the app from the fast preview the log doesn't show up in the debug (F12) in Mozilla. But in the Project Manager it debugs it ok…

I don't know if in your system is going to work or not, the thing is that if it doesn't work from the Fast Preview it's a little annoying to do it in a strange way I think I should start the project again and import the .blend file, over the weekend I'll try all these things….
18 July 2016 11:34
Hello,

I was able to run your (nice looking) project via Project Manager. I think there is a little confusion on how things work in Blend4Web.

The Fast Preview button in Blender opens your scene but doesn't run your JavaScript code, this is intended behaviour. Instead your scene is loaded into the Scene Viewer which is separate programmed app with its own code. Basically, this button is "for artists".

I'd suggest iterating your development through the Project Manager. Possible workflow can look as follows:

1. open the app JS file and change the app code using your preferred text editor
2. run your app in the browser using the link in the Project Manager (dev: guitar_presentation.html in your case). Use F5 button to reload your app in the browser for iterating
3. Edit your blend file in Blender and export the scene in JSON format. Keep reexporting each time you change something in your scene. Fast Preview button can still be useful for checking your standalone scene.

Hope this helps!
The Founder | Twitter | Facebook | Linkedin
18 July 2016 12:11
Ok, thank you, Yuri. Yes, it is just what I have ended doing. I have a newer version now with a loader that I think it's quite nice and I am starting to go with the script for the user interaction. I have one doubt now:

· Where do I store a javascript file to use from the html file? I have tried to include it in a 'scripts' folder inside the apps_dev/my_project one but I've found out that it doesn't work after compiling. Must I store it in the deploy/assets/my_app directory?
19 July 2016 13:47
Where do I store a javascript file to use from the html file? I have tried to include it in a 'scripts' folder inside the apps_dev/my_project one but I've found out that it doesn't work after compiling. Must I store it in the deploy/assets/my_app directory?
Hello!

JS files may be stored in any folder inside the sdk folder ('scripts' folder inside the apps_dev/my_project one is suitable of course ). You just need to make sure that their passes are specified correctly in your main HTML file.
Blend4Web Team - developer
Twitter
LinkedIn
 
Please register or log in to leave a reply.