fix(Phase 24.1): Migrate panel/dialog to Phase 24.0 Operand-based ConditionPreset model - #430
Open
Atlasbruce with Copilot wants to merge 2 commits into
Open
fix(Phase 24.1): Migrate panel/dialog to Phase 24.0 Operand-based ConditionPreset model#430Atlasbruce with Copilot wants to merge 2 commits into
Atlasbruce with Copilot wants to merge 2 commits into
Conversation
- Fix include paths in ConditionPresetLibraryPanel.h and ConditionPresetEditDialog.h to use new Editor/ConditionPreset/ headers instead of BlueprintEditor/ConditionPreset.h - Create ConditionPreset.cpp and ConditionPresetRegistry.cpp in Source/Editor/ConditionPreset/ (missing implementations) - Add GetFilteredPresets() to new ConditionPresetRegistry - Update ConditionPresetLibraryPanel.cpp to use new registry API (CreatePreset/DeletePreset instead of AddPreset/RemovePreset) - Rewrite ConditionPresetEditDialog.cpp to use Operand/ComparisonOp types directly, replacing string-based Condition sub-struct accessors - Fix accessor methods in dialog header to return string by value - Update Phase 24.1 tests to use new ConditionPreset struct - Update CMakeLists.txt: add Phase 24.0 test targets and update Phase 24.1 test sources to use new implementation files - All 49 Phase 24 tests pass (5+8+6+12+10+8)" Co-authored-by: Atlasbruce <2962180+Atlasbruce@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix include errors and structural inconsistencies
fix(Phase 24.1): Migrate panel/dialog to Phase 24.0 Operand-based ConditionPreset model
Mar 17, 2026
Atlasbruce
marked this pull request as ready for review
March 17, 2026 18:40
There was a problem hiding this comment.
Pull request overview
Migrates the Phase 24.1 Condition Preset UI (panel + edit dialog) and its tests away from the legacy string-based BlueprintEditor/ConditionPreset.h model to the Phase 24.0 Operand/ComparisonOp typed model under Source/Editor/ConditionPreset/, and adds the missing .cpp implementations needed for linking.
Changes:
- Updated Phase 24.1 panel/dialog includes and internal state to use
Operand+ComparisonOp(typed model), plus aligned registry API calls (CreatePreset/DeletePreset/GetFilteredPresets). - Added implementations for
ConditionPresetandConditionPresetRegistryinSource/Editor/ConditionPreset/(serialization, preview helpers, CRUD, persistence, filtering). - Updated Phase 24.1 tests and CMake targets to compile/link against the new module sources and added Phase 24.0 test executables.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Editor/Panels/ConditionPresetLibraryPanelTest.cpp | Updates tests to construct presets via Operand/ComparisonOp and use the new registry API. |
| Tests/Editor/Dialogs/ConditionPresetEditDialogTest.cpp | Updates dialog tests to assert against typed ConditionPreset fields and operator string conversion helpers. |
| Source/Editor/Panels/ConditionPresetLibraryPanel.h | Fixes includes to point at the new ConditionPreset module and registry header. |
| Source/Editor/Panels/ConditionPresetLibraryPanel.cpp | Switches default preset creation and deletion to Operand-based model + new registry CRUD methods. |
| Source/Editor/Dialogs/ConditionPresetEditDialog.h | Switches accessors/setters away from legacy condition.* strings to typed Operand-based state and adds operator raw string tracking. |
| Source/Editor/Dialogs/ConditionPresetEditDialog.cpp | Implements Operand-based setters/accessors/validation and updates ImGui rendering logic accordingly. |
| Source/Editor/ConditionPreset/ConditionPresetRegistry.h | Adds GetFilteredPresets(filter) API for UI filtering by name/preview. |
| Source/Editor/ConditionPreset/ConditionPresetRegistry.cpp | New implementation: CRUD, filtering, JSON load/save persistence, error accumulation. |
| Source/Editor/ConditionPreset/ConditionPreset.cpp | New implementation: preview rendering, operator string conversions, JSON (de)serialization. |
| CMakeLists.txt | Adds Phase 24.0 test executables and updates Phase 24.1 test targets to link against the new ConditionPreset module sources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+25
to
+33
| std::string ConditionPresetRegistry::GenerateID() | ||
| { | ||
| // Simple counter-based ID — sufficient for a single-threaded editor tool. | ||
| static int s_counter = 0; | ||
| ++s_counter; | ||
| std::ostringstream oss; | ||
| oss << "preset_" << s_counter; | ||
| return oss.str(); | ||
| } |
| if (!entry.is_object()) { continue; } | ||
| ConditionPreset p = ConditionPreset::FromJson(entry); | ||
| if (!p.id.empty()) | ||
| { |
Comment on lines
109
to
+118
| void ConditionPresetEditDialog::SetLeftConst(const TaskValue& value) | ||
| { | ||
| m_workingCopy.condition.leftConstValue = value; | ||
| if (value.GetType() == VariableType::Int) | ||
| m_workingCopy.left.constValue = static_cast<double>(value.AsInt()); | ||
| else if (value.GetType() == VariableType::Float) | ||
| m_workingCopy.left.constValue = static_cast<double>(value.AsFloat()); | ||
| else if (value.GetType() == VariableType::Bool) | ||
| m_workingCopy.left.constValue = value.AsBool() ? 1.0 : 0.0; | ||
| else | ||
| m_workingCopy.left.constValue = 0.0; |
Comment on lines
145
to
+154
| void ConditionPresetEditDialog::SetRightConst(const TaskValue& value) | ||
| { | ||
| m_workingCopy.condition.rightConstValue = value; | ||
| if (value.GetType() == VariableType::Int) | ||
| m_workingCopy.right.constValue = static_cast<double>(value.AsInt()); | ||
| else if (value.GetType() == VariableType::Float) | ||
| m_workingCopy.right.constValue = static_cast<double>(value.AsFloat()); | ||
| else if (value.GetType() == VariableType::Bool) | ||
| m_workingCopy.right.constValue = value.AsBool() ? 1.0 : 0.0; | ||
| else | ||
| m_workingCopy.right.constValue = 0.0; |
Comment on lines
348
to
+360
| const auto& ops = GetValidOperators(); | ||
| const std::string& current = m_workingCopy.condition.operatorStr; | ||
|
|
||
| int opIdx = 0; | ||
| for (int i = 0; i < static_cast<int>(ops.size()); ++i) | ||
| { | ||
| if (ops[i] == current) { opIdx = i; break; } | ||
| if (ops[i] == m_operatorStr) { opIdx = i; break; } | ||
| } | ||
|
|
||
| // Build C-string array for ImGui::Combo | ||
| const char* items[] = { "==", "!=", "<", "<=", ">", ">=" }; | ||
| ImGui::SetNextItemWidth(70.f); | ||
| if (ImGui::Combo("Operator", &opIdx, items, static_cast<int>(ops.size()))) | ||
| { | ||
| m_workingCopy.condition.operatorStr = ops[opIdx]; | ||
| SetOperator(ops[opIdx]); |
Comment on lines
+155
to
+185
| std::vector<ConditionPreset> | ||
| ConditionPresetRegistry::GetFilteredPresets(const std::string& filter) const | ||
| { | ||
| std::vector<ConditionPreset> result; | ||
| result.reserve(m_order.size()); | ||
|
|
||
| if (filter.empty()) | ||
| { | ||
| for (const auto& id : m_order) | ||
| { | ||
| auto it = m_presets.find(id); | ||
| if (it != m_presets.end()) | ||
| result.push_back(it->second); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| const std::string lowerFilter = ToLowerStr(filter); | ||
|
|
||
| for (const auto& id : m_order) | ||
| { | ||
| auto it = m_presets.find(id); | ||
| if (it == m_presets.end()) { continue; } | ||
|
|
||
| const ConditionPreset& p = it->second; | ||
| if (ToLowerStr(p.name).find(lowerFilter) != std::string::npos || | ||
| ToLowerStr(p.GetPreview()).find(lowerFilter) != std::string::npos) | ||
| { | ||
| result.push_back(p); | ||
| } | ||
| } |
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.
Phase 24.1 UI files (
ConditionPresetLibraryPanel,ConditionPresetEditDialog) were pointing at the legacyBlueprintEditor/ConditionPreset.h(string-basedConditionsub-struct) instead of the Phase 24.0Editor/ConditionPreset/ConditionPreset.h(Operand/ComparisonOptyped model). Additionally, the new model's.cppimplementations didn't exist yet, so nothing in the new module could link.New files
Source/Editor/ConditionPreset/ConditionPreset.cpp— implementsGetPreview(),ToJson/FromJson(),OpToString/FromString(), etc.Source/Editor/ConditionPreset/ConditionPresetRegistry.cpp— full CRUD + JSON persistence (CreatePreset,DeletePreset,GetFilteredPresets,Load,Save)Include path fixes
ConditionPresetLibraryPanel.h/ConditionPresetEditDialog.h:Structural fix — dialog internal state
Replaced all
m_workingCopy.condition.leftMode/.operatorStr/.leftVariablestring-field accesses with typedOperand/ComparisonOpequivalents. A separatem_operatorStrstring is retained for invalid-operator validation (e.g.SetOperator("??")→IsValid() == false). Accessor return types changed fromconst std::string&tostd::string(value) since they now translate from enum.Registry API alignment
Panel updated to use new registry surface (
CreatePreset/DeletePreset/GetFilteredPresets) instead of oldAddPreset/RemovePreset.GetFilteredPresets(filter)added toConditionPresetRegistry(case-insensitive name + preview match).Tests & CMake
result.left.stringValue,ConditionPreset::OpToString(result.op))CMakeLists.txt:OlympePhase24OperandTests,OlympePhase24ConditionPresetTests,OlympePhase24DynamicDataPinTests,OlympePhase24RegistryTestsSource/BlueprintEditor/ConditionPreset.cppto the newSource/Editor/ConditionPreset/sourcesOriginal prompt
🔧 FIX: Corriger les Erreurs d'Include et les Incohérences Structurelles
Référence: Suite PR #422, #426, #424
Issue Parent: #421 (MEGA REFACTOR Phase 24)
Type: Bug Fix - Compilation Errors
Priority: P0 - CRITICAL (Blocking compilation)
🚨 Problèmes Identifiés
1. Include Paths Incorrects
ConditionPresetLibraryPanel.h (ligne 38)
ConditionPresetEditDialog.h (ligne 40)
2. Forward Declarations Manquantes
ConditionPresetLibraryPanel.h
Ajouter avant la classe ConditionPresetLibraryPanel:
ConditionPresetEditDialog.h
Ajouter:
3. Include Manquants pour Dépendances
ConditionPresetLibraryPanel.h
ConditionPresetEditDialog.h
4. Vérifier la Structure de ConditionPreset
Il y a une incohérence dans ConditionPresetEditDialog.h:
✅ Corrections à Appliquer
File 1: Source/Editor/Panels/ConditionPresetLibraryPanel.h
Changes:
#include "../../BlueprintEditor/ConditionPreset.h"→
#include "../ConditionPreset/ConditionPreset.h"File 2: Source/Editor/Dialogs/ConditionPresetEditDialog.h
Changes:
#include "../../BlueprintEditor/ConditionPreset.h"→
#include "../ConditionPreset/ConditionPreset.h"File 3: Vérifier ConditionPresetEditDialog.cpp
File 4: Source/Editor/ConditionPreset/ (Tous les .cpp)
🎯 Success Criteria
The following is the prior conversation context from the user's chat exploration (may be truncated):
Assistant: Perfect! J'ai drafted la mega issue pour la Phase 24. Voici le résumé: