论坛

由用户创建的信息 Ivan Lyubovnikov
02 May 2017 18:23
Hi Ian!
Yes, those modules were added into the engine since the previous release. A more convenient way to fix this is to use the "check modules" command located in the "Operations" column in the Project Manager's interface.

More information can be found here: Updating Saved Projects.
02 May 2017 11:04
Hi, there are some issues in the code. In general, the result of loading should be accessed in the corresponding callback: reader.result in the reader.onload callback and the img content in the img.onload callback, otherwise it can be null/undefined.

However, you can do it in a more simple way without using the FileReader API:
//Display the uploaded texture image on the 3D model by selecting it thru "File upload" Button
fileInput.addEventListener('change', function() {
var file = fileInput.files[0];

var img = new Image();
img.onload = function() {
    ctx_image.drawImage(img, 0, 0, ctx_image.canvas.width, ctx_image.canvas.height);
    m_tex.update_canvas_ctx(cube, "Canvas_TextureNEW");
}
img.src = URL.createObjectURL(file);
28 April 2017 15:53
17.04
В версии 17.04 такого предупреждения уже нет, похоже, что у вас свежий аддон, но устаревший движок. Покажите лучше все, что консоль выводит.
28 April 2017 11:50
B4W WARN: Property "b4w_lod_transition" is undefined for "object". To fix this, reexport
Scene > LOD Smooth Transition > OFF что ещё надо сделать чтобы избавиться от ворнинга?
какая версия движка?
26 April 2017 14:36
Интересная тема, а как это самый модуль сформровать?
Нужен объект, где под именем ресурса хранятся собственно данные этого ресурса. JSON хранится в виде строки, а bin-файл и изображения/звуки конвертируюся в формат base64 и опять же в строку. Вот функция, которая конвертирует бинарные данные:
html_exporter.py
Если составите такой объект, то можно будет отдать его с сервера по запросу в виде JSONа. Модуль "built_in_data" сами регистрируете в приложении и, когда придет ответ с сервера, кладете его в exports["data"] этого модуля.
26 April 2017 11:35
Здравствуйте! В принципе можно так же, как это делается при экспорте в HTML файл. Движок может грузить ресурсы из специального "built_in_data" модуля.

Перед стартом приложения можно указать имя этого модуля:
var m_cfg = require("config");
m_cfg.set("built_in_module_name", "ИМЯ_МОДУЛЯ");

- если не указывать, то будет значение по умолчанию "built_in_data".

Соответственно, перед загрузкой сцены эти данные уже должны быть доступны/скачаны браузером, т.е. данный модуль уже должен быть готов. Он должен быть примерно таким:
b4w.register("built_in_data", function(exports, require) {
exports["data"] = {
    "my_scene.json": ...,
    "my_scene.bin": ...
}
});

Пример того, как это выглядит, можно увидеть в любой экспортированной в html-сцене. Объект, лежащий в exports["data"], можно сформировать на сервере и отдавать браузеру единым файлом. После того, как он скачается, его нужно будет оформить в виде вышеописанного b4w-модуля и только потом начинать загрузку приложения.
Вообще способ довольно хакерский, так что никто не гарантирует, что структура "built_in_data" не изменится при обновлении движка.
26 April 2017 10:45
Hi, in case of multiple dynamically loaded scenes you need to specify a special "data_id" parameter when calling this method, for example:
m_scenes.get_object_by_name("front_classer", 2);

This id is a counter for loaded scenes (or JSONs): for the starting scene and its objects it is 0, for the dynamically loaded and their objects it is 1,2,3,…
Its purpose is to distinguish multiple objects with the same name, because you can load the same JSON file multiple times and thus have many "front_classer" objects.

In your case it will be:
"assets/webparts/env.json" - 0
"assets/webparts/back/Pu10RoSt_Cl_back.json" - 1
"assets/webparts/front/Pu10RoSt_Cl_front.json" - 2
"assets/webparts/bottom/Pu10RoSt_St_bottom.json" - 3
"assets/webparts/insole/Pu10RoSt_top.json" - 4

Also you get "data_id" in the loaded_*** functions as a parameter.
25 April 2017 11:04
Hi Alberto, this method requires the given points to be in the format [X0,Y0,Z0,X1,Y1,Z1…] to draw the segments (X0,Y0,Z0)->(X1,Y1,Z1), (X1,Y1,Z1)->(X2,Y2,Z2) and so on.

So, when you do it like this:
var lugar2 = new Float32Array(m_trans.get_translation(punto2));

you just create the array for only one point - the position of "punto2", so the method doesn't draw anything.

//Get the second empty position in local space (I think)
It's in the world space, so you need to transform it.

If you want to draw a simple line from punto1 to punto2 you should specify their positions in the punto1's local space. The first point is [0,0,0], because punto1 is the origin of its space, and the second can be calculated as follows (if punto1 has the zero rotation and the unit scale):

var m_vec3 = require("vec3");

var pos1 = m_trans.get_translation(punto1);
var pos2 = m_trans.get_translation(punto2);

var pos_local = m_vec3.subtract(pos2, pos1, pos1);


And the drawing call:
var points = new Float32Array(6);
points.set(pos_local, 3);
m_geom.draw_line(punto1, points, false);
24 April 2017 15:47
Могу, куда отправить?
отправьте на саппорт-почту, её адрес есть в ответном письме после покупки лицензии,
по всем вопросам также можете на нее писать
24 April 2017 14:17
м, hardness = 15, я пробовал менять значения, результат тот же
тогда уже непонятно,
можете прикрепить blend-файл, на котором это воспроизведётся?