Форум

Сообщения, созданные пользователем Константин Хомяков
06 мая 2016 17:21

НО если нажать на любой другой объект в сцене работать мои кнопки перестают :) Помогите :)
Добрый день!
В ноде "Switch Select" есть выход "Miss". Он отвечает за клик по любым объектам, которых нету в списке объектов ноды. Соответсвенно вам нужно этот выход замкнуть на вход той же самой ноды "Switch Select":


P.S. Классный домик кстати
Команда Blend4Web - разработчик
Twitter
LinkedIn
06 мая 2016 16:46

and how do I add a new socket?
Hello again!

Adding a new socket to the "Switch Select" will be something like this:

bpy.ops.node.b4w_logic_add_dyn_jump_sock('INVOKE_DEFAULT', node_tree="B4WLogicNodeTree", node="B4WLogicNode.002", sock="id1")
#increment number in sock parameter
Команда Blend4Web - разработчик
Twitter
LinkedIn
05 мая 2016 16:35

By the way, I watched the conference video. Congratulations!
Thank you! Really glad to hear!
We won't stop on it!

After searching I was able to create a small tree (as a start):
Great job!

This is okay, I believe, but how do I select an object (the default cube) in Switch_Select
In case of not dupli grouped objects it is simple:

node = … #your node
node.objects_paths['id0'].path = 'Cube' #name of the object


Adding a new socket may be tricky. I'll figure out the optimal way and give you an answer a little bit later
Команда Blend4Web - разработчик
Twitter
LinkedIn
05 мая 2016 11:46

Is there any possibility to do the same with single html output?
Is it possible to keep JS file inside Blender's Text Editor?
No, for now this functionality can only be used in b4w applications with external JS.
Команда Blend4Web - разработчик
Twitter
LinkedIn
05 мая 2016 10:52
Besides you may watch my recent presentation from b4w conference:
https://youtu.be/JPUIe5bi774?t=16508
There is also an example of multi-thread logic tree.
Example scene and B4W Project used in presentation in attachments (you can simply import it in project manager).
Команда Blend4Web - разработчик
Twitter
LinkedIn
05 мая 2016 10:45

I read from the manual that "By using multiple entry points you can create multi-threaded applications."
I wonder how it should work.
Here is what I try to do:
"Start" button makes pendulum work
"x2" button should increase speed by 2
Hello!
You should declare global variable for duration (default R1…R8 variables are local for every thread). And you should also cycle miss outputs of the Switch Select nodes (fixed blend file in attachments):

Команда Blend4Web - разработчик
Twitter
LinkedIn
04 мая 2016 15:57

Thanks!

Another question.
How to make number input field?
I would like that the user can input a number and then the number is used in Blend4Web logic nodes and it affects animation.
Hello!

You can use standard HTML elements for user input.
For example:
 
<form>
  Aniamtion speed:<br>
  <input type="number" name="anim_speed" id="anim_speed"><br>
...
</form>


Then for example if you want to use this input value in node "JS Callback" you should register a callback before loading the scene:

var m_anim = require("anim");
var m_logn = require("logic_nodes");

...

function init_cb(canvas_elem, success) {
    //callback registration 
    m_logn.append_custom_callback("anim_speed", anim_speed_cb);
    load_scene();
}

...

function anim_speed_cb(in_params, out_params) {
    var inp_speed = document.getElementById("anim_speed").value;
    ...
    m_anim.set_speed(obj, inp_speed);
}


Then you can add a "JS callback" logic node to your tree and specify an id of your callback in it.


So this node will execute anim_speed_cb function.

Команда Blend4Web - разработчик
Twitter
LinkedIn
04 мая 2016 11:45
Hello and welcome to our forum!

Sorry for delayed answer, we were really busy with b4w conference stuff.
Video https://www.youtube.com/watch?v=8tELJBf53Kc shows how to add and link Cycle nodes in Blender by using Python. Unfortunately I can't figure out how to do this for B4W logic nodes. Could somebody give me an example?
Of course you can add b4w logic nodes via Python scripting.
For example the next code snippet will add "move to" node to logic the tree named "B4W_LogicTree":

node = bpy.data.node_groups['B4W_LogicTree'].nodes.new(type='B4W_logic_node')
node.type = 'MOVE_TO'

I can't describe all aspects of the question in one answer. So if you are interested in this topic in general you should take a look at "logic_node_tree.py" to learn about our logic nodes inner structure. This file is a part of our Blender addon.
If you have certain task or question, I will answer more concrete
Команда Blend4Web - разработчик
Twitter
LinkedIn
28 апреля 2016 11:18

Hy,
i remember you once told me that the node tree coudn't call JS function ans JS functions coudn't influence node tree.
But i wonder if i start an animation with the node tree can i stop it by calling a JS function?
I wouldn't be modifying the node tree behavior. I was thinking of looping a animation with the don't wait option. But to stop it within the node tree is going to be hell.
So could a stop animation be called from my JS file? Does it sound OK?
Hello!

BREAKING NEWS!!!
There are some new features for integrating Logic Nodes into JS code in our latest B4W Release 16.04. I suppose they may be interesting for you
Команда Blend4Web - разработчик
Twitter
LinkedIn
28 апреля 2016 11:09

Hi,

I would like to launch Node Trees from Blender inside my JS script, is this possible ? For example, I've got a basic animation with vsibility/hide set within a node tree and I would like to launch it with a JS function.
Hello!

Check our latest RC 16.04. There is a feature you were looking for
Команда Blend4Web - разработчик
Twitter
LinkedIn