Skip to content

Commit

Permalink
Merge branch 'main' into combine-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Feb 14, 2024
2 parents 8b5c870 + 2945933 commit ad067d2
Show file tree
Hide file tree
Showing 24 changed files with 301 additions and 210 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
### v0.18.0 - 2024-03-01

* **Breaking change:** `cesium.usd.plugins` has been removed and merged into the main `cesium.omniverse` extension. Python bindings for the Cesium USD Schemas are now available in the `cesium.omniverse.usd.plugins` module.
* **Breaking change:** removed deprecated properties `projectDefaultIonAccessToken` and `projectDefaultIonAccessToken` from `CesiumDataPrim`. `CesiumIonServerPrim` should be used instead.
* Added support for globe anchors on non-georeferenced tilesets.
* Fixed zooming to tileset extents when tileset prims have non identity transformation.
* Fixed crash when updating tilesets shader inputs.
* Fixed crash when setting certain `/Cesium` debug options at runtime.
* Fixed crash when disabling and re-enabling the extension.
* Fixed crash when removing USD prims in certain order.
* Fixed issue where Cesium ion session would not resume on reload.

### v0.17.0 - 2024-02-01

Expand Down
7 changes: 0 additions & 7 deletions exts/cesium.omniverse/cesium/omniverse/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,3 @@ def _setup_ion_server_prims(self):

data_prim: CesiumData = CesiumData.Get(stage, CESIUM_DATA_PRIM_PATH)
data_prim.GetSelectedIonServerRel().AddTarget(path)

# For backwards compatibility. Add access token from CesiumData prim.
defaultAccessToken = data_prim.GetProjectDefaultIonAccessTokenAttr().Get()
defaultAccessTokenId = data_prim.GetProjectDefaultIonAccessTokenIdAttr().Get()

prim.GetProjectDefaultIonAccessTokenAttr().Set(defaultAccessToken)
prim.GetProjectDefaultIonAccessTokenIdAttr().Set(defaultAccessTokenId)
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class Data(pxr.Usd.Typed):
@classmethod
def CreateDebugTexturePoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateProjectDefaultIonAccessTokenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateProjectDefaultIonAccessTokenIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSelectedIonServerRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
Expand All @@ -61,10 +57,6 @@ class Data(pxr.Usd.Typed):
@classmethod
def GetDebugTexturePoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetProjectDefaultIonAccessTokenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetProjectDefaultIonAccessTokenIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSelectedIonServerRel(cls, *args, **kwargs) -> Any: ...
Expand Down Expand Up @@ -471,8 +463,6 @@ class Tokens(Boost.Python.instance):
@property
def cesiumGeoreferenceOriginLongitude(self) -> Any: ...
@property
def cesiumHeight(self) -> Any: ...
@property
def cesiumInvertSelection(self) -> Any: ...
@property
def cesiumIonAccessToken(self) -> Any: ...
Expand Down Expand Up @@ -525,9 +515,11 @@ class Tokens(Boost.Python.instance):
@property
def cesiumSuspendUpdate(self) -> Any: ...
@property
def cesiumUrl(self) -> Any: ...
def cesiumTileHeight(self) -> Any: ...
@property
def cesiumWidth(self) -> Any: ...
def cesiumTileWidth(self) -> Any: ...
@property
def cesiumUrl(self) -> Any: ...
@property
def clip(self) -> Any: ...
@property
Expand All @@ -544,24 +536,22 @@ class WebMapServiceRasterOverlay(RasterOverlay):
@classmethod
def CreateBaseUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateLayersAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMinimumLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateWidthAttr(cls, *args, **kwargs) -> Any: ...
def CreateTileHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateTileWidthAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetBaseUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetLayersAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumLevelAttr(cls, *args, **kwargs) -> Any: ...
Expand All @@ -570,7 +560,9 @@ class WebMapServiceRasterOverlay(RasterOverlay):
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetWidthAttr(cls, *args, **kwargs) -> Any: ...
def GetTileHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetTileWidthAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
Expand Down
16 changes: 0 additions & 16 deletions exts/cesium.omniverse/schemas/cesium_schemas.usda
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@ class CesiumDataPrim "CesiumDataPrim" (
doc = "The current ion Server prim used in the Cesium for Omniverse UI."
)

string cesium:projectDefaultIonAccessToken = "" (
customData = {
string apiName = "projectDefaultIonAccessToken"
}
displayName = "Project default ion Access Token"
doc = "DEPRECATED: A string representing the token for accessing Cesium ion assets. Moved to CesiumIonServerPrim. Will be removed in a future version."
)

string cesium:projectDefaultIonAccessTokenId = "" (
customData = {
string apiName = "projectDefaultIonAccessTokenId"
}
displayName = "Project default ion Access Token ID"
doc = "DEPRECATED: A string representing the token ID for accessing Cesium ion assets. Moved to CesiumIonServerPrim. Will be removed in a future version."
)

bool cesium:debug:disableMaterials = false (
customData = {
string apiName = "debugDisableMaterials"
Expand Down
10 changes: 5 additions & 5 deletions genStubs.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ set CESIUM_TESTS_STUB_PATH=%PROJECT_ROOT%\exts\cesium.omniverse.cpp.tests\cesium

set PYTHONPATH=%NVIDIA_USD_PYTHON_LIBS%;%PYTHONPATH%

echo "Ensuring mypy is installed"
%NVIDIA_PYTHON_EXECUTABLE% -m pip install mypy==1.6.1
echo "Ensuring mypy and black are installed"
%NVIDIA_PYTHON_EXECUTABLE% -m pip install mypy==1.6.1 black==23.1.0

echo "Building lib files flat in temp dir"
cmake -B build-stubs
Expand All @@ -45,9 +45,9 @@ copy out\_CesiumUsdSchemas.pyi %CESIUM_USD_STUB_PATH%
copy out\CesiumOmniverseCppTestsPythonBindings.pyi %CESIUM_TESTS_STUB_PATH%

echo "Formatting stubs"
black %CESIUM_OMNI_STUB_PATH%
black %CESIUM_USD_STUB_PATH%
black %CESIUM_TESTS_STUB_PATH%
%NVIDIA_PYTHON_EXECUTABLE% -m black %CESIUM_OMNI_STUB_PATH%
%NVIDIA_PYTHON_EXECUTABLE% -m black %CESIUM_USD_STUB_PATH%
%NVIDIA_PYTHON_EXECUTABLE% -m black %CESIUM_TESTS_STUB_PATH%

echo "Cleaning up temp dir"
cd %PROJECT_ROOT%
Expand Down
10 changes: 5 additions & 5 deletions genStubs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ CESIUM_TESTS_STUB_PATH="$PROJECT_ROOT/exts/cesium.omniverse.cpp.tests/cesium/omn

export PYTHONPATH="$NVIDIA_USD_PYTHON_LIBS:$PYTHONPATH"

echo "Ensuring mypy is installed"
$NVIDIA_PYTHON_EXECUTABLE -m pip install mypy==1.6.1
echo "Ensuring mypy and black are installed"
$NVIDIA_PYTHON_EXECUTABLE -m pip install mypy==1.6.1 black==23.1.0

echo "Building lib files flat in temp dir"
cmake -B build
Expand All @@ -45,9 +45,9 @@ cp "out/_CesiumUsdSchemas.pyi" $CESIUM_USD_STUB_PATH
cp "out/CesiumOmniverseCppTestsPythonBindings.pyi" $CESIUM_TESTS_STUB_PATH

echo "Formatting stubs"
black $CESIUM_OMNI_STUB_PATH
black $CESIUM_USD_STUB_PATH
black $CESIUM_TESTS_STUB_PATH
$NVIDIA_PYTHON_EXECUTABLE -m black $CESIUM_OMNI_STUB_PATH
$NVIDIA_PYTHON_EXECUTABLE -m black $CESIUM_USD_STUB_PATH
$NVIDIA_PYTHON_EXECUTABLE -m black $CESIUM_TESTS_STUB_PATH

echo "Cleaning up temp dir"
rm -rf $FLAT_LIBRARIES_DIR
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 @@ -91,6 +91,8 @@ Cesium3DTilesSelection::ViewState computeViewState(
const Viewport& viewport);

bool primExists(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path);
bool isSchemaValid(const pxr::UsdSchemaBase& schema);

bool isPrimVisible(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path);
const std::string& getName(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path);

Expand Down
3 changes: 3 additions & 0 deletions src/core/src/OmniCartographicPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ std::vector<CesiumGeospatial::Cartographic> OmniCartographicPolygon::getCartogra
}

const auto cesiumCartographicPolygon = UsdUtil::getCesiumCartographicPolygon(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumCartographicPolygon)) {
return {};
}

pxr::VtArray<pxr::GfVec3f> points;
cesiumCartographicPolygon.GetPointsAttr().Get(&points);
Expand Down
33 changes: 33 additions & 0 deletions src/core/src/OmniData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const pxr::SdfPath& OmniData::getPath() const {

pxr::SdfPath OmniData::getSelectedIonServerPath() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return {};
}

pxr::SdfPathVector targets;
cesiumData.GetSelectedIonServerRel().GetForwardedTargets(&targets);
Expand All @@ -30,6 +33,9 @@ pxr::SdfPath OmniData::getSelectedIonServerPath() const {

bool OmniData::getDebugDisableMaterials() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return false;
}

bool disableMaterials;
cesiumData.GetDebugDisableMaterialsAttr().Get(&disableMaterials);
Expand All @@ -39,6 +45,9 @@ bool OmniData::getDebugDisableMaterials() const {

bool OmniData::getDebugDisableTextures() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return false;
}

bool disableTextures;
cesiumData.GetDebugDisableTexturesAttr().Get(&disableTextures);
Expand All @@ -48,6 +57,9 @@ bool OmniData::getDebugDisableTextures() const {

bool OmniData::getDebugDisableGeometryPool() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return false;
}

bool disableGeometryPool;
cesiumData.GetDebugDisableGeometryPoolAttr().Get(&disableGeometryPool);
Expand All @@ -57,6 +69,9 @@ bool OmniData::getDebugDisableGeometryPool() const {

bool OmniData::getDebugDisableMaterialPool() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return false;
}

bool disableMaterialPool;
cesiumData.GetDebugDisableMaterialPoolAttr().Get(&disableMaterialPool);
Expand All @@ -66,6 +81,9 @@ bool OmniData::getDebugDisableMaterialPool() const {

bool OmniData::getDebugDisableTexturePool() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return false;
}

bool disableTexturePool;
cesiumData.GetDebugDisableTexturePoolAttr().Get(&disableTexturePool);
Expand All @@ -75,6 +93,9 @@ bool OmniData::getDebugDisableTexturePool() const {

uint64_t OmniData::getDebugGeometryPoolInitialCapacity() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return 2048;
}

uint64_t geometryPoolInitialCapacity;
cesiumData.GetDebugGeometryPoolInitialCapacityAttr().Get(&geometryPoolInitialCapacity);
Expand All @@ -84,6 +105,9 @@ uint64_t OmniData::getDebugGeometryPoolInitialCapacity() const {

uint64_t OmniData::getDebugMaterialPoolInitialCapacity() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return 2048;
}

uint64_t materialPoolInitialCapacity;
cesiumData.GetDebugMaterialPoolInitialCapacityAttr().Get(&materialPoolInitialCapacity);
Expand All @@ -93,6 +117,9 @@ uint64_t OmniData::getDebugMaterialPoolInitialCapacity() const {

uint64_t OmniData::getDebugTexturePoolInitialCapacity() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return 2048;
}

uint64_t texturePoolInitialCapacity;
cesiumData.GetDebugTexturePoolInitialCapacityAttr().Get(&texturePoolInitialCapacity);
Expand All @@ -102,6 +129,9 @@ uint64_t OmniData::getDebugTexturePoolInitialCapacity() const {

bool OmniData::getDebugRandomColors() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return false;
}

bool debugRandomColors;
cesiumData.GetDebugRandomColorsAttr().Get(&debugRandomColors);
Expand All @@ -111,6 +141,9 @@ bool OmniData::getDebugRandomColors() const {

bool OmniData::getDebugDisableGeoreferencing() const {
const auto cesiumData = UsdUtil::getCesiumData(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumData)) {
return false;
}

bool debugDisableGeoreferencing;
cesiumData.GetDebugDisableGeoreferencingAttr().Get(&debugDisableGeoreferencing);
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/OmniGeoreference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const pxr::SdfPath& OmniGeoreference::getPath() const {

CesiumGeospatial::Cartographic OmniGeoreference::getOrigin() const {
const auto cesiumGeoreference = UsdUtil::getCesiumGeoreference(_pContext->getUsdStage(), _path);
if (!UsdUtil::isSchemaValid(cesiumGeoreference)) {
return {0.0, 0.0, 0.0};
}

double longitude;
double latitude;
Expand Down
Loading

0 comments on commit ad067d2

Please sign in to comment.