论坛

由用户创建的信息 aravind90
25 July 2017 06:53
Hi, Is there a way to stop the shot function from screen module from automatically downloading the screenshot? I need it to send the screenshot back to the server, not download it to the user system.
13 May 2017 10:57
I am using blend4web to create a 3D product configurator with a varied set of options that would be live rendered. Blend4web renders this on a canvas. I have built the db in such a way that the product is only created as and when the user creates it putting all the building blocks together on the canvas and paints them with different materials. Once the user configures the product, I want to be capture the rendered product on the canvas as a png and display it in the cart page.

When I right click on the loaded 3D file on canvas and choose "Save Image as..", I get the actual canvas content as a png image. However, when I do the same thing with js in the file or even in console, an empty transparent image is being generated. This issue has been giving me bad headaches for the last couple of days and I haven't found any reason or solution.

I have referred this and edited b4w.min.js so that any getContext("2d") is modified to getContext("2d",{preserveDrawingBuffer: true}). However, the result is still the same.

Console output below. b is an empty image-

    > var a = document.getElementsByTagName("canvas")[0];
a
<canvas width=​"575" height=​"613" style=​"position:​ absolute;​ left:​ 0px;​ top:​ 0px;​ width:​ 575px;​ height:​ 613px;​">​
> b = a.toDataURL();
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj8AAAJlCAYAAAA1uZOmAAAcrUlEQ…GjAwQIECBAgEBKwPhJvVtYAgQIECBAwPjRAQIECBAgQCAl8IPuAmYVHTVbAAAAAElFTkSuQmCC"
12 May 2017 19:29
Hi,

When I right click on the loaded 3D file on canvas and choose "Save Image as..", I get the actual canvas content as a png image. However, when I do the same thing with js in the file or even in console, an empty image is being generated. The purpose of this functionality is simple. I am building a product configurator and would like to generate the product image as and when the product is designed to add in the shopping cart. This issue has been giving me bad headaches for the last couple of days and I haven't found any reason or solution.

I referred this and edited all the getContext instances in b4w.min.js from getContext("2d") to getContext("2d", {preserveDrawingBuffer: true}). But still no change.

Console output below:


var a = document.getElementsByTagName("canvas")[0];
a
<canvas width=​"575" height=​"613" style=​"position:​ absolute;​ left:​ 0px;​ top:​ 0px;​ width:​ 575px;​ height:​ 613px;​">​
b = a.toDataURL();
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj8AAAJlCAYAAAA1uZOmAAAcrUlEQ…GjAwQIECBAgEBKwPhJvVtYAgQIECBAwPjRAQIECBAgQCAl8IPuAmYVHTVbAAAAAElFTkSuQmCC"
12 May 2017 19:17
Any suggestions anyone?
08 May 2017 15:10
As I have mentioned, I need a single preloader for multi-file loading. For example, if I am loading a table design in 4 blend files as table-top, legs, table cloth and table lamp, I want a single preloader that will show that the file is loading until those 4 files are loaded. Using m_data.load("filename.json", load_cb, preloader_cb);, the preloader will start loading for every file separately which is not what is required.
07 May 2017 19:43
Hi, I am designing a configurator where I load multiple component json files with m_data.load(). Now my question is how to create a preloader that shows loading until all these components are loaded?
26 April 2017 19:45
Thanks! I thought data_id is an optional parameter and is basically used only for unloading models and all the objects have to be unqiuely named across files, and was trying to think of a work-around for this. What you say makes a lot more sense! Thank you, made my life much easier.
25 April 2017 19:43
Hi, I am loading multiple json files into a single scene as part of a large configurator. Each of these files has multiple objects. Node materials have been used so that the colors for these materials can be changed dynamically through the api. However after loading the models, get_object_by_name() is unable to find the object even though get_all_objects() shows the object in the list.

Here is my simple code.

function load() {
    m_data.load("assets/webparts/env.json", loaded_env, preloader_cb);
}

function preloader_cb(percentage) {
          m_preloader.update_preloader(percentage);
}
      
function loaded_env(data_id) {
    m_app.enable_camera_controls();
    m_data.load("assets/webparts/back/Pu10RoSt_Cl_back.json", loaded_back);
}

function loaded_back(data_id) {
    m_data.load("assets/webparts/front/Pu10RoSt_Cl_front.json", loaded_front);
}

function loaded_front(data_id) {
    m_data.load("assets/webparts/bottom/Pu10RoSt_St_bottom.json", loaded_bottom);
}

function loaded_bottom(data_id) {
    m_data.load("assets/webparts/insole/Pu10RoSt_top.json", loaded_top);
}

function loaded_top(data_id) {
    set_initial_mats();
}

function set_initial_mats() {
    var object_list = m_scenes.get_all_objects();
    console.log(object_list);
    var _frontclasser = m_scenes.get_object_by_name("front_classer");
    var _backclasser = m_scenes.check_object_by_name("back_classer");
    console.log(_frontclasser);
    console.log(_backclasser);
//    m_mat.set_nodemat_rgb(_frontclasser,["material", "base_color"], color_list["biege"][0],color_list["biege"][1],color_list["biege"][2]);
}


get_all_objects() throws a bunch of objects, of which "back_classer" and "front_classer" are clearly objects present in the scene. But get_object_by_name gives B4W ERROR: get object front_classer: not found: and check_object_by_name gives false. Why is this happening? Am I doing something wrong or is this a bug? get_all_objects() partial output can be seen below.


Object
$q:Array(0)
$s:null
Bx:false
Cd:"back_classer"
Ce:false
Df:null
EC:false
Fv:Array(0)
Hp:""
I:null
Ir:null
J:null
K:Array(1)
Kc:Array(0)
Kg:Object
Le:null
Lj:false
OA:null
Og:null
Oi:"48951b6d7f7a01a6aba41f626aba227e"
Ox:Array(0)
Qf:Array(0)
Ub:""
Wp:Array(0)
Y:null
Yi:true
Zs:Array(0)
al:false
anchor:null
cc:null
fa:Array(0)
fr:null
ig:null
is_character:false
is_dynamic:true
jv:false
lD:false
mk:10
name:"back_classer"
nb:null
o:Object
om:null
parent:null
qm:null
rc:Object
sg:Array(0)
sp:false
type:"MESH"
uu:null
ve:Array(0)
wt:null
xD:Object
xn:false
yl:Array(0)
zq:false
zr:"AUTO"
__proto__:Object