06 February 2019 01:15
Hey there, I am attempting to make a web application that takes uploaded photos and places them on a model of a T-shirt, the end goal is eventually to use it as a market place feature. I have the web player working and understand how to export the files, but unfortunately, no matter which way I set up the tex_canvas it just doesn't grab it. The error says "B4W ERROR: Object must be type of mesh." I have downloaded the example blender file online and tried to match the settings, but I am obviously missing something.
My code :
attached is the work I have done, and the original 3ds file I am using. If you can't tell I am trying to get the canvas on the Illustration portion
My code :
function load_data() {
var shirt = m_scenes.get_object_by_name("Shirt");
var ctx_image = m_tex.get_canvas_ctx(shirt, "tex_canvas");
if (ctx_image) {
var img = new Image();
img.src = APP_ASSETS_PATH + "earth.jpg";
img.onload = function () {
ctx_image.drawImage(img, 0, 0, ctx_image.canvas.width,
ctx_image.canvas.height);
m_tex.update_canvas_ctx(shirt, "tex_canvas");
}
}
}
attached is the work I have done, and the original 3ds file I am using. If you can't tell I am trying to get the canvas on the Illustration portion