From 241f104d92517a3a962c8bee6678590de6674fba Mon Sep 17 00:00:00 2001 From: ChenX Date: Sun, 24 Apr 2022 10:47:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E4=BF=AE=E6=94=B9=E6=8E=92?= =?UTF-8?q?=E7=89=88=E9=9D=A2=E5=90=8E=E5=85=B3=E8=81=94=E6=8B=89=E6=A7=BD?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF(=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E5=9C=A8=E8=AF=BB=E5=8F=96=E6=96=87=E4=BB=B6=E6=97=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=98=BE=E7=A4=BA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DatabaseServices/Entity/Board.ts | 21 +++++++++++++-------- src/DatabaseServices/Entity/Entity.ts | 6 +++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/DatabaseServices/Entity/Board.ts b/src/DatabaseServices/Entity/Board.ts index 02b58b197..cd87c4a11 100644 --- a/src/DatabaseServices/Entity/Board.ts +++ b/src/DatabaseServices/Entity/Board.ts @@ -183,22 +183,27 @@ export class Board extends ExtrudeSolid let arr = this.CreateArray() as any[]; arr.push(...value); target[key] = arr; - if (key === EBoardKeyList.HighSealed) + if (!this.__ReadFileIng__ && key === EBoardKeyList.HighSealed) this.Update(UpdateDraw.Geometry); return true; } let result = Reflect.set(target, key, value, receiver); - if (key === EBoardKeyList.Lines) - this.Update(UpdateDraw.Geometry); - else if (key === EBoardKeyList.ComposingFace) + + if (!this.__ReadFileIng__)//看起来使用 this.ReadFileIng 似乎也是没问题的 { - let obj = this.GetDrawObjectFromRenderType(RenderType.PlaceFace); - if (obj) + if (key === EBoardKeyList.Lines) + this.Update(UpdateDraw.Geometry); + else if (key === EBoardKeyList.ComposingFace) { - this.UpdateDrawObject(RenderType.PlaceFace, obj); - obj.updateMatrixWorld(true); + let obj = this.CacheDrawObject.get(RenderType.PlaceFace); + if (obj) + { + this.UpdateDrawObject(RenderType.PlaceFace, obj); + obj.updateMatrixWorld(true); + } } } + return result; } return true; diff --git a/src/DatabaseServices/Entity/Entity.ts b/src/DatabaseServices/Entity/Entity.ts index b970201b9..52881470e 100644 --- a/src/DatabaseServices/Entity/Entity.ts +++ b/src/DatabaseServices/Entity/Entity.ts @@ -409,7 +409,11 @@ export class Entity extends CADObject this.__UpdateVersion__++; this.NeedUpdateFlag |= mode; if (this.AutoUpdate) + { this.DeferUpdate(); + // if (this.__ReadFileIng__) //!警告 + // console.error("在读取文件时更新实体的显示!"); + } } //三维实体总是一起生成线框实体和网格实体,这个通知更新,然后统一更新就好了 @@ -682,8 +686,8 @@ export class Entity extends CADObject { this.__ReadFileIng__ = true; this._ReadFile(file); - this.Update(); this.__ReadFileIng__ = false; + this.Update(); } //对象从文件中读取数据,初始化自身