Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/modals/ModalErrorCancel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defineEmits<{

<template>
<ModalBase :icon="IconExclamation" title="Error">
{{ data.message }}
<div class="whitespace-pre-wrap">{{ data.message }}</div>

<template #actions>
<MyButton
Expand Down
49 changes: 33 additions & 16 deletions src/core/particle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,27 +206,44 @@ function packParticle(
tasks.push({
description: `Packing particle "${name}" texture...`,
async execute() {
for (const { name, transform, groups } of particle.data.effects) {
for (const { name: effectName, transform, groups } of particle.data.effects) {
particleData.effects.push({
name,
name: effectName,
transform,
groups: groups.map(({ count, particles }) => ({
groups: groups.map(({ count, particles }, groupIndex) => ({
count,
particles: particles.map(
({ spriteId, color, start, duration, x, y, w, h, r, a }) => ({
sprite: particle.data.sprites.findIndex(
(
{ spriteId, color, start, duration, x, y, w, h, r, a },
particleIndex,
) => {
const spriteIndex = particle.data.sprites.findIndex(
({ id }) => id === spriteId,
),
color,
start,
duration,
x: { from: x.from, to: x.to, ease: x.ease },
y: { from: y.from, to: y.to, ease: y.ease },
w: { from: w.from, to: w.to, ease: w.ease },
h: { from: h.from, to: h.to, ease: h.ease },
r: { from: r.from, to: r.to, ease: r.ease },
a: { from: a.from, to: a.to, ease: a.ease },
}),
)
if (spriteIndex === -1) {
throw new Error(
[
`Sprite not specified in particle "${name}"`,
`Effect: "${effectName}"`,
`Group: #${groupIndex}`,
`Particle: #${particleIndex}`,
'Please select a sprite for this particle.',
].join('\n'),
)
}
return {
sprite: spriteIndex,
color,
start,
duration,
x: { from: x.from, to: x.to, ease: x.ease },
y: { from: y.from, to: y.to, ease: y.ease },
w: { from: w.from, to: w.to, ease: w.ease },
h: { from: h.from, to: h.to, ease: h.ease },
r: { from: r.from, to: r.to, ease: r.ease },
a: { from: a.from, to: a.to, ease: a.ease },
}
},
),
})),
})
Expand Down