Skip to content

Commit 52858ab

Browse files
authored
Merge pull request #1080 from CesiumGS/credit-display-changes
Properly separate on-screen credits from popup
2 parents fb0fce0 + 7410314 commit 52858ab

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Source/CesiumRuntime/Private/CesiumCreditSystem.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,17 @@ void ACesiumCreditSystem::Tick(float DeltaTime) {
174174
CreditsUpdated =
175175
creditsToShowThisFrame.size() != _lastCreditsCount ||
176176
_pCreditSystem->getCreditsToNoLongerShowThisFrame().size() > 0;
177+
177178
if (CreditsUpdated) {
178179
FString OnScreenCredits;
179180
FString Credits;
180181

181182
_lastCreditsCount = creditsToShowThisFrame.size();
182183

183-
bool first = true;
184+
bool firstCreditOnScreen = true;
184185
for (int i = 0; i < creditsToShowThisFrame.size(); i++) {
185186
const Cesium3DTilesSelection::Credit& credit = creditsToShowThisFrame[i];
186-
if (i != 0) {
187-
Credits += "\n";
188-
}
187+
189188
FString CreditRtf;
190189
const std::string& html = _pCreditSystem->getHtml(credit);
191190

@@ -196,17 +195,28 @@ void ACesiumCreditSystem::Tick(float DeltaTime) {
196195
CreditRtf = ConvertHtmlToRtf(html);
197196
_htmlToRtf.insert({html, CreditRtf});
198197
}
199-
Credits += CreditRtf;
198+
200199
if (_pCreditSystem->shouldBeShownOnScreen(credit)) {
201-
if (first) {
202-
first = false;
200+
if (firstCreditOnScreen) {
201+
firstCreditOnScreen = false;
203202
} else {
204203
OnScreenCredits += TEXT(" \u2022 ");
205204
}
205+
206206
OnScreenCredits += CreditRtf;
207+
} else {
208+
if (i != 0) {
209+
Credits += "\n";
210+
}
211+
212+
Credits += CreditRtf;
207213
}
208214
}
209-
OnScreenCredits += "<credits url=\"popup\" text=\" Data attribution\"/>";
215+
216+
if (!Credits.IsEmpty()) {
217+
OnScreenCredits += "<credits url=\"popup\" text=\" Data attribution\"/>";
218+
}
219+
210220
CreditsWidget->SetCredits(Credits, OnScreenCredits);
211221
}
212222
_pCreditSystem->startNextFrame();

0 commit comments

Comments
 (0)