Hey thanks for the report, Interesting it only renders the first few characters especially considering menu's appear to render fine, sounds like another WindowLayer/Window issue, possibly not updating or being stopped by something. Anyway, I've been really busy but I'll defenitly take a deeper look at this once I get the chance/free time.
Thanks to your reply, I've figured somethig out
I've added the following log to Window_Base.prototype.processNormalCharacter:
JavaScript:
Window_Base.prototype.processNormalCharacter = function(textState) {
var c = textState.text[textState.index++];
var w = this.textWidth(c);
console.info("Window_Base.prototype.processNormalCharacter", textState, c, w);
this.contents.drawText(c, textState.x, textState.y, w * 2, textState.height);
textState.x += w;
};
I've also changed the following in Window_Message.prototype.updateMessage:
JavaScript:
Window_Message.prototype.updateMessage = function() {
if (this._textState) {
while (!this.isEndOfText(this._textState)) {
if (this.needsNewPage(this._textState)) {
this.newPage(this._textState);
}
this.updateShowFast();
this.processCharacter(this._textState);
// This part's changed
if (!this._showFast && !this._lineShowFast) {
console.info("Window_Message.prototype.updateMessage !this._showFast && !this._lineShowFast");
// Removing this seems to partially solve the apparent issues
// break;
//
}
if (this.pause || this._waitCount > 0) {
console.info("Window_Message.prototype.updateMessage this.pause || this._waitCount > 0");
// Removing this seems to partially solve the apparent issues
// break;
//
}
//
}
if (this.isEndOfText(this._textState)) {
this.onEndOfText();
}
return true;
} else {
return false;
}
};
While both versions of Window_Message.prototype.updateMessage causes Window_Base.prototype.processNormalCharacter to show the exact same 15 logs(from the 1st 1 to the last 3 with everything logged as correct), the version with some codes commented out can show all characters(also with 15 logs in Window_Message.prototype.updateMessage), while the original one only shows the 1st character.
As for the root cause, I think that the window's updating just fine, otherwise those log added my mine wouldn't be able to log all the 15 characters to be drawn. The difference between the original version and mine is that, the original one draws each character per frame, while mine draws all characters in the same frame, even though they're still drawn one by one.
Also, as Bitmap.prototype.drawText just uses strokeText and fillText from a CanvasRenderingContext2D dom, which doesn't seem to have anything to do with Pixi directly, I wonder if Pixi 5.3.0 has subtly changed some CanvasRenderingContext2D behaviors, causing it to fail to keep drawing in consecutive frames.
Edit: After some more investigation, I think I've finally found the root causes of the issue.
It's that, after every Bitmap draw, be it text, fill rect, blt, etc, the bitmap will become dirty.
Normally, this._baseTexture.update() should be called for the bitmap when it becomes dirty, then that bitmap should become clean again, so subsequent drawing will be allowed.
In Pixi 4.5.4, it's done by calling Sprite.prototype._renderWebGL and TilingSprite.prototype.renderWebGL per frame(the former can be called multiple times per frame).
In Pixi 5.3.0, however, none of them are ever called at all, causing a dirty bitmap to never update its base texture nor become clean again, thus preventing subsequent drawing(that's probably because of _renderWebGL becoming _render and renderWebGL becoming render, which is mentioned in the v5 migration guide).
That's why, drawing everything on the same bitmap all at once on the same frame works fine(the same applies to those window drawings involving creating a new bitmap altogether via createContents), while drawing little by little on consecutive frames fail.
So I'm proposing these additional changes:
rpg_core.js(Around line 4331) -
From:
JavaScript:
Sprite.prototype._renderWebGL_PIXI = PIXI.Sprite.prototype._renderWebGL;
To:
JavaScript:
Sprite.prototype._render_PIXI = PIXI.Sprite.prototype._render;
rpg_core.js(Around line 5935) -
From:
JavaScript:
TilingSprite.prototype._renderWebGL_PIXI = PIXI.extras.PictureTilingSprite.prototype._renderWebGL;
To:
JavaScript:
TilingSprite.prototype._render_PIXI = PIXI.extras.PictureTilingSprite.prototype._render;
Change Sprite.prototype._renderWebGL in rpg_core.js(Around line 4381) to this:
JavaScript:
/**
* @method _render
* @param {Object} renderer
* @private
*/
Sprite.prototype._render = function(renderer) {
if (this.bitmap) {
this.bitmap.touch();
}
if(this.bitmap && !this.bitmap.isReady()){
return;
}
if (this.texture.frame.width > 0 && this.texture.frame.height > 0) {
if (this._bitmap) {
this._bitmap.checkDirty();
}
//copy of pixi-v4 internal code
this.calculateVertices();
if (this.pluginName === 'sprite' && this._isPicture) {
// use heavy renderer, which reduces artifacts and applies corrent blendMode,
// but does not use multitexture optimization
// Edited by DoubleX on GMT 0800 5-Jul-2020 to stop using blend which isn't supported in v5
// this._speedUpCustomBlendModes(renderer); // Blend's not supported in v5.3.0
//
// Edited by DoubleX on GMT 0800 5-Jul-2020 to use batch renderer instead
// renderer.setObjectRenderer(renderer.plugins.picture);
renderer.batch.setObjectRenderer(renderer.plugins.picture);
//
renderer.plugins.picture.render(this);
} else {
// use pixi super-speed renderer
// Edited by DoubleX on GMT 0800 5-Jul-2020 to use batch renderer instead
// renderer.setObjectRenderer(renderer.plugins[this.pluginName]);
renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);
//
renderer.plugins[this.pluginName].render(this);
}
//
}
};
Change TilingSprite.prototype._renderWebGL in rpg_core.js(Around line 6097) to this:
JavaScript:
/**
* @method _render
* @param {Object} renderer
* @private
*/
TilingSprite.prototype._render = function(renderer) {
if (this._bitmap) {
this._bitmap.touch();
this._bitmap.checkDirty();
}
// Edited by DoubleX on GMT 0800 5-Jul-2020 to stop using blend which isn't supported in v5
// this._speedUpCustomBlendModes(renderer);
//
this._render_PIXI(renderer);
};
P.S.: Because the default pixi filter padding has changed from 4 to 0 in v5, I wonder if these are needed as well:
JavaScript:
Sprite.voidFilter.padding = 4;
WindowLayer.voidFilter.padding = 4;
ToneFilter.padding = 4;
P.S.S.: I've just uploaded the rpg_core.js withh my additional changes
