From df07e1f1e950418a29b24c1de79eaa90256df786 Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Tue, 22 Apr 2025 01:26:49 -0700 Subject: [PATCH] Hotfix rerendering spam - Outliner and Promptbox (#547) Could be done better, but this works just as well under time constraints. For future reference: The freecam movement speed logic should be moved to React land instead of processing the update every frame using the time delta. Just use performance.now() in a useEffect or something. --------- Co-authored-by: Tanish Manku <-h> --- .../app/src/pages/PageEnigma/Editor/editor.ts | 11 ----------- .../app/src/pages/PageEnigma/Editor/free_cam.ts | 6 +++++- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/editor.ts b/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/editor.ts index a35393ff05..630d2a27f7 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/editor.ts +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/editor.ts @@ -1300,17 +1300,6 @@ class Editor { } } - if (this.cam_obj == undefined) { - this.cam_obj = this.activeScene.get_object_by_name(this.camera_name); - - if (this.outliner_feature_flag) { - const result = this.sceneManager?.render_outliner( - this.timeline.characters, - ); - if (result) outlinerState.items.value = result.items; - } - } - if (this.clock == undefined || this.renderer == undefined) { return; } diff --git a/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts b/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts index 1f2674dcd7..5878047c2c 100644 --- a/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts +++ b/frontend/apps/editor3d/app/src/pages/PageEnigma/Editor/free_cam.ts @@ -220,8 +220,12 @@ class FreeCam extends EventDispatcher { this.updateMovementVector(); } + isStationary() { + return this.moveVector.distanceTo(new Vector3(0, 0, 0)) === 0; + } + update(delta: number) { - if (!this.enabled) { + if (!this.enabled || this.isStationary()) { return; }