feat(ui): add feature summary tooltips and enhanced unloaded UI#1134
Conversation
- Add GetFeatureSummary() virtual method to Feature base class - Implement feature summaries for 20+ features with descriptions and key features - Add hover tooltips in feature list showing comprehensive feature information - Create default DrawUnloadedUI() with theme-consistent error colors - Update TerrainVariation and TerrainHelper to use new summary system - Enhance user experience with rich feature descriptions and consistent UI
WalkthroughA standardized feature summary system was introduced across all feature structs by adding a virtual Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Menu
participant Feature
participant ImGui
User->>Menu: Hover over feature in menu
Menu->>Feature: GetFeatureSummary()
Feature-->>Menu: (description, key features)
Menu->>ImGui: Show tooltip with description and key features
sequenceDiagram
participant User
participant FeatureUI
participant Feature
User->>FeatureUI: View unloaded feature
FeatureUI->>Feature: GetFeatureSummary()
Feature-->>FeatureUI: (description, key features)
FeatureUI->>ImGui: Render summary and key features in UI
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (26)
🚧 Files skipped from review as they are similar to previous changes (26)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new hover tooltip system for feature summaries, enhancing the unloaded UI across multiple features. The changes add a virtual GetFeatureSummary() method to the Feature base class and implement feature-specific summaries (including descriptions and key bullet points) in various feature files.
- Added GetFeatureSummary() implementations to several feature classes.
- Updated DrawUnloadedUI() in both TerrainHelper.cpp and Feature.h to display hover tooltips and descriptive messaging.
- Enhanced UI error messaging for unloaded features to be theme consistent.
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Features/TerrainHelper.h | Added GetFeatureSummary() method providing terrain helper details. |
| src/Features/TerrainHelper.cpp | Updated DrawUnloadedUI() to use the new summary information. |
| src/Features/TerrainBlending.h | Added GetFeatureSummary() for blending feature description. |
| src/Features/SubsurfaceScattering.h | Added GetFeatureSummary() returning multi-line summary for realistic character lighting. |
| src/Features/Skylighting.h | Introduced summary details for skylighting feature. |
| src/Features/SkySync.h | Added summary for synchronizing celestial lighting. |
| src/Features/ScreenSpaceShadows.h | Added feature summary for improved shadow details. |
| src/Features/ScreenSpaceGI.h | Added summary for global illumination techniques. |
| src/Features/LightLimitFix.h | Implmented summary detailing removal of the 4-light limit. |
| src/Features/LODBlending.h | Added summary for smooth transitions between LODs. |
| src/Features/InverseSquareLighting.h | Added physical-based lighting summary details. |
| src/Features/InteriorSunShadows.h | Added summary for realistic interior sun shadows. |
| src/Features/IBL.h | Added summary for Image Based Lighting enhancements. |
| src/Features/HairSpecular.h | Added summary for hair specular enhancements. |
| src/Features/GrassLighting.h | Added summary detailing enhanced grass lighting features. |
| src/Features/GrassCollision.h | Added summary for dynamic grass collision interactions. |
| src/Features/ExtendedMaterials.h | Added summary for advanced material effects. |
| src/Features/DynamicCubemaps.h | Added summary for real-time environment mapping via cubemaps. |
| src/Features/CloudShadows.h | Added summary for dynamic cloud shadows. |
| src/Feature.h | Updated default DrawUnloadedUI() to utilize feature summaries. |
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (9)
src/Features/ExtendedMaterials.h (1)
15-28: Feature summary implementation is correct
Description and bullet list accurately reflect the Extended Materials feature. Consider using a raw string literal for the multi-sentence description to improve readability and maintenance.src/Features/WaterEffects.h (1)
20-33: Feature summary implementation is correct
Summary clearly covers enhanced water rendering aspects. To reduce string-concatenation noise and ease future edits, you might switch to a raw string literal for the two-line description.src/Features/DynamicCubemaps.h (1)
105-117: MarkGetFeatureSummary()as inline and consider caching its return.
Currently, this method allocates a newstd::stringandstd::vectoron every invocation and isn’t markedinlinelike the other header-defined overrides. For consistency and performance, add theinlinespecifier and/or store the summary in astatic constso repeated calls don’t reallocate.src/Features/TerrainVariation.h (1)
19-31: MakeGetFeatureSummary()inline and avoid per-call allocations.
This override isn’t markedinlineand rebuilds the description and key points on every call. To align with the rest of the header-defined methods and reduce runtime allocations, addinlineand/or cache the returned pair as astatic const.src/Features/GrassLighting.h (1)
16-29: Add inline specifier toGetFeatureSummary()and optimize memory usage.
This header-defined override should be markedinlineand could benefit from caching its summary to prevent repeated heap allocations of the string and vector.src/Features/SubsurfaceScattering.h (1)
66-79: Consistently inline and cache the feature summary.
As with other header-defined overrides, markGetFeatureSummary()asinlineand consider returning a reference to astatic const std::pairto eliminate per-call construction overhead.src/Features/Skylighting.h (1)
16-28: Inline and memoizeGetFeatureSummary()in the header.
This override rebuilds its summary and key-point list on every invocation. For consistency and performance, add theinlinekeyword and/or cache the summary in astatic constto avoid unnecessary allocations.src/Menu.cpp (1)
413-429: Avoid repeated allocations by cachingGetFeatureSummary()
GetFeatureSummary()is invoked every time the item is hovered, constructing astd::pair<std::string, std::vector<std::string>>and potentially allocating memory for the vectors on every frame while the tooltip is visible. For large feature lists this can add measurable overhead to the UI thread.- if (auto _tt = Util::HoverTooltipWrapper()) { - auto [description, keyFeatures] = feat->GetFeatureSummary(); + if (auto _tt = Util::HoverTooltipWrapper()) { + static thread_local std::pair<std::string, std::vector<std::string>> summary; + summary = feat->GetFeatureSummary(); // 1-time copy per frame, not per ImGui item + const auto& description = summary.first; + const auto& keyFeatures = summary.second;(Optional) retain a small LRU cache keyed on
Feature*if you expect the summaries to be immutable during the session.src/Feature.h (1)
41-47:GetFeatureSummary()contract looks good – consider returningstd::span<const std::string>for zero-copyReturning a
std::pair<std::string, std::vector<std::string>>works but forces every caller to allocate / copy on every call. Exposing astd::string_view+std::span<const std::string>(or twostd::string_views) would avoid extra allocations while keeping the API simple.No action required if performance is not a concern.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/.DS_Storeis excluded by!**/.DS_Store
📒 Files selected for processing (28)
src/Feature.h(1 hunks)src/Features/CloudShadows.h(1 hunks)src/Features/DynamicCubemaps.h(1 hunks)src/Features/ExtendedMaterials.h(1 hunks)src/Features/GrassCollision.h(1 hunks)src/Features/GrassLighting.h(1 hunks)src/Features/HairSpecular.h(1 hunks)src/Features/IBL.h(1 hunks)src/Features/InteriorSunShadows.h(1 hunks)src/Features/InverseSquareLighting.h(1 hunks)src/Features/LODBlending.h(1 hunks)src/Features/LightLimitFix.h(1 hunks)src/Features/ScreenSpaceGI.h(1 hunks)src/Features/ScreenSpaceShadows.h(1 hunks)src/Features/SkySync.h(1 hunks)src/Features/Skylighting.h(1 hunks)src/Features/SubsurfaceScattering.h(1 hunks)src/Features/TerrainBlending.h(1 hunks)src/Features/TerrainHelper.cpp(1 hunks)src/Features/TerrainHelper.h(1 hunks)src/Features/TerrainShadows.h(1 hunks)src/Features/TerrainVariation.cpp(0 hunks)src/Features/TerrainVariation.h(1 hunks)src/Features/VR.h(1 hunks)src/Features/VolumetricLighting.h(1 hunks)src/Features/WaterEffects.h(1 hunks)src/Features/WetnessEffects.h(1 hunks)src/Menu.cpp(1 hunks)
💤 Files with no reviewable changes (1)
- src/Features/TerrainVariation.cpp
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/Features/TerrainHelper.cpp (1)
src/Feature.h (1)
description(52-73)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build plugin and addons
🔇 Additional comments (12)
src/Features/TerrainShadows.h (1)
16-28: Correctly implemented feature summary
GetFeatureSummary() delivers a precise description and a comprehensive list of key capabilities. Content is clear, consistent with other features, and free of typos.src/Features/VR.h (1)
14-26: Well-defined VR feature summary
The summary text concisely conveys purpose and optimization points for VR. Implementation matches the established pattern with no issues.src/Features/IBL.h (1)
17-30: Correct IBL feature summary
GetFeatureSummary() provides an accurate overview and relevant bullet points for image-based lighting. Aligns with the standardized pattern; no changes needed.src/Features/ScreenSpaceShadows.h (1)
14-28: Approve addition of GetFeatureSummary
The summary and key points accurately describe Screen Space Shadows and align with the standardized format.src/Features/WetnessEffects.h (1)
16-28: Approve addition of GetFeatureSummary
The descriptive text and bullet list clearly convey the Wetness Effects feature and match the style of other feature summaries.src/Features/TerrainBlending.h (1)
15-27: Approve addition of GetFeatureSummary
The summary string and highlights effectively outline the Terrain Blending feature’s capabilities and follow the established pattern.src/Features/GrassCollision.h (1)
15-27: Approve addition of GetFeatureSummary
The summary and bullet points accurately reflect Grass Collision behavior and maintain consistency with other feature descriptions.src/Features/LightLimitFix.h (1)
18-31: Approve addition of GetFeatureSummary
The feature summary clearly explains the Light Limit Fix improvements and aligns with the format used across features.src/Features/HairSpecular.h (1)
14-26: 🛠️ Refactor suggestion
⚠️ Potential issueODR violation risk: missing
inlineon header-defined method
Defining a non-inline, non-template virtual method in a header can lead to multiple-definition errors at link time.Apply this diff to mark it inline:
- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override + virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() overrideLikely an incorrect or invalid review comment.
src/Features/ScreenSpaceGI.h (1)
23-36: 🛠️ Refactor suggestion
⚠️ Potential issueODR violation risk: missing
inlineon header-defined method
As above,GetFeatureSummary()is defined in the header withoutinline, risking multiple-definition linker errors.- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override + virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() overrideLikely an incorrect or invalid review comment.
src/Features/CloudShadows.h (1)
22-34: 🛠️ Refactor suggestion
⚠️ Potential issueODR violation risk: missing
inlineon header-defined method
GetFeatureSummary()appears in the header; mark itinlineto avoid duplicate definitions.- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override + virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() overrideLikely an incorrect or invalid review comment.
src/Features/VolumetricLighting.h (1)
36-49: 🛠️ Refactor suggestion
⚠️ Potential issueODR violation risk: missing
inlineon header-defined method
Same pattern: header-defined virtual method needsinline.- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override + virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() overrideLikely an incorrect or invalid review comment.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | ||
| { | ||
| return { | ||
| "Provides seamless visual transitions between Level of Detail (LOD) objects and full-detail objects, eliminating harsh transitions and creating smooth visual continuity.", | ||
| { | ||
| "Smooth LOD object brightness blending", | ||
| "Enhanced terrain LOD appearance matching", | ||
| "Snow-specific LOD brightness adjustment", | ||
| "Optional terrain vertex color modification", | ||
| "Seamless transition between detail levels" | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Mark GetFeatureSummary() as inline (and add const) to prevent ODR issues and match base signature.
Defining a non-inline virtual in a header can cause multiple-definition errors; also confirm the base method is const and mirror its qualifiers for a valid override.
Apply this diff:
- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override
+ virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const override📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | |
| { | |
| return { | |
| "Provides seamless visual transitions between Level of Detail (LOD) objects and full-detail objects, eliminating harsh transitions and creating smooth visual continuity.", | |
| { | |
| "Smooth LOD object brightness blending", | |
| "Enhanced terrain LOD appearance matching", | |
| "Snow-specific LOD brightness adjustment", | |
| "Optional terrain vertex color modification", | |
| "Seamless transition between detail levels" | |
| } | |
| }; | |
| } | |
| virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const override | |
| { | |
| return { | |
| "Provides seamless visual transitions between Level of Detail (LOD) objects and full-detail objects, eliminating harsh transitions and creating smooth visual continuity.", | |
| { | |
| "Smooth LOD object brightness blending", | |
| "Enhanced terrain LOD appearance matching", | |
| "Snow-specific LOD brightness adjustment", | |
| "Optional terrain vertex color modification", | |
| "Seamless transition between detail levels" | |
| } | |
| }; | |
| } |
🤖 Prompt for AI Agents
In src/Features/LODBlending.h lines 14 to 26, mark the GetFeatureSummary()
method as inline and add the const qualifier to match the base class signature
and prevent multiple-definition (ODR) errors. Change the method declaration to
inline and append const after the override keyword to ensure it correctly
overrides the base method.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | ||
| { | ||
| return { | ||
| "Implements physically accurate inverse square falloff for lighting, making light attenuation behave realistically with distance for more natural illumination.", | ||
| { | ||
| "Physically accurate light attenuation based on distance", | ||
| "Automatic radius calculation for optimal performance", | ||
| "Enhanced light editor for fine-tuning light properties", | ||
| "Realistic shadow caster handling", | ||
| "Support for both point and directional lighting" | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Add inline specifier (and const) to GetFeatureSummary() in-header.
This definition lives in a header; mark it inline and align constness with the base declaration to ensure proper linkage and overriding.
- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override
+ virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const override🤖 Prompt for AI Agents
In src/Features/InverseSquareLighting.h around lines 19 to 31, the
GetFeatureSummary() method is defined in the header but lacks the inline
specifier and const qualifier. To fix this, add the inline keyword before the
method definition and mark the method as const to match the base class
declaration, ensuring correct linkage and proper overriding.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | ||
| { | ||
| return { | ||
| "Enables realistic sun shadows inside interior spaces that have openings to the exterior, such as windows and doors, bringing natural lighting indoors.", | ||
| { | ||
| "Sun shadow casting through windows and openings", | ||
| "Double-sided rendering for accurate interior shadows", | ||
| "Automatic detection of interiors with sun exposure", | ||
| "Enhanced directional light culling for interiors", | ||
| "Seamless integration with existing shadow systems" | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Make GetFeatureSummary() inline and const-correct.
Header-defined virtuals should be marked inline; add const if the base signature is const to guarantee a true override.
- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override
+ virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const overrideCommittable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/Features/InteriorSunShadows.h lines 14 to 26, the GetFeatureSummary()
method should be marked inline and const-correct. Add the inline keyword before
the method definition and append const at the end of the method signature to
match the base class and ensure proper overriding.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | ||
| { | ||
| return { | ||
| "Provides enhanced terrain material support for terrain mods that require additional texture slots and parallax mapping capabilities.", | ||
| { | ||
| "Extended texture slot support for terrain materials", | ||
| "Parallax mapping integration for terrain textures", | ||
| "Automatic terrain material detection and setup", | ||
| "Support for advanced terrain modifications", | ||
| "Compatibility layer for terrain enhancement mods" | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Inline-qualify and const-qualify GetFeatureSummary().
Since this method is implemented in a header, add inline and mirror the base method’s const qualifier to avoid ODR violations and ensure it actually overrides.
- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override
+ virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const override📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | |
| { | |
| return { | |
| "Provides enhanced terrain material support for terrain mods that require additional texture slots and parallax mapping capabilities.", | |
| { | |
| "Extended texture slot support for terrain materials", | |
| "Parallax mapping integration for terrain textures", | |
| "Automatic terrain material detection and setup", | |
| "Support for advanced terrain modifications", | |
| "Compatibility layer for terrain enhancement mods" | |
| } | |
| }; | |
| } | |
| virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const override | |
| { | |
| return { | |
| "Provides enhanced terrain material support for terrain mods that require additional texture slots and parallax mapping capabilities.", | |
| { | |
| "Extended texture slot support for terrain materials", | |
| "Parallax mapping integration for terrain textures", | |
| "Automatic terrain material detection and setup", | |
| "Support for advanced terrain modifications", | |
| "Compatibility layer for terrain enhancement mods" | |
| } | |
| }; | |
| } |
🤖 Prompt for AI Agents
In src/Features/TerrainHelper.h around lines 15 to 27, the GetFeatureSummary()
method lacks the inline specifier and const qualifier. To fix this, add the
inline keyword before the method declaration and append const at the end of the
method signature to match the base class method. This prevents ODR violations
and ensures proper overriding.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | ||
| { | ||
| return { | ||
| "Synchronizes celestial lighting with the actual sky state, ensuring sun and moon lighting direction and intensity accurately match their visual position in the sky.", | ||
| { | ||
| "Accurate sun and moon lighting direction matching sky position", | ||
| "Alternative sun path calculation for improved realism", | ||
| "Configurable moon light source selection", | ||
| "Real-time celestial body tracking and updates", | ||
| "Enhanced sky and climate transition handling" | ||
| } | ||
| }; | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Add inline and const to GetFeatureSummary() for header safety and proper override.
Marking this virtual in a header as inline prevents multiple definitions; add const to match the base declaration.
- virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override
+ virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const override📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| virtual std::pair<std::string, std::vector<std::string>> GetFeatureSummary() override | |
| { | |
| return { | |
| "Synchronizes celestial lighting with the actual sky state, ensuring sun and moon lighting direction and intensity accurately match their visual position in the sky.", | |
| { | |
| "Accurate sun and moon lighting direction matching sky position", | |
| "Alternative sun path calculation for improved realism", | |
| "Configurable moon light source selection", | |
| "Real-time celestial body tracking and updates", | |
| "Enhanced sky and climate transition handling" | |
| } | |
| }; | |
| } | |
| virtual inline std::pair<std::string, std::vector<std::string>> GetFeatureSummary() const override | |
| { | |
| return { | |
| "Synchronizes celestial lighting with the actual sky state, ensuring sun and moon lighting direction and intensity accurately match their visual position in the sky.", | |
| { | |
| "Accurate sun and moon lighting direction matching sky position", | |
| "Alternative sun path calculation for improved realism", | |
| "Configurable moon light source selection", | |
| "Real-time celestial body tracking and updates", | |
| "Enhanced sky and climate transition handling" | |
| } | |
| }; | |
| } |
🤖 Prompt for AI Agents
In src/Features/SkySync.h lines 15 to 27, the GetFeatureSummary() method should
be marked as inline to avoid multiple definition errors when included in
multiple translation units, and it should be marked const to match the base
class declaration and ensure it does not modify the object state. Update the
method signature to include both inline and const keywords accordingly.
| auto [description, keyFeatures] = GetFeatureSummary(); | ||
|
|
||
| ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); | ||
| ImGui::Text("%s", description.c_str()); | ||
|
|
||
| if (!keyFeatures.empty()) { | ||
| ImGui::Spacing(); | ||
| ImGui::Text("Key Features:"); | ||
| for (const auto& feature : keyFeatures) { | ||
| ImGui::BulletText("%s", feature.c_str()); | ||
| } | ||
| } | ||
|
|
||
| ImGui::Spacing(); | ||
| ImGui::TextWrapped("Note: This feature is only required if a terrain mod you are using specifically requires it, otherwise it does nothing."); | ||
| ImGui::PopTextWrapPos(); | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Ensure consistency with base DrawUnloadedUI() behavior
This override omits the “This feature is not installed!” header and uses ImGui::Text instead of TextWrapped for the summary.
Consider:
- Re-adding the error-colored header to match other unloaded UIs.
- Using
ImGui::TextWrappedfor the description to respect wrapping. - Guarding
PushTextWrapPos/PopTextWrapPosinside a non-empty check.
Example diff:
void TerrainHelper::DrawUnloadedUI()
{
- auto [description, keyFeatures] = GetFeatureSummary();
+ auto [description, keyFeatures] = GetFeatureSummary();
+
+ if (!description.empty() || !keyFeatures.empty()) {
+ ImGui::TextColored(globals::menu->settings.Theme.StatusPalette.Error, "This feature is not installed!");
+ ImGui::Spacing();
+
+ ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
+ ImGui::TextWrapped("%s", description.c_str());
+ if (!keyFeatures.empty()) {
+ ImGui::Spacing();
+ ImGui::TextWrapped("Key Features:");
+ for (const auto& feature : keyFeatures) {
+ ImGui::BulletText("%s", feature.c_str());
+ }
+ }
+ ImGui::Spacing();
+ ImGui::TextWrapped("Note: This feature is only required if a terrain mod you are using specifically requires it, otherwise it does nothing.");
+ ImGui::PopTextWrapPos();
+ }Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/Features/TerrainHelper.cpp lines 8 to 24, the UI override is missing the
error-colored header "This feature is not installed!" present in the base
DrawUnloadedUI(), and it uses ImGui::Text instead of TextWrapped for the
description. To fix this, add the error-colored header at the top using
ImGui::TextColored with an appropriate error color, replace ImGui::Text with
ImGui::TextWrapped for the description to ensure proper text wrapping, and only
call ImGui::PushTextWrapPos and ImGui::PopTextWrapPos if the description is not
empty to avoid unnecessary calls.
| virtual void DrawUnloadedUI() | ||
| { | ||
| auto [description, keyFeatures] = GetFeatureSummary(); | ||
|
|
||
| if (!description.empty() || !keyFeatures.empty()) { | ||
| ImGui::TextColored(globals::menu->settings.Theme.StatusPalette.Error, "This feature is not installed!"); | ||
| ImGui::Spacing(); | ||
|
|
||
| if (!description.empty()) { | ||
| ImGui::TextWrapped("%s", description.c_str()); | ||
| ImGui::Spacing(); | ||
| } | ||
|
|
||
| if (!keyFeatures.empty()) { | ||
| ImGui::TextWrapped("Key features:"); | ||
| for (const auto& feature : keyFeatures) { | ||
| ImGui::BulletText("%s", feature.c_str()); | ||
| } | ||
| ImGui::Spacing(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Header now contains ImGui calls – add explicit include to keep compilation order-agnostic
DrawUnloadedUI() uses ImGui::* symbols but imgui.h is not included. This relies on every translation unit that includes Feature.h to have already included ImGui, which is fragile.
#pragma once
+
+#include <imgui.h> // required for ImGui::TextWrapped etc.
+#include "Menu.h" // for globals::menuPlacing the include behind an #ifdef IMGUI_VERSION guard is fine if you want to keep it optional.
🤖 Prompt for AI Agents
In src/Feature.h around lines 52 to 73, the DrawUnloadedUI() method uses ImGui
functions but the header does not include imgui.h, causing fragile dependencies
on include order. Fix this by adding an explicit #include "imgui.h" at the top
of Feature.h, optionally guarded by #ifdef IMGUI_VERSION to keep it optional and
ensure compilation order-agnostic usage of ImGui symbols.
…unity-shaders#1134) * feat(ui): add feature summary tooltips and enhanced unloaded UI - Add GetFeatureSummary() virtual method to Feature base class - Implement feature summaries for 20+ features with descriptions and key features - Add hover tooltips in feature list showing comprehensive feature information - Create default DrawUnloadedUI() with theme-consistent error colors - Update TerrainVariation and TerrainHelper to use new summary system - Enhance user experience with rich feature descriptions and consistent UI * style: 🎨 apply pre-commit.ci formatting Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Improvements