!2942 优化:对锁定材质的模型,显示不可替换材质提示

pull/2583/MERGE
zc 2 months ago committed by ChenX
parent cbdf669b57
commit 9f64033b6b

@ -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;
}

@ -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<PhysicalMaterialRecord>, 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);

@ -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<PhysicalMaterialRecord>, 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);

Loading…
Cancel
Save