Forum

User posts stewet
28 April 2019 20:28
Hi Guys!
I couldn't find a solution to the previous question, but the final version - v16.12 - is ready.
Binary to decimal conversion
(I also made the English version - Language and help selection with flags)
http://blender.hu Hungary Blender Community Site
25 April 2019 12:47
Hi Guys!
How do I set up the blend file to show the application in a mobile browser only horizontally?
The last project - 4Bit - Bin to dec conversion - in version 18.05 on my mobile does not appear (S6 - Chrome and S9 - Chrome || In Firefox perfect) That's why I made it in version 16.12 because it appears. Do you have an idea for someone?

I'm glad the forum is running again
http://blender.hu Hungary Blender Community Site
29 December 2017 23:16
Interactive LED
Made in: blender and blend4web
Language: Hungarian

thx b4w team
http://blender.hu Hungary Blender Community Site
29 December 2017 23:11
Interactive Bulb
Made in: blender - blend4web
Language: Hungarian

(in menu: ON OFF switch it does not work yet…)

thx b4w team
http://blender.hu Hungary Blender Community Site
24 November 2017 18:50
Sorry! I solved!
http://blender.hu Hungary Blender Community Site
22 November 2017 22:50
Hi!
My problem:
I would like to turn on/off a LED lamp depending on the checkbox status.

HTML Code:
<body>
  <div id="main_canvas_container"></div>

<!--SLIDER - OPACITY-->
  <div class="header">
  <center>
	<span>L.E.D. OPACITY</span><label id="demo"></label><br>
	<input type="range" id="myRange" style="width:180px" min="20" value="100"><p></p>
  </center>

<!--LIGHT-SWITCH & COLOR PICKER-->
  <div class="footer">
	<div class="glow"><span>LIGHT</span><input class="toggle" type="checkbox" id="light"></div>
	<div class="color"><span>COLOR</span><input type="color" id="color_input" value="#FF0000"></div>
	<div style="clear: both;"></div>
  </div>

	<script>
	   var slider = document.getElementById("myRange");
	   var output = document.getElementById("demo");
	   output.innerHTML = slider.value/100;

	   slider.oninput = function() {
  	   	output.innerHTML = this.value/100;
	   }
	</script>
	
  </div>
</body>

JS Code:
    // place your code here
    var lens = m_scenes.get_object_by_name("lens");
    var nodes = new Array("lens_mat", "RGB");

//OPACITY SLIDER
    var slider = document.getElementById("myRange");
    var output = document.getElementById("demo");
    output.innerHTML = slider.value/100;

	slider.oninput = function() {
   	   output.innerHTML = this.value/100;
	   m_mat.set_nodemat_value(lens, ["lens_mat", "Value"], output.innerHTML)
	}
//COLOR PICKER - HEX to RGB
    $('#color_input').change(function(){
        var rgb = hexToRgb($(this).val());
        $('#demo').text(rgb.r+', '+rgb.g+', '+rgb.b);
        m_objects.set_nodemat_rgb(lens, nodes, rgb.r, rgb.g, rgb.b);
    });

    m_objects.set_nodemat_rgb(lens, ["lens_mat", 'RGB'], 0.8, 0, 0);

//GLOW ON/OFF WITH CHECKBOX (does not work)
function main_canvas_click(e) {
    if (e.preventDefault)
        e.preventDefault();

    var x = e.clientX;
    var y = e.clientY;
    var glow = document.getElementById('light').checked;
    if (glow == false) {
	m_mat.set_nodemat_value(lens, ["lens_mat", "Value"], 0.0);
    }
    else
	m_mat.set_nodemat_value(lens, ["lens_mat", "Value"], 1.0);
}

}


function hexToRgb(hex) {
    var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
    return result ? {
        r: parseInt(result[1], 16)/255,
        g: parseInt(result[2], 16)/255,
        b: parseInt(result[3], 16)/255
    } : null;
}

Material Node:

Light ON (image):

but…
If you click the LIGHT checkbox, (ON status), GLOW will not be displayed. No console error. The transparency and color picker works. Can you help? Thanks
http://blender.hu Hungary Blender Community Site
25 October 2017 11:05
Which version do you use?
What does the console write onto your code?
http://blender.hu Hungary Blender Community Site
24 October 2017 19:42
Test it possibly so:
var scenes = m_scenes.get_all_scenes();
    var scene_names = [];
    for (var i = 0; i < scenes.length; i++)
        scene_names.push(scenes[i]["name"]);

It may be m_scenes.set_active() a name may be his parameter only. (I am not a programmer)
http://blender.hu Hungary Blender Community Site
23 October 2017 16:19
Did you try it on already with API?
var m_scenes = require("scenes");
m_scenes.set_active("Scene");
http://blender.hu Hungary Blender Community Site
11 October 2017 20:26
Thank you everyone
http://blender.hu Hungary Blender Community Site