Fixed bug importing animations into existing ThangTypes that had only containers.

This commit is contained in:
Nick Winter 2014-03-08 15:04:11 -08:00
parent 5bde534757
commit b3964571e1
2 changed files with 5 additions and 2 deletions

View file

@ -2,7 +2,10 @@ module.exports = class SpriteParser
constructor: (@thangTypeModel) ->
# Create a new ThangType, or work with one we've been building
@thangType = _.cloneDeep(@thangTypeModel.attributes.raw)
@thangType ?= {shapes: {}, containers: {}, animations: {}}
@thangType ?= {}
@thangType.shapes ?= {}
@thangType.containers ?= {}
@thangType.animations ?= {}
# Internal parser state
@shapeLongKeys = {}

View file

@ -316,7 +316,7 @@ module.exports = class ThangTypeEditView extends View
@thangType.set 'actions', undefined
@clearDisplayObject()
@treema.set('/', @getThangData())
getThangData: ->
data = _.cloneDeep(@thangType.attributes)
data = _.pick data, (value, key) => not (key in ['components'])