修复材质序列化后类名出现错误的问题
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "material-editor",
 | 
					  "name": "material-editor",
 | 
				
			||||||
  "private": true,
 | 
					  "private": true,
 | 
				
			||||||
  "version": "1.0.15",
 | 
					  "version": "1.0.16",
 | 
				
			||||||
  "type": "module",
 | 
					  "type": "module",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "dev": "vite",
 | 
					    "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: 注意入侵性代码
 | 
					// TODO: Danger: 注意入侵性代码
 | 
				
			||||||
// 疑似是WebCAD中的漏洞,当传入new Database()时,
 | 
					// 疑似是WebCAD中的漏洞,当传入new Database()时,
 | 
				
			||||||
@@ -23,7 +23,12 @@ export function MaterialOut(material: PhysicalMaterialRecord): string
 | 
				
			|||||||
        new Map(),
 | 
					        new Map(),
 | 
				
			||||||
        DuplicateRecordCloning.Ignore
 | 
					        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
 | 
					export function MaterialIn(fileData: Object[]): PhysicalMaterialRecord
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user