weixin_39775428 2020-11-30 16:05
浏览 0

Prototype JS node

in https://github.com/nortikin/sverchok/tree/js_prototype_node

Similar to the existing Script Nodes but using execjs. ExecJS will look in the most common places on your machine to find installed JS runtimes. On my machine it finds Node.JS and thus can execute javascript via the v8 engine. (Probably coffeescript too, it would mean a one-off trans-compile between coffee to js)

I want to see if it's possible to get nice fast code execution with v8 / js by having a precompile step. The exact format of the js file isn't decided yet, but it could potentially look something like:

 js
function inputs(){
    return [
        ['a', {min: 1.0, max: 100.0, default: 5.0, step: 0.1}],
        ['b', {default: 14}],
        ['c', {default: 0.7}]
    ];
}

function outputs(){
    return [['verts', 'v'], ['edges', 's']];
}

function sv_proto_main(a, b, c){
    var verts = [],
        edges = [],
        coordinate,
        theta;

    for (var j=0; j<b j theta="j/b" math.pi coordinate="[Math.sin(theta)*c," math.cos verts.push return edges></b>

该提问来源于开源项目:nortikin/sverchok

  • 写回答

0条回答 默认 最新

    报告相同问题?