Skip to content

Commit 8113a0a

Browse files
committed
Merge remote-tracking branch 'origin/main' into enh-1658_mesh-build-callbacks
2 parents c33861f + adb00ce commit 8113a0a

40 files changed

+7570
-486
lines changed

CHANGES.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# Change Log {#changes}
22

3-
### ? - ?
3+
### ???
4+
5+
##### Fixes :wrench:
6+
7+
- Added a missing `CesiumRuntime.h` include in `CesiumPropertyAttribute.cpp` that broke compilation in v2.18.0 on Windows.
8+
9+
### v2.18.0 - 2025-08-01
10+
11+
##### Breaking Changes :mega:
12+
13+
- Removed support for Unreal Engine 5.3. Unreal Engine 5.4 or later is now required.
14+
- `FCesiumPrimitiveMetadata::GetPropertyAttributeIndices` is now deprecated. Use `GetPropertyAttributes` to directly get the `FCesiumPropertyAttribute`s instead.
15+
16+
##### Additions :tada:
17+
18+
- Added `CesiumGeoJsonDocumentRasterOverlay`, allowing stylized GeoJSON to be rasterized and draped over terrain and other 3D Tiles.
19+
- Added `FCesiumPropertyAttributeProperty` to represent glTF property attribute properties and `UCesiumPropertyAttributePropertyBlueprintLibrary` to retrieve their values.
20+
- Added `FCesiumPropertyAttribute` to represent glTF property attributes and `UCesiumPropertyAttributeBlueprintLibrary` to act upon them with Blueprints.
21+
- Added `UCesiumPrimitiveMetadataBlueprintLibrary::GetPropertyAttributes` to retrieve the property attributes from a `FCesiumPrimitiveMetadata`.
22+
- Added `UCesiumPropertyTexturePropertyBlueprintLibrary::GetInteger64`. Although 64-bit integers aren't directly supported by property textures, this enables the lossless retrieval of 32-bit unsigned integers.
423

524
##### Additions :tada:
625

@@ -9,7 +28,10 @@
928
##### Fixes :wrench:
1029

1130
- Fixed error messages in the Unreal log about uninitialized fields in `FCesiumGeocoderServiceAttribution` and `FCesiumGeocoderServiceFeature`.
12-
- Fixed a bug where `CesiumEllipsoidFunctions` was inaccessible outside of the plugin.
31+
- Fixed a bug where `CesiumEllipsoidFunctions` was inaccessible outside of the plugin.
32+
- Fixed an issue where `UCesiumGlobeAnchorComponent::SetEastSouthUpRotation()` would throw an exception if no `ACesiumGeoreference` was found in the level.
33+
34+
In addition to the above, this release updates [cesium-native](https://github.com/CesiumGS/cesium-native) from v0.49.0 to v0.50.0. See the [changelog](https://github.com/CesiumGS/cesium-native/blob/main/CHANGES.md) for a complete list of changes in cesium-native.
1335

1436
### v2.17.0 - 2025-07-01
1537

CesiumForUnreal.uplugin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
3-
"Version": 77,
4-
"VersionName": "2.17.0",
3+
"Version": 78,
4+
"VersionName": "2.18.0",
55
"FriendlyName": "Cesium for Unreal",
66
"Description": "Unlock the 3D geospatial ecosystem in Unreal Engine with real-world 3D content and a high accuracy full-scale WGS84 globe.",
77
"Category": "Geospatial",

Source/CesiumRuntime/Private/CesiumGeoJsonDocument.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ FCesiumGeoJsonDocument::FCesiumGeoJsonDocument(
1313
std::shared_ptr<CesiumVectorData::GeoJsonDocument>&& document)
1414
: _pDocument(std::move(document)) {}
1515

16+
bool FCesiumGeoJsonDocument::IsValid() const {
17+
return this->_pDocument != nullptr;
18+
}
19+
20+
const std::shared_ptr<CesiumVectorData::GeoJsonDocument>&
21+
FCesiumGeoJsonDocument::GetDocument() const {
22+
return this->_pDocument;
23+
}
24+
1625
bool UCesiumGeoJsonDocumentBlueprintLibrary::LoadGeoJsonFromString(
1726
const FString& InString,
1827
FCesiumGeoJsonDocument& OutGeoJsonDocument) {
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2+
3+
#include "CesiumGeoJsonDocumentRasterOverlay.h"
4+
5+
#include "CesiumCustomVersion.h"
6+
#include "CesiumGeometry/QuadtreeTilingScheme.h"
7+
#include "CesiumGeospatial/GlobeRectangle.h"
8+
#include "CesiumGeospatial/Projection.h"
9+
#include "CesiumRasterOverlays/GeoJsonDocumentRasterOverlay.h"
10+
#include "CesiumVectorData/VectorStyle.h"
11+
12+
#include "CesiumRuntime.h"
13+
14+
namespace {
15+
CesiumAsync::Future<std::shared_ptr<CesiumVectorData::GeoJsonDocument>>
16+
wrapLoaderFuture(
17+
UCesiumGeoJsonDocumentRasterOverlay* pThis,
18+
CesiumAsync::Future<
19+
CesiumUtility::Result<CesiumVectorData::GeoJsonDocument>>&& future) {
20+
return std::move(future).thenInMainThread(
21+
[pThis](CesiumUtility::Result<CesiumVectorData::GeoJsonDocument>&&
22+
documentResult)
23+
-> std::shared_ptr<CesiumVectorData::GeoJsonDocument> {
24+
if (documentResult.errors) {
25+
documentResult.errors.logError(
26+
spdlog::default_logger(),
27+
"Errors loading GeoJSON document: ");
28+
return nullptr;
29+
}
30+
31+
std::shared_ptr<CesiumVectorData::GeoJsonDocument> pGeoJsonDocument =
32+
std::make_shared<CesiumVectorData::GeoJsonDocument>(
33+
std::move(*documentResult.value));
34+
35+
if (pThis->OnDocumentLoaded.IsBound()) {
36+
pThis->OnDocumentLoaded.Execute(FCesiumGeoJsonDocument(
37+
std::shared_ptr<CesiumVectorData::GeoJsonDocument>(
38+
pGeoJsonDocument)));
39+
}
40+
41+
return pGeoJsonDocument;
42+
});
43+
}
44+
} // namespace
45+
46+
std::unique_ptr<CesiumRasterOverlays::RasterOverlay>
47+
UCesiumGeoJsonDocumentRasterOverlay::CreateOverlay(
48+
const CesiumRasterOverlays::RasterOverlayOptions& options) {
49+
if (this->Source == ECesiumGeoJsonDocumentRasterOverlaySource::FromDocument &&
50+
!this->GeoJsonDocument.IsValid()) {
51+
// Don't create an overlay with an invalid document.
52+
return nullptr;
53+
}
54+
55+
CesiumRasterOverlays::GeoJsonDocumentRasterOverlayOptions vectorOptions{
56+
this->DefaultStyle.toNative(),
57+
options.ellipsoid,
58+
this->MipLevels};
59+
60+
if (this->Source ==
61+
ECesiumGeoJsonDocumentRasterOverlaySource::FromCesiumIon) {
62+
if (!IsValid(this->CesiumIonServer)) {
63+
this->CesiumIonServer = UCesiumIonServer::GetServerForNewObjects();
64+
}
65+
66+
return std::make_unique<CesiumRasterOverlays::GeoJsonDocumentRasterOverlay>(
67+
TCHAR_TO_UTF8(*this->MaterialLayerKey),
68+
wrapLoaderFuture(
69+
this,
70+
CesiumVectorData::GeoJsonDocument::fromCesiumIonAsset(
71+
getAsyncSystem(),
72+
getAssetAccessor(),
73+
this->IonAssetID,
74+
TCHAR_TO_UTF8(*this->CesiumIonServer->DefaultIonAccessToken),
75+
std::string(TCHAR_TO_UTF8(*this->CesiumIonServer->ApiUrl)) +
76+
"/")),
77+
vectorOptions,
78+
options);
79+
} else if (
80+
this->Source == ECesiumGeoJsonDocumentRasterOverlaySource::FromUrl) {
81+
std::vector<CesiumAsync::IAssetAccessor::THeader> headers;
82+
headers.reserve(this->RequestHeaders.Num());
83+
84+
for (auto& [k, v] : this->RequestHeaders) {
85+
headers.push_back({TCHAR_TO_UTF8(*k), TCHAR_TO_UTF8(*v)});
86+
}
87+
88+
return std::make_unique<CesiumRasterOverlays::GeoJsonDocumentRasterOverlay>(
89+
TCHAR_TO_UTF8(*this->MaterialLayerKey),
90+
wrapLoaderFuture(
91+
this,
92+
CesiumVectorData::GeoJsonDocument::fromUrl(
93+
getAsyncSystem(),
94+
getAssetAccessor(),
95+
TCHAR_TO_UTF8(*this->Url),
96+
std::move(headers))),
97+
vectorOptions,
98+
options);
99+
}
100+
101+
if (this->OnDocumentLoaded.IsBound()) {
102+
this->OnDocumentLoaded.Execute(this->GeoJsonDocument);
103+
}
104+
105+
return std::make_unique<CesiumRasterOverlays::GeoJsonDocumentRasterOverlay>(
106+
getAsyncSystem(),
107+
TCHAR_TO_UTF8(*this->MaterialLayerKey),
108+
this->GeoJsonDocument.GetDocument(),
109+
vectorOptions,
110+
options);
111+
}

Source/CesiumRuntime/Private/CesiumGeoJsonObject.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,41 @@ UCesiumGeoJsonObjectBlueprintLibrary::GetObjectAsFeatureCollection(
451451
return Features;
452452
}
453453

454+
FCesiumVectorStyle UCesiumGeoJsonObjectBlueprintLibrary::GetStyle(
455+
const FCesiumGeoJsonObject& InObject,
456+
EHasValue& Branches) {
457+
if (!InObject._pDocument || !InObject._pObject) {
458+
Branches = EHasValue::NoValue;
459+
return FCesiumVectorStyle();
460+
}
461+
462+
const std::optional<CesiumVectorData::VectorStyle> style =
463+
InObject._pObject->getStyle();
464+
Branches = style ? EHasValue::HasValue : EHasValue::NoValue;
465+
return style ? FCesiumVectorStyle::fromNative(*style) : FCesiumVectorStyle();
466+
}
467+
468+
void UCesiumGeoJsonObjectBlueprintLibrary::SetStyle(
469+
UPARAM(Ref) FCesiumGeoJsonObject& InObject,
470+
const FCesiumVectorStyle& InStyle) {
471+
if (!InObject._pDocument || !InObject._pObject) {
472+
return;
473+
}
474+
475+
const_cast<CesiumVectorData::GeoJsonObject*>(InObject._pObject)->getStyle() =
476+
InStyle.toNative();
477+
}
478+
479+
void UCesiumGeoJsonObjectBlueprintLibrary::ClearStyle(
480+
UPARAM(Ref) FCesiumGeoJsonObject& InObject) {
481+
if (!InObject._pDocument || !InObject._pObject) {
482+
return;
483+
}
484+
485+
const_cast<CesiumVectorData::GeoJsonObject*>(InObject._pObject)->getStyle() =
486+
std::nullopt;
487+
}
488+
454489
FCesiumGeoJsonLineString::FCesiumGeoJsonLineString(TArray<FVector>&& InPoints)
455490
: Points(MoveTemp(InPoints)) {}
456491

Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,18 @@ void UCesiumGlobeAnchorComponent::SetEastSouthUpRotation(
411411
VecMath::createQuaternion(EastSouthUpRotation),
412412
scale);
413413

414-
const CesiumGeospatial::Ellipsoid& ellipsoid =
415-
this->ResolveGeoreference()->GetEllipsoid()->GetNativeEllipsoid();
416-
417-
anchor.setAnchorToLocalTransform(
418-
eastSouthUp,
419-
newModelToEastSouthUp,
420-
false,
421-
ellipsoid);
422-
this->_updateFromNativeGlobeAnchor(anchor);
414+
const ACesiumGeoreference* pGeoreference = this->ResolveGeoreference();
415+
if (pGeoreference) {
416+
const CesiumGeospatial::Ellipsoid& ellipsoid =
417+
pGeoreference->GetEllipsoid()->GetNativeEllipsoid();
418+
419+
anchor.setAnchorToLocalTransform(
420+
eastSouthUp,
421+
newModelToEastSouthUp,
422+
false,
423+
ellipsoid);
424+
this->_updateFromNativeGlobeAnchor(anchor);
425+
}
423426
}
424427

425428
FQuat UCesiumGlobeAnchorComponent::GetEarthCenteredEarthFixedRotation() const {

Source/CesiumRuntime/Private/CesiumGltfComponent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ static void loadPrimitiveFeaturesMetadata(
10951095
pFeatures ? FCesiumPrimitiveFeatures(model, primitive, *pFeatures)
10961096
: FCesiumPrimitiveFeatures();
10971097
primitiveResult.Metadata =
1098-
pMetadata ? FCesiumPrimitiveMetadata(primitive, *pMetadata)
1098+
pMetadata ? FCesiumPrimitiveMetadata(model, primitive, *pMetadata)
10991099
: FCesiumPrimitiveMetadata();
11001100

11011101
PRAGMA_DISABLE_DEPRECATION_WARNINGS

Source/CesiumRuntime/Private/CesiumPrimitiveMetadata.cpp

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,51 @@
11
// Copyright 2020-2024 CesiumGS, Inc. and Contributors
22

33
#include "CesiumPrimitiveMetadata.h"
4-
#include "CesiumGltf/AccessorView.h"
5-
#include "CesiumGltf/ExtensionMeshPrimitiveExtStructuralMetadata.h"
6-
#include "CesiumGltf/Model.h"
74
#include "CesiumGltfPrimitiveComponent.h"
5+
#include "CesiumPropertyAttribute.h"
6+
7+
#include <CesiumGltf/ExtensionMeshPrimitiveExtStructuralMetadata.h>
8+
#include <CesiumGltf/ExtensionModelExtStructuralMetadata.h>
9+
#include <CesiumGltf/Model.h>
810

911
static FCesiumPrimitiveMetadata EmptyPrimitiveMetadata;
1012

1113
FCesiumPrimitiveMetadata::FCesiumPrimitiveMetadata(
12-
const CesiumGltf::MeshPrimitive& Primitive,
13-
const CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata& Metadata)
14-
: _propertyTextureIndices(), _propertyAttributeIndices() {
15-
this->_propertyTextureIndices.Reserve(Metadata.propertyTextures.size());
16-
for (const int64 propertyTextureIndex : Metadata.propertyTextures) {
14+
const CesiumGltf::Model& model,
15+
const CesiumGltf::MeshPrimitive& primitive,
16+
const CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata& metadata)
17+
: _propertyTextureIndices(),
18+
_propertyAttributes(),
19+
_propertyAttributeIndices() {
20+
this->_propertyTextureIndices.Reserve(metadata.propertyTextures.size());
21+
for (const int64 propertyTextureIndex : metadata.propertyTextures) {
1722
this->_propertyTextureIndices.Emplace(propertyTextureIndex);
1823
}
1924

20-
this->_propertyAttributeIndices.Reserve(Metadata.propertyAttributes.size());
21-
for (const int64 propertyAttributeIndex : Metadata.propertyAttributes) {
25+
// For backwards compatibility with GetPropertyAttributeIndices().
26+
this->_propertyAttributeIndices.Reserve(metadata.propertyAttributes.size());
27+
for (const int64 propertyAttributeIndex : metadata.propertyAttributes) {
2228
this->_propertyAttributeIndices.Emplace(propertyAttributeIndex);
2329
}
30+
31+
const auto* pModelMetadata =
32+
model.getExtension<CesiumGltf::ExtensionModelExtStructuralMetadata>();
33+
if (!pModelMetadata) {
34+
return;
35+
}
36+
37+
for (const int64 propertyAttributeIndex : metadata.propertyAttributes) {
38+
if (propertyAttributeIndex < 0 ||
39+
propertyAttributeIndex >=
40+
int64_t(pModelMetadata->propertyAttributes.size())) {
41+
continue;
42+
}
43+
44+
this->_propertyAttributes.Emplace(FCesiumPropertyAttribute(
45+
model,
46+
primitive,
47+
pModelMetadata->propertyAttributes[propertyAttributeIndex]));
48+
}
2449
}
2550

2651
const FCesiumPrimitiveMetadata&
@@ -41,6 +66,12 @@ UCesiumPrimitiveMetadataBlueprintLibrary::GetPropertyTextureIndices(
4166
return PrimitiveMetadata._propertyTextureIndices;
4267
}
4368

69+
const TArray<FCesiumPropertyAttribute>&
70+
UCesiumPrimitiveMetadataBlueprintLibrary::GetPropertyAttributes(
71+
UPARAM(ref) const FCesiumPrimitiveMetadata& PrimitiveMetadata) {
72+
return PrimitiveMetadata._propertyAttributes;
73+
}
74+
4475
const TArray<int64>&
4576
UCesiumPrimitiveMetadataBlueprintLibrary::GetPropertyAttributeIndices(
4677
UPARAM(ref) const FCesiumPrimitiveMetadata& PrimitiveMetadata) {

0 commit comments

Comments
 (0)