index

Übersicht: Blend4Web



With the result of getTimeStamp call, decisions are possible which color to use.

function myclock () {

  // coloring all parts of the clock for a timestamp
  var ts = getTimeStamp ();
  var o = m_scenes.get_object_by_name('seconds');
  if(ts['seconds'] == 0){
    m_mat.set_nodemat_rgb(o, ['Material','RGB'], .9, .2, 0);
  }else{
    m_mat.set_nodemat_rgb(o, ['Material','RGB'], 0, 0.2, .9);
  }

  var objs = m_scenes.get_all_objects();
  for (var i in objs) {
    var name = objs[i].name;
    var o = m_scenes.get_object_by_name(name);
    if(name.indexOf('minute_') == 0){
      if (ts[name] == true){
        m_mat.set_nodemat_rgb(o, ['Material','RGB'], .9, .7, .1);
      } else {
        m_mat.set_nodemat_rgb(o, ['Material','RGB'], .4, .8, .4);
      }
    };
    if (name.indexOf('hour_') == 0){
      if (ts[name] == true){
        m_mat.set_nodemat_rgb(o, ['Material','RGB'], .7, .25, .9);
      } else {
        m_mat.set_nodemat_rgb(o, ['Material','RGB'],  .4, .8, .4);
      }
    };
  }
}

Errors

There is one missing element, but the first errors can be corrected very quickly In the first case, a library m_scenes is missing. Add a missing library is easy.

Nummer 1

/blend4web/berlin-clock/bc_error_m_scenes.png

var m_scenes    = require("scenes");

Nummer 2

An other library is missing: m_mat. Same procedure...

/blend4web/berlin-clock/bc_error_m_mat.png

var m_mat       = require("material");

Nummer 3

The next error should no longer occur, one line in the script generator.py is the solution

/blend4web/berlin-clock/bc_error_dyn_obj.png

obj.b4w_do_not_batch = True

A checkbox is marked:

/blend4web/berlin-clock/bc-error-dyn-obj.png

The label has changed somewhat

/blend4web/berlin-clock/bc-error-dyn-obj2.jpg

As you can see very nicely, these twists (renouncements) are sometimes happens

Comments