diff --git a/mdl/generate.ts b/mdl/generate.ts index c29f9e2..fb0f0d8 100644 --- a/mdl/generate.ts +++ b/mdl/generate.ts @@ -773,7 +773,7 @@ function generateRibbonEmitterChunk (ribbonEmitter: RibbonEmitter): string { generateIntPropIfNotEmpty('Gravity', ribbonEmitter.Gravity, 0) + generateIntProp('Rows', ribbonEmitter.Rows) + generateIntProp('Columns', ribbonEmitter.Columns) + - generateIntPropIfNotEmpty('MaterialID', ribbonEmitter.MaterialID) + + generateIntPropIfNotEmpty('MaterialID', ribbonEmitter.MaterialID, undefined) + generateBlockEnd(); } diff --git a/mdl/parse.ts b/mdl/parse.ts index cfc4ddc..08e7c54 100644 --- a/mdl/parse.ts +++ b/mdl/parse.ts @@ -882,7 +882,7 @@ function parseEventObject (state: State, model: Model): void { strictParseSymbol(state, '}'); model.EventObjects.push(res); - model.Nodes.push(res); + model.Nodes[res.ObjectId] = res; } function parseCollisionShape (state: State, model: Model): void { @@ -938,7 +938,7 @@ function parseCollisionShape (state: State, model: Model): void { strictParseSymbol(state, '}'); model.CollisionShapes.push(res); - model.Nodes.push(res); + model.Nodes[res.ObjectId] = res; } function parseGlobalSequences (state: State, model: Model): void { @@ -1173,7 +1173,7 @@ function parseParticleEmitter2 (state: State, model: Model): void { strictParseSymbol(state, '}'); model.ParticleEmitters2.push(res); - model.Nodes.push(res); + model.Nodes[res.ObjectId] = res; } function parseCamera (state: State, model: Model): void { @@ -1310,7 +1310,7 @@ function parseLight (state: State, model: Model): void { strictParseSymbol(state, '}'); model.Lights.push(res); - model.Nodes.push(res); + model.Nodes[res.ObjectId] = res; } function parseTextureAnims (state: State, model: Model): void { @@ -1372,7 +1372,7 @@ function parseRibbonEmitter (state: State, model: Model): void { EmissionRate: null, Rows: null, Columns: null, - MaterialID: null, + MaterialID: 0, Gravity: null, Visibility: null }; @@ -1431,7 +1431,7 @@ function parseRibbonEmitter (state: State, model: Model): void { strictParseSymbol(state, '}'); model.RibbonEmitters.push(res); - model.Nodes.push(res); + model.Nodes[res.ObjectId] = res; } function parseFaceFX (state: State, model: Model): void { @@ -1574,7 +1574,7 @@ function parseParticleEmitterPopcorn (state: State, model: Model): void { model.ParticleEmitterPopcorns = model.ParticleEmitterPopcorns || []; model.ParticleEmitterPopcorns.push(res); - model.Nodes.push(res); + model.Nodes[res.ObjectId] = res; } const parsers = { diff --git a/package.json b/package.json index 341c8ad..3d721ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "war3-model", - "version": "3.1.0", + "version": "3.1.1", "description": "Warcraft 3 model parser, generator, convertor and previewer", "keywords": [ "warcraft3",