Skip to content

Added panel to the editor to view and search UIDs - #1144

Merged
Arctis-Fireblight merged 5 commits into
Redot-Engine:devfrom
tindrew:uid-viewer
Jan 6, 2026
Merged

Added panel to the editor to view and search UIDs#1144
Arctis-Fireblight merged 5 commits into
Redot-Engine:devfrom
tindrew:uid-viewer

Conversation

@tindrew

@tindrew tindrew commented Jan 4, 2026

Copy link
Copy Markdown
Collaborator

UID Viewer Panel

The UID Viewer Panel allows the user to see all the UIDs and associated paths to the file in their project.
Screenshot 2026-01-04 at 4 07 09 PM

The user can filter results by typing in the search box, and double clicking on any UID or path in the panel will target that file in the project dock.
Screenshot 2026-01-04 at 4 08 16 PM

The user can also right click on any uid and can copy the uid or the path.
Screenshot 2026-01-04 at 4 08 39 PM

Summary by CodeRabbit

Release Notes

  • New Features
    • Added UID Viewer dock to the editor for browsing all project resource IDs and their associated file paths
    • Search and filter UIDs by text in real-time
    • Manually refresh the UID list or enable automatic updates on filesystem changes
    • Copy UID or resource path to clipboard via context menu
    • Quick navigation to files from the UID list

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

A new UID Viewer dock component is introduced to the editor, enabling users to enumerate and search resource UIDs alongside their file paths. The dock integrates into the editor UI with search/filter capabilities, context menu actions, and automatic refresh triggered by filesystem changes.

Changes

Cohort / File(s) Summary
New UID Viewer Dock
editor/docks/uid_viewer_dock.h, editor/docks/uid_viewer_dock.cpp
Introduces UIDViewerDock class with tree-based UI for displaying UIDs. Includes top bar with search LineEdit and Refresh button; two-column Tree (UID, Resource Path); context PopupMenu with Copy actions. Implements recursive filesystem traversal to collect UIDs, text-based filtering with recursive visibility updates, item activation for navigation, RMB for context menu, and auto-refresh via EditorFileSystem::filesystem_changed signal.
Editor Integration
editor/editor_node.cpp
Includes new header and instantiates UIDViewerDock as a bottom panel item with themed ResourceUID icon in EditorNode constructor.
Build Configuration
platform/android/java/nativeSrcsConfigs/CMakeLists.txt
Adds uid_viewer_dock.h and uid_viewer_dock.cpp to source compilation list.

Sequence Diagram

sequenceDiagram
    actor User
    participant EditorNode
    participant UIDViewerDock
    participant EditorFileSystem
    participant ResourceLoader
    participant FileSystemDock

    EditorNode->>UIDViewerDock: instantiate & add to bottom panel
    UIDViewerDock->>EditorFileSystem: subscribe to filesystem_changed signal
    
    EditorFileSystem-->>UIDViewerDock: filesystem_changed (initial or on change)
    UIDViewerDock->>UIDViewerDock: _refresh_uid_list()
    UIDViewerDock->>EditorFileSystem: traverse res:// directory
    EditorFileSystem-->>UIDViewerDock: resource paths
    UIDViewerDock->>ResourceLoader: query UID for each resource
    ResourceLoader-->>UIDViewerDock: UID or null
    UIDViewerDock->>UIDViewerDock: populate tree with UID + path items
    
    User->>UIDViewerDock: type in search field
    UIDViewerDock->>UIDViewerDock: _on_search_text_changed()
    UIDViewerDock->>UIDViewerDock: _filter_tree_recursive() on root
    UIDViewerDock->>UIDViewerDock: update item visibility based on search
    
    User->>UIDViewerDock: click tree item
    UIDViewerDock->>UIDViewerDock: _on_item_activated()
    UIDViewerDock->>FileSystemDock: navigate to resource file
    
    User->>UIDViewerDock: right-click tree item
    UIDViewerDock->>UIDViewerDock: _on_tree_rmb_selected()
    UIDViewerDock->>UIDViewerDock: show context_menu
    User->>UIDViewerDock: select Copy UID/Copy Path
    UIDViewerDock->>UIDViewerDock: _on_context_menu_id_pressed()
    UIDViewerDock->>User: copy to clipboard
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 A viewer for UIDs hops into place,
With search and refresh at a rapid pace!
Each resource path in a tree finds its home,
Copy and navigate through the editor's realm—
The UID dock's magic, from filesystem's glow! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a new editor panel for viewing and searching UIDs, which aligns with the changeset's core feature.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Arctis-Fireblight

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 4, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread editor/docks/uid_viewer_dock.cpp Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (7)
editor/docks/uid_viewer_dock.h (1)

33-40: Consider removing redundant header guards.

Both #pragma once (line 33) and traditional header guards (lines 39-40) are present. While harmless, modern C++ codebases typically use one approach. Since #pragma once is already present and widely supported, the traditional guards can be removed.

Additionally, the author comment (lines 35-37) is inconsistent with the rest of the codebase style, which doesn't include such comments in other files.

🔎 Proposed cleanup
 
 #pragma once
 
-//
-// Created by Andrew Martin on 1/2/26.
-//
-
-#ifndef UID_VIEWER_DOCK_H
-#define UID_VIEWER_DOCK_H
-
 #include "scene/gui/box_container.h"

And remove the closing #endif at the end:

 public:
 	UIDViewerDock();
 };
-
-#endif // UID_VIEWER_DOCK_H
platform/android/java/nativeSrcsConfigs/CMakeLists.txt (1)

17-19: Redundant explicit file listing (likely harmless).

The GLOB_RECURSE patterns on lines 14-15 already recursively collect all source and header files from ${GODOT_ROOT_DIR}, which includes editor/docks/uid_viewer_dock.{h,cpp}. Explicitly adding them again (lines 18-19) is redundant.

However, since this is a non-functional CMake file for Android Studio editor support (as noted in line 1), the explicit listing might improve IDE indexing. Consider removing the explicit entries unless they're needed for IDE features.

🔎 Optional cleanup
-add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}
-        ../../../../editor/docks/uid_viewer_dock.h
-        ../../../../editor/docks/uid_viewer_dock.cpp)
+add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
editor/editor_node.cpp (2)

82-82: Align UID viewer dock include path with other dock includes

The include works as-is, but it’s the only dock header included via "docks/... while all the others in this file use "editor/docks/...". For consistency with the rest of editor_node.cpp, consider switching to:

#include "editor/docks/uid_viewer_dock.h"

8453-8458: UID Viewer bottom panel integration looks good; consider small cleanups

The bottom panel registration is correct and follows existing patterns (e.g. Output panel). Two minor polish points:

  • UIDViewerDock already calls set_name("UID Viewer") in its constructor, so uid_viewer_dock->set_name("UID Viewer"); here is redundant and could be dropped to avoid future drift if the internal name changes.
  • For consistency with nearby code, you might want a slightly clearer comment and spacing, e.g. // UID Viewer or // UID Viewer bottom panel.

Functionally this is fine to ship as-is.

editor/docks/uid_viewer_dock.cpp (3)

105-110: Misleading variable name: queue is used as a stack.

The variable operates in LIFO order (pop from end), making it a stack, not a queue. Consider renaming to stack for clarity.

🔎 Suggested rename
-	Vector<String> queue;
-	queue.push_back("res://");
+	Vector<String> stack;
+	stack.push_back("res://");

-	while (!queue.is_empty()) {
-		String dir_path = queue[queue.size() - 1];
-		queue.resize(queue.size() - 1);
+	while (!stack.is_empty()) {
+		String dir_path = stack[stack.size() - 1];
+		stack.resize(stack.size() - 1);
		...
-			queue.push_back(dir_path + subdir->get_name() + "/");
+			stack.push_back(dir_path + subdir->get_name() + "/");

156-159: Consider the asynchronous nature of scan().

EditorFileSystem::scan() is asynchronous, so the immediate _refresh_uid_list() call reads the current (potentially stale) filesystem state. The list will auto-update when the scan completes via the filesystem_changed signal connection.

This works but may cause a brief UI flicker (list refreshes twice). You could either:

  1. Accept current behavior (functional, minor UX quirk), or
  2. Only call scan() and let the signal handler refresh the list once.
🔎 Alternative: let signal handler refresh
 void UIDViewerDock::_on_refresh_pressed() {
 	EditorFileSystem::get_singleton()->scan();
-	_refresh_uid_list();
 }

196-211: Consider using named constants for menu IDs.

Magic numbers 0 and 1 are fragile if menu items are reordered. An enum improves maintainability:

🔎 Suggested refactor

In the header or at file scope:

enum ContextMenuID {
	CONTEXT_COPY_UID = 0,
	CONTEXT_COPY_PATH = 1,
};

Then in the constructor:

-	context_menu->add_item("Copy UID");
-	context_menu->add_item("Copy Path");
+	context_menu->add_item("Copy UID", CONTEXT_COPY_UID);
+	context_menu->add_item("Copy Path", CONTEXT_COPY_PATH);

And in the handler:

-	if (id == 0) { // Copy UID
+	if (id == CONTEXT_COPY_UID) {
 		text_to_copy = last_selected_item->get_text(0);
-	} else if (id == 1) { // Copy Path
+	} else if (id == CONTEXT_COPY_PATH) {
 		text_to_copy = last_selected_item->get_text(1);
 	}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe0c89b and 3854a56.

📒 Files selected for processing (4)
  • editor/docks/uid_viewer_dock.cpp
  • editor/docks/uid_viewer_dock.h
  • editor/editor_node.cpp
  • platform/android/java/nativeSrcsConfigs/CMakeLists.txt
🧰 Additional context used
🧬 Code graph analysis (2)
editor/docks/uid_viewer_dock.h (1)
editor/docks/uid_viewer_dock.cpp (19)
  • UIDViewerDock (46-94)
  • _refresh_uid_list (96-137)
  • _refresh_uid_list (96-96)
  • _on_search_text_changed (139-154)
  • _on_search_text_changed (139-139)
  • _on_refresh_pressed (156-159)
  • _on_refresh_pressed (156-156)
  • _on_item_activated (161-174)
  • _on_item_activated (161-161)
  • _on_context_menu_id_pressed (196-211)
  • _on_context_menu_id_pressed (196-196)
  • _gui_input (176-194)
  • _gui_input (176-176)
  • _on_tree_rmb_selected (257-272)
  • _on_tree_rmb_selected (257-257)
  • _show_all_items (213-228)
  • _show_all_items (213-213)
  • _filter_tree_recursive (230-255)
  • _filter_tree_recursive (230-230)
editor/editor_node.cpp (2)
editor/docks/uid_viewer_dock.cpp (1)
  • UIDViewerDock (46-94)
editor/docks/uid_viewer_dock.h (1)
  • UIDViewerDock (48-69)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: 🤖 Android / Template arm64 (target=template_release, arch=arm64)
  • GitHub Check: 🐧 Linux / Editor w/ Mono (target=editor)
  • GitHub Check: 🐧 Linux / Minimal template (target=template_release, everything disabled)
  • GitHub Check: 🏁 Windows / Template w/ GCC (target=template_release, use_mingw=yes)
  • GitHub Check: 🐧 Linux / Template w/ Mono, debug (target=template_debug)
  • GitHub Check: 🐧 Linux / Template w/ Mono, release (target=template_release)
  • GitHub Check: 🐧 Linux / Editor with ThreadSanitizer (target=editor, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)
  • GitHub Check: 🏁 Windows / Template (target=template_release)
  • GitHub Check: 🌐 Web / Template w/ threads (target=template_release, threads=yes)
  • GitHub Check: 🤖 Android / Template arm32 (target=template_release, arch=arm32)
  • GitHub Check: 🌐 Web / Template w/o threads (target=template_release, threads=no)
  • GitHub Check: 🍎 macOS / Template (target=template_release)
  • GitHub Check: 🏁 Windows / Editor (target=editor)
  • GitHub Check: 🍏 iOS / Template (target=template_release)
  • GitHub Check: 🍎 macOS / Editor (target=editor)
🔇 Additional comments (4)
editor/docks/uid_viewer_dock.cpp (4)

46-94: LGTM! Well-structured UI initialization.

The constructor properly sets up the dock with search, refresh button, tree view, and context menu. Signal connections are appropriate for the intended functionality.


161-174: LGTM!

Proper null checks and appropriate use of FileSystemDock API to navigate and select the file.


213-255: LGTM!

The recursive filter and show-all implementations correctly handle tree visibility. Good defensive null checks and proper case-insensitive search logic.


257-272: LGTM!

This is the correct handler for tree RMB selection. The position coordinates from item_mouse_selected are properly relative to the tree.

Comment thread editor/docks/uid_viewer_dock.cpp Outdated
Comment thread editor/docks/uid_viewer_dock.h
Comment thread editor/docks/uid_viewer_dock.h Outdated
Comment thread editor/docks/uid_viewer_dock.h Outdated
Comment thread editor/docks/uid_viewer_dock.cpp Outdated
@Arctis-Fireblight

Copy link
Copy Markdown
Contributor

@tindrew can you please run 'pre-commit run -a' and then re submit?

Looks like it failed the formatting check.

Comment thread editor/docks/uid_viewer_dock.cpp Outdated
String path_text = item->get_text(1).to_lower();

bool matches = uid_text.contains(search_lower) || path_text.contains(search_lower);
bool visible = matches || has_visible_child;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would rename visible here to result or something.
This is hiding a base member causing the compiler to complain.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok will do.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

@Arctis-Fireblight Arctis-Fireblight left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good and works great!
Approved!

@Arctis-Fireblight
Arctis-Fireblight merged commit 4eaf1bf into Redot-Engine:dev Jan 6, 2026
17 checks passed
mcdubhghlas pushed a commit to mcdubhghlas/redot-engine that referenced this pull request Feb 17, 2026
Added panel to the editor to view and search UIDs
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