论坛

由用户创建的信息 klevis
04 January 2016 14:08
In previous Post#5657 we resolved how to get the correct instance reference.
But the initial topic persists - it seems that some resources/objects don't get unloaded.

Loading and unloading different objects (000.json, 001.json, …, 004.json) and a subsequent listing of all objects from the active scene via
m_scenes.get_all_objects()
lists still all prior loaded-and-unloaded objects.



With even more complex objects (geometry-, texture- and shader-wise) it shows on mobile devices by crashing the website after loading and unloading 10-20 objects. The attached project contain simpler/smaller objects with which the crash is not apparent, but the object clogging can be seen/reproduced in console-log.

SceneUnloadingTest.zip

Do I miss something? Please help.
18 December 2015 11:51
Sorry Ivan, yes the message appears, on our 8000/9000 series pc. It works fine, thanks.
Unfortunatelly I checked only on another pc, which shows the same GL_OUT_OF_MEMORY issue, but has a slightly different hardware specification. I attach for you the verbose console of that pc, too:



Perhaps the same fix could be applied for that hardware profile, also.
Please let me know and thank you and the Blend4Web-Team for the automated texture resizing solution, it works fine!
16 December 2015 12:21
Hi Ivan,

is there any news on that topic?

We tried with 15.11 but it is still the same :-/
04 December 2015 18:39
Yes, of course, always very much appreciated.
(This was only a test-project for reproducing/showing my question. Main project will keep track of that)

Thank you Roman!
04 December 2015 18:30
Roman, thank you for clarifying.

Cheers, Daniel
04 December 2015 17:17
Hi @ll,

I want to load, unload and load an object. Therefore I am storing in the 'object loaded callback' the data_id of the object, given as the callback parameter.
This data_id is later-on used to unload the object with
m_data.unload(data_id);

Executing the unload function, the object disappears visually, giving the impression that unloading worked. But reading with
m_scenes.get_all_objects()
all objects, the object name remains still there.

Attached is a small project, in which an environment scene gets dynamically loaded first (the ground plane), and then, by pressing the 'load object'-button, a Torus object is dynamically loaded. By pressing the 'unload object'-button the object unloads "visually". The third button tries to set a shader-node-parameter of the Torus (controlling the level, all above the level shows as gray material, below as black).

There is some, perhaps related/influencing, circumstance occurring: The function
m_scenes.get_object_by_name("Torus")
does not find the Torus object.
(I found the m_scenes.get_active() API call and thought, perhaps there is not marked the right scene as active. But no other scene was available, only the 'EnvironmentScene'-Scene of the first dynamic load. )

In the attached gif is also visible the javascript-console. The shown console-error is the before mentioned 'not finding via get_object_by_name()' function. I left the error-message only for demonstration. The demo behaves the same, when the error-message/cause is commented out.
The searched object instead is found manually by iterating over all objects via
m_scenes.get_all_objects()
and comparing with the object-name. At console message:script.js:92 we see that the Torus is present multiple times and not unloaded.

'A' torus was found (the first in list), and shader-node-parameter-changed (because no further errors arise), but not from the visible one.



Am I missing something to unload (or load) an object properly?
Please help,

SceneUnloadingTest.zip
02 November 2015 19:29
Thank you Ivan, using a sensor in the meantime works like a charm.

02 November 2015 18:31
Thank you Ivan for your quick reply.
02 November 2015 16:24
Hi Ivan, thank you, too.

I've tried it also with append_loop_cb(), now. But it is the same, the camera-smooth-damping is not implied.
02 November 2015 16:17
Thank you Yuri.

Trying your mentioned set_render_callback() works.
But now I'm seeing the 'lag' isn't coming from the previously out-of sync / rendering in different loops - using the set_render_callback unfortunately produces the same effect as before.
It seems that the camera smoothing/damping is the cause of the (as 'lagging' appearing)-effect.

I'm almost sure that I'm accessing the camera-position the wrong way.
I receive 'a' camera-position, but it appears that this position is the target-camera-position, not the real camera position of that moment, because Blend4Webs standard camera behaviour has a (nice) smooth-damping applied.

The way I access the camera position for now:
camObj = m_scenes.get_object_by_name("Camera");
camPos = m_camera.get_eye(camObj);


or also by trying:
camPos = m_trans.get_translation(camObj);


I would like to keep the camera-smooth/damping active (actually don't know neither how to deactivate it),
what is the right way to access 'real'-current camera position (smooth-damping implied)?

Cheers, Daniel.