From 453c66367c4e49f6d9bfc3c625527291368c8740 Mon Sep 17 00:00:00 2001 From: 4eb0da Date: Thu, 29 Aug 2024 23:17:41 +0300 Subject: [PATCH] MDL ParticleEmitter2 fixes --- mdl/generate.ts | 5 +++-- mdl/parse.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mdl/generate.ts b/mdl/generate.ts index fb502b1..5b2c115 100644 --- a/mdl/generate.ts +++ b/mdl/generate.ts @@ -432,7 +432,7 @@ function generateGeosetVertexGroup (arr: Uint8Array|Uint16Array): string { if (!arr.length) { return ''; } - + let middle = ''; for (let i = 0; i < arr.length; ++i) { @@ -745,6 +745,7 @@ function generateParticleEmitter2Chunk (particleEmitter2: ParticleEmitter2) { generateIntPropIfNotEmpty('LifeSpan', particleEmitter2.LifeSpan, 0) + generateIntPropIfNotEmpty('TailLength', particleEmitter2.TailLength, 0) + generateIntPropIfNotEmpty('PriorityPlane', particleEmitter2.PriorityPlane, 0) + + generateIntPropIfNotEmpty('ReplaceableId', particleEmitter2.ReplaceableId, null) + (particleEmitter2.Flags & ParticleEmitter2Flags.SortPrimsFarZ ? generateBooleanProp('SortPrimsFarZ') : '') + (particleEmitter2.Flags & ParticleEmitter2Flags.LineEmitter ? generateBooleanProp('LineEmitter') : '') + (particleEmitter2.Flags & ParticleEmitter2Flags.ModelSpace ? generateBooleanProp('ModelSpace') : '') + @@ -868,7 +869,7 @@ function generateBindPose (model: Model): string { } function generateBindPoseChunk (bindPose: BindPose): string { - const middle = generateBlockStart('Matrices', bindPose.Matrices.length, 1) + + const middle = generateBlockStart('Matrices', bindPose.Matrices.length, 1) + bindPose.Matrices.map(item => { return generateTab(2) + generateArray(item); }).join('\n') + '\n' + diff --git a/mdl/parse.ts b/mdl/parse.ts index 08e7c54..ed2ec1e 100644 --- a/mdl/parse.ts +++ b/mdl/parse.ts @@ -1104,7 +1104,7 @@ function parseParticleEmitter2 (state: State, model: Model): void { break; } res[keyword] = parseAnimVector(state, type); - } else if (keyword === 'Variation' || keyword === 'Gravity') { + } else if (keyword === 'Variation' || keyword === 'Gravity' || keyword === 'ReplaceableId' || keyword === 'PriorityPlane') { res[keyword] = parseNumber(state); } else if (keyword === 'SortPrimsFarZ' || keyword === 'Unshaded' || keyword === 'LineEmitter' || keyword === 'Unfogged' || keyword === 'ModelSpace' || keyword === 'XYQuad') {