Advanced Lighting 4.0 | Error: Cannot read property 'length' of undefined

PROBLEM SOLVED (At end of the post)


Hi, first of all, thanks in advance and sorry for my cadence of English...

1 - I tested the engine in the "Advanced Lighting Demo 4.0" and it works very well.

2 - I created a new project and installed the 3 Kha's scripts.
3 - I copied the map from the "Advanced Lighting Demo 4.0" to my new project.

When the map load i have the next error:
TypeError Cannot read property 'length' of undefined
​
4 - I look on console and i see the next:
PixiJS 4.5.4 - ✰ WebGL ✰ http://www.pixijs.com/ ♥♥♥


5/C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasUltraLighting.js:1096 2
/C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasUltraLighting.js:1096 4
3/C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasUltraLighting.js:1096 2
/C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasUltraLighting.js:1096 4
rpg_managers.js:1949 TypeError: Cannot read property 'length' of undefined
at WebGLState.setBlendMode (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/libs/pixi.js:18126:17)
at SpriteRenderer.flush (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/libs/pixi.js:22163:33)
at WebGLRenderer.render (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/libs/pixi.js:17529:30)
at Khas_Lighting.update (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasUltraLighting.js:1387:24)
at Khas_Graphics.updateScene (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasUltraLighting.js:1347:40)
at Spriteset_Map.updateKhasGraphics (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasGraphics.js:149:19)
at Spriteset_Map.update (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/plugins/KhasGraphics.js:139:10)
at file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/rpg_scenes.js:262:19
at Array.forEach (native)
at Scene_Map.Scene_Base.updateChildren (file:///C:/Users/mikiito/Documents/Games/Last%20Tear/js/rpg_scenes.js:260:19)rpg_managers.js:1949 SceneManager.catchException
5 - I think the error may be in a lib version incompatibility.
My project use:
* pixi.js - v4.5.4
* Compiled Wed, 23 Aug 2017 10:08:43 UTC​
Kha's Demo use:
* pixi.js - v4.0.3
* Compiled Wed Oct 12 2016 19:18:54 GMT+0300 (RTZ 2 (зима))
​
6 - I deleted my project lib folder and copied the Kha's Demo, then it works perfect. But, does anyone know if it's my problem? Will the kha's engine be updated to work with the new libraries?

----------------------------------------------------------------------------------------

EDITED
Last night I could not find anything about the error, but today I saw that it was already treated.
You can delete the post or maybe, the best option is keep it for someone with the same problem trying to find the problem by the name of the error.

As well indicates Khas (Here...):
MV Update 1.5.1 breaks this plugin! An update is on the way, but you can use this solution (click me!) meanwhile!

SOLUTION (BY NIKE)
Go to your KhasUltraLighting or KhasAdvancedLighting and inside there is a function called Graphics._createRenderer. Replace it with this:
Code:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// * Graphics
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Graphics.kal_createRenderer = Graphics._createRenderer;
  Graphics._createRenderer = function() {
    this.kal_createRenderer();
    if (typeof PIXI.BLEND_MODES != 'undefined') {
      var gl = this._renderer.gl;
      PIXI.BLEND_MODES.KHAS_LIGHT = 31;
      PIXI.BLEND_MODES.KHAS_LIGHTING = 32;
      this._renderer.state.blendModes[PIXI.BLEND_MODES.KHAS_LIGHT] = [gl.SRC_ALPHA, gl.ONE];
      this._renderer.state.blendModes[PIXI.BLEND_MODES.KHAS_LIGHTING] = [gl.ZERO, gl.SRC_COLOR];
    } else {
      throw new PixiOutOfDateError();
    };
  };

Have a good day !
This problem has been fixed on versions 3.2 and 4.2 😀
This problem has been fixed on versions 3.2 and 4.2 😀
I just tried the new version, it works perfectly.
Thanks Khas for your good work.
Hope I can still post on this one, even though it's so late. Tried the same thing in 1.5.2, but I guess since Khas isn't around anymore to fix this (and I can't code my way out of a paper bag) that the problem will persist until further notice?

Original thread: https://forums.rpgmakerweb.com/threads/advanced-lighting-4-0-error-cannot-read-property-length-of-undefined.84893/