diff --git a/package.json b/package.json index de59cef..a66255d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "material-editor", "private": true, - "version": "1.0.18", + "version": "1.0.19", "type": "module", "scripts": { "dev": "vite", diff --git a/src/common/MaterialSerializer.ts b/src/common/MaterialSerializer.ts index 4207404..59e3044 100644 --- a/src/common/MaterialSerializer.ts +++ b/src/common/MaterialSerializer.ts @@ -16,19 +16,24 @@ Database.prototype.AllocationObjectId = function (this: Database, object: CADObj export function MaterialOut(material: PhysicalMaterialRecord): string { - let db = new Database(); - db.WblockCloneObejcts( - [material], - db.MaterialTable, - new Map(), - DuplicateRecordCloning.Ignore - ); - 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; + try { + let db = new Database(); + db.WblockCloneObejcts( + [material], + db.MaterialTable, + new Map(), + DuplicateRecordCloning.Ignore + ); + 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; + } catch (error) { + console.error("error in MaterialOut:", error, material); + throw error; + } } export function MaterialIn(fileData: Object[]): PhysicalMaterialRecord diff --git a/src/components/MaterialAdjuster.vue b/src/components/MaterialAdjuster.vue index 391a70c..c5c2856 100644 --- a/src/components/MaterialAdjuster.vue +++ b/src/components/MaterialAdjuster.vue @@ -139,7 +139,7 @@ const emits = defineEmits<{ (e: 'submit', data: MaterialRequest[]): void; }>(); -const debugMode = ref(true); +const debugMode = ref(false); const _textureSrc = ref(props.textureSrcList); const debugTextureSrc = ref(""); const textureAdjustment = ref({