修复材质序列化后类名出现错误的问题
This commit is contained in:
parent
59703decc4
commit
990dfa2944
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "material-editor",
|
||||
"private": true,
|
||||
"version": "1.0.15",
|
||||
"version": "1.0.16",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user