ArticyXImporter
ArticyXImporter for Unreal Engine
Loading...
Searching...
No Matches
SArticyGlobalVariables.h
1//
2// Copyright (c) 2023 articy Software GmbH & Co. KG. All rights reserved.
3//
4
5#pragma once
6
7#include "CoreMinimal.h"
8#include "Widgets/DeclarativeSyntaxSupport.h"
9#include "ArticyGlobalVariables.h"
10#include "Misc/TextFilterExpressionEvaluator.h"
11#include "Slate/ArticyFilterHelpers.h"
12#include "Widgets/SCompoundWidget.h"
13#include "Widgets/Layout/SExpandableArea.h"
14#include "Widgets/Layout/SSplitter.h"
15#include "Widgets/SBoxPanel.h"
16
19{
20 TAttribute<float> LeftColumnWidth;
21 TAttribute<float> RightColumnWidth;
22 SSplitter::FOnSlotResized OnWidthChanged;
23
24 void SetColumnWidth(float InWidth) { OnWidthChanged.ExecuteIfBound(InWidth); }
25};
26
30class SArticyVariableSet : public SCompoundWidget
31{
32 SLATE_BEGIN_ARGS(SArticyVariableSet) :
33 _bInitiallyCollapsed(true),
34 _SizeData(nullptr)
35 {}
36
38 SLATE_ARGUMENT(bool, bInitiallyCollapsed)
39
40
41 SLATE_ARGUMENT(const FGlobalVariablesSizeData*, SizeData)
42
43 SLATE_END_ARGS()
44
45
51 void Construct(const FArguments& Args, TWeakObjectPtr<UArticyBaseVariableSet> VariableSet);
52
58 void SetExpanded(bool bInExpanded) const;
59
65 bool IsExpanded() const;
66
73 void UpdateVisibility(const UArticyVariable* Variable, EVisibility InVisibility);
74
80 TArray<UArticyVariable*> GetVariables();
81
82private:
84 void BuildVariableWidgets();
85
86private:
88 bool bVariableWidgetsBuilt = false;
89
91 bool bSliderMoving = false;
92
94 TWeakObjectPtr<UArticyBaseVariableSet> VariableSet;
95
97 TMap<UArticyVariable*, TWeakPtr<SWidget>> VariableWidgetMapping;
98
100 TSharedPtr<SVerticalBox> VariableContainer;
101
103 TSharedPtr<SExpandableArea> NamespaceExpansion;
104
106 const FGlobalVariablesSizeData* SizeData = nullptr;
107
116 template<typename T, typename T2>
117 void OnValueChanged(T Value, T2* Var);
118};
119
120template <typename T, typename T2>
121void SArticyVariableSet::OnValueChanged(T Value, T2* Var)
122{
123 if (bSliderMoving)
124 {
125 if (Var->Get() == Value)
126 {
127 return;
128 }
129 Var->Modify();
130 *Var = Value;
131 }
132}
133
137class SArticyGlobalVariables : public SCompoundWidget
138{
139 SLATE_BEGIN_ARGS(SArticyGlobalVariables) :
140 _bInitiallyCollapsed(true)
141 {}
143 SLATE_ARGUMENT(bool, bInitiallyCollapsed)
144 SLATE_END_ARGS()
145
146
152 void Construct(const FArguments& Args, TWeakObjectPtr<UArticyGlobalVariables> GV);
153
159 void UpdateDisplayedGlobalVariables(TWeakObjectPtr<UArticyGlobalVariables> InGV);
160
161private:
163 TWeakObjectPtr<UArticyGlobalVariables> GlobalVariables;
164
165private:
168
170 float ColumnWidth = 0.65f;
171
173 bool bInitiallyCollapsed = true;
174
175private:
177 float OnGetLeftColumnWidth() const { return 1.0f - ColumnWidth; }
178
180 float OnGetRightColumnWidth() const { return ColumnWidth; }
181
183 void OnSetColumnWidth(float InWidth) { ColumnWidth = InWidth; }
184
185private:
187 void OnSearchBoxChanged(const FText& InSearchText);
188
190 void OnSearchBoxCommitted(const FText& InSearchText, ETextCommit::Type CommitInfo);
191
193 void SetSearchBoxText(const FText& InSearchText);
194
196 void OnFrontendFiltersChanged();
197
199 bool TestAgainstFrontendFilters(const UArticyVariable* Item) const;
200
202 void CacheExpansionStates();
203
205 void RestoreExpansionStates();
206
207private:
209 TSharedPtr<SVerticalBox> SetContainer;
210
212 TArray<TSharedPtr<SArticyVariableSet>> VariableSetWidgets;
213
215 bool bShouldForceExpand = false;
216
218 TMap<TSharedPtr<SArticyVariableSet>, bool> ExpansionCache;
219
221 TSharedPtr<FFrontendFilter_ArticyVariable> VariableFilter;
222
224 TSharedPtr<FArticyVariableFilterCollectionType> FrontendFilters;
225};
Definition SArticyGlobalVariables.h:138
Definition SArticyGlobalVariables.h:31
Definition ArticyGlobalVariables.h:89
Definition SArticyGlobalVariables.h:19