Skip to content

Fix crash that results from duplicating a georeference #1680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

- Worked around an Unreal Engine limitation that prevented collisions and line traces from working correctly for tilesets with a very small scale factor.
- Add a missing include for `GEngine` when packaging from source, introduced in *v2.16.0*.
- Fixed a bug in UCesiumFeaturesMetadataComponent where multiple references to same feature ID set would cause improper encoding of its feature IDs.
- Fixed a bug in `UCesiumFeaturesMetadataComponent` where multiple references to same feature ID set would cause improper encoding of its feature IDs.
- Fixed a crash that would occur when duplicating an `ACesiumGeoreference`.
- Removed an unnecessary copy operation that happened while constructing tile meshes.

### v2.16.0 - 2025-05-01
Expand Down
25 changes: 14 additions & 11 deletions Source/CesiumRuntime/Private/Cesium3DTileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,20 @@ ACesiumGeoreference* ACesium3DTileset::ResolveGeoreference() {
ACesiumGeoreference::GetDefaultGeoreferenceForActor(this);
}

UCesium3DTilesetRoot* pRoot = Cast<UCesium3DTilesetRoot>(this->RootComponent);
if (pRoot) {
this->ResolvedGeoreference->OnGeoreferenceUpdated.AddUniqueDynamic(
pRoot,
&UCesium3DTilesetRoot::HandleGeoreferenceUpdated);
this->ResolvedGeoreference->OnEllipsoidChanged.AddUniqueDynamic(
this,
&ACesium3DTileset::HandleOnGeoreferenceEllipsoidChanged);

// Update existing tile positions, if any.
pRoot->HandleGeoreferenceUpdated();
if (this->ResolvedGeoreference) {
UCesium3DTilesetRoot* pRoot =
Cast<UCesium3DTilesetRoot>(this->RootComponent);
if (pRoot) {
this->ResolvedGeoreference->OnGeoreferenceUpdated.AddUniqueDynamic(
pRoot,
&UCesium3DTilesetRoot::HandleGeoreferenceUpdated);
this->ResolvedGeoreference->OnEllipsoidChanged.AddUniqueDynamic(
this,
&ACesium3DTileset::HandleOnGeoreferenceEllipsoidChanged);

// Update existing tile positions, if any.
pRoot->HandleGeoreferenceUpdated();
}
}

return this->ResolvedGeoreference;
Expand Down
10 changes: 6 additions & 4 deletions Source/CesiumRuntime/Private/Cesium3DTilesetRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ void UCesium3DTilesetRoot::_updateAbsoluteLocation() {

void UCesium3DTilesetRoot::_updateTilesetToUnrealRelativeWorldTransform() {
ACesium3DTileset* pTileset = this->GetOwner<ACesium3DTileset>();
ACesiumGeoreference* pGeoreference = pTileset->ResolveGeoreference();

this->_tilesetToUnrealRelativeWorld = VecMath::createMatrix4D(
pTileset->ResolveGeoreference()
->ComputeEarthCenteredEarthFixedToUnrealTransformation());
if (pGeoreference) {
this->_tilesetToUnrealRelativeWorld = VecMath::createMatrix4D(
pGeoreference->ComputeEarthCenteredEarthFixedToUnrealTransformation());

pTileset->UpdateTransformFromCesium();
pTileset->UpdateTransformFromCesium();
}
}