Render from partially-completed prerendered spritesheet correctly, fix #3641

This commit is contained in:
Scott Erickson 2016-08-22 11:45:37 -07:00
parent 0cef562d9b
commit 136d274d54

View file

@ -358,6 +358,9 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
prerenderedSpriteSheet = thangType.getPrerenderedSpriteSheet(colorConfig, 'segmented')
if prerenderedSpriteSheet and not prerenderedSpriteSheet.loadedImage
return
else if prerenderedSpriteSheet
animations = prerenderedSpriteSheet.spriteSheet._animations
renderedActions = _.zipObject(animations, _.times(animations.length, -> true))
containersToRender = thangType.getContainersForActions(actionNames)
#console.log 'render segmented', thangType.get('name'), actionNames, colorConfig, 'because we do not have prerendered sprite sheet?', prerenderedSpriteSheet
spriteBuilder = new SpriteBuilder(thangType, {colorConfig: colorConfig})
@ -367,7 +370,7 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
container = new createjs.Sprite(@spriteSheet)
container.gotoAndStop(containerKey)
frame = spriteSheetBuilder.addFrame(container)
else if prerenderedSpriteSheet
else if prerenderedSpriteSheet and renderedActions[containerGlobalName]
container = new createjs.Sprite(prerenderedSpriteSheet.spriteSheet)
container.gotoAndStop(containerGlobalName)
scale = @resolutionFactor / (prerenderedSpriteSheet.get('resolutionFactor') or 1)