-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix gizmo on top material option having no effect #90183
Fix gizmo on top material option having no effect #90183
Conversation
Update get_material function in EditorNode3DGizmoPlugin so that it enables the disable depth test flag on duplicate versions of the gizmo materials if the flag is not already set and the gizmo is set to use the 'x-ray' visibility state.
601652e
to
9b1a1d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally (rebased on top of master
b2f425f), it works as expected on #44077 (comment). Code looks good to me.
Toggling x-ray visibility on default gizmos still works.
Thanks! And congrats for your first merged Godot contribution 🎉 |
Trying this in my plugin: Zylann's workaround still better:
ETA: Selected gizmo. The background has gone awry. Godot v4.4.dev (61598c5) - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (nvidia; 535.183.01) - Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz (6 Threads) |
@donn-xx in your
|
How do we setup the selected and unselected materials? Also, imo, I need the "icon material" (at least) to be visible always, so that it's visible in the scene (in the editor). It would be great to be able to select the node by clicking on the billboard/icon too. (Otherwise, why bother with it all? May as well select the node in the tree.) |
This fixes #44077
I found that the
get_material
function in EditorNode3DGizmoPlugin is changing the gizmo materials directly to add and remove the disable depth test flag to enable/disable them for the 'x-ray' visibility state before returning them. This is causing the original state of the disable depth test flag to be lost so materials that were created with the on_top parameter are never returned with the disable depth test flag enabled when in the regular 'visible' visibility state.To fix this I have updated
get_material
to change the disable depth test flag on duplicate versions of the gizmomaterials when the gizmo is set to use the 'x-ray' /
ON_TOP
visibility state if the flag is not already set or otherwise return the stored materials without change.(Since StandardMaterial3D is RefCounted these duplicates should be freed automatically when later unreferenced when the gizmo is redrawn.)