diff --git a/exts/cesium.omniverse/cesium/omniverse/ui/attributes/attribute_widget_util.py b/exts/cesium.omniverse/cesium/omniverse/ui/attributes/attribute_widget_util.py index f8a17ff8..e0398800 100644 --- a/exts/cesium.omniverse/cesium/omniverse/ui/attributes/attribute_widget_util.py +++ b/exts/cesium.omniverse/cesium/omniverse/ui/attributes/attribute_widget_util.py @@ -113,13 +113,8 @@ def build_common_raster_overlay_properties(add_overlay_render_method=False): CustomLayoutProperty("cesium:alpha", build_fn=build_slider(0, 1)) if add_overlay_render_method: CustomLayoutProperty("cesium:overlayRenderMethod") - with CustomLayoutGroup("Maximum Screen Space Error"): - CustomLayoutProperty("cesium:maximumScreenSpaceError") - with CustomLayoutGroup("Maximum Texture Size"): - CustomLayoutProperty("cesium:maximumTextureSize") - with CustomLayoutGroup("Maximum Simultaneous Tile Loads"): - CustomLayoutProperty("cesium:maximumSimultaneousTileLoads") - with CustomLayoutGroup("Sub Tile Cache Bytes"): - CustomLayoutProperty("cesium:subTileCacheBytes") - with CustomLayoutGroup("Credit Display"): - CustomLayoutProperty("cesium:showCreditsOnScreen") + CustomLayoutProperty("cesium:maximumScreenSpaceError") + CustomLayoutProperty("cesium:maximumTextureSize") + CustomLayoutProperty("cesium:maximumSimultaneousTileLoads") + CustomLayoutProperty("cesium:subTileCacheBytes") + CustomLayoutProperty("cesium:showCreditsOnScreen") diff --git a/src/core/include/cesium/omniverse/OmniRasterOverlay.h b/src/core/include/cesium/omniverse/OmniRasterOverlay.h index fc142ef9..0a187d9e 100644 --- a/src/core/include/cesium/omniverse/OmniRasterOverlay.h +++ b/src/core/include/cesium/omniverse/OmniRasterOverlay.h @@ -30,10 +30,10 @@ class OmniRasterOverlay { [[nodiscard]] int getMaximumSimultaneousTileLoads() const; [[nodiscard]] int getSubTileCacheBytes() const; - [[nodiscard]] CesiumRasterOverlays::RasterOverlayOptions getUsdOptions(); + [[nodiscard]] CesiumRasterOverlays::RasterOverlayOptions createRasterOverlayOptions() const; [[nodiscard]] virtual CesiumRasterOverlays::RasterOverlay* getRasterOverlay() const = 0; - void updateRasterOverlayOptions(CesiumRasterOverlays::RasterOverlayOptions& options); + void updateRasterOverlayOptions() const; virtual void reload() = 0; protected: @@ -41,6 +41,6 @@ class OmniRasterOverlay { pxr::SdfPath _path; private: - void setOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options); + void setRasterOverlayOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options) const; }; } // namespace cesium::omniverse diff --git a/src/core/src/OmniIonRasterOverlay.cpp b/src/core/src/OmniIonRasterOverlay.cpp index 318eab00..af7615dc 100644 --- a/src/core/src/OmniIonRasterOverlay.cpp +++ b/src/core/src/OmniIonRasterOverlay.cpp @@ -108,7 +108,7 @@ void OmniIonRasterOverlay::reload() { const auto rasterOverlayName = UsdUtil::getName(_pContext->getUsdStage(), _path); - auto options = getUsdOptions(); + auto options = createRasterOverlayOptions(); options.loadErrorCallback = [this, rasterOverlayIonAssetId, rasterOverlayName]( const CesiumRasterOverlays::RasterOverlayLoadFailureDetails& error) { diff --git a/src/core/src/OmniPolygonRasterOverlay.cpp b/src/core/src/OmniPolygonRasterOverlay.cpp index 74041bfc..1f976f43 100644 --- a/src/core/src/OmniPolygonRasterOverlay.cpp +++ b/src/core/src/OmniPolygonRasterOverlay.cpp @@ -94,7 +94,7 @@ void OmniPolygonRasterOverlay::reload() { const auto projection = CesiumGeospatial::GeographicProjection(*pEllipsoid); - auto options = getUsdOptions(); + auto options = createRasterOverlayOptions(); options.loadErrorCallback = [this](const CesiumRasterOverlays::RasterOverlayLoadFailureDetails& error) { _pContext->getLogger()->error(error.message); diff --git a/src/core/src/OmniRasterOverlay.cpp b/src/core/src/OmniRasterOverlay.cpp index edaaec37..1902d8e1 100644 --- a/src/core/src/OmniRasterOverlay.cpp +++ b/src/core/src/OmniRasterOverlay.cpp @@ -81,19 +81,22 @@ FabricOverlayRenderMethod OmniRasterOverlay::getOverlayRenderMethod() const { return FabricOverlayRenderMethod::OVERLAY; } -CesiumRasterOverlays::RasterOverlayOptions OmniRasterOverlay::getUsdOptions() { +CesiumRasterOverlays::RasterOverlayOptions OmniRasterOverlay::createRasterOverlayOptions() const { CesiumRasterOverlays::RasterOverlayOptions options; - setOptionsFromUsd(options); + options.ktx2TranscodeTargets = GltfUtil::getKtx2TranscodeTargets(); + setRasterOverlayOptionsFromUsd(options); return options; } -void OmniRasterOverlay::updateRasterOverlayOptions(CesiumRasterOverlays::RasterOverlayOptions& options) { - setOptionsFromUsd(options); +void OmniRasterOverlay::updateRasterOverlayOptions() const { + const auto pRasterOverlay = getRasterOverlay(); + if (pRasterOverlay) { + setRasterOverlayOptionsFromUsd(pRasterOverlay->getOptions()); + } } -void OmniRasterOverlay::setOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options) { +void OmniRasterOverlay::setRasterOverlayOptionsFromUsd(CesiumRasterOverlays::RasterOverlayOptions& options) const { options.showCreditsOnScreen = getShowCreditsOnScreen(); - options.ktx2TranscodeTargets = GltfUtil::getKtx2TranscodeTargets(); options.maximumScreenSpaceError = getMaximumScreenSpaceError(); options.maximumTextureSize = getMaximumTextureSize(); options.maximumSimultaneousTileLoads = getMaximumSimultaneousTileLoads(); diff --git a/src/core/src/OmniWebMapServiceRasterOverlay.cpp b/src/core/src/OmniWebMapServiceRasterOverlay.cpp index e9ddccba..bef6fe40 100644 --- a/src/core/src/OmniWebMapServiceRasterOverlay.cpp +++ b/src/core/src/OmniWebMapServiceRasterOverlay.cpp @@ -72,7 +72,7 @@ std::string OmniWebMapServiceRasterOverlay::getLayers() const { void OmniWebMapServiceRasterOverlay::reload() { const auto rasterOverlayName = UsdUtil::getName(_pContext->getUsdStage(), _path); - auto options = getUsdOptions(); + auto options = createRasterOverlayOptions(); options.loadErrorCallback = [this](const CesiumRasterOverlays::RasterOverlayLoadFailureDetails& error) { _pContext->getLogger()->error(error.message); diff --git a/src/core/src/UsdNotificationHandler.cpp b/src/core/src/UsdNotificationHandler.cpp index f06e2334..fc0e637e 100644 --- a/src/core/src/UsdNotificationHandler.cpp +++ b/src/core/src/UsdNotificationHandler.cpp @@ -341,8 +341,7 @@ void processCesiumRasterOverlayChanged( } if (updateRasterOverlayOptions) { - auto pNativeOverlay = pRasterOverlay->getRasterOverlay(); - pRasterOverlay->updateRasterOverlayOptions(pNativeOverlay->getOptions()); + pRasterOverlay->updateRasterOverlayOptions(); } }