The Spine Plugin will now work in HEADLESS mode without crashing. Fix #4988

This commit is contained in:
Richard Davey 2020-08-25 14:47:03 +01:00
parent d38cae6682
commit b1929b8579

View file

@ -12,6 +12,7 @@ var ScenePlugin = require('../../../src/plugins/ScenePlugin');
var Spine = require('Spine'); var Spine = require('Spine');
var SpineFile = require('./SpineFile'); var SpineFile = require('./SpineFile');
var SpineGameObject = require('./gameobject/SpineGameObject'); var SpineGameObject = require('./gameobject/SpineGameObject');
var NOOP = require('../../../src/utils/NOOP');
/** /**
* @classdesc * @classdesc
@ -278,6 +279,19 @@ var SpinePlugin = new Class({
this.getAtlas = this.getAtlasCanvas; this.getAtlas = this.getAtlasCanvas;
} }
// Headless mode?
if (!this.renderer)
{
this.renderer = {
width: game.scale.width,
height: game.scale.height,
preRender: NOOP,
postRender: NOOP,
render: NOOP,
destroy: NOOP
};
}
var _this = this; var _this = this;
var add = function (x, y, key, animationName, loop) var add = function (x, y, key, animationName, loop)