From 990dfa2944b7be3887b9416dcd4b8309e5642c99 Mon Sep 17 00:00:00 2001 From: "2817212736@qq.com" <2817212736@qq.com> Date: Tue, 3 Jun 2025 11:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9D=90=E8=B4=A8=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E5=90=8E=E7=B1=BB=E5=90=8D=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/common/MaterialSerializer.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 97b245b..810097b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "material-editor", "private": true, - "version": "1.0.15", + "version": "1.0.16", "type": "module", "scripts": { "dev": "vite", diff --git a/src/common/MaterialSerializer.ts b/src/common/MaterialSerializer.ts index 9837284..4207404 100644 --- a/src/common/MaterialSerializer.ts +++ b/src/common/MaterialSerializer.ts @@ -1,4 +1,4 @@ -import { CADFiler, CADObject, Database, DuplicateRecordCloning, Factory, LayerNode, ObjectId, PhysicalMaterialRecord } from "webcad_ue4_api"; +import { CADFiler, CADObject, Database, DuplicateRecordCloning, Factory, LayerNode, ObjectId, PhysicalMaterialRecord, TextureTableRecord } from "webcad_ue4_api"; // TODO: Danger: 注意入侵性代码 // 疑似是WebCAD中的漏洞,当传入new Database()时, @@ -23,7 +23,12 @@ export function MaterialOut(material: PhysicalMaterialRecord): string new Map(), DuplicateRecordCloning.Ignore ); - return JSON.stringify(db.FileWrite().Data); + let json = JSON.stringify(db.FileWrite().Data); + // // TODO: Danger: 因为WebCAD依赖库中的部分类的构造函数名异常,所以在生成JSON时需要对类名进行替换 + json = json.replace(LayerNode.name, "LayerNode") + .replace(TextureTableRecord.name, "TextureTableRecord") + .replace(PhysicalMaterialRecord.name, "PhysicalMaterialRecord"); + return json; } export function MaterialIn(fileData: Object[]): PhysicalMaterialRecord