Forum

Project Manager: Additional HTML files

28 July 2017 02:03
Project Manager automatically creates html/css/js files only once at the time of project creation. If I later add a blend file to the project, I have to manually export the json and manually create html/js files. My intention is to have each scene in a separate html/js file rather than pack everything in one file. This is to reduce load time at the start of the project.

Also user will only load a scene if he chooses it and need not load all the scenes.

But creating the html/js files manually and changing the path names is a real pain in the ***

I am using version 1704
28 July 2017 03:42
Would it help to keep the same HTML and JS, then load various scenes? I once did a large project that had 20 or so little scenes that I just loaded on demand. The project used the JSON web player but you should be able to do the same thing.
28 July 2017 13:53
Ok.
I have about 5 scenes.
I am doing this:

var scene=require("scenes");
….
scene.set_active("Scene.005");
var scenename=scene.get_active();
var currcam = scene.get_active_camera();
var camname=scene.get_object_name(currcam);
window.alert(scenename);
window.alert(camname);

I am getting the correct scene name(Scene.005) and camera name(Camera.005).

But problem is, the view is not changing. It is stuck in "Scene.001" which is the first(default) scene.
01 August 2017 12:40
My intention is to have each scene in a separate html/js file rather than pack everything in one file. This is to reduce load time at the start of the project.
Also user will only load a scene if he chooses it and need not load all the scenes.
Hi, are you talking about dynamic loading? In that case you just need only json/bin files exported from a blend scene. They can be used with the data.load/data.unload methods. There's a dedicated tutorial here: Furnishing a Room Part 1: Dynamic Loading.

But problem is, the view is not changing. It is stuck in "Scene.001" which is the first(default) scene.
scene.set_active doesn't change the view automatically, in fact you can't do it at all. If you want to change the view, you have to do it manually by placing the camera from the default scene into the position of other cameras. I think you can do it via the get_tsr/set_tsr methods:

var m_scenes=require("scenes");
var m_trans = require("transform");

var main_cam = m_scenes.get_active_camera();
var another_cam = m_scenes.get_object_by_name("Camera.005");

var cam_tsr = m_trans.get_tsr(another_cam);
m_trans.set_tsr(main_cam, cam_tsr);
 
Please register or log in to leave a reply.