@@ -1,4 +1,4 @@
import { CADFiler , CADObject , Database , DuplicateRecordCloning , Factory , LayerNode , ObjectId , PhysicalMaterialRecord , TextureTableRecord } from "webcad_ue4_api" ;
import { CADFactory , CADFiler, CADObject , Database , DuplicateRecordCloning , Factory , LayerNode , ObjectId , PhysicalMaterialRecord , TextureTableRecord } from "webcad_ue4_api" ;
// TODO: Danger: 注意入侵性代码
// 疑似是WebCAD中的漏洞, 当传入new Database()时,
@@ -14,9 +14,7 @@ Database.prototype.AllocationObjectId = function (this: Database, object: CADObj
this . idMap . set ( object . Id . Index , object . Id ) ;
}
export function MaterialOut ( material : PhysicalMaterialRecord ) : string
{
try {
export function MaterialOut ( material : PhysicalMaterialRecord ) : string {
let db = new Database ( ) ;
db . WblockCloneObejcts (
[ material ] ,
@@ -29,11 +27,9 @@ export function MaterialOut(material: PhysicalMaterialRecord): string
json = json . replace ( LayerNode . name , "LayerNode" )
. replace ( TextureTableRecord . name , "TextureTableRecord" )
. replace ( PhysicalMaterialRecord . name , "PhysicalMaterialRecord" ) ;
console . debug ( "DEBUG CAD Object Name" , CADFactory [ 'factory' ] . objectNameMap ) ;
console . debug ( "CURRENT PROTOTYPE NAME\n" , "LAYERNODE:" , LayerNode . name , "TEXTURETABLERECORD:" , TextureTableRecord . name , "PHYSICALMATERIALRECORD:" , PhysicalMaterialRecord . name ) ;
return json ;
} catch ( error ) {
console . error ( "error in MaterialOut:" , error , material ) ;
throw error ;
}
}
export function MaterialIn ( fileData : Object [ ] ) : PhysicalMaterialRecord