修复材质导出问题,添加库打包模式
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
import { CADFiler, Database, DuplicateRecordCloning, PhysicalMaterialRecord } from "webcad_ue4_api";
|
||||
import { CADFactory, CADFiler, CADObject, Database, DuplicateRecordCloning, ObjectId, PhysicalMaterialRecord } from "webcad_ue4_api";
|
||||
|
||||
// TODO: Danger: 注意入侵性代码
|
||||
// 疑似是WebCAD中的漏洞,当传入new Database()时,
|
||||
// Database中的filer.ReadObject方法并不会为CadObject.objectId赋值,
|
||||
// 导致后续的CadObject.Id.Index发生空指针异常
|
||||
// 因此需要修改CAD中的Database.AllocationObjectId,尝试手动赋值
|
||||
// @ts-ignore
|
||||
Database.prototype.AllocationObjectId = function (this: Database, object: CADObject) {
|
||||
if (object.Id === undefined) object.objectId = new ObjectId(undefined, undefined);
|
||||
// @ts-ignore
|
||||
object.Id.Index = this.idIndex++;
|
||||
// @ts-ignore
|
||||
this.idMap.set(object.Id.Index, object.Id);
|
||||
}
|
||||
|
||||
export function MaterialOut(material: PhysicalMaterialRecord): string
|
||||
{
|
||||
let db = new Database();
|
||||
debugger;
|
||||
db.WblockCloneObejcts(
|
||||
[material],
|
||||
db.MaterialTable,
|
||||
|
Reference in New Issue
Block a user