Forum

User posts User_123
20 February 2018 12:00
I'm using the latest version 17.12 and tried both approaches, with the same result.

I don't really get what you mean with using b4w.register incorrectly. But maybe I need to get deeper into your api.

Maybe I should avoid the webplayer as basis and start from scratch, in the end it seems to be simpler.
13 February 2018 14:00
I'm sorry, but I cant get it work. I get no errors anymore in console but when I hit the button nothing happends. This is my code at the moment

var el = document.getElementById("testbutton");
if(el){
el.addEventListener('click', function() {
"use strict"
// register the module
b4w.register("module1", function(exports, require) {

var m_logic_n = b4w.logic_nodes;
exports.ChangeCam = function() {
m_logic_n.run_entrypoint("Scene", "ChangeCam");
}
})
});
}


Is there anything more I can do to debug this?
12 February 2018 17:21
How exactly does that work?

At the moment I got the normal "webplayer. html" which got the "webplayer.min.js" loaded. When I now try to load another javascript file with this code to execute the entry point I created:
var m_logic_n   = require("logic_nodes");
function ChangeCam() {
m_logic_n.run_entrypoint("Scene", "ChangeCam");
}


But this doesnt work because "require isn't defined".
12 February 2018 13:46
I'm also interested in this. I've seen your example, but I wonder how I can achive this via normal html buttons with the webplayer.html?

When I'm not mistaken your example only works when you create a user interface in blender directly.

EDIT:
Ok, I looked a little bit deeper and searched through other treads. I think I can achieve the camera moves via html buttons with an "entry point" marked as "run from script". Problem with this, is that I can not use javascript functions/commands when I'm using the webplayer. I have to create project as "custom type". But is there anyway I can use the preprogrammed webplayer interface and just add my buttons and using javascript functions?