From 9f64033b6b5cc32064b8879e2258d5de3c794d01 Mon Sep 17 00:00:00 2001 From: zc <14204416+zhangconging@user.noreply.gitee.com> Date: Fri, 2 Aug 2024 02:25:51 +0000 Subject: [PATCH] =?UTF-8?q?!2942=20=E4=BC=98=E5=8C=96:=E5=AF=B9=E9=94=81?= =?UTF-8?q?=E5=AE=9A=E6=9D=90=E8=B4=A8=E7=9A=84=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=8F=AF=E6=9B=BF=E6=8D=A2=E6=9D=90?= =?UTF-8?q?=E8=B4=A8=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/Entity/Entity.ts | 12 +++++++++- src/DatabaseServices/Entity/EntityRef.ts | 22 +++++++++++++++++-- .../Room/Entity/Wall/Hole/RoomHolePolyline.ts | 22 +++++++++++++++++-- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/DatabaseServices/Entity/Entity.ts b/src/DatabaseServices/Entity/Entity.ts index 67aecf3b5..d4cb3692b 100644 --- a/src/DatabaseServices/Entity/Entity.ts +++ b/src/DatabaseServices/Entity/Entity.ts @@ -1,3 +1,4 @@ +import { Intent } from '@blueprintjs/core'; import { Frustum, Material, Matrix3, Matrix4, MeshStandardMaterial, Object3D, Vector3 } from 'three'; import { iaop } from 'xaop'; import { HostApplicationServices } from '../../ApplicationServices/HostApplicationServices'; @@ -11,6 +12,7 @@ import { GetBox, IdentityMtx4, UpdateBoundingSphere, equaln, equalv3 } from '../ import { Vec3 } from '../../Geometry/IVec3'; import { IntersectOption } from '../../GraphicsSystem/IntersectWith'; import { RenderType } from '../../GraphicsSystem/RenderType'; +import { AppToaster } from '../../UI/Components/Toaster'; import { AutoRecord } from '../AutoRecord'; import { Factory } from '../CADFactory'; import { CADFiler } from '../CADFiler'; @@ -138,7 +140,15 @@ export class Entity extends CADObject SetMaterialAtSlot(mtl: ObjectId, slotIndex?: number) { - if ((this.Material?.Object as PhysicalMaterialRecord)?.IsMaterialLock) return; + if ((this.Material?.Object as PhysicalMaterialRecord)?.IsMaterialLock) + { + AppToaster.show({ + message: "该模型材质已锁定,无法更换!", + timeout: 5000, + intent: Intent.WARNING, + }, "material_lock"); + return; + } this.Material = mtl; } diff --git a/src/DatabaseServices/Entity/EntityRef.ts b/src/DatabaseServices/Entity/EntityRef.ts index eb149555a..5f44d8988 100644 --- a/src/DatabaseServices/Entity/EntityRef.ts +++ b/src/DatabaseServices/Entity/EntityRef.ts @@ -1,3 +1,4 @@ +import { Intent } from "@blueprintjs/core"; import { Box3, Group, Matrix3, Matrix4, Mesh, MeshPhongMaterial, MeshPhysicalMaterial, Object3D, Vector3 } from "three"; import { BoxLine } from "../../Add-on/testEntity/BoxLine"; import { ConverMaterial2, ParseBoxUrl, ParseFBXUrl, UE_FBX_LOADER } from "../../Add-on/testEntity/ParseMaterialImage"; @@ -11,6 +12,7 @@ import { Box3Ext } from "../../Geometry/Box"; import { equalv3 } from "../../Geometry/GeUtils"; import { RenderType } from "../../GraphicsSystem/RenderType"; import { IndexedDbStore, StoreName } from "../../IndexedDb/IndexedDbStore"; +import { AppToaster } from "../../UI/Components/Toaster"; import { Factory } from "../CADFactory"; import { CADFiler } from "../CADFiler"; import { ObjectId } from "../ObjectId"; @@ -181,7 +183,15 @@ export class EntityRef extends Entity SetMaterialAtSlot(mtl: ObjectId, slotIndex: number) { let curMtl = this._OverWriteMaterial.get(slotIndex); - if (curMtl && (curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) return; + if (curMtl && (curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) + { + AppToaster.show({ + message: "该模型材质已锁定,无法更换!", + timeout: 5000, + intent: Intent.WARNING, + }, "material_lock"); + return; + } if (this._OverWriteMaterial.get(slotIndex) !== mtl) { @@ -202,7 +212,15 @@ export class EntityRef extends Entity for (let i = 0; i < o.material.length; i++) { let curMtl = this._OverWriteMaterial.get(i); - if (curMtl && (curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) continue; + if (curMtl && (curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) + { + AppToaster.show({ + message: "部分模型材质已锁定,无法更换!", + timeout: 5000, + intent: Intent.WARNING, + }, "material_lock"); + continue; + } this.WriteAllObjectRecord(); this._OverWriteMaterial.set(i, mtl); diff --git a/src/DatabaseServices/Room/Entity/Wall/Hole/RoomHolePolyline.ts b/src/DatabaseServices/Room/Entity/Wall/Hole/RoomHolePolyline.ts index 2d93b442c..8cecaa713 100644 --- a/src/DatabaseServices/Room/Entity/Wall/Hole/RoomHolePolyline.ts +++ b/src/DatabaseServices/Room/Entity/Wall/Hole/RoomHolePolyline.ts @@ -1,3 +1,4 @@ +import { Intent } from "@blueprintjs/core"; import { Color, Face3, Geometry, InstancedInterleavedBuffer, InterleavedBufferAttribute, LineSegments, Material, Matrix3, Mesh, MeshStandardMaterial, Object3D, ShapeUtils, Vector2, Vector3 } from "three"; import { Line2 } from "three/examples/jsm/lines/Line2"; import { LineGeometry } from "three/examples/jsm/lines/LineGeometry"; @@ -12,6 +13,7 @@ import { CreatePolylinePath } from "../../../../../Geometry/CreatePolylinePath"; import { AsVector3, ZAxis, equalv2 } from "../../../../../Geometry/GeUtils"; import { IntersectOption } from "../../../../../GraphicsSystem/IntersectWith"; import { RenderType } from "../../../../../GraphicsSystem/RenderType"; +import { AppToaster } from "../../../../../UI/Components/Toaster"; import { Factory } from "../../../../CADFactory"; import { CADFiler } from "../../../../CADFiler"; import { CADObject } from "../../../../CADObject"; @@ -512,7 +514,15 @@ export class RoomHolePolyline extends RoomHoleBase SetMaterialAtSlot(mtl: ObjectId, slotIndex: number) { let curMtl = this._OverWriteMaterial.get(slotIndex); - if ((curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) return; + if ((curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) + { + AppToaster.show({ + message: "该模型材质已锁定,无法更换!", + timeout: 5000, + intent: Intent.WARNING, + }, "material_lock"); + return; + } if (this._OverWriteMaterial.get(slotIndex) !== mtl) { @@ -533,7 +543,15 @@ export class RoomHolePolyline extends RoomHoleBase for (let i = 0; i < o.material.length; i++) { let curMtl = this._OverWriteMaterial.get(i); - if (curMtl && (curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) continue; + if (curMtl && (curMtl.Object as PhysicalMaterialRecord).IsMaterialLock) + { + AppToaster.show({ + message: "部分模型材质已锁定,无法更换!", + timeout: 5000, + intent: Intent.WARNING, + }, "material_lock"); + continue; + }; this.WriteAllObjectRecord(); this._OverWriteMaterial.set(i, mtl);