Repository navigation
fix: Harden gizmos: shared layers, layer setter, enabled state, theme hover, multi-touch, arc mesh leak, uniform plane scaling and picking order - #9800
Merged
Conversation
…c mesh leak, uniform plane scaling and picking order
Build size reportThis PR changes the size of the minified bundles.
|
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #9799 with further fixes to the gizmos in
src/extras/gizmo:cameraandlayersetters removed every copy of the gizmo layer from the camera, so moving one gizmo to another camera stopped the other gizmos sharing that layer from rendering. Each gizmo now adds and removes a single reference, anddestroy()releases its reference too, so the layer leaves the camera when the last gizmo using it there is gone.layerchanged the camera layers but left every gizmo mesh, including the rotate guide lines, on the old layer. The meshes now move to the new layer.destroy()can run twice, for example from the app destroy event and from app code. It now returns early on the second call, so it never releases another gizmo's layer reference.cameraandlayersetters forcedenabled = true, which re-showed a gizmo the app had disabled. They now keep the requested enabled state, and still re-check the camera distance as before.setThemewhile hovering: every shape switched to its hover color whenever anything was hovered. Only the hovered shapes keep their hover color now.ArcShapemesh leak: every change toxyzRingRadius,xyzTubeRadius,faceRingRadius,faceTubeRadiusorringTolerancecreated new ring meshes without destroying the old ones, and the constructor built every ring twice. Replaced meshes are now destroyed, and the constructor builds each ring once.ScaleGizmowithuniformprojected plane drags onto an unnormalized diagonal, so uniform plane drags scaled twice as fast as the cursor. They now match the non-uniform plane drag.Behavior changes
setThemeduring a drag keeps the dragged shape highlighted.Manual smoke test
In each example, add
window.gizmo = gizmo;at the end of the example code, then run this in the console to make a second camera:const c = new pc.Entity(); c.addComponent('camera', { priority: -1 }); c.setPosition(6, 6, 6); pc.AppBase.getApplication().root.addChild(c);gizmos/transform-translate, runsetTimeout(() => gizmo.setTheme({}), 3000)and hover the X arrow until it fires. Expected: only the X arrow stays highlighted.const r = new pc.RotateGizmo(gizmo.camera, gizmo.layer); r.camera = c.camera;. Expected: the translate gizmo is still drawn.gizmo.enabled = false; gizmo.camera = c.camera;. Expected: the gizmo stays hidden.gizmos/transform-rotateand change the ring radius in the controls several times. Expected: the rings resize and GPU memory does not grow.gizmos/transform-scale, enable uniform scaling and drag a plane. Expected: the scale follows the cursor at the same rate as a non-uniform plane drag.const l = pc.Gizmo.createLayer(pc.AppBase.getApplication(), 'Gizmo2'); gizmo.layer = l;ingizmos/transform-rotate, then drag a ring. Expected: the rings and the angle guide lines still render.Fixes #
Checklist