Forum

How to convert Logic nodes Functions to editable coding,

07 February 2019 12:09
we are created logic nodes for color change ,camera movement and add parts in object,, but its working only export> blend4web(HTML),, we need to control the object from outside , for that we need to convert the logic nodes to editable codes,

we tried with project manger but we didn't get codes for logic nodes .

please explain us to solve the problem.
07 February 2019 19:45
we need to control the object from outside , for that we need to convert the logic nodes to editable codes,
Yes, if you use pure Logic Nodes, then you can export your project as a simple self-contained HTML, but you will be limited in your interactivity options. The Logic Nodes can communicate with Javascript through the JS_CALLBACK node, however, using that node means having custom javascript in your project and then you cannot export as HTML, you must make a project of the COPY or COMPILE type with its own javascript file.

You say you want to control the object "FROM OUTSIDE", can you explain what exactly you mean by that?
08 February 2019 08:30
Thanks for your replay.
I have attached my query in Power point format. please give your valuable suggestions for us.
08 February 2019 20:01
I think reading the following thread will be helpful to you. It explains which button types there are in B4W with links to examples:

https://www.blend4web.com/en/forums/topic/5009/?page=1#post-22903

My tip for beginners would be to use camera-parented buttons (the SECOND type mentioned in the above post), because these buttons look like HTML buttons but can be used directly with the Select Node and therefore you will not need any javascripting. Changing colors and adding/removing object parts can all be done with Logic Nodes.



However, if you want to use HTML buttons and want them to run your Logic Node actions, the simplest way would be to let the HTML buttons run Entry Points. That means whenever the user clicks a button, an Entry Point Logic Node in your Logic Tree is called. This is still quite simple and only requires a minimal amount of coding for each button, namely the following onClick portion:
<button type="button" onclick="b4w.require('logic_nodes').run_entrypoint('my_scene_name','my_logic_node_name')">Click Me!</button>

If you put this button in your HTML, clicking the button will run the specified Entry Point Logic Node. You only need to fill in the names:
  • "my_logic_node_name" is the name of your Entry Point node - you can rename nodes in the property panel (KEY N) in Blender. Don't forget to check the option RUN FROM SCRIPT in that node because otherwise it will be run right from the start of the scene, which is not what you want!
  • "my_scene_name" is the name of your scene - it's usually simply "Scene" (can be renamed in the menu bar in Blender).
08 February 2019 20:07
I made a little demonstration: "HTML buttons drive Logic Nodes through Entry Points":

LINK

I've attached the project.zip to the post. It also contains the blend file with the Logic Tree.
12 February 2019 07:26
Thanks for your support. Its works like a charm.
 
Please register or log in to leave a reply.