Skip to content
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

Only show reference cross in TextureProgressBar when the node is selected #99683

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Nov 25, 2024

This reduces visual obstruction in the editor.

Additionally, the cross' width no longer scales with zoom, improving visibility at high zoom levels.

Alternative solution to #99628. This one is simpler - it avoids using an extra internal node which would have a performance cost in scenes with hundreds of TextureProgressBars or more1. It also works more automatically by addressing the original problem at the core (bad visibility when editing pixel art UI), similar to how #75303 works.

I also have an alternate version where the cross has a drop shadow (not included here), but given it's drawn with thin lines, it doesn't look great at high zoom levels since the lines start being separated from each other.

Preview

100% zoom

Screenshot_20241125_180901

High zoom level (600% or so)

Screenshot_20241125_180906

Footnotes

  1. Even if this is editor-only, it still has an impact when editing scenes in the editor.

if (Engine::get_singleton()->is_editor_hint()) {
#ifdef TOOLS_ENABLED
// Draw a reference cross when the node is selected in the editor.
if (Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()->get_editor_selection()->is_selected(this)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the use of EditorNode below is IMO good reasons to add functionality to Node to enforce the separation here

@arkology
Copy link
Contributor

As it relies on selection in editor, wouldn't be better adding custom gizmo as suggested in godotengine/godot-proposals#11225 (comment)? And this will be groundwork for more functionality (for example, range editing) which could be added later.

@Calinou Calinou force-pushed the textureprogressbar-reference-when-selected-only branch from f86048a to ba1ed9a Compare November 25, 2024 19:05
…cted

This reduces visual obstruction in the editor.

Additionally, the cross' width no longer scales with zoom, improving
visibility at high zoom levels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants