Skip to content

Commit

Permalink
Fix crash when setting globe anchor attributes when georefencing is d…
Browse files Browse the repository at this point in the history
…isabled
  • Loading branch information
lilleyse committed May 7, 2024
1 parent 988d827 commit 04fe545
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/core/include/cesium/omniverse/UsdUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,6 @@ struct TranslateRotateScaleOps {

std::optional<TranslateRotateScaleOps> getOrCreateTranslateRotateScaleOps(const pxr::UsdGeomXformable& xformable);

bool getDebugDisableGeoreferencing(const Context& context);

}; // namespace cesium::omniverse::UsdUtil
4 changes: 4 additions & 0 deletions src/core/src/OmniGlobeAnchor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ bool OmniGlobeAnchor::isAnchorValid() const {
return false;
}

if (UsdUtil::getDebugDisableGeoreferencing(*_pContext)) {
return false;
}

return true;
}

Expand Down
22 changes: 9 additions & 13 deletions src/core/src/UsdUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@

namespace cesium::omniverse::UsdUtil {

namespace {

bool getDebugDisableGeoreferencing(const Context& context) {
const auto pData = context.getAssetRegistry().getFirstData();
if (!pData) {
return false;
}

return pData->getDebugDisableGeoreferencing();
}

} // namespace

glm::dvec3 usdToGlmVector(const pxr::GfVec3d& vector) {
return {vector[0], vector[1], vector[2]};
}
Expand Down Expand Up @@ -803,4 +790,13 @@ std::optional<TranslateRotateScaleOps> getOrCreateTranslateRotateScaleOps(const
return TranslateRotateScaleOps{translateOp, rotateOp, scaleOp, eulerAngleOrder};
}

bool getDebugDisableGeoreferencing(const Context& context) {
const auto pData = context.getAssetRegistry().getFirstData();
if (!pData) {
return false;
}

return pData->getDebugDisableGeoreferencing();
}

} // namespace cesium::omniverse::UsdUtil

0 comments on commit 04fe545

Please sign in to comment.