From f2f36023e678692d4c29ddc6814e59cdef0bedc8 Mon Sep 17 00:00:00 2001 From: arorad1 Date: Mon, 15 Jul 2024 13:00:54 -0700 Subject: [PATCH 1/4] Removed the unaccessable _deleteGizmoOnEscape variable & fixed manageassemblies not deleting the gizmo & removed duplicate function implementation --- fission/src/mirabuf/MirabufSceneObject.ts | 27 ++++++++++--------- .../modals/spawning/ManageAssembliesModal.tsx | 4 +++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/fission/src/mirabuf/MirabufSceneObject.ts b/fission/src/mirabuf/MirabufSceneObject.ts index a7d05a7bb8..7ff655aca0 100644 --- a/fission/src/mirabuf/MirabufSceneObject.ts +++ b/fission/src/mirabuf/MirabufSceneObject.ts @@ -30,7 +30,6 @@ class MirabufSceneObject extends SceneObject { private _physicsLayerReserve: LayerReserve | undefined = undefined private _transformGizmos: TransformGizmos | undefined = undefined - private _deleteGizmoOnEscape: boolean = true get mirabufInstance() { return this._mirabufInstance @@ -109,16 +108,12 @@ class MirabufSceneObject extends SceneObject { if (this._transformGizmos) { if (InputSystem.isKeyPressed("Enter")) { // confirming placement of the mirabuf object - this._transformGizmos.RemoveGizmos() - this.EnablePhysics() - this._transformGizmos = undefined + this.DisableTransformControls() return - } else if (InputSystem.isKeyPressed("Escape") && this._deleteGizmoOnEscape) { + } else if (InputSystem.isKeyPressed("Escape")) { // cancelling the creation of the mirabuf scene object - this._transformGizmos.RemoveGizmos() + this.DisableTransformControls() World.SceneRenderer.RemoveSceneObject(this.id) - this._transformGizmos = undefined - this._deleteGizmoOnEscape = false return } @@ -168,10 +163,6 @@ class MirabufSceneObject extends SceneObject { this._brain?.clearControls() } - public GetRootNodeId(): Jolt.BodyID | undefined { - return this._mechanism.nodeToBody.get(this._mechanism.rootBody) - } - private CreateMeshForShape(shape: Jolt.Shape): THREE.Mesh { const scale = new JOLT.Vec3(1, 1, 1) const triangleContext = new JOLT.ShapeGetTriangles( @@ -205,6 +196,9 @@ class MirabufSceneObject extends SceneObject { return mesh } + /** + * Changes the mode of the mirabuf object from being interacted with to being placed. + */ public EnableTransformControls(): void { this._transformGizmos = new TransformGizmos( new THREE.Mesh( @@ -218,6 +212,15 @@ class MirabufSceneObject extends SceneObject { this.DisablePhysics() } + /** + * Changes the mode of the mirabuf object from being placed to being interacted with. + */ + public DisableTransformControls(): void { + this._transformGizmos?.RemoveGizmos() + this._transformGizmos = undefined + this.EnablePhysics() + } + private EnablePhysics() { this._mirabufInstance.parser.rigidNodes.forEach(rn => { World.PhysicsSystem.EnablePhysicsForBody(this._mechanism.GetBodyByNodeId(rn.id)!) diff --git a/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx b/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx index 3031aec4c9..57a53f1782 100644 --- a/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx +++ b/fission/src/ui/modals/spawning/ManageAssembliesModal.tsx @@ -21,6 +21,10 @@ const AssemblyCard: React.FC = ({ id, update }) => {