diff --git a/frontend/src/app/pages/particles/components/properties/properties.component.html b/frontend/src/app/pages/particles/components/properties/properties.component.html index a59ab76..f4e5490 100644 --- a/frontend/src/app/pages/particles/components/properties/properties.component.html +++ b/frontend/src/app/pages/particles/components/properties/properties.component.html @@ -7,18 +7,18 @@
Particle Name - + Display Name - +
Permission name - + Package name @@ -37,14 +37,14 @@ Display Item - +
Lore - +
diff --git a/frontend/src/app/pages/particles/services/particle-manager.service.ts b/frontend/src/app/pages/particles/services/particle-manager.service.ts index 3c54084..5cc973c 100644 --- a/frontend/src/app/pages/particles/services/particle-manager.service.ts +++ b/frontend/src/app/pages/particles/services/particle-manager.service.ts @@ -3,6 +3,7 @@ import * as THREE from 'three'; import {RendererService} from './renderer.service'; import {Particle, ParticleData, ParticleInfo, ParticleType} from '../models/particle.model'; import {IntersectionPlaneService, PlaneOrientation} from './intersection-plane.service'; +import {deepCopy} from '../../../util/deep-copy.util'; /** * Service responsible for managing particles in the scene @@ -281,6 +282,13 @@ export class ParticleManagerService { * Generates JSON output of the particle data */ generateJson(): string { + const particleData = deepCopy(this.particleData) + if (this.particleData.package_permission) { + particleData.package_permission = 'apart.set.' + this.particleData.package_permission.toLowerCase().replace(' ', '-'); + } else { + particleData.package_permission = 'apart.set.none'; + } + particleData.permission = 'apart.particle.' + this.particleData.permission.toLowerCase().replace(' ', '-'); return JSON.stringify(this.particleData, null, 2); } diff --git a/frontend/src/app/util/deep-copy.util.ts b/frontend/src/app/util/deep-copy.util.ts new file mode 100644 index 0000000..39e7fe4 --- /dev/null +++ b/frontend/src/app/util/deep-copy.util.ts @@ -0,0 +1,10 @@ +export function deepCopy(obj: T): T { + // Structured cloning + if (typeof globalThis?.structuredClone === 'function') { + // @ts-ignore + return globalThis.structuredClone(obj) as T; + } + + // Normal objects + return JSON.parse(JSON.stringify(obj)) as T; +}