file_path
stringlengths 21
224
| content
stringlengths 0
80.8M
|
---|---|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/ionServer.cpp | #include ".//ionServer.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumIonServer,
TfType::Bases< UsdTyped > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumIonServerPrim")
// to find TfType<CesiumIonServer>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumIonServer>("CesiumIonServerPrim");
}
/* virtual */
CesiumIonServer::~CesiumIonServer()
{
}
/* static */
CesiumIonServer
CesiumIonServer::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumIonServer();
}
return CesiumIonServer(stage->GetPrimAtPath(path));
}
/* static */
CesiumIonServer
CesiumIonServer::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumIonServerPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumIonServer();
}
return CesiumIonServer(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumIonServer::_GetSchemaKind() const
{
return CesiumIonServer::schemaKind;
}
/* static */
const TfType &
CesiumIonServer::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumIonServer>();
return tfType;
}
/* static */
bool
CesiumIonServer::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumIonServer::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumIonServer::GetDisplayNameAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDisplayName);
}
UsdAttribute
CesiumIonServer::CreateDisplayNameAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDisplayName,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumIonServer::GetIonServerUrlAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumIonServerUrl);
}
UsdAttribute
CesiumIonServer::CreateIonServerUrlAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumIonServerUrl,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumIonServer::GetIonServerApiUrlAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumIonServerApiUrl);
}
UsdAttribute
CesiumIonServer::CreateIonServerApiUrlAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumIonServerApiUrl,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumIonServer::GetIonServerApplicationIdAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumIonServerApplicationId);
}
UsdAttribute
CesiumIonServer::CreateIonServerApplicationIdAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumIonServerApplicationId,
SdfValueTypeNames->Int64,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumIonServer::GetProjectDefaultIonAccessTokenAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumProjectDefaultIonAccessToken);
}
UsdAttribute
CesiumIonServer::CreateProjectDefaultIonAccessTokenAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumProjectDefaultIonAccessToken,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumIonServer::GetProjectDefaultIonAccessTokenIdAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumProjectDefaultIonAccessTokenId);
}
UsdAttribute
CesiumIonServer::CreateProjectDefaultIonAccessTokenIdAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumProjectDefaultIonAccessTokenId,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumIonServer::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumDisplayName,
CesiumTokens->cesiumIonServerUrl,
CesiumTokens->cesiumIonServerApiUrl,
CesiumTokens->cesiumIonServerApplicationId,
CesiumTokens->cesiumProjectDefaultIonAccessToken,
CesiumTokens->cesiumProjectDefaultIonAccessTokenId,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
UsdTyped::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/module.cpp | #include "pxr/pxr.h"
#include "pxr/base/tf/pyModule.h"
PXR_NAMESPACE_USING_DIRECTIVE
TF_WRAP_MODULE
{
TF_WRAP(CesiumData);
TF_WRAP(CesiumGeoreference);
TF_WRAP(CesiumGlobeAnchorAPI);
TF_WRAP(CesiumIonServer);
TF_WRAP(CesiumRasterOverlay);
TF_WRAP(CesiumIonRasterOverlay);
TF_WRAP(CesiumPolygonRasterOverlay);
TF_WRAP(CesiumSession);
TF_WRAP(CesiumTileMapServiceRasterOverlay);
TF_WRAP(CesiumTileset);
TF_WRAP(CesiumTokens);
TF_WRAP(CesiumWebMapServiceRasterOverlay);
TF_WRAP(CesiumWebMapTileServiceRasterOverlay);
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/webMapServiceRasterOverlay.cpp | #include ".//webMapServiceRasterOverlay.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumWebMapServiceRasterOverlay,
TfType::Bases< CesiumRasterOverlay > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumWebMapServiceRasterOverlayPrim")
// to find TfType<CesiumWebMapServiceRasterOverlay>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumWebMapServiceRasterOverlay>("CesiumWebMapServiceRasterOverlayPrim");
}
/* virtual */
CesiumWebMapServiceRasterOverlay::~CesiumWebMapServiceRasterOverlay()
{
}
/* static */
CesiumWebMapServiceRasterOverlay
CesiumWebMapServiceRasterOverlay::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumWebMapServiceRasterOverlay();
}
return CesiumWebMapServiceRasterOverlay(stage->GetPrimAtPath(path));
}
/* static */
CesiumWebMapServiceRasterOverlay
CesiumWebMapServiceRasterOverlay::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumWebMapServiceRasterOverlayPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumWebMapServiceRasterOverlay();
}
return CesiumWebMapServiceRasterOverlay(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumWebMapServiceRasterOverlay::_GetSchemaKind() const
{
return CesiumWebMapServiceRasterOverlay::schemaKind;
}
/* static */
const TfType &
CesiumWebMapServiceRasterOverlay::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumWebMapServiceRasterOverlay>();
return tfType;
}
/* static */
bool
CesiumWebMapServiceRasterOverlay::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumWebMapServiceRasterOverlay::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::GetBaseUrlAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumBaseUrl);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::CreateBaseUrlAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumBaseUrl,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::GetLayersAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumLayers);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::CreateLayersAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumLayers,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::GetTileWidthAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumTileWidth);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::CreateTileWidthAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumTileWidth,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::GetTileHeightAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumTileHeight);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::CreateTileHeightAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumTileHeight,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::GetMinimumLevelAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMinimumLevel);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::CreateMinimumLevelAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMinimumLevel,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::GetMaximumLevelAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumLevel);
}
UsdAttribute
CesiumWebMapServiceRasterOverlay::CreateMaximumLevelAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumLevel,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumWebMapServiceRasterOverlay::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumBaseUrl,
CesiumTokens->cesiumLayers,
CesiumTokens->cesiumTileWidth,
CesiumTokens->cesiumTileHeight,
CesiumTokens->cesiumMinimumLevel,
CesiumTokens->cesiumMaximumLevel,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
CesiumRasterOverlay::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/georeference.cpp | #include ".//georeference.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumGeoreference,
TfType::Bases< UsdTyped > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumGeoreferencePrim")
// to find TfType<CesiumGeoreference>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumGeoreference>("CesiumGeoreferencePrim");
}
/* virtual */
CesiumGeoreference::~CesiumGeoreference()
{
}
/* static */
CesiumGeoreference
CesiumGeoreference::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumGeoreference();
}
return CesiumGeoreference(stage->GetPrimAtPath(path));
}
/* static */
CesiumGeoreference
CesiumGeoreference::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumGeoreferencePrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumGeoreference();
}
return CesiumGeoreference(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumGeoreference::_GetSchemaKind() const
{
return CesiumGeoreference::schemaKind;
}
/* static */
const TfType &
CesiumGeoreference::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumGeoreference>();
return tfType;
}
/* static */
bool
CesiumGeoreference::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumGeoreference::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumGeoreference::GetGeoreferenceOriginLongitudeAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumGeoreferenceOriginLongitude);
}
UsdAttribute
CesiumGeoreference::CreateGeoreferenceOriginLongitudeAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumGeoreferenceOriginLongitude,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumGeoreference::GetGeoreferenceOriginLatitudeAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumGeoreferenceOriginLatitude);
}
UsdAttribute
CesiumGeoreference::CreateGeoreferenceOriginLatitudeAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumGeoreferenceOriginLatitude,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumGeoreference::GetGeoreferenceOriginHeightAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumGeoreferenceOriginHeight);
}
UsdAttribute
CesiumGeoreference::CreateGeoreferenceOriginHeightAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumGeoreferenceOriginHeight,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumGeoreference::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumGeoreferenceOriginLongitude,
CesiumTokens->cesiumGeoreferenceOriginLatitude,
CesiumTokens->cesiumGeoreferenceOriginHeight,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
UsdTyped::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/webMapTileServiceRasterOverlay.cpp | #include ".//webMapTileServiceRasterOverlay.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumWebMapTileServiceRasterOverlay,
TfType::Bases< CesiumRasterOverlay > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumWebMapTileServiceRasterOverlayPrim")
// to find TfType<CesiumWebMapTileServiceRasterOverlay>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumWebMapTileServiceRasterOverlay>("CesiumWebMapTileServiceRasterOverlayPrim");
}
/* virtual */
CesiumWebMapTileServiceRasterOverlay::~CesiumWebMapTileServiceRasterOverlay()
{
}
/* static */
CesiumWebMapTileServiceRasterOverlay
CesiumWebMapTileServiceRasterOverlay::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumWebMapTileServiceRasterOverlay();
}
return CesiumWebMapTileServiceRasterOverlay(stage->GetPrimAtPath(path));
}
/* static */
CesiumWebMapTileServiceRasterOverlay
CesiumWebMapTileServiceRasterOverlay::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumWebMapTileServiceRasterOverlayPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumWebMapTileServiceRasterOverlay();
}
return CesiumWebMapTileServiceRasterOverlay(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumWebMapTileServiceRasterOverlay::_GetSchemaKind() const
{
return CesiumWebMapTileServiceRasterOverlay::schemaKind;
}
/* static */
const TfType &
CesiumWebMapTileServiceRasterOverlay::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumWebMapTileServiceRasterOverlay>();
return tfType;
}
/* static */
bool
CesiumWebMapTileServiceRasterOverlay::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumWebMapTileServiceRasterOverlay::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetUrlAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumUrl);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateUrlAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumUrl,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetLayerAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumLayer);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateLayerAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumLayer,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetStyleAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumStyle);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateStyleAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumStyle,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetFormatAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumFormat);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateFormatAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumFormat,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetTileMatrixSetIdAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumTileMatrixSetId);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateTileMatrixSetIdAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumTileMatrixSetId,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetSpecifyTileMatrixSetLabelsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSpecifyTileMatrixSetLabels);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateSpecifyTileMatrixSetLabelsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSpecifyTileMatrixSetLabels,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetTileMatrixSetLabelPrefixAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumTileMatrixSetLabelPrefix);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateTileMatrixSetLabelPrefixAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumTileMatrixSetLabelPrefix,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetTileMatrixSetLabelsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumTileMatrixSetLabels);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateTileMatrixSetLabelsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumTileMatrixSetLabels,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetUseWebMercatorProjectionAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumUseWebMercatorProjection);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateUseWebMercatorProjectionAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumUseWebMercatorProjection,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetSpecifyTilingSchemeAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSpecifyTilingScheme);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateSpecifyTilingSchemeAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSpecifyTilingScheme,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetRootTilesXAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumRootTilesX);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateRootTilesXAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumRootTilesX,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetRootTilesYAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumRootTilesY);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateRootTilesYAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumRootTilesY,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetWestAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumWest);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateWestAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumWest,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetEastAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumEast);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateEastAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumEast,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetSouthAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSouth);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateSouthAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSouth,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetNorthAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumNorth);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateNorthAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumNorth,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetSpecifyZoomLevelsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSpecifyZoomLevels);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateSpecifyZoomLevelsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSpecifyZoomLevels,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetMinimumZoomLevelAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMinimumZoomLevel);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateMinimumZoomLevelAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMinimumZoomLevel,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::GetMaximumZoomLevelAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumZoomLevel);
}
UsdAttribute
CesiumWebMapTileServiceRasterOverlay::CreateMaximumZoomLevelAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumZoomLevel,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumWebMapTileServiceRasterOverlay::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumUrl,
CesiumTokens->cesiumLayer,
CesiumTokens->cesiumStyle,
CesiumTokens->cesiumFormat,
CesiumTokens->cesiumTileMatrixSetId,
CesiumTokens->cesiumSpecifyTileMatrixSetLabels,
CesiumTokens->cesiumTileMatrixSetLabelPrefix,
CesiumTokens->cesiumTileMatrixSetLabels,
CesiumTokens->cesiumUseWebMercatorProjection,
CesiumTokens->cesiumSpecifyTilingScheme,
CesiumTokens->cesiumRootTilesX,
CesiumTokens->cesiumRootTilesY,
CesiumTokens->cesiumWest,
CesiumTokens->cesiumEast,
CesiumTokens->cesiumSouth,
CesiumTokens->cesiumNorth,
CesiumTokens->cesiumSpecifyZoomLevels,
CesiumTokens->cesiumMinimumZoomLevel,
CesiumTokens->cesiumMaximumZoomLevel,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
CesiumRasterOverlay::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapTileMapServiceRasterOverlay.cpp | #include ".//tileMapServiceRasterOverlay.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateUrlAttr(CesiumTileMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateUrlAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateSpecifyZoomLevelsAttr(CesiumTileMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateSpecifyZoomLevelsAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateMinimumZoomLevelAttr(CesiumTileMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMinimumZoomLevelAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateMaximumZoomLevelAttr(CesiumTileMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMaximumZoomLevelAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static std::string
_Repr(const CesiumTileMapServiceRasterOverlay &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.TileMapServiceRasterOverlay(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumTileMapServiceRasterOverlay()
{
typedef CesiumTileMapServiceRasterOverlay This;
class_<This, bases<CesiumRasterOverlay> >
cls("TileMapServiceRasterOverlay");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("Define", &This::Define, (arg("stage"), arg("path")))
.staticmethod("Define")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetUrlAttr",
&This::GetUrlAttr)
.def("CreateUrlAttr",
&_CreateUrlAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetSpecifyZoomLevelsAttr",
&This::GetSpecifyZoomLevelsAttr)
.def("CreateSpecifyZoomLevelsAttr",
&_CreateSpecifyZoomLevelsAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMinimumZoomLevelAttr",
&This::GetMinimumZoomLevelAttr)
.def("CreateMinimumZoomLevelAttr",
&_CreateMinimumZoomLevelAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMaximumZoomLevelAttr",
&This::GetMaximumZoomLevelAttr)
.def("CreateMaximumZoomLevelAttr",
&_CreateMaximumZoomLevelAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/globeAnchorAPI.cpp | #include ".//globeAnchorAPI.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/usd/tokens.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumGlobeAnchorAPI,
TfType::Bases< UsdAPISchemaBase > >();
}
TF_DEFINE_PRIVATE_TOKENS(
_schemaTokens,
(CesiumGlobeAnchorSchemaAPI)
);
/* virtual */
CesiumGlobeAnchorAPI::~CesiumGlobeAnchorAPI()
{
}
/* static */
CesiumGlobeAnchorAPI
CesiumGlobeAnchorAPI::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumGlobeAnchorAPI();
}
return CesiumGlobeAnchorAPI(stage->GetPrimAtPath(path));
}
/* virtual */
UsdSchemaKind CesiumGlobeAnchorAPI::_GetSchemaKind() const
{
return CesiumGlobeAnchorAPI::schemaKind;
}
/* static */
bool
CesiumGlobeAnchorAPI::CanApply(
const UsdPrim &prim, std::string *whyNot)
{
return prim.CanApplyAPI<CesiumGlobeAnchorAPI>(whyNot);
}
/* static */
CesiumGlobeAnchorAPI
CesiumGlobeAnchorAPI::Apply(const UsdPrim &prim)
{
if (prim.ApplyAPI<CesiumGlobeAnchorAPI>()) {
return CesiumGlobeAnchorAPI(prim);
}
return CesiumGlobeAnchorAPI();
}
/* static */
const TfType &
CesiumGlobeAnchorAPI::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumGlobeAnchorAPI>();
return tfType;
}
/* static */
bool
CesiumGlobeAnchorAPI::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumGlobeAnchorAPI::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumGlobeAnchorAPI::GetAdjustOrientationForGlobeWhenMovingAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumAnchorAdjustOrientationForGlobeWhenMoving);
}
UsdAttribute
CesiumGlobeAnchorAPI::CreateAdjustOrientationForGlobeWhenMovingAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumAnchorAdjustOrientationForGlobeWhenMoving,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumGlobeAnchorAPI::GetDetectTransformChangesAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumAnchorDetectTransformChanges);
}
UsdAttribute
CesiumGlobeAnchorAPI::CreateDetectTransformChangesAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumAnchorDetectTransformChanges,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumGlobeAnchorAPI::GetAnchorLongitudeAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumAnchorLongitude);
}
UsdAttribute
CesiumGlobeAnchorAPI::CreateAnchorLongitudeAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumAnchorLongitude,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumGlobeAnchorAPI::GetAnchorLatitudeAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumAnchorLatitude);
}
UsdAttribute
CesiumGlobeAnchorAPI::CreateAnchorLatitudeAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumAnchorLatitude,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumGlobeAnchorAPI::GetAnchorHeightAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumAnchorHeight);
}
UsdAttribute
CesiumGlobeAnchorAPI::CreateAnchorHeightAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumAnchorHeight,
SdfValueTypeNames->Double,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumGlobeAnchorAPI::GetPositionAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumAnchorPosition);
}
UsdAttribute
CesiumGlobeAnchorAPI::CreatePositionAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumAnchorPosition,
SdfValueTypeNames->Double3,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdRelationship
CesiumGlobeAnchorAPI::GetGeoreferenceBindingRel() const
{
return GetPrim().GetRelationship(CesiumTokens->cesiumAnchorGeoreferenceBinding);
}
UsdRelationship
CesiumGlobeAnchorAPI::CreateGeoreferenceBindingRel() const
{
return GetPrim().CreateRelationship(CesiumTokens->cesiumAnchorGeoreferenceBinding,
/* custom = */ false);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumGlobeAnchorAPI::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumAnchorAdjustOrientationForGlobeWhenMoving,
CesiumTokens->cesiumAnchorDetectTransformChanges,
CesiumTokens->cesiumAnchorLongitude,
CesiumTokens->cesiumAnchorLatitude,
CesiumTokens->cesiumAnchorHeight,
CesiumTokens->cesiumAnchorPosition,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
UsdAPISchemaBase::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/georeference.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_GEOREFERENCE_H
#define CESIUMUSDSCHEMAS_GENERATED_GEOREFERENCE_H
/// \file CesiumUsdSchemas/georeference.h
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMGEOREFERENCEPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumGeoreference
///
/// Stores Georeference data for Cesium for Omniverse. Every stage should have at least one of these.
///
class CesiumGeoreference : public UsdTyped
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumGeoreference on UsdPrim \p prim .
/// Equivalent to CesiumGeoreference::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumGeoreference(const UsdPrim& prim=UsdPrim())
: UsdTyped(prim)
{
}
/// Construct a CesiumGeoreference on the prim held by \p schemaObj .
/// Should be preferred over CesiumGeoreference(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumGeoreference(const UsdSchemaBase& schemaObj)
: UsdTyped(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumGeoreference();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumGeoreference holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumGeoreference(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumGeoreference
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumGeoreference
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// GEOREFERENCEORIGINLONGITUDE
// --------------------------------------------------------------------- //
/// The longitude of the origin in degrees, in the range [-180, 180].
///
/// | ||
/// | -- | -- |
/// | Declaration | `double cesium:georeferenceOrigin:longitude = -105.25737` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
CESIUMUSDSCHEMAS_API
UsdAttribute GetGeoreferenceOriginLongitudeAttr() const;
/// See GetGeoreferenceOriginLongitudeAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateGeoreferenceOriginLongitudeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// GEOREFERENCEORIGINLATITUDE
// --------------------------------------------------------------------- //
/// The latitude of the origin in degrees, in the range [-90, 90].
///
/// | ||
/// | -- | -- |
/// | Declaration | `double cesium:georeferenceOrigin:latitude = 39.736401` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
CESIUMUSDSCHEMAS_API
UsdAttribute GetGeoreferenceOriginLatitudeAttr() const;
/// See GetGeoreferenceOriginLatitudeAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateGeoreferenceOriginLatitudeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// GEOREFERENCEORIGINHEIGHT
// --------------------------------------------------------------------- //
/// The height of the origin in meters above the WGS84 ellipsoid. Do not confuse this with a geoid height or height above mean sea level, which can be tens of meters higher or lower depending on where in the world the origin is located.
///
/// | ||
/// | -- | -- |
/// | Declaration | `double cesium:georeferenceOrigin:height = 2250` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
CESIUMUSDSCHEMAS_API
UsdAttribute GetGeoreferenceOriginHeightAttr() const;
/// See GetGeoreferenceOriginHeightAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateGeoreferenceOriginHeightAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapGlobeAnchorAPI.cpp | #include ".//globeAnchorAPI.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyAnnotatedBoolResult.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateAdjustOrientationForGlobeWhenMovingAttr(CesiumGlobeAnchorAPI &self,
object defaultVal, bool writeSparsely) {
return self.CreateAdjustOrientationForGlobeWhenMovingAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateDetectTransformChangesAttr(CesiumGlobeAnchorAPI &self,
object defaultVal, bool writeSparsely) {
return self.CreateDetectTransformChangesAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateAnchorLongitudeAttr(CesiumGlobeAnchorAPI &self,
object defaultVal, bool writeSparsely) {
return self.CreateAnchorLongitudeAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateAnchorLatitudeAttr(CesiumGlobeAnchorAPI &self,
object defaultVal, bool writeSparsely) {
return self.CreateAnchorLatitudeAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateAnchorHeightAttr(CesiumGlobeAnchorAPI &self,
object defaultVal, bool writeSparsely) {
return self.CreateAnchorHeightAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreatePositionAttr(CesiumGlobeAnchorAPI &self,
object defaultVal, bool writeSparsely) {
return self.CreatePositionAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double3), writeSparsely);
}
static std::string
_Repr(const CesiumGlobeAnchorAPI &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.GlobeAnchorAPI(%s)",
primRepr.c_str());
}
struct CesiumGlobeAnchorAPI_CanApplyResult :
public TfPyAnnotatedBoolResult<std::string>
{
CesiumGlobeAnchorAPI_CanApplyResult(bool val, std::string const &msg) :
TfPyAnnotatedBoolResult<std::string>(val, msg) {}
};
static CesiumGlobeAnchorAPI_CanApplyResult
_WrapCanApply(const UsdPrim& prim)
{
std::string whyNot;
bool result = CesiumGlobeAnchorAPI::CanApply(prim, &whyNot);
return CesiumGlobeAnchorAPI_CanApplyResult(result, whyNot);
}
} // anonymous namespace
void wrapCesiumGlobeAnchorAPI()
{
typedef CesiumGlobeAnchorAPI This;
CesiumGlobeAnchorAPI_CanApplyResult::Wrap<CesiumGlobeAnchorAPI_CanApplyResult>(
"_CanApplyResult", "whyNot");
class_<This, bases<UsdAPISchemaBase> >
cls("GlobeAnchorAPI");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("CanApply", &_WrapCanApply, (arg("prim")))
.staticmethod("CanApply")
.def("Apply", &This::Apply, (arg("prim")))
.staticmethod("Apply")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetAdjustOrientationForGlobeWhenMovingAttr",
&This::GetAdjustOrientationForGlobeWhenMovingAttr)
.def("CreateAdjustOrientationForGlobeWhenMovingAttr",
&_CreateAdjustOrientationForGlobeWhenMovingAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDetectTransformChangesAttr",
&This::GetDetectTransformChangesAttr)
.def("CreateDetectTransformChangesAttr",
&_CreateDetectTransformChangesAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetAnchorLongitudeAttr",
&This::GetAnchorLongitudeAttr)
.def("CreateAnchorLongitudeAttr",
&_CreateAnchorLongitudeAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetAnchorLatitudeAttr",
&This::GetAnchorLatitudeAttr)
.def("CreateAnchorLatitudeAttr",
&_CreateAnchorLatitudeAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetAnchorHeightAttr",
&This::GetAnchorHeightAttr)
.def("CreateAnchorHeightAttr",
&_CreateAnchorHeightAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetPositionAttr",
&This::GetPositionAttr)
.def("CreatePositionAttr",
&_CreatePositionAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetGeoreferenceBindingRel",
&This::GetGeoreferenceBindingRel)
.def("CreateGeoreferenceBindingRel",
&This::CreateGeoreferenceBindingRel)
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/rasterOverlay.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_RASTEROVERLAY_H
#define CESIUMUSDSCHEMAS_GENERATED_RASTEROVERLAY_H
/// \file CesiumUsdSchemas/rasterOverlay.h
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMRASTEROVERLAYPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumRasterOverlay
///
/// Abstract base class for prims that represent a raster overlay.
///
/// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
/// that are text/tokens, the actual token is published and defined in \ref CesiumTokens.
/// So to set an attribute to the value "rightHanded", use CesiumTokens->rightHanded
/// as the value.
///
class CesiumRasterOverlay : public UsdTyped
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractTyped;
/// Construct a CesiumRasterOverlay on UsdPrim \p prim .
/// Equivalent to CesiumRasterOverlay::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumRasterOverlay(const UsdPrim& prim=UsdPrim())
: UsdTyped(prim)
{
}
/// Construct a CesiumRasterOverlay on the prim held by \p schemaObj .
/// Should be preferred over CesiumRasterOverlay(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumRasterOverlay(const UsdSchemaBase& schemaObj)
: UsdTyped(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumRasterOverlay();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumRasterOverlay holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumRasterOverlay(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumRasterOverlay
Get(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// SHOWCREDITSONSCREEN
// --------------------------------------------------------------------- //
/// Whether or not to show this raster overlay's credits on screen.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform bool cesium:showCreditsOnScreen = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
CESIUMUSDSCHEMAS_API
UsdAttribute GetShowCreditsOnScreenAttr() const;
/// See GetShowCreditsOnScreenAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateShowCreditsOnScreenAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// ALPHA
// --------------------------------------------------------------------- //
/// The alpha blending value, from 0.0 to 1.0, where 1.0 is fully opaque.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform float cesium:alpha = 1` |
/// | C++ Type | float |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
CESIUMUSDSCHEMAS_API
UsdAttribute GetAlphaAttr() const;
/// See GetAlphaAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateAlphaAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// OVERLAYRENDERMETHOD
// --------------------------------------------------------------------- //
/// The Cesium default material will give the raster overlay a different rendering treatment based on this selection.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform token cesium:overlayRenderMethod = "overlay"` |
/// | C++ Type | TfToken |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
/// | \ref CesiumTokens "Allowed Values" | overlay, clip |
CESIUMUSDSCHEMAS_API
UsdAttribute GetOverlayRenderMethodAttr() const;
/// See GetOverlayRenderMethodAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateOverlayRenderMethodAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMSCREENSPACEERROR
// --------------------------------------------------------------------- //
/// The maximum number of pixels of error when rendering this overlay. This is used to select an appropriate level-of-detail. When this property has its default value, 2.0, it means that raster overlay images will be sized so that, when zoomed in closest, a single pixel in the raster overlay maps to approximately 2x2 pixels on the screen.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform float cesium:maximumScreenSpaceError = 2` |
/// | C++ Type | float |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumScreenSpaceErrorAttr() const;
/// See GetMaximumScreenSpaceErrorAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumScreenSpaceErrorAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMTEXTURESIZE
// --------------------------------------------------------------------- //
/// The maximum texel size of raster overlay textures, in either direction. Images created by this overlay will be no more than this number of texels in either direction. This may result in reduced raster overlay detail in some cases.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform int cesium:maximumTextureSize = 2048` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumTextureSizeAttr() const;
/// See GetMaximumTextureSizeAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumTextureSizeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMSIMULTANEOUSTILELOADS
// --------------------------------------------------------------------- //
/// The maximum number of overlay tiles that may simultaneously be in the process of loading.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform int cesium:maximumSimultaneousTileLoads = 20` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumSimultaneousTileLoadsAttr() const;
/// See GetMaximumSimultaneousTileLoadsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumSimultaneousTileLoadsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// SUBTILECACHEBYTES
// --------------------------------------------------------------------- //
/// The maximum number of bytes to use to cache sub-tiles in memory. This is used by provider types, that have an underlying tiling scheme that may not align with the tiling scheme of the geometry tiles on which the raster overlay tiles are draped. Because a single sub-tile may overlap multiple geometry tiles, it is useful to cache loaded sub-tiles in memory in case they're needed again soon. This property controls the maximum size of that cache.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform int cesium:subTileCacheBytes = 16777216` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
CESIUMUSDSCHEMAS_API
UsdAttribute GetSubTileCacheBytesAttr() const;
/// See GetSubTileCacheBytesAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateSubTileCacheBytesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapWebMapTileServiceRasterOverlay.cpp | #include ".//webMapTileServiceRasterOverlay.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateUrlAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateUrlAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateLayerAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateLayerAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateStyleAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateStyleAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateFormatAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateFormatAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateTileMatrixSetIdAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateTileMatrixSetIdAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateSpecifyTileMatrixSetLabelsAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateSpecifyTileMatrixSetLabelsAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateTileMatrixSetLabelPrefixAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateTileMatrixSetLabelPrefixAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateTileMatrixSetLabelsAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateTileMatrixSetLabelsAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateUseWebMercatorProjectionAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateUseWebMercatorProjectionAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateSpecifyTilingSchemeAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateSpecifyTilingSchemeAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateRootTilesXAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateRootTilesXAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateRootTilesYAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateRootTilesYAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateWestAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateWestAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateEastAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateEastAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateSouthAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateSouthAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateNorthAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateNorthAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateSpecifyZoomLevelsAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateSpecifyZoomLevelsAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateMinimumZoomLevelAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMinimumZoomLevelAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateMaximumZoomLevelAttr(CesiumWebMapTileServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMaximumZoomLevelAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static std::string
_Repr(const CesiumWebMapTileServiceRasterOverlay &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.WebMapTileServiceRasterOverlay(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumWebMapTileServiceRasterOverlay()
{
typedef CesiumWebMapTileServiceRasterOverlay This;
class_<This, bases<CesiumRasterOverlay> >
cls("WebMapTileServiceRasterOverlay");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("Define", &This::Define, (arg("stage"), arg("path")))
.staticmethod("Define")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetUrlAttr",
&This::GetUrlAttr)
.def("CreateUrlAttr",
&_CreateUrlAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetLayerAttr",
&This::GetLayerAttr)
.def("CreateLayerAttr",
&_CreateLayerAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetStyleAttr",
&This::GetStyleAttr)
.def("CreateStyleAttr",
&_CreateStyleAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetFormatAttr",
&This::GetFormatAttr)
.def("CreateFormatAttr",
&_CreateFormatAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetTileMatrixSetIdAttr",
&This::GetTileMatrixSetIdAttr)
.def("CreateTileMatrixSetIdAttr",
&_CreateTileMatrixSetIdAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetSpecifyTileMatrixSetLabelsAttr",
&This::GetSpecifyTileMatrixSetLabelsAttr)
.def("CreateSpecifyTileMatrixSetLabelsAttr",
&_CreateSpecifyTileMatrixSetLabelsAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetTileMatrixSetLabelPrefixAttr",
&This::GetTileMatrixSetLabelPrefixAttr)
.def("CreateTileMatrixSetLabelPrefixAttr",
&_CreateTileMatrixSetLabelPrefixAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetTileMatrixSetLabelsAttr",
&This::GetTileMatrixSetLabelsAttr)
.def("CreateTileMatrixSetLabelsAttr",
&_CreateTileMatrixSetLabelsAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetUseWebMercatorProjectionAttr",
&This::GetUseWebMercatorProjectionAttr)
.def("CreateUseWebMercatorProjectionAttr",
&_CreateUseWebMercatorProjectionAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetSpecifyTilingSchemeAttr",
&This::GetSpecifyTilingSchemeAttr)
.def("CreateSpecifyTilingSchemeAttr",
&_CreateSpecifyTilingSchemeAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetRootTilesXAttr",
&This::GetRootTilesXAttr)
.def("CreateRootTilesXAttr",
&_CreateRootTilesXAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetRootTilesYAttr",
&This::GetRootTilesYAttr)
.def("CreateRootTilesYAttr",
&_CreateRootTilesYAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetWestAttr",
&This::GetWestAttr)
.def("CreateWestAttr",
&_CreateWestAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetEastAttr",
&This::GetEastAttr)
.def("CreateEastAttr",
&_CreateEastAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetSouthAttr",
&This::GetSouthAttr)
.def("CreateSouthAttr",
&_CreateSouthAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetNorthAttr",
&This::GetNorthAttr)
.def("CreateNorthAttr",
&_CreateNorthAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetSpecifyZoomLevelsAttr",
&This::GetSpecifyZoomLevelsAttr)
.def("CreateSpecifyZoomLevelsAttr",
&_CreateSpecifyZoomLevelsAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMinimumZoomLevelAttr",
&This::GetMinimumZoomLevelAttr)
.def("CreateMinimumZoomLevelAttr",
&_CreateMinimumZoomLevelAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMaximumZoomLevelAttr",
&This::GetMaximumZoomLevelAttr)
.def("CreateMaximumZoomLevelAttr",
&_CreateMaximumZoomLevelAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/tileMapServiceRasterOverlay.cpp | #include ".//tileMapServiceRasterOverlay.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumTileMapServiceRasterOverlay,
TfType::Bases< CesiumRasterOverlay > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumTileMapServiceRasterOverlayPrim")
// to find TfType<CesiumTileMapServiceRasterOverlay>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumTileMapServiceRasterOverlay>("CesiumTileMapServiceRasterOverlayPrim");
}
/* virtual */
CesiumTileMapServiceRasterOverlay::~CesiumTileMapServiceRasterOverlay()
{
}
/* static */
CesiumTileMapServiceRasterOverlay
CesiumTileMapServiceRasterOverlay::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumTileMapServiceRasterOverlay();
}
return CesiumTileMapServiceRasterOverlay(stage->GetPrimAtPath(path));
}
/* static */
CesiumTileMapServiceRasterOverlay
CesiumTileMapServiceRasterOverlay::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumTileMapServiceRasterOverlayPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumTileMapServiceRasterOverlay();
}
return CesiumTileMapServiceRasterOverlay(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumTileMapServiceRasterOverlay::_GetSchemaKind() const
{
return CesiumTileMapServiceRasterOverlay::schemaKind;
}
/* static */
const TfType &
CesiumTileMapServiceRasterOverlay::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumTileMapServiceRasterOverlay>();
return tfType;
}
/* static */
bool
CesiumTileMapServiceRasterOverlay::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumTileMapServiceRasterOverlay::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::GetUrlAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumUrl);
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::CreateUrlAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumUrl,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::GetSpecifyZoomLevelsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSpecifyZoomLevels);
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::CreateSpecifyZoomLevelsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSpecifyZoomLevels,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::GetMinimumZoomLevelAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMinimumZoomLevel);
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::CreateMinimumZoomLevelAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMinimumZoomLevel,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::GetMaximumZoomLevelAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumZoomLevel);
}
UsdAttribute
CesiumTileMapServiceRasterOverlay::CreateMaximumZoomLevelAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumZoomLevel,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumTileMapServiceRasterOverlay::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumUrl,
CesiumTokens->cesiumSpecifyZoomLevels,
CesiumTokens->cesiumMinimumZoomLevel,
CesiumTokens->cesiumMaximumZoomLevel,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
CesiumRasterOverlay::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/ionRasterOverlay.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_IONRASTEROVERLAY_H
#define CESIUMUSDSCHEMAS_GENERATED_IONRASTEROVERLAY_H
/// \file CesiumUsdSchemas/ionRasterOverlay.h
#include "pxr/pxr.h"
#include ".//api.h"
#include ".//rasterOverlay.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMIONRASTEROVERLAYPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumIonRasterOverlay
///
/// Adds a prim for representing an ion raster overlay.
///
class CesiumIonRasterOverlay : public CesiumRasterOverlay
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumIonRasterOverlay on UsdPrim \p prim .
/// Equivalent to CesiumIonRasterOverlay::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumIonRasterOverlay(const UsdPrim& prim=UsdPrim())
: CesiumRasterOverlay(prim)
{
}
/// Construct a CesiumIonRasterOverlay on the prim held by \p schemaObj .
/// Should be preferred over CesiumIonRasterOverlay(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumIonRasterOverlay(const UsdSchemaBase& schemaObj)
: CesiumRasterOverlay(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumIonRasterOverlay();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumIonRasterOverlay holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumIonRasterOverlay(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumIonRasterOverlay
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumIonRasterOverlay
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// IONASSETID
// --------------------------------------------------------------------- //
/// The ID of the Cesium ion asset to use.
///
/// | ||
/// | -- | -- |
/// | Declaration | `int64 cesium:ionAssetId = 0` |
/// | C++ Type | int64_t |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int64 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetIonAssetIdAttr() const;
/// See GetIonAssetIdAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateIonAssetIdAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// IONACCESSTOKEN
// --------------------------------------------------------------------- //
/// The access token to use to access the Cesium ion resource. Overrides the default token. Blank if using URL.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:ionAccessToken = ""` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetIonAccessTokenAttr() const;
/// See GetIonAccessTokenAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateIonAccessTokenAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// IONSERVERBINDING
// --------------------------------------------------------------------- //
/// Specifies which Cesium ion Server prim to use for this tileset.
///
CESIUMUSDSCHEMAS_API
UsdRelationship GetIonServerBindingRel() const;
/// See GetIonServerBindingRel(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
CESIUMUSDSCHEMAS_API
UsdRelationship CreateIonServerBindingRel() const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/globeAnchorAPI.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_GLOBEANCHORAPI_H
#define CESIUMUSDSCHEMAS_GENERATED_GLOBEANCHORAPI_H
/// \file CesiumUsdSchemas/globeAnchorAPI.h
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/usd/usd/apiSchemaBase.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMGLOBEANCHORSCHEMAAPI //
// -------------------------------------------------------------------------- //
/// \class CesiumGlobeAnchorAPI
///
/// Adds Globe Anchoring information to a Prim for use with Cesium for Omniverse.
///
class CesiumGlobeAnchorAPI : public UsdAPISchemaBase
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
/// Construct a CesiumGlobeAnchorAPI on UsdPrim \p prim .
/// Equivalent to CesiumGlobeAnchorAPI::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumGlobeAnchorAPI(const UsdPrim& prim=UsdPrim())
: UsdAPISchemaBase(prim)
{
}
/// Construct a CesiumGlobeAnchorAPI on the prim held by \p schemaObj .
/// Should be preferred over CesiumGlobeAnchorAPI(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumGlobeAnchorAPI(const UsdSchemaBase& schemaObj)
: UsdAPISchemaBase(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumGlobeAnchorAPI();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumGlobeAnchorAPI holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumGlobeAnchorAPI(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumGlobeAnchorAPI
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Returns true if this <b>single-apply</b> API schema can be applied to
/// the given \p prim. If this schema can not be a applied to the prim,
/// this returns false and, if provided, populates \p whyNot with the
/// reason it can not be applied.
///
/// Note that if CanApply returns false, that does not necessarily imply
/// that calling Apply will fail. Callers are expected to call CanApply
/// before calling Apply if they want to ensure that it is valid to
/// apply a schema.
///
/// \sa UsdPrim::GetAppliedSchemas()
/// \sa UsdPrim::HasAPI()
/// \sa UsdPrim::CanApplyAPI()
/// \sa UsdPrim::ApplyAPI()
/// \sa UsdPrim::RemoveAPI()
///
CESIUMUSDSCHEMAS_API
static bool
CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
/// Applies this <b>single-apply</b> API schema to the given \p prim.
/// This information is stored by adding "CesiumGlobeAnchorSchemaAPI" to the
/// token-valued, listOp metadata \em apiSchemas on the prim.
///
/// \return A valid CesiumGlobeAnchorAPI object is returned upon success.
/// An invalid (or empty) CesiumGlobeAnchorAPI object is returned upon
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
/// resulting in failure.
///
/// \sa UsdPrim::GetAppliedSchemas()
/// \sa UsdPrim::HasAPI()
/// \sa UsdPrim::CanApplyAPI()
/// \sa UsdPrim::ApplyAPI()
/// \sa UsdPrim::RemoveAPI()
///
CESIUMUSDSCHEMAS_API
static CesiumGlobeAnchorAPI
Apply(const UsdPrim &prim);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// ADJUSTORIENTATIONFORGLOBEWHENMOVING
// --------------------------------------------------------------------- //
/// Gets or sets whether to adjust the Prim's orientation based on globe curvature as the game object moves.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:anchor:adjustOrientationForGlobeWhenMoving = 1` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetAdjustOrientationForGlobeWhenMovingAttr() const;
/// See GetAdjustOrientationForGlobeWhenMovingAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateAdjustOrientationForGlobeWhenMovingAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DETECTTRANSFORMCHANGES
// --------------------------------------------------------------------- //
/// Gets or sets whether to automatically detect changes in the Prim's transform and update the precise globe coordinates accordingly.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:anchor:detectTransformChanges = 1` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDetectTransformChangesAttr() const;
/// See GetDetectTransformChangesAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDetectTransformChangesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// ANCHORLONGITUDE
// --------------------------------------------------------------------- //
/// The longitude in degrees, in the range [-180, 180].
///
/// | ||
/// | -- | -- |
/// | Declaration | `double cesium:anchor:longitude = 0` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
CESIUMUSDSCHEMAS_API
UsdAttribute GetAnchorLongitudeAttr() const;
/// See GetAnchorLongitudeAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateAnchorLongitudeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// ANCHORLATITUDE
// --------------------------------------------------------------------- //
/// The latitude in degrees, in the range [-90, 90].
///
/// | ||
/// | -- | -- |
/// | Declaration | `double cesium:anchor:latitude = 0` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
CESIUMUSDSCHEMAS_API
UsdAttribute GetAnchorLatitudeAttr() const;
/// See GetAnchorLatitudeAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateAnchorLatitudeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// ANCHORHEIGHT
// --------------------------------------------------------------------- //
/// The height in meters above the ellipsoid.
///
/// | ||
/// | -- | -- |
/// | Declaration | `double cesium:anchor:height = 0` |
/// | C++ Type | double |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
CESIUMUSDSCHEMAS_API
UsdAttribute GetAnchorHeightAttr() const;
/// See GetAnchorHeightAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateAnchorHeightAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// POSITION
// --------------------------------------------------------------------- //
/// The actual position of the globally anchored prim in the ECEF coordinate system.
///
/// | ||
/// | -- | -- |
/// | Declaration | `double3 cesium:anchor:position = (0, 0, 0)` |
/// | C++ Type | GfVec3d |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double3 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetPositionAttr() const;
/// See GetPositionAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreatePositionAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// GEOREFERENCEBINDING
// --------------------------------------------------------------------- //
/// The Georeference Origin prim used for the globe anchor calculations.
///
CESIUMUSDSCHEMAS_API
UsdRelationship GetGeoreferenceBindingRel() const;
/// See GetGeoreferenceBindingRel(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
CESIUMUSDSCHEMAS_API
UsdRelationship CreateGeoreferenceBindingRel() const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/rasterOverlay.cpp | #include ".//rasterOverlay.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumRasterOverlay,
TfType::Bases< UsdTyped > >();
}
/* virtual */
CesiumRasterOverlay::~CesiumRasterOverlay()
{
}
/* static */
CesiumRasterOverlay
CesiumRasterOverlay::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumRasterOverlay();
}
return CesiumRasterOverlay(stage->GetPrimAtPath(path));
}
/* virtual */
UsdSchemaKind CesiumRasterOverlay::_GetSchemaKind() const
{
return CesiumRasterOverlay::schemaKind;
}
/* static */
const TfType &
CesiumRasterOverlay::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumRasterOverlay>();
return tfType;
}
/* static */
bool
CesiumRasterOverlay::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumRasterOverlay::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumRasterOverlay::GetShowCreditsOnScreenAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumShowCreditsOnScreen);
}
UsdAttribute
CesiumRasterOverlay::CreateShowCreditsOnScreenAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumShowCreditsOnScreen,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumRasterOverlay::GetAlphaAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumAlpha);
}
UsdAttribute
CesiumRasterOverlay::CreateAlphaAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumAlpha,
SdfValueTypeNames->Float,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumRasterOverlay::GetOverlayRenderMethodAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumOverlayRenderMethod);
}
UsdAttribute
CesiumRasterOverlay::CreateOverlayRenderMethodAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumOverlayRenderMethod,
SdfValueTypeNames->Token,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumRasterOverlay::GetMaximumScreenSpaceErrorAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumScreenSpaceError);
}
UsdAttribute
CesiumRasterOverlay::CreateMaximumScreenSpaceErrorAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumScreenSpaceError,
SdfValueTypeNames->Float,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumRasterOverlay::GetMaximumTextureSizeAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumTextureSize);
}
UsdAttribute
CesiumRasterOverlay::CreateMaximumTextureSizeAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumTextureSize,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumRasterOverlay::GetMaximumSimultaneousTileLoadsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumSimultaneousTileLoads);
}
UsdAttribute
CesiumRasterOverlay::CreateMaximumSimultaneousTileLoadsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumSimultaneousTileLoads,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumRasterOverlay::GetSubTileCacheBytesAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSubTileCacheBytes);
}
UsdAttribute
CesiumRasterOverlay::CreateSubTileCacheBytesAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSubTileCacheBytes,
SdfValueTypeNames->Int,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumRasterOverlay::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumShowCreditsOnScreen,
CesiumTokens->cesiumAlpha,
CesiumTokens->cesiumOverlayRenderMethod,
CesiumTokens->cesiumMaximumScreenSpaceError,
CesiumTokens->cesiumMaximumTextureSize,
CesiumTokens->cesiumMaximumSimultaneousTileLoads,
CesiumTokens->cesiumSubTileCacheBytes,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
UsdTyped::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/data.cpp | #include ".//data.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumData,
TfType::Bases< UsdTyped > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumDataPrim")
// to find TfType<CesiumData>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumData>("CesiumDataPrim");
}
/* virtual */
CesiumData::~CesiumData()
{
}
/* static */
CesiumData
CesiumData::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumData();
}
return CesiumData(stage->GetPrimAtPath(path));
}
/* static */
CesiumData
CesiumData::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumDataPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumData();
}
return CesiumData(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumData::_GetSchemaKind() const
{
return CesiumData::schemaKind;
}
/* static */
const TfType &
CesiumData::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumData>();
return tfType;
}
/* static */
bool
CesiumData::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumData::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumData::GetDebugDisableMaterialsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugDisableMaterials);
}
UsdAttribute
CesiumData::CreateDebugDisableMaterialsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugDisableMaterials,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugDisableTexturesAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugDisableTextures);
}
UsdAttribute
CesiumData::CreateDebugDisableTexturesAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugDisableTextures,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugDisableGeometryPoolAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugDisableGeometryPool);
}
UsdAttribute
CesiumData::CreateDebugDisableGeometryPoolAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugDisableGeometryPool,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugDisableMaterialPoolAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugDisableMaterialPool);
}
UsdAttribute
CesiumData::CreateDebugDisableMaterialPoolAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugDisableMaterialPool,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugDisableTexturePoolAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugDisableTexturePool);
}
UsdAttribute
CesiumData::CreateDebugDisableTexturePoolAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugDisableTexturePool,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugGeometryPoolInitialCapacityAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugGeometryPoolInitialCapacity);
}
UsdAttribute
CesiumData::CreateDebugGeometryPoolInitialCapacityAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugGeometryPoolInitialCapacity,
SdfValueTypeNames->UInt64,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugMaterialPoolInitialCapacityAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugMaterialPoolInitialCapacity);
}
UsdAttribute
CesiumData::CreateDebugMaterialPoolInitialCapacityAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugMaterialPoolInitialCapacity,
SdfValueTypeNames->UInt64,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugTexturePoolInitialCapacityAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugTexturePoolInitialCapacity);
}
UsdAttribute
CesiumData::CreateDebugTexturePoolInitialCapacityAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugTexturePoolInitialCapacity,
SdfValueTypeNames->UInt64,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugRandomColorsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugRandomColors);
}
UsdAttribute
CesiumData::CreateDebugRandomColorsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugRandomColors,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumData::GetDebugDisableGeoreferencingAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumDebugDisableGeoreferencing);
}
UsdAttribute
CesiumData::CreateDebugDisableGeoreferencingAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumDebugDisableGeoreferencing,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdRelationship
CesiumData::GetSelectedIonServerRel() const
{
return GetPrim().GetRelationship(CesiumTokens->cesiumSelectedIonServer);
}
UsdRelationship
CesiumData::CreateSelectedIonServerRel() const
{
return GetPrim().CreateRelationship(CesiumTokens->cesiumSelectedIonServer,
/* custom = */ false);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumData::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumDebugDisableMaterials,
CesiumTokens->cesiumDebugDisableTextures,
CesiumTokens->cesiumDebugDisableGeometryPool,
CesiumTokens->cesiumDebugDisableMaterialPool,
CesiumTokens->cesiumDebugDisableTexturePool,
CesiumTokens->cesiumDebugGeometryPoolInitialCapacity,
CesiumTokens->cesiumDebugMaterialPoolInitialCapacity,
CesiumTokens->cesiumDebugTexturePoolInitialCapacity,
CesiumTokens->cesiumDebugRandomColors,
CesiumTokens->cesiumDebugDisableGeoreferencing,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
UsdTyped::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/data.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_DATA_H
#define CESIUMUSDSCHEMAS_GENERATED_DATA_H
/// \file CesiumUsdSchemas/data.h
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMDATAPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumData
///
/// Stores stage level data for Cesium for Omniverse/USD.
///
class CesiumData : public UsdTyped
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumData on UsdPrim \p prim .
/// Equivalent to CesiumData::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumData(const UsdPrim& prim=UsdPrim())
: UsdTyped(prim)
{
}
/// Construct a CesiumData on the prim held by \p schemaObj .
/// Should be preferred over CesiumData(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumData(const UsdSchemaBase& schemaObj)
: UsdTyped(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumData();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumData holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumData(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumData
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumData
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// DEBUGDISABLEMATERIALS
// --------------------------------------------------------------------- //
/// Debug option that renders tilesets with materials disabled.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:debug:disableMaterials = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugDisableMaterialsAttr() const;
/// See GetDebugDisableMaterialsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugDisableMaterialsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGDISABLETEXTURES
// --------------------------------------------------------------------- //
/// Debug option that renders tilesets with textures disabled.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:debug:disableTextures = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugDisableTexturesAttr() const;
/// See GetDebugDisableTexturesAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugDisableTexturesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGDISABLEGEOMETRYPOOL
// --------------------------------------------------------------------- //
/// Debug option that disables geometry pooling.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:debug:disableGeometryPool = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugDisableGeometryPoolAttr() const;
/// See GetDebugDisableGeometryPoolAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugDisableGeometryPoolAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGDISABLEMATERIALPOOL
// --------------------------------------------------------------------- //
/// Debug option that disables material pooling.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:debug:disableMaterialPool = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugDisableMaterialPoolAttr() const;
/// See GetDebugDisableMaterialPoolAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugDisableMaterialPoolAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGDISABLETEXTUREPOOL
// --------------------------------------------------------------------- //
/// Debug option that disables texture pooling.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:debug:disableTexturePool = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugDisableTexturePoolAttr() const;
/// See GetDebugDisableTexturePoolAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugDisableTexturePoolAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGGEOMETRYPOOLINITIALCAPACITY
// --------------------------------------------------------------------- //
/// Debug option that controls the initial capacity of the geometry pool.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uint64 cesium:debug:geometryPoolInitialCapacity = 2048` |
/// | C++ Type | uint64_t |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->UInt64 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugGeometryPoolInitialCapacityAttr() const;
/// See GetDebugGeometryPoolInitialCapacityAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugGeometryPoolInitialCapacityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGMATERIALPOOLINITIALCAPACITY
// --------------------------------------------------------------------- //
/// Debug option that controls the initial capacity of the material pool.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uint64 cesium:debug:materialPoolInitialCapacity = 2048` |
/// | C++ Type | uint64_t |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->UInt64 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugMaterialPoolInitialCapacityAttr() const;
/// See GetDebugMaterialPoolInitialCapacityAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugMaterialPoolInitialCapacityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGTEXTUREPOOLINITIALCAPACITY
// --------------------------------------------------------------------- //
/// Debug option that controls the initial capacity of the texture pool.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uint64 cesium:debug:texturePoolInitialCapacity = 2048` |
/// | C++ Type | uint64_t |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->UInt64 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugTexturePoolInitialCapacityAttr() const;
/// See GetDebugTexturePoolInitialCapacityAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugTexturePoolInitialCapacityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGRANDOMCOLORS
// --------------------------------------------------------------------- //
/// Debug option that renders tiles with random colors.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:debug:randomColors = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugRandomColorsAttr() const;
/// See GetDebugRandomColorsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugRandomColorsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// DEBUGDISABLEGEOREFERENCING
// --------------------------------------------------------------------- //
/// Debug option to disable georeferencing. Tiles will be rendered in EPSG:4978 (ECEF) coordinates where (0, 0, 0) is the center of the globe, the X axis points towards the prime meridian, the Y axis points towards the 90th meridian east, and the Z axis points towards the North Pole.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:debug:disableGeoreferencing = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDebugDisableGeoreferencingAttr() const;
/// See GetDebugDisableGeoreferencingAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDebugDisableGeoreferencingAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// SELECTEDIONSERVER
// --------------------------------------------------------------------- //
/// The current ion Server prim used in the Cesium for Omniverse UI.
///
CESIUMUSDSCHEMAS_API
UsdRelationship GetSelectedIonServerRel() const;
/// See GetSelectedIonServerRel(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
CESIUMUSDSCHEMAS_API
UsdRelationship CreateSelectedIonServerRel() const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/tileset.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_TILESET_H
#define CESIUMUSDSCHEMAS_GENERATED_TILESET_H
/// \file CesiumUsdSchemas/tileset.h
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/usd/usdGeom/gprim.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMTILESETPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumTileset
///
/// A prim representing a tileset.
///
/// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
/// that are text/tokens, the actual token is published and defined in \ref CesiumTokens.
/// So to set an attribute to the value "rightHanded", use CesiumTokens->rightHanded
/// as the value.
///
class CesiumTileset : public UsdGeomGprim
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumTileset on UsdPrim \p prim .
/// Equivalent to CesiumTileset::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumTileset(const UsdPrim& prim=UsdPrim())
: UsdGeomGprim(prim)
{
}
/// Construct a CesiumTileset on the prim held by \p schemaObj .
/// Should be preferred over CesiumTileset(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumTileset(const UsdSchemaBase& schemaObj)
: UsdGeomGprim(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumTileset();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumTileset holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumTileset(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumTileset
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumTileset
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// SOURCETYPE
// --------------------------------------------------------------------- //
/// Selects whether to use the Cesium ion Asset ID or the provided URL for this tileset.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uniform token cesium:sourceType = "ion"` |
/// | C++ Type | TfToken |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
/// | \ref CesiumTokens "Allowed Values" | ion, url |
CESIUMUSDSCHEMAS_API
UsdAttribute GetSourceTypeAttr() const;
/// See GetSourceTypeAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateSourceTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// URL
// --------------------------------------------------------------------- //
/// The URL of this tileset's tileset.json file. Usually blank if this is an ion asset.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:url = ""` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetUrlAttr() const;
/// See GetUrlAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateUrlAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// IONASSETID
// --------------------------------------------------------------------- //
/// The ID of the Cesium ion asset to use. Usually blank if using URL.
///
/// | ||
/// | -- | -- |
/// | Declaration | `int64 cesium:ionAssetId = 0` |
/// | C++ Type | int64_t |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int64 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetIonAssetIdAttr() const;
/// See GetIonAssetIdAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateIonAssetIdAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// IONACCESSTOKEN
// --------------------------------------------------------------------- //
/// The access token to use to access the Cesium ion resource. Overrides the default token. Usually blank if using URL.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:ionAccessToken = ""` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetIonAccessTokenAttr() const;
/// See GetIonAccessTokenAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateIonAccessTokenAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMSCREENSPACEERROR
// --------------------------------------------------------------------- //
/// The maximum number of pixels of error when rendering this tileset. This is used to select an appropriate level-of-detail: A low value will cause many tiles with a high level of detail to be loaded, causing a finer visual representation of the tiles, but with a higher performance cost for loading and rendering. A higher value will cause a coarser visual representation, with lower performance requirements. When a tileset uses the older layer.json / quantized-mesh format rather than 3D Tiles, this value is effectively divided by 8.0. So the default value of 16.0 corresponds to the standard value for quantized-mesh terrain of 2.0.
///
/// | ||
/// | -- | -- |
/// | Declaration | `float cesium:maximumScreenSpaceError = 16` |
/// | C++ Type | float |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumScreenSpaceErrorAttr() const;
/// See GetMaximumScreenSpaceErrorAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumScreenSpaceErrorAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// PRELOADANCESTORS
// --------------------------------------------------------------------- //
/// Whether to preload ancestor tiles. Setting this to true optimizes the zoom-out experience and provides more detail in newly-exposed areas when panning. The down side is that it requires loading more tiles.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:preloadAncestors = 1` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetPreloadAncestorsAttr() const;
/// See GetPreloadAncestorsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreatePreloadAncestorsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// PRELOADSIBLINGS
// --------------------------------------------------------------------- //
/// Whether to preload sibling tiles. Setting this to true causes tiles with the same parent as a rendered tile to be loaded, even if they are culled. Setting this to true may provide a better panning experience at the cost of loading more tiles.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:preloadSiblings = 1` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetPreloadSiblingsAttr() const;
/// See GetPreloadSiblingsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreatePreloadSiblingsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// FORBIDHOLES
// --------------------------------------------------------------------- //
/// Whether to prevent refinement of a parent tile when a child isn't done loading. When this is set to true, the tileset will guarantee that the tileset will never be rendered with holes in place of tiles that are not yet loaded, even though the tile that is rendered instead may have low resolution. When false, overall loading will be faster, but newly-visible parts of the tileset may initially be blank.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:forbidHoles = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetForbidHolesAttr() const;
/// See GetForbidHolesAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateForbidHolesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMSIMULTANEOUSTILELOADS
// --------------------------------------------------------------------- //
/// The maximum number of tiles that may be loaded at once. When new parts of the tileset become visible, the tasks to load the corresponding tiles are put into a queue. This value determines how many of these tasks are processed at the same time. A higher value may cause the tiles to be loaded and rendered more quickly, at the cost of a higher network and processing load.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uint cesium:maximumSimultaneousTileLoads = 20` |
/// | C++ Type | unsigned int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->UInt |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumSimultaneousTileLoadsAttr() const;
/// See GetMaximumSimultaneousTileLoadsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumSimultaneousTileLoadsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMCACHEDBYTES
// --------------------------------------------------------------------- //
/// The maximum number of bytes that may be cached. Note that this value, even if 0, will never cause tiles that are needed for rendering to be unloaded. However, if the total number of loaded bytes is greater than this value, tiles will be unloaded until the total is under this number or until only required tiles remain, whichever comes first.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uint64 cesium:maximumCachedBytes = 536870912` |
/// | C++ Type | uint64_t |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->UInt64 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumCachedBytesAttr() const;
/// See GetMaximumCachedBytesAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumCachedBytesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// LOADINGDESCENDANTLIMIT
// --------------------------------------------------------------------- //
/// The number of loading descendants a tile should allow before deciding to render itself instead of waiting. Setting this to 0 will cause each level of detail to be loaded successively. This will increase the overall loading time, but cause additional detail to appear more gradually. Setting this to a high value like 1000 will decrease the overall time until the desired level of detail is achieved, but this high-detail representation will appear at once, as soon as it is loaded completely.
///
/// | ||
/// | -- | -- |
/// | Declaration | `uint cesium:loadingDescendantLimit = 20` |
/// | C++ Type | unsigned int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->UInt |
CESIUMUSDSCHEMAS_API
UsdAttribute GetLoadingDescendantLimitAttr() const;
/// See GetLoadingDescendantLimitAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateLoadingDescendantLimitAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// ENABLEFRUSTUMCULLING
// --------------------------------------------------------------------- //
/// Whether to cull tiles that are outside the frustum. By default this is true, meaning that tiles that are not visible with the current camera configuration will be ignored. It can be set to false, so that these tiles are still considered for loading, refinement and rendering. This will cause more tiles to be loaded, but helps to avoid holes and provides a more consistent mesh, which may be helpful for physics and shadows. Note that this will always be disabled if Use Lod Transitions is set to true.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:enableFrustumCulling = 1` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetEnableFrustumCullingAttr() const;
/// See GetEnableFrustumCullingAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateEnableFrustumCullingAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// ENABLEFOGCULLING
// --------------------------------------------------------------------- //
/// Whether to cull tiles that are occluded by fog. This does not refer to the atmospheric fog rendered by Unity, but to an internal representation of fog: Depending on the height of the camera above the ground, tiles that are far away (close to the horizon) will be culled when this flag is enabled. Note that this will always be disabled if Use Lod Transitions is set to true.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:enableFogCulling = 1` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetEnableFogCullingAttr() const;
/// See GetEnableFogCullingAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateEnableFogCullingAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// ENFORCECULLEDSCREENSPACEERROR
// --------------------------------------------------------------------- //
/// Whether a specified screen-space error should be enforced for tiles that are outside the frustum or hidden in fog. When Enable Frustum Culling and Enable Fog Culling are both true, tiles outside the view frustum or hidden in fog are effectively ignored, and so their level-of-detail doesn't matter. And in this scenario, this property is ignored. However, when either of those flags are false, these would-be-culled tiles continue to be processed, and the question arises of how to handle their level-of-detail. When this property is false, refinement terminates at these tiles, no matter what their current screen-space error. The tiles are available for physics, shadows, etc., but their level-of-detail may be very low. When set to true, these tiles are refined until they achieve the specified Culled Screen Space Error. This allows control over the minimum quality of these would-be-culled tiles.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:enforceCulledScreenSpaceError = 1` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetEnforceCulledScreenSpaceErrorAttr() const;
/// See GetEnforceCulledScreenSpaceErrorAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateEnforceCulledScreenSpaceErrorAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// CULLEDSCREENSPACEERROR
// --------------------------------------------------------------------- //
/// The screen-space error to be enforced for tiles that are outside the frustum or hidden in fog. When Enable Frustum Culling and Enable Fog Culling are both true, tiles outside the view frustum or hidden in fog are effectively ignored, and so their level-of-detail doesn't matter. And in this scenario, this property is ignored. However, when either of those flags are false, these would-be-culled tiles continue to be processed, and the question arises of how to handle their level-of-detail. When this property is false, refinement terminates at these tiles, no matter what their current screen-space error. The tiles are available for physics, shadows, etc., but their level-of-detail may be very low. When set to true, these tiles are refined until they achieve the specified Culled Screen Space Error. This allows control over the minimum quality of these would-be-culled tiles.
///
/// | ||
/// | -- | -- |
/// | Declaration | `float cesium:culledScreenSpaceError = 64` |
/// | C++ Type | float |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
CESIUMUSDSCHEMAS_API
UsdAttribute GetCulledScreenSpaceErrorAttr() const;
/// See GetCulledScreenSpaceErrorAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateCulledScreenSpaceErrorAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// SUSPENDUPDATE
// --------------------------------------------------------------------- //
/// Pauses level-of-detail and culling updates of this tileset.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:suspendUpdate = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetSuspendUpdateAttr() const;
/// See GetSuspendUpdateAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateSuspendUpdateAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// SMOOTHNORMALS
// --------------------------------------------------------------------- //
/// Generate smooth normals instead of flat normals when normals are missing.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:smoothNormals = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetSmoothNormalsAttr() const;
/// See GetSmoothNormalsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateSmoothNormalsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// SHOWCREDITSONSCREEN
// --------------------------------------------------------------------- //
/// Whether or not to show this tileset's credits on screen.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:showCreditsOnScreen = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetShowCreditsOnScreenAttr() const;
/// See GetShowCreditsOnScreenAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateShowCreditsOnScreenAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAINTHREADLOADINGTIMELIMIT
// --------------------------------------------------------------------- //
/// A soft limit on how long (in milliseconds) to spend on the main-thread part of tile loading each frame. A value of 0.0 indicates that all pending main-thread loads should be completed each tick.
///
/// | ||
/// | -- | -- |
/// | Declaration | `float cesium:mainThreadLoadingTimeLimit = 0` |
/// | C++ Type | float |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMainThreadLoadingTimeLimitAttr() const;
/// See GetMainThreadLoadingTimeLimitAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMainThreadLoadingTimeLimitAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// GEOREFERENCEBINDING
// --------------------------------------------------------------------- //
/// Specifies which Cesium Georeference object to use for this tileset.
///
CESIUMUSDSCHEMAS_API
UsdRelationship GetGeoreferenceBindingRel() const;
/// See GetGeoreferenceBindingRel(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
CESIUMUSDSCHEMAS_API
UsdRelationship CreateGeoreferenceBindingRel() const;
public:
// --------------------------------------------------------------------- //
// IONSERVERBINDING
// --------------------------------------------------------------------- //
/// Specifies which Cesium ion Server prim to use for this tileset.
///
CESIUMUSDSCHEMAS_API
UsdRelationship GetIonServerBindingRel() const;
/// See GetIonServerBindingRel(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
CESIUMUSDSCHEMAS_API
UsdRelationship CreateIonServerBindingRel() const;
public:
// --------------------------------------------------------------------- //
// RASTEROVERLAYBINDING
// --------------------------------------------------------------------- //
/// Specifies which raster overlays to use for this tileset.
///
CESIUMUSDSCHEMAS_API
UsdRelationship GetRasterOverlayBindingRel() const;
/// See GetRasterOverlayBindingRel(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
CESIUMUSDSCHEMAS_API
UsdRelationship CreateRasterOverlayBindingRel() const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/tokens.h | #ifndef CESIUM_TOKENS_H
#define CESIUM_TOKENS_H
/// \file CesiumUsdSchemas/tokens.h
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//
// This is an automatically generated file (by usdGenSchema.py).
// Do not hand-edit!
//
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/base/tf/staticData.h"
#include "pxr/base/tf/token.h"
#include <vector>
PXR_NAMESPACE_OPEN_SCOPE
/// \class CesiumTokensType
///
/// \link CesiumTokens \endlink provides static, efficient
/// \link TfToken TfTokens\endlink for use in all public USD API.
///
/// These tokens are auto-generated from the module's schema, representing
/// property names, for when you need to fetch an attribute or relationship
/// directly by name, e.g. UsdPrim::GetAttribute(), in the most efficient
/// manner, and allow the compiler to verify that you spelled the name
/// correctly.
///
/// CesiumTokens also contains all of the \em allowedTokens values
/// declared for schema builtin attributes of 'token' scene description type.
/// Use CesiumTokens like so:
///
/// \code
/// gprim.GetMyTokenValuedAttr().Set(CesiumTokens->cesiumAlpha);
/// \endcode
struct CesiumTokensType {
CESIUMUSDSCHEMAS_API CesiumTokensType();
/// \brief "cesium:alpha"
///
/// CesiumRasterOverlay
const TfToken cesiumAlpha;
/// \brief "cesium:anchor:adjustOrientationForGlobeWhenMoving"
///
/// CesiumGlobeAnchorAPI
const TfToken cesiumAnchorAdjustOrientationForGlobeWhenMoving;
/// \brief "cesium:anchor:detectTransformChanges"
///
/// CesiumGlobeAnchorAPI
const TfToken cesiumAnchorDetectTransformChanges;
/// \brief "cesium:anchor:georeferenceBinding"
///
/// CesiumGlobeAnchorAPI
const TfToken cesiumAnchorGeoreferenceBinding;
/// \brief "cesium:anchor:height"
///
/// CesiumGlobeAnchorAPI
const TfToken cesiumAnchorHeight;
/// \brief "cesium:anchor:latitude"
///
/// CesiumGlobeAnchorAPI
const TfToken cesiumAnchorLatitude;
/// \brief "cesium:anchor:longitude"
///
/// CesiumGlobeAnchorAPI
const TfToken cesiumAnchorLongitude;
/// \brief "cesium:anchor:position"
///
/// CesiumGlobeAnchorAPI
const TfToken cesiumAnchorPosition;
/// \brief "cesium:baseUrl"
///
/// CesiumWebMapServiceRasterOverlay
const TfToken cesiumBaseUrl;
/// \brief "cesium:cartographicPolygonBinding"
///
/// CesiumPolygonRasterOverlay
const TfToken cesiumCartographicPolygonBinding;
/// \brief "cesium:culledScreenSpaceError"
///
/// CesiumTileset
const TfToken cesiumCulledScreenSpaceError;
/// \brief "cesium:debug:disableGeometryPool"
///
/// CesiumData
const TfToken cesiumDebugDisableGeometryPool;
/// \brief "cesium:debug:disableGeoreferencing"
///
/// CesiumData
const TfToken cesiumDebugDisableGeoreferencing;
/// \brief "cesium:debug:disableMaterialPool"
///
/// CesiumData
const TfToken cesiumDebugDisableMaterialPool;
/// \brief "cesium:debug:disableMaterials"
///
/// CesiumData
const TfToken cesiumDebugDisableMaterials;
/// \brief "cesium:debug:disableTexturePool"
///
/// CesiumData
const TfToken cesiumDebugDisableTexturePool;
/// \brief "cesium:debug:disableTextures"
///
/// CesiumData
const TfToken cesiumDebugDisableTextures;
/// \brief "cesium:debug:geometryPoolInitialCapacity"
///
/// CesiumData
const TfToken cesiumDebugGeometryPoolInitialCapacity;
/// \brief "cesium:debug:materialPoolInitialCapacity"
///
/// CesiumData
const TfToken cesiumDebugMaterialPoolInitialCapacity;
/// \brief "cesium:debug:randomColors"
///
/// CesiumData
const TfToken cesiumDebugRandomColors;
/// \brief "cesium:debug:texturePoolInitialCapacity"
///
/// CesiumData
const TfToken cesiumDebugTexturePoolInitialCapacity;
/// \brief "cesium:displayName"
///
/// CesiumIonServer
const TfToken cesiumDisplayName;
/// \brief "cesium:east"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumEast;
/// \brief "cesium:ecefToUsdTransform"
///
/// CesiumSession
const TfToken cesiumEcefToUsdTransform;
/// \brief "cesium:enableFogCulling"
///
/// CesiumTileset
const TfToken cesiumEnableFogCulling;
/// \brief "cesium:enableFrustumCulling"
///
/// CesiumTileset
const TfToken cesiumEnableFrustumCulling;
/// \brief "cesium:enforceCulledScreenSpaceError"
///
/// CesiumTileset
const TfToken cesiumEnforceCulledScreenSpaceError;
/// \brief "cesium:excludeSelectedTiles"
///
/// CesiumPolygonRasterOverlay
const TfToken cesiumExcludeSelectedTiles;
/// \brief "cesium:forbidHoles"
///
/// CesiumTileset
const TfToken cesiumForbidHoles;
/// \brief "cesium:format"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumFormat;
/// \brief "cesium:georeferenceBinding"
///
/// CesiumTileset
const TfToken cesiumGeoreferenceBinding;
/// \brief "cesium:georeferenceOrigin:height"
///
/// CesiumGeoreference
const TfToken cesiumGeoreferenceOriginHeight;
/// \brief "cesium:georeferenceOrigin:latitude"
///
/// CesiumGeoreference
const TfToken cesiumGeoreferenceOriginLatitude;
/// \brief "cesium:georeferenceOrigin:longitude"
///
/// CesiumGeoreference
const TfToken cesiumGeoreferenceOriginLongitude;
/// \brief "cesium:invertSelection"
///
/// CesiumPolygonRasterOverlay
const TfToken cesiumInvertSelection;
/// \brief "cesium:ionAccessToken"
///
/// CesiumIonRasterOverlay, CesiumTileset
const TfToken cesiumIonAccessToken;
/// \brief "cesium:ionAssetId"
///
/// CesiumIonRasterOverlay, CesiumTileset
const TfToken cesiumIonAssetId;
/// \brief "cesium:ionServerApiUrl"
///
/// CesiumIonServer
const TfToken cesiumIonServerApiUrl;
/// \brief "cesium:ionServerApplicationId"
///
/// CesiumIonServer
const TfToken cesiumIonServerApplicationId;
/// \brief "cesium:ionServerBinding"
///
/// CesiumIonRasterOverlay, CesiumTileset
const TfToken cesiumIonServerBinding;
/// \brief "cesium:ionServerUrl"
///
/// CesiumIonServer
const TfToken cesiumIonServerUrl;
/// \brief "cesium:layer"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumLayer;
/// \brief "cesium:layers"
///
/// CesiumWebMapServiceRasterOverlay
const TfToken cesiumLayers;
/// \brief "cesium:loadingDescendantLimit"
///
/// CesiumTileset
const TfToken cesiumLoadingDescendantLimit;
/// \brief "cesium:mainThreadLoadingTimeLimit"
///
/// CesiumTileset
const TfToken cesiumMainThreadLoadingTimeLimit;
/// \brief "cesium:maximumCachedBytes"
///
/// CesiumTileset
const TfToken cesiumMaximumCachedBytes;
/// \brief "cesium:maximumLevel"
///
/// CesiumWebMapServiceRasterOverlay
const TfToken cesiumMaximumLevel;
/// \brief "cesium:maximumScreenSpaceError"
///
/// CesiumRasterOverlay, CesiumTileset
const TfToken cesiumMaximumScreenSpaceError;
/// \brief "cesium:maximumSimultaneousTileLoads"
///
/// CesiumRasterOverlay, CesiumTileset
const TfToken cesiumMaximumSimultaneousTileLoads;
/// \brief "cesium:maximumTextureSize"
///
/// CesiumRasterOverlay
const TfToken cesiumMaximumTextureSize;
/// \brief "cesium:maximumZoomLevel"
///
/// CesiumWebMapTileServiceRasterOverlay, CesiumTileMapServiceRasterOverlay
const TfToken cesiumMaximumZoomLevel;
/// \brief "cesium:minimumLevel"
///
/// CesiumWebMapServiceRasterOverlay
const TfToken cesiumMinimumLevel;
/// \brief "cesium:minimumZoomLevel"
///
/// CesiumWebMapTileServiceRasterOverlay, CesiumTileMapServiceRasterOverlay
const TfToken cesiumMinimumZoomLevel;
/// \brief "cesium:north"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumNorth;
/// \brief "cesium:overlayRenderMethod"
///
/// CesiumPolygonRasterOverlay, CesiumRasterOverlay
const TfToken cesiumOverlayRenderMethod;
/// \brief "cesium:preloadAncestors"
///
/// CesiumTileset
const TfToken cesiumPreloadAncestors;
/// \brief "cesium:preloadSiblings"
///
/// CesiumTileset
const TfToken cesiumPreloadSiblings;
/// \brief "cesium:projectDefaultIonAccessToken"
///
/// CesiumIonServer
const TfToken cesiumProjectDefaultIonAccessToken;
/// \brief "cesium:projectDefaultIonAccessTokenId"
///
/// CesiumIonServer
const TfToken cesiumProjectDefaultIonAccessTokenId;
/// \brief "cesium:rasterOverlayBinding"
///
/// CesiumTileset
const TfToken cesiumRasterOverlayBinding;
/// \brief "cesium:rootTilesX"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumRootTilesX;
/// \brief "cesium:rootTilesY"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumRootTilesY;
/// \brief "cesium:selectedIonServer"
///
/// CesiumData
const TfToken cesiumSelectedIonServer;
/// \brief "cesium:showCreditsOnScreen"
///
/// CesiumRasterOverlay, CesiumTileset
const TfToken cesiumShowCreditsOnScreen;
/// \brief "cesium:smoothNormals"
///
/// CesiumTileset
const TfToken cesiumSmoothNormals;
/// \brief "cesium:sourceType"
///
/// CesiumTileset
const TfToken cesiumSourceType;
/// \brief "cesium:south"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumSouth;
/// \brief "cesium:specifyTileMatrixSetLabels"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumSpecifyTileMatrixSetLabels;
/// \brief "cesium:specifyTilingScheme"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumSpecifyTilingScheme;
/// \brief "cesium:specifyZoomLevels"
///
/// CesiumWebMapTileServiceRasterOverlay, CesiumTileMapServiceRasterOverlay
const TfToken cesiumSpecifyZoomLevels;
/// \brief "cesium:style"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumStyle;
/// \brief "cesium:subTileCacheBytes"
///
/// CesiumRasterOverlay
const TfToken cesiumSubTileCacheBytes;
/// \brief "cesium:suspendUpdate"
///
/// CesiumTileset
const TfToken cesiumSuspendUpdate;
/// \brief "cesium:tileHeight"
///
/// CesiumWebMapServiceRasterOverlay
const TfToken cesiumTileHeight;
/// \brief "cesium:tileMatrixSetId"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumTileMatrixSetId;
/// \brief "cesium:tileMatrixSetLabelPrefix"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumTileMatrixSetLabelPrefix;
/// \brief "cesium:tileMatrixSetLabels"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumTileMatrixSetLabels;
/// \brief "cesium:tileWidth"
///
/// CesiumWebMapServiceRasterOverlay
const TfToken cesiumTileWidth;
/// \brief "cesium:url"
///
/// CesiumWebMapTileServiceRasterOverlay, CesiumTileMapServiceRasterOverlay, CesiumTileset
const TfToken cesiumUrl;
/// \brief "cesium:useWebMercatorProjection"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumUseWebMercatorProjection;
/// \brief "cesium:west"
///
/// CesiumWebMapTileServiceRasterOverlay
const TfToken cesiumWest;
/// \brief "clip"
///
/// Default value for CesiumPolygonRasterOverlay::GetCesiumOverlayRenderMethodAttr(), Possible value for CesiumRasterOverlay::GetOverlayRenderMethodAttr()
const TfToken clip;
/// \brief "ion"
///
/// Possible value for CesiumTileset::GetSourceTypeAttr(), Default value for CesiumTileset::GetSourceTypeAttr()
const TfToken ion;
/// \brief "overlay"
///
/// Possible value for CesiumRasterOverlay::GetOverlayRenderMethodAttr(), Default value for CesiumRasterOverlay::GetOverlayRenderMethodAttr()
const TfToken overlay;
/// \brief "url"
///
/// Possible value for CesiumTileset::GetSourceTypeAttr()
const TfToken url;
/// A vector of all of the tokens listed above.
const std::vector<TfToken> allTokens;
};
/// \var CesiumTokens
///
/// A global variable with static, efficient \link TfToken TfTokens\endlink
/// for use in all public USD API. \sa CesiumTokensType
extern CESIUMUSDSCHEMAS_API TfStaticData<CesiumTokensType> CesiumTokens;
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/tileset.cpp | #include ".//tileset.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumTileset,
TfType::Bases< UsdGeomGprim > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumTilesetPrim")
// to find TfType<CesiumTileset>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumTileset>("CesiumTilesetPrim");
}
/* virtual */
CesiumTileset::~CesiumTileset()
{
}
/* static */
CesiumTileset
CesiumTileset::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumTileset();
}
return CesiumTileset(stage->GetPrimAtPath(path));
}
/* static */
CesiumTileset
CesiumTileset::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumTilesetPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumTileset();
}
return CesiumTileset(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumTileset::_GetSchemaKind() const
{
return CesiumTileset::schemaKind;
}
/* static */
const TfType &
CesiumTileset::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumTileset>();
return tfType;
}
/* static */
bool
CesiumTileset::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumTileset::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumTileset::GetSourceTypeAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSourceType);
}
UsdAttribute
CesiumTileset::CreateSourceTypeAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSourceType,
SdfValueTypeNames->Token,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetUrlAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumUrl);
}
UsdAttribute
CesiumTileset::CreateUrlAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumUrl,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetIonAssetIdAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumIonAssetId);
}
UsdAttribute
CesiumTileset::CreateIonAssetIdAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumIonAssetId,
SdfValueTypeNames->Int64,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetIonAccessTokenAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumIonAccessToken);
}
UsdAttribute
CesiumTileset::CreateIonAccessTokenAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumIonAccessToken,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetMaximumScreenSpaceErrorAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumScreenSpaceError);
}
UsdAttribute
CesiumTileset::CreateMaximumScreenSpaceErrorAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumScreenSpaceError,
SdfValueTypeNames->Float,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetPreloadAncestorsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumPreloadAncestors);
}
UsdAttribute
CesiumTileset::CreatePreloadAncestorsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumPreloadAncestors,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetPreloadSiblingsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumPreloadSiblings);
}
UsdAttribute
CesiumTileset::CreatePreloadSiblingsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumPreloadSiblings,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetForbidHolesAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumForbidHoles);
}
UsdAttribute
CesiumTileset::CreateForbidHolesAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumForbidHoles,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetMaximumSimultaneousTileLoadsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumSimultaneousTileLoads);
}
UsdAttribute
CesiumTileset::CreateMaximumSimultaneousTileLoadsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumSimultaneousTileLoads,
SdfValueTypeNames->UInt,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetMaximumCachedBytesAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMaximumCachedBytes);
}
UsdAttribute
CesiumTileset::CreateMaximumCachedBytesAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMaximumCachedBytes,
SdfValueTypeNames->UInt64,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetLoadingDescendantLimitAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumLoadingDescendantLimit);
}
UsdAttribute
CesiumTileset::CreateLoadingDescendantLimitAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumLoadingDescendantLimit,
SdfValueTypeNames->UInt,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetEnableFrustumCullingAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumEnableFrustumCulling);
}
UsdAttribute
CesiumTileset::CreateEnableFrustumCullingAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumEnableFrustumCulling,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetEnableFogCullingAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumEnableFogCulling);
}
UsdAttribute
CesiumTileset::CreateEnableFogCullingAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumEnableFogCulling,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetEnforceCulledScreenSpaceErrorAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumEnforceCulledScreenSpaceError);
}
UsdAttribute
CesiumTileset::CreateEnforceCulledScreenSpaceErrorAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumEnforceCulledScreenSpaceError,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetCulledScreenSpaceErrorAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumCulledScreenSpaceError);
}
UsdAttribute
CesiumTileset::CreateCulledScreenSpaceErrorAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumCulledScreenSpaceError,
SdfValueTypeNames->Float,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetSuspendUpdateAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSuspendUpdate);
}
UsdAttribute
CesiumTileset::CreateSuspendUpdateAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSuspendUpdate,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetSmoothNormalsAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumSmoothNormals);
}
UsdAttribute
CesiumTileset::CreateSmoothNormalsAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumSmoothNormals,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetShowCreditsOnScreenAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumShowCreditsOnScreen);
}
UsdAttribute
CesiumTileset::CreateShowCreditsOnScreenAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumShowCreditsOnScreen,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumTileset::GetMainThreadLoadingTimeLimitAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumMainThreadLoadingTimeLimit);
}
UsdAttribute
CesiumTileset::CreateMainThreadLoadingTimeLimitAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumMainThreadLoadingTimeLimit,
SdfValueTypeNames->Float,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdRelationship
CesiumTileset::GetGeoreferenceBindingRel() const
{
return GetPrim().GetRelationship(CesiumTokens->cesiumGeoreferenceBinding);
}
UsdRelationship
CesiumTileset::CreateGeoreferenceBindingRel() const
{
return GetPrim().CreateRelationship(CesiumTokens->cesiumGeoreferenceBinding,
/* custom = */ false);
}
UsdRelationship
CesiumTileset::GetIonServerBindingRel() const
{
return GetPrim().GetRelationship(CesiumTokens->cesiumIonServerBinding);
}
UsdRelationship
CesiumTileset::CreateIonServerBindingRel() const
{
return GetPrim().CreateRelationship(CesiumTokens->cesiumIonServerBinding,
/* custom = */ false);
}
UsdRelationship
CesiumTileset::GetRasterOverlayBindingRel() const
{
return GetPrim().GetRelationship(CesiumTokens->cesiumRasterOverlayBinding);
}
UsdRelationship
CesiumTileset::CreateRasterOverlayBindingRel() const
{
return GetPrim().CreateRelationship(CesiumTokens->cesiumRasterOverlayBinding,
/* custom = */ false);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumTileset::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumSourceType,
CesiumTokens->cesiumUrl,
CesiumTokens->cesiumIonAssetId,
CesiumTokens->cesiumIonAccessToken,
CesiumTokens->cesiumMaximumScreenSpaceError,
CesiumTokens->cesiumPreloadAncestors,
CesiumTokens->cesiumPreloadSiblings,
CesiumTokens->cesiumForbidHoles,
CesiumTokens->cesiumMaximumSimultaneousTileLoads,
CesiumTokens->cesiumMaximumCachedBytes,
CesiumTokens->cesiumLoadingDescendantLimit,
CesiumTokens->cesiumEnableFrustumCulling,
CesiumTokens->cesiumEnableFogCulling,
CesiumTokens->cesiumEnforceCulledScreenSpaceError,
CesiumTokens->cesiumCulledScreenSpaceError,
CesiumTokens->cesiumSuspendUpdate,
CesiumTokens->cesiumSmoothNormals,
CesiumTokens->cesiumShowCreditsOnScreen,
CesiumTokens->cesiumMainThreadLoadingTimeLimit,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
UsdGeomGprim::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapIonRasterOverlay.cpp | #include ".//ionRasterOverlay.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateIonAssetIdAttr(CesiumIonRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateIonAssetIdAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int64), writeSparsely);
}
static UsdAttribute
_CreateIonAccessTokenAttr(CesiumIonRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateIonAccessTokenAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static std::string
_Repr(const CesiumIonRasterOverlay &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.IonRasterOverlay(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumIonRasterOverlay()
{
typedef CesiumIonRasterOverlay This;
class_<This, bases<CesiumRasterOverlay> >
cls("IonRasterOverlay");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("Define", &This::Define, (arg("stage"), arg("path")))
.staticmethod("Define")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetIonAssetIdAttr",
&This::GetIonAssetIdAttr)
.def("CreateIonAssetIdAttr",
&_CreateIonAssetIdAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetIonAccessTokenAttr",
&This::GetIonAccessTokenAttr)
.def("CreateIonAccessTokenAttr",
&_CreateIonAccessTokenAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetIonServerBindingRel",
&This::GetIonServerBindingRel)
.def("CreateIonServerBindingRel",
&This::CreateIonServerBindingRel)
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapWebMapServiceRasterOverlay.cpp | #include ".//webMapServiceRasterOverlay.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateBaseUrlAttr(CesiumWebMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateBaseUrlAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateLayersAttr(CesiumWebMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateLayersAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->String), writeSparsely);
}
static UsdAttribute
_CreateTileWidthAttr(CesiumWebMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateTileWidthAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateTileHeightAttr(CesiumWebMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateTileHeightAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateMinimumLevelAttr(CesiumWebMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMinimumLevelAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateMaximumLevelAttr(CesiumWebMapServiceRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMaximumLevelAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static std::string
_Repr(const CesiumWebMapServiceRasterOverlay &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.WebMapServiceRasterOverlay(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumWebMapServiceRasterOverlay()
{
typedef CesiumWebMapServiceRasterOverlay This;
class_<This, bases<CesiumRasterOverlay> >
cls("WebMapServiceRasterOverlay");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("Define", &This::Define, (arg("stage"), arg("path")))
.staticmethod("Define")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetBaseUrlAttr",
&This::GetBaseUrlAttr)
.def("CreateBaseUrlAttr",
&_CreateBaseUrlAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetLayersAttr",
&This::GetLayersAttr)
.def("CreateLayersAttr",
&_CreateLayersAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetTileWidthAttr",
&This::GetTileWidthAttr)
.def("CreateTileWidthAttr",
&_CreateTileWidthAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetTileHeightAttr",
&This::GetTileHeightAttr)
.def("CreateTileHeightAttr",
&_CreateTileHeightAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMinimumLevelAttr",
&This::GetMinimumLevelAttr)
.def("CreateMinimumLevelAttr",
&_CreateMinimumLevelAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMaximumLevelAttr",
&This::GetMaximumLevelAttr)
.def("CreateMaximumLevelAttr",
&_CreateMaximumLevelAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapPolygonRasterOverlay.cpp | #include ".//polygonRasterOverlay.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateInvertSelectionAttr(CesiumPolygonRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateInvertSelectionAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateExcludeSelectedTilesAttr(CesiumPolygonRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateExcludeSelectedTilesAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateCesiumOverlayRenderMethodAttr(CesiumPolygonRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateCesiumOverlayRenderMethodAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Token), writeSparsely);
}
static std::string
_Repr(const CesiumPolygonRasterOverlay &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.PolygonRasterOverlay(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumPolygonRasterOverlay()
{
typedef CesiumPolygonRasterOverlay This;
class_<This, bases<CesiumRasterOverlay> >
cls("PolygonRasterOverlay");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("Define", &This::Define, (arg("stage"), arg("path")))
.staticmethod("Define")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetInvertSelectionAttr",
&This::GetInvertSelectionAttr)
.def("CreateInvertSelectionAttr",
&_CreateInvertSelectionAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetExcludeSelectedTilesAttr",
&This::GetExcludeSelectedTilesAttr)
.def("CreateExcludeSelectedTilesAttr",
&_CreateExcludeSelectedTilesAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetCesiumOverlayRenderMethodAttr",
&This::GetCesiumOverlayRenderMethodAttr)
.def("CreateCesiumOverlayRenderMethodAttr",
&_CreateCesiumOverlayRenderMethodAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetCartographicPolygonBindingRel",
&This::GetCartographicPolygonBindingRel)
.def("CreateCartographicPolygonBindingRel",
&This::CreateCartographicPolygonBindingRel)
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/tileMapServiceRasterOverlay.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_TILEMAPSERVICERASTEROVERLAY_H
#define CESIUMUSDSCHEMAS_GENERATED_TILEMAPSERVICERASTEROVERLAY_H
/// \file CesiumUsdSchemas/tileMapServiceRasterOverlay.h
#include "pxr/pxr.h"
#include ".//api.h"
#include ".//rasterOverlay.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMTILEMAPSERVICERASTEROVERLAYPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumTileMapServiceRasterOverlay
///
/// Adds a prim for representing a Tile Map Service (TMS) raster overlay.
///
class CesiumTileMapServiceRasterOverlay : public CesiumRasterOverlay
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumTileMapServiceRasterOverlay on UsdPrim \p prim .
/// Equivalent to CesiumTileMapServiceRasterOverlay::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumTileMapServiceRasterOverlay(const UsdPrim& prim=UsdPrim())
: CesiumRasterOverlay(prim)
{
}
/// Construct a CesiumTileMapServiceRasterOverlay on the prim held by \p schemaObj .
/// Should be preferred over CesiumTileMapServiceRasterOverlay(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumTileMapServiceRasterOverlay(const UsdSchemaBase& schemaObj)
: CesiumRasterOverlay(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumTileMapServiceRasterOverlay();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumTileMapServiceRasterOverlay holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumTileMapServiceRasterOverlay(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumTileMapServiceRasterOverlay
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumTileMapServiceRasterOverlay
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// URL
// --------------------------------------------------------------------- //
/// The base url of the Tile Map Service (TMS).
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:url = ""` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetUrlAttr() const;
/// See GetUrlAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateUrlAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// SPECIFYZOOMLEVELS
// --------------------------------------------------------------------- //
/// True to directly specify minum and maximum zoom levels available from the server, or false to automatically determine the minimum and maximum zoom levels from the server's tilemapresource.xml file.
///
/// | ||
/// | -- | -- |
/// | Declaration | `bool cesium:specifyZoomLevels = 0` |
/// | C++ Type | bool |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
CESIUMUSDSCHEMAS_API
UsdAttribute GetSpecifyZoomLevelsAttr() const;
/// See GetSpecifyZoomLevelsAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateSpecifyZoomLevelsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MINIMUMZOOMLEVEL
// --------------------------------------------------------------------- //
/// Minimum zoom level
///
/// | ||
/// | -- | -- |
/// | Declaration | `int cesium:minimumZoomLevel = 0` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMinimumZoomLevelAttr() const;
/// See GetMinimumZoomLevelAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMinimumZoomLevelAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMZOOMLEVEL
// --------------------------------------------------------------------- //
/// Maximum zoom level
///
/// | ||
/// | -- | -- |
/// | Declaration | `int cesium:maximumZoomLevel = 10` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumZoomLevelAttr() const;
/// See GetMaximumZoomLevelAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumZoomLevelAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapTokens.cpp | // GENERATED FILE. DO NOT EDIT.
#include <boost/python/class.hpp>
#include ".//tokens.h"
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
// Helper to return a static token as a string. We wrap tokens as Python
// strings and for some reason simply wrapping the token using def_readonly
// bypasses to-Python conversion, leading to the error that there's no
// Python type for the C++ TfToken type. So we wrap this functor instead.
class _WrapStaticToken {
public:
_WrapStaticToken(const TfToken* token) : _token(token) { }
std::string operator()() const
{
return _token->GetString();
}
private:
const TfToken* _token;
};
template <typename T>
void
_AddToken(T& cls, const char* name, const TfToken& token)
{
cls.add_static_property(name,
boost::python::make_function(
_WrapStaticToken(&token),
boost::python::return_value_policy<
boost::python::return_by_value>(),
boost::mpl::vector1<std::string>()));
}
} // anonymous
void wrapCesiumTokens()
{
boost::python::class_<CesiumTokensType, boost::noncopyable>
cls("Tokens", boost::python::no_init);
_AddToken(cls, "cesiumAlpha", CesiumTokens->cesiumAlpha);
_AddToken(cls, "cesiumAnchorAdjustOrientationForGlobeWhenMoving", CesiumTokens->cesiumAnchorAdjustOrientationForGlobeWhenMoving);
_AddToken(cls, "cesiumAnchorDetectTransformChanges", CesiumTokens->cesiumAnchorDetectTransformChanges);
_AddToken(cls, "cesiumAnchorGeoreferenceBinding", CesiumTokens->cesiumAnchorGeoreferenceBinding);
_AddToken(cls, "cesiumAnchorHeight", CesiumTokens->cesiumAnchorHeight);
_AddToken(cls, "cesiumAnchorLatitude", CesiumTokens->cesiumAnchorLatitude);
_AddToken(cls, "cesiumAnchorLongitude", CesiumTokens->cesiumAnchorLongitude);
_AddToken(cls, "cesiumAnchorPosition", CesiumTokens->cesiumAnchorPosition);
_AddToken(cls, "cesiumBaseUrl", CesiumTokens->cesiumBaseUrl);
_AddToken(cls, "cesiumCartographicPolygonBinding", CesiumTokens->cesiumCartographicPolygonBinding);
_AddToken(cls, "cesiumCulledScreenSpaceError", CesiumTokens->cesiumCulledScreenSpaceError);
_AddToken(cls, "cesiumDebugDisableGeometryPool", CesiumTokens->cesiumDebugDisableGeometryPool);
_AddToken(cls, "cesiumDebugDisableGeoreferencing", CesiumTokens->cesiumDebugDisableGeoreferencing);
_AddToken(cls, "cesiumDebugDisableMaterialPool", CesiumTokens->cesiumDebugDisableMaterialPool);
_AddToken(cls, "cesiumDebugDisableMaterials", CesiumTokens->cesiumDebugDisableMaterials);
_AddToken(cls, "cesiumDebugDisableTexturePool", CesiumTokens->cesiumDebugDisableTexturePool);
_AddToken(cls, "cesiumDebugDisableTextures", CesiumTokens->cesiumDebugDisableTextures);
_AddToken(cls, "cesiumDebugGeometryPoolInitialCapacity", CesiumTokens->cesiumDebugGeometryPoolInitialCapacity);
_AddToken(cls, "cesiumDebugMaterialPoolInitialCapacity", CesiumTokens->cesiumDebugMaterialPoolInitialCapacity);
_AddToken(cls, "cesiumDebugRandomColors", CesiumTokens->cesiumDebugRandomColors);
_AddToken(cls, "cesiumDebugTexturePoolInitialCapacity", CesiumTokens->cesiumDebugTexturePoolInitialCapacity);
_AddToken(cls, "cesiumDisplayName", CesiumTokens->cesiumDisplayName);
_AddToken(cls, "cesiumEast", CesiumTokens->cesiumEast);
_AddToken(cls, "cesiumEcefToUsdTransform", CesiumTokens->cesiumEcefToUsdTransform);
_AddToken(cls, "cesiumEnableFogCulling", CesiumTokens->cesiumEnableFogCulling);
_AddToken(cls, "cesiumEnableFrustumCulling", CesiumTokens->cesiumEnableFrustumCulling);
_AddToken(cls, "cesiumEnforceCulledScreenSpaceError", CesiumTokens->cesiumEnforceCulledScreenSpaceError);
_AddToken(cls, "cesiumExcludeSelectedTiles", CesiumTokens->cesiumExcludeSelectedTiles);
_AddToken(cls, "cesiumForbidHoles", CesiumTokens->cesiumForbidHoles);
_AddToken(cls, "cesiumFormat", CesiumTokens->cesiumFormat);
_AddToken(cls, "cesiumGeoreferenceBinding", CesiumTokens->cesiumGeoreferenceBinding);
_AddToken(cls, "cesiumGeoreferenceOriginHeight", CesiumTokens->cesiumGeoreferenceOriginHeight);
_AddToken(cls, "cesiumGeoreferenceOriginLatitude", CesiumTokens->cesiumGeoreferenceOriginLatitude);
_AddToken(cls, "cesiumGeoreferenceOriginLongitude", CesiumTokens->cesiumGeoreferenceOriginLongitude);
_AddToken(cls, "cesiumInvertSelection", CesiumTokens->cesiumInvertSelection);
_AddToken(cls, "cesiumIonAccessToken", CesiumTokens->cesiumIonAccessToken);
_AddToken(cls, "cesiumIonAssetId", CesiumTokens->cesiumIonAssetId);
_AddToken(cls, "cesiumIonServerApiUrl", CesiumTokens->cesiumIonServerApiUrl);
_AddToken(cls, "cesiumIonServerApplicationId", CesiumTokens->cesiumIonServerApplicationId);
_AddToken(cls, "cesiumIonServerBinding", CesiumTokens->cesiumIonServerBinding);
_AddToken(cls, "cesiumIonServerUrl", CesiumTokens->cesiumIonServerUrl);
_AddToken(cls, "cesiumLayer", CesiumTokens->cesiumLayer);
_AddToken(cls, "cesiumLayers", CesiumTokens->cesiumLayers);
_AddToken(cls, "cesiumLoadingDescendantLimit", CesiumTokens->cesiumLoadingDescendantLimit);
_AddToken(cls, "cesiumMainThreadLoadingTimeLimit", CesiumTokens->cesiumMainThreadLoadingTimeLimit);
_AddToken(cls, "cesiumMaximumCachedBytes", CesiumTokens->cesiumMaximumCachedBytes);
_AddToken(cls, "cesiumMaximumLevel", CesiumTokens->cesiumMaximumLevel);
_AddToken(cls, "cesiumMaximumScreenSpaceError", CesiumTokens->cesiumMaximumScreenSpaceError);
_AddToken(cls, "cesiumMaximumSimultaneousTileLoads", CesiumTokens->cesiumMaximumSimultaneousTileLoads);
_AddToken(cls, "cesiumMaximumTextureSize", CesiumTokens->cesiumMaximumTextureSize);
_AddToken(cls, "cesiumMaximumZoomLevel", CesiumTokens->cesiumMaximumZoomLevel);
_AddToken(cls, "cesiumMinimumLevel", CesiumTokens->cesiumMinimumLevel);
_AddToken(cls, "cesiumMinimumZoomLevel", CesiumTokens->cesiumMinimumZoomLevel);
_AddToken(cls, "cesiumNorth", CesiumTokens->cesiumNorth);
_AddToken(cls, "cesiumOverlayRenderMethod", CesiumTokens->cesiumOverlayRenderMethod);
_AddToken(cls, "cesiumPreloadAncestors", CesiumTokens->cesiumPreloadAncestors);
_AddToken(cls, "cesiumPreloadSiblings", CesiumTokens->cesiumPreloadSiblings);
_AddToken(cls, "cesiumProjectDefaultIonAccessToken", CesiumTokens->cesiumProjectDefaultIonAccessToken);
_AddToken(cls, "cesiumProjectDefaultIonAccessTokenId", CesiumTokens->cesiumProjectDefaultIonAccessTokenId);
_AddToken(cls, "cesiumRasterOverlayBinding", CesiumTokens->cesiumRasterOverlayBinding);
_AddToken(cls, "cesiumRootTilesX", CesiumTokens->cesiumRootTilesX);
_AddToken(cls, "cesiumRootTilesY", CesiumTokens->cesiumRootTilesY);
_AddToken(cls, "cesiumSelectedIonServer", CesiumTokens->cesiumSelectedIonServer);
_AddToken(cls, "cesiumShowCreditsOnScreen", CesiumTokens->cesiumShowCreditsOnScreen);
_AddToken(cls, "cesiumSmoothNormals", CesiumTokens->cesiumSmoothNormals);
_AddToken(cls, "cesiumSourceType", CesiumTokens->cesiumSourceType);
_AddToken(cls, "cesiumSouth", CesiumTokens->cesiumSouth);
_AddToken(cls, "cesiumSpecifyTileMatrixSetLabels", CesiumTokens->cesiumSpecifyTileMatrixSetLabels);
_AddToken(cls, "cesiumSpecifyTilingScheme", CesiumTokens->cesiumSpecifyTilingScheme);
_AddToken(cls, "cesiumSpecifyZoomLevels", CesiumTokens->cesiumSpecifyZoomLevels);
_AddToken(cls, "cesiumStyle", CesiumTokens->cesiumStyle);
_AddToken(cls, "cesiumSubTileCacheBytes", CesiumTokens->cesiumSubTileCacheBytes);
_AddToken(cls, "cesiumSuspendUpdate", CesiumTokens->cesiumSuspendUpdate);
_AddToken(cls, "cesiumTileHeight", CesiumTokens->cesiumTileHeight);
_AddToken(cls, "cesiumTileMatrixSetId", CesiumTokens->cesiumTileMatrixSetId);
_AddToken(cls, "cesiumTileMatrixSetLabelPrefix", CesiumTokens->cesiumTileMatrixSetLabelPrefix);
_AddToken(cls, "cesiumTileMatrixSetLabels", CesiumTokens->cesiumTileMatrixSetLabels);
_AddToken(cls, "cesiumTileWidth", CesiumTokens->cesiumTileWidth);
_AddToken(cls, "cesiumUrl", CesiumTokens->cesiumUrl);
_AddToken(cls, "cesiumUseWebMercatorProjection", CesiumTokens->cesiumUseWebMercatorProjection);
_AddToken(cls, "cesiumWest", CesiumTokens->cesiumWest);
_AddToken(cls, "clip", CesiumTokens->clip);
_AddToken(cls, "ion", CesiumTokens->ion);
_AddToken(cls, "overlay", CesiumTokens->overlay);
_AddToken(cls, "url", CesiumTokens->url);
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/ionServer.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_IONSERVER_H
#define CESIUMUSDSCHEMAS_GENERATED_IONSERVER_H
/// \file CesiumUsdSchemas/ionServer.h
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMIONSERVERPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumIonServer
///
/// Stores metadata related to Cesium ion server connections for tilesets.
///
class CesiumIonServer : public UsdTyped
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumIonServer on UsdPrim \p prim .
/// Equivalent to CesiumIonServer::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumIonServer(const UsdPrim& prim=UsdPrim())
: UsdTyped(prim)
{
}
/// Construct a CesiumIonServer on the prim held by \p schemaObj .
/// Should be preferred over CesiumIonServer(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumIonServer(const UsdSchemaBase& schemaObj)
: UsdTyped(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumIonServer();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumIonServer holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumIonServer(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumIonServer
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumIonServer
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// DISPLAYNAME
// --------------------------------------------------------------------- //
/// The name to display for this server.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:displayName` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetDisplayNameAttr() const;
/// See GetDisplayNameAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateDisplayNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// IONSERVERURL
// --------------------------------------------------------------------- //
/// The base URL for the Cesium ion Server.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:ionServerUrl` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetIonServerUrlAttr() const;
/// See GetIonServerUrlAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateIonServerUrlAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// IONSERVERAPIURL
// --------------------------------------------------------------------- //
/// The base URL for the Cesium ion Server API.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:ionServerApiUrl` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetIonServerApiUrlAttr() const;
/// See GetIonServerApiUrlAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateIonServerApiUrlAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// IONSERVERAPPLICATIONID
// --------------------------------------------------------------------- //
/// The application ID for the Cesium ion Server connection.
///
/// | ||
/// | -- | -- |
/// | Declaration | `int64 cesium:ionServerApplicationId` |
/// | C++ Type | int64_t |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int64 |
CESIUMUSDSCHEMAS_API
UsdAttribute GetIonServerApplicationIdAttr() const;
/// See GetIonServerApplicationIdAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateIonServerApplicationIdAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// PROJECTDEFAULTIONACCESSTOKEN
// --------------------------------------------------------------------- //
/// A string representing the token for accessing Cesium ion assets.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:projectDefaultIonAccessToken = ""` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetProjectDefaultIonAccessTokenAttr() const;
/// See GetProjectDefaultIonAccessTokenAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateProjectDefaultIonAccessTokenAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// PROJECTDEFAULTIONACCESSTOKENID
// --------------------------------------------------------------------- //
/// A string representing the token ID for accessing Cesium ion assets.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:projectDefaultIonAccessTokenId = ""` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetProjectDefaultIonAccessTokenIdAttr() const;
/// See GetProjectDefaultIonAccessTokenIdAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateProjectDefaultIonAccessTokenIdAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapData.cpp | #include ".//data.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateDebugDisableMaterialsAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugDisableMaterialsAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateDebugDisableTexturesAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugDisableTexturesAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateDebugDisableGeometryPoolAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugDisableGeometryPoolAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateDebugDisableMaterialPoolAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugDisableMaterialPoolAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateDebugDisableTexturePoolAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugDisableTexturePoolAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateDebugGeometryPoolInitialCapacityAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugGeometryPoolInitialCapacityAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->UInt64), writeSparsely);
}
static UsdAttribute
_CreateDebugMaterialPoolInitialCapacityAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugMaterialPoolInitialCapacityAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->UInt64), writeSparsely);
}
static UsdAttribute
_CreateDebugTexturePoolInitialCapacityAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugTexturePoolInitialCapacityAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->UInt64), writeSparsely);
}
static UsdAttribute
_CreateDebugRandomColorsAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugRandomColorsAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateDebugDisableGeoreferencingAttr(CesiumData &self,
object defaultVal, bool writeSparsely) {
return self.CreateDebugDisableGeoreferencingAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static std::string
_Repr(const CesiumData &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.Data(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumData()
{
typedef CesiumData This;
class_<This, bases<UsdTyped> >
cls("Data");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("Define", &This::Define, (arg("stage"), arg("path")))
.staticmethod("Define")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetDebugDisableMaterialsAttr",
&This::GetDebugDisableMaterialsAttr)
.def("CreateDebugDisableMaterialsAttr",
&_CreateDebugDisableMaterialsAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugDisableTexturesAttr",
&This::GetDebugDisableTexturesAttr)
.def("CreateDebugDisableTexturesAttr",
&_CreateDebugDisableTexturesAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugDisableGeometryPoolAttr",
&This::GetDebugDisableGeometryPoolAttr)
.def("CreateDebugDisableGeometryPoolAttr",
&_CreateDebugDisableGeometryPoolAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugDisableMaterialPoolAttr",
&This::GetDebugDisableMaterialPoolAttr)
.def("CreateDebugDisableMaterialPoolAttr",
&_CreateDebugDisableMaterialPoolAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugDisableTexturePoolAttr",
&This::GetDebugDisableTexturePoolAttr)
.def("CreateDebugDisableTexturePoolAttr",
&_CreateDebugDisableTexturePoolAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugGeometryPoolInitialCapacityAttr",
&This::GetDebugGeometryPoolInitialCapacityAttr)
.def("CreateDebugGeometryPoolInitialCapacityAttr",
&_CreateDebugGeometryPoolInitialCapacityAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugMaterialPoolInitialCapacityAttr",
&This::GetDebugMaterialPoolInitialCapacityAttr)
.def("CreateDebugMaterialPoolInitialCapacityAttr",
&_CreateDebugMaterialPoolInitialCapacityAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugTexturePoolInitialCapacityAttr",
&This::GetDebugTexturePoolInitialCapacityAttr)
.def("CreateDebugTexturePoolInitialCapacityAttr",
&_CreateDebugTexturePoolInitialCapacityAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugRandomColorsAttr",
&This::GetDebugRandomColorsAttr)
.def("CreateDebugRandomColorsAttr",
&_CreateDebugRandomColorsAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetDebugDisableGeoreferencingAttr",
&This::GetDebugDisableGeoreferencingAttr)
.def("CreateDebugDisableGeoreferencingAttr",
&_CreateDebugDisableGeoreferencingAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetSelectedIonServerRel",
&This::GetSelectedIonServerRel)
.def("CreateSelectedIonServerRel",
&This::CreateSelectedIonServerRel)
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapGeoreference.cpp | #include ".//georeference.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateGeoreferenceOriginLongitudeAttr(CesiumGeoreference &self,
object defaultVal, bool writeSparsely) {
return self.CreateGeoreferenceOriginLongitudeAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateGeoreferenceOriginLatitudeAttr(CesiumGeoreference &self,
object defaultVal, bool writeSparsely) {
return self.CreateGeoreferenceOriginLatitudeAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static UsdAttribute
_CreateGeoreferenceOriginHeightAttr(CesiumGeoreference &self,
object defaultVal, bool writeSparsely) {
return self.CreateGeoreferenceOriginHeightAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Double), writeSparsely);
}
static std::string
_Repr(const CesiumGeoreference &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.Georeference(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumGeoreference()
{
typedef CesiumGeoreference This;
class_<This, bases<UsdTyped> >
cls("Georeference");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("Define", &This::Define, (arg("stage"), arg("path")))
.staticmethod("Define")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetGeoreferenceOriginLongitudeAttr",
&This::GetGeoreferenceOriginLongitudeAttr)
.def("CreateGeoreferenceOriginLongitudeAttr",
&_CreateGeoreferenceOriginLongitudeAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetGeoreferenceOriginLatitudeAttr",
&This::GetGeoreferenceOriginLatitudeAttr)
.def("CreateGeoreferenceOriginLatitudeAttr",
&_CreateGeoreferenceOriginLatitudeAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetGeoreferenceOriginHeightAttr",
&This::GetGeoreferenceOriginHeightAttr)
.def("CreateGeoreferenceOriginHeightAttr",
&_CreateGeoreferenceOriginHeightAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/polygonRasterOverlay.cpp | #include ".//polygonRasterOverlay.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumPolygonRasterOverlay,
TfType::Bases< CesiumRasterOverlay > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumPolygonRasterOverlayPrim")
// to find TfType<CesiumPolygonRasterOverlay>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumPolygonRasterOverlay>("CesiumPolygonRasterOverlayPrim");
}
/* virtual */
CesiumPolygonRasterOverlay::~CesiumPolygonRasterOverlay()
{
}
/* static */
CesiumPolygonRasterOverlay
CesiumPolygonRasterOverlay::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumPolygonRasterOverlay();
}
return CesiumPolygonRasterOverlay(stage->GetPrimAtPath(path));
}
/* static */
CesiumPolygonRasterOverlay
CesiumPolygonRasterOverlay::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumPolygonRasterOverlayPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumPolygonRasterOverlay();
}
return CesiumPolygonRasterOverlay(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumPolygonRasterOverlay::_GetSchemaKind() const
{
return CesiumPolygonRasterOverlay::schemaKind;
}
/* static */
const TfType &
CesiumPolygonRasterOverlay::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumPolygonRasterOverlay>();
return tfType;
}
/* static */
bool
CesiumPolygonRasterOverlay::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumPolygonRasterOverlay::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumPolygonRasterOverlay::GetInvertSelectionAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumInvertSelection);
}
UsdAttribute
CesiumPolygonRasterOverlay::CreateInvertSelectionAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumInvertSelection,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumPolygonRasterOverlay::GetExcludeSelectedTilesAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumExcludeSelectedTiles);
}
UsdAttribute
CesiumPolygonRasterOverlay::CreateExcludeSelectedTilesAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumExcludeSelectedTiles,
SdfValueTypeNames->Bool,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumPolygonRasterOverlay::GetCesiumOverlayRenderMethodAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumOverlayRenderMethod);
}
UsdAttribute
CesiumPolygonRasterOverlay::CreateCesiumOverlayRenderMethodAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumOverlayRenderMethod,
SdfValueTypeNames->Token,
/* custom = */ false,
SdfVariabilityUniform,
defaultValue,
writeSparsely);
}
UsdRelationship
CesiumPolygonRasterOverlay::GetCartographicPolygonBindingRel() const
{
return GetPrim().GetRelationship(CesiumTokens->cesiumCartographicPolygonBinding);
}
UsdRelationship
CesiumPolygonRasterOverlay::CreateCartographicPolygonBindingRel() const
{
return GetPrim().CreateRelationship(CesiumTokens->cesiumCartographicPolygonBinding,
/* custom = */ false);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumPolygonRasterOverlay::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumInvertSelection,
CesiumTokens->cesiumExcludeSelectedTiles,
CesiumTokens->cesiumOverlayRenderMethod,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
CesiumRasterOverlay::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/webMapServiceRasterOverlay.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_WEBMAPSERVICERASTEROVERLAY_H
#define CESIUMUSDSCHEMAS_GENERATED_WEBMAPSERVICERASTEROVERLAY_H
/// \file CesiumUsdSchemas/webMapServiceRasterOverlay.h
#include "pxr/pxr.h"
#include ".//api.h"
#include ".//rasterOverlay.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMWEBMAPSERVICERASTEROVERLAYPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumWebMapServiceRasterOverlay
///
/// Adds a prim for representing a Web Map Service raster overlay.
///
class CesiumWebMapServiceRasterOverlay : public CesiumRasterOverlay
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumWebMapServiceRasterOverlay on UsdPrim \p prim .
/// Equivalent to CesiumWebMapServiceRasterOverlay::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumWebMapServiceRasterOverlay(const UsdPrim& prim=UsdPrim())
: CesiumRasterOverlay(prim)
{
}
/// Construct a CesiumWebMapServiceRasterOverlay on the prim held by \p schemaObj .
/// Should be preferred over CesiumWebMapServiceRasterOverlay(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumWebMapServiceRasterOverlay(const UsdSchemaBase& schemaObj)
: CesiumRasterOverlay(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumWebMapServiceRasterOverlay();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumWebMapServiceRasterOverlay holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumWebMapServiceRasterOverlay(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumWebMapServiceRasterOverlay
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumWebMapServiceRasterOverlay
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// BASEURL
// --------------------------------------------------------------------- //
/// The base url of the Web Map Service (WMS). e.g. https://services.ga.gov.au/gis/services/NM_Culture_and_Infrastructure/MapServer/WMSServer
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:baseUrl = ""` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetBaseUrlAttr() const;
/// See GetBaseUrlAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateBaseUrlAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// LAYERS
// --------------------------------------------------------------------- //
/// Comma-separated layer names to request from the server.
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:layers = "1"` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
UsdAttribute GetLayersAttr() const;
/// See GetLayersAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateLayersAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// TILEWIDTH
// --------------------------------------------------------------------- //
/// Image width
///
/// | ||
/// | -- | -- |
/// | Declaration | `int cesium:tileWidth = 256` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
CESIUMUSDSCHEMAS_API
UsdAttribute GetTileWidthAttr() const;
/// See GetTileWidthAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateTileWidthAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// TILEHEIGHT
// --------------------------------------------------------------------- //
/// Image height
///
/// | ||
/// | -- | -- |
/// | Declaration | `int cesium:tileHeight = 256` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
CESIUMUSDSCHEMAS_API
UsdAttribute GetTileHeightAttr() const;
/// See GetTileHeightAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateTileHeightAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MINIMUMLEVEL
// --------------------------------------------------------------------- //
/// Take care when specifying this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely to result in rendering problems.
///
/// | ||
/// | -- | -- |
/// | Declaration | `int cesium:minimumLevel = 0` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMinimumLevelAttr() const;
/// See GetMinimumLevelAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMinimumLevelAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// --------------------------------------------------------------------- //
// MAXIMUMLEVEL
// --------------------------------------------------------------------- //
/// Maximum zoom level.
///
/// | ||
/// | -- | -- |
/// | Declaration | `int cesium:maximumLevel = 14` |
/// | C++ Type | int |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
CESIUMUSDSCHEMAS_API
UsdAttribute GetMaximumLevelAttr() const;
/// See GetMaximumLevelAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateMaximumLevelAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/tokens.cpp | #include ".//tokens.h"
PXR_NAMESPACE_OPEN_SCOPE
CesiumTokensType::CesiumTokensType() :
cesiumAlpha("cesium:alpha", TfToken::Immortal),
cesiumAnchorAdjustOrientationForGlobeWhenMoving("cesium:anchor:adjustOrientationForGlobeWhenMoving", TfToken::Immortal),
cesiumAnchorDetectTransformChanges("cesium:anchor:detectTransformChanges", TfToken::Immortal),
cesiumAnchorGeoreferenceBinding("cesium:anchor:georeferenceBinding", TfToken::Immortal),
cesiumAnchorHeight("cesium:anchor:height", TfToken::Immortal),
cesiumAnchorLatitude("cesium:anchor:latitude", TfToken::Immortal),
cesiumAnchorLongitude("cesium:anchor:longitude", TfToken::Immortal),
cesiumAnchorPosition("cesium:anchor:position", TfToken::Immortal),
cesiumBaseUrl("cesium:baseUrl", TfToken::Immortal),
cesiumCartographicPolygonBinding("cesium:cartographicPolygonBinding", TfToken::Immortal),
cesiumCulledScreenSpaceError("cesium:culledScreenSpaceError", TfToken::Immortal),
cesiumDebugDisableGeometryPool("cesium:debug:disableGeometryPool", TfToken::Immortal),
cesiumDebugDisableGeoreferencing("cesium:debug:disableGeoreferencing", TfToken::Immortal),
cesiumDebugDisableMaterialPool("cesium:debug:disableMaterialPool", TfToken::Immortal),
cesiumDebugDisableMaterials("cesium:debug:disableMaterials", TfToken::Immortal),
cesiumDebugDisableTexturePool("cesium:debug:disableTexturePool", TfToken::Immortal),
cesiumDebugDisableTextures("cesium:debug:disableTextures", TfToken::Immortal),
cesiumDebugGeometryPoolInitialCapacity("cesium:debug:geometryPoolInitialCapacity", TfToken::Immortal),
cesiumDebugMaterialPoolInitialCapacity("cesium:debug:materialPoolInitialCapacity", TfToken::Immortal),
cesiumDebugRandomColors("cesium:debug:randomColors", TfToken::Immortal),
cesiumDebugTexturePoolInitialCapacity("cesium:debug:texturePoolInitialCapacity", TfToken::Immortal),
cesiumDisplayName("cesium:displayName", TfToken::Immortal),
cesiumEast("cesium:east", TfToken::Immortal),
cesiumEcefToUsdTransform("cesium:ecefToUsdTransform", TfToken::Immortal),
cesiumEnableFogCulling("cesium:enableFogCulling", TfToken::Immortal),
cesiumEnableFrustumCulling("cesium:enableFrustumCulling", TfToken::Immortal),
cesiumEnforceCulledScreenSpaceError("cesium:enforceCulledScreenSpaceError", TfToken::Immortal),
cesiumExcludeSelectedTiles("cesium:excludeSelectedTiles", TfToken::Immortal),
cesiumForbidHoles("cesium:forbidHoles", TfToken::Immortal),
cesiumFormat("cesium:format", TfToken::Immortal),
cesiumGeoreferenceBinding("cesium:georeferenceBinding", TfToken::Immortal),
cesiumGeoreferenceOriginHeight("cesium:georeferenceOrigin:height", TfToken::Immortal),
cesiumGeoreferenceOriginLatitude("cesium:georeferenceOrigin:latitude", TfToken::Immortal),
cesiumGeoreferenceOriginLongitude("cesium:georeferenceOrigin:longitude", TfToken::Immortal),
cesiumInvertSelection("cesium:invertSelection", TfToken::Immortal),
cesiumIonAccessToken("cesium:ionAccessToken", TfToken::Immortal),
cesiumIonAssetId("cesium:ionAssetId", TfToken::Immortal),
cesiumIonServerApiUrl("cesium:ionServerApiUrl", TfToken::Immortal),
cesiumIonServerApplicationId("cesium:ionServerApplicationId", TfToken::Immortal),
cesiumIonServerBinding("cesium:ionServerBinding", TfToken::Immortal),
cesiumIonServerUrl("cesium:ionServerUrl", TfToken::Immortal),
cesiumLayer("cesium:layer", TfToken::Immortal),
cesiumLayers("cesium:layers", TfToken::Immortal),
cesiumLoadingDescendantLimit("cesium:loadingDescendantLimit", TfToken::Immortal),
cesiumMainThreadLoadingTimeLimit("cesium:mainThreadLoadingTimeLimit", TfToken::Immortal),
cesiumMaximumCachedBytes("cesium:maximumCachedBytes", TfToken::Immortal),
cesiumMaximumLevel("cesium:maximumLevel", TfToken::Immortal),
cesiumMaximumScreenSpaceError("cesium:maximumScreenSpaceError", TfToken::Immortal),
cesiumMaximumSimultaneousTileLoads("cesium:maximumSimultaneousTileLoads", TfToken::Immortal),
cesiumMaximumTextureSize("cesium:maximumTextureSize", TfToken::Immortal),
cesiumMaximumZoomLevel("cesium:maximumZoomLevel", TfToken::Immortal),
cesiumMinimumLevel("cesium:minimumLevel", TfToken::Immortal),
cesiumMinimumZoomLevel("cesium:minimumZoomLevel", TfToken::Immortal),
cesiumNorth("cesium:north", TfToken::Immortal),
cesiumOverlayRenderMethod("cesium:overlayRenderMethod", TfToken::Immortal),
cesiumPreloadAncestors("cesium:preloadAncestors", TfToken::Immortal),
cesiumPreloadSiblings("cesium:preloadSiblings", TfToken::Immortal),
cesiumProjectDefaultIonAccessToken("cesium:projectDefaultIonAccessToken", TfToken::Immortal),
cesiumProjectDefaultIonAccessTokenId("cesium:projectDefaultIonAccessTokenId", TfToken::Immortal),
cesiumRasterOverlayBinding("cesium:rasterOverlayBinding", TfToken::Immortal),
cesiumRootTilesX("cesium:rootTilesX", TfToken::Immortal),
cesiumRootTilesY("cesium:rootTilesY", TfToken::Immortal),
cesiumSelectedIonServer("cesium:selectedIonServer", TfToken::Immortal),
cesiumShowCreditsOnScreen("cesium:showCreditsOnScreen", TfToken::Immortal),
cesiumSmoothNormals("cesium:smoothNormals", TfToken::Immortal),
cesiumSourceType("cesium:sourceType", TfToken::Immortal),
cesiumSouth("cesium:south", TfToken::Immortal),
cesiumSpecifyTileMatrixSetLabels("cesium:specifyTileMatrixSetLabels", TfToken::Immortal),
cesiumSpecifyTilingScheme("cesium:specifyTilingScheme", TfToken::Immortal),
cesiumSpecifyZoomLevels("cesium:specifyZoomLevels", TfToken::Immortal),
cesiumStyle("cesium:style", TfToken::Immortal),
cesiumSubTileCacheBytes("cesium:subTileCacheBytes", TfToken::Immortal),
cesiumSuspendUpdate("cesium:suspendUpdate", TfToken::Immortal),
cesiumTileHeight("cesium:tileHeight", TfToken::Immortal),
cesiumTileMatrixSetId("cesium:tileMatrixSetId", TfToken::Immortal),
cesiumTileMatrixSetLabelPrefix("cesium:tileMatrixSetLabelPrefix", TfToken::Immortal),
cesiumTileMatrixSetLabels("cesium:tileMatrixSetLabels", TfToken::Immortal),
cesiumTileWidth("cesium:tileWidth", TfToken::Immortal),
cesiumUrl("cesium:url", TfToken::Immortal),
cesiumUseWebMercatorProjection("cesium:useWebMercatorProjection", TfToken::Immortal),
cesiumWest("cesium:west", TfToken::Immortal),
clip("clip", TfToken::Immortal),
ion("ion", TfToken::Immortal),
overlay("overlay", TfToken::Immortal),
url("url", TfToken::Immortal),
allTokens({
cesiumAlpha,
cesiumAnchorAdjustOrientationForGlobeWhenMoving,
cesiumAnchorDetectTransformChanges,
cesiumAnchorGeoreferenceBinding,
cesiumAnchorHeight,
cesiumAnchorLatitude,
cesiumAnchorLongitude,
cesiumAnchorPosition,
cesiumBaseUrl,
cesiumCartographicPolygonBinding,
cesiumCulledScreenSpaceError,
cesiumDebugDisableGeometryPool,
cesiumDebugDisableGeoreferencing,
cesiumDebugDisableMaterialPool,
cesiumDebugDisableMaterials,
cesiumDebugDisableTexturePool,
cesiumDebugDisableTextures,
cesiumDebugGeometryPoolInitialCapacity,
cesiumDebugMaterialPoolInitialCapacity,
cesiumDebugRandomColors,
cesiumDebugTexturePoolInitialCapacity,
cesiumDisplayName,
cesiumEast,
cesiumEcefToUsdTransform,
cesiumEnableFogCulling,
cesiumEnableFrustumCulling,
cesiumEnforceCulledScreenSpaceError,
cesiumExcludeSelectedTiles,
cesiumForbidHoles,
cesiumFormat,
cesiumGeoreferenceBinding,
cesiumGeoreferenceOriginHeight,
cesiumGeoreferenceOriginLatitude,
cesiumGeoreferenceOriginLongitude,
cesiumInvertSelection,
cesiumIonAccessToken,
cesiumIonAssetId,
cesiumIonServerApiUrl,
cesiumIonServerApplicationId,
cesiumIonServerBinding,
cesiumIonServerUrl,
cesiumLayer,
cesiumLayers,
cesiumLoadingDescendantLimit,
cesiumMainThreadLoadingTimeLimit,
cesiumMaximumCachedBytes,
cesiumMaximumLevel,
cesiumMaximumScreenSpaceError,
cesiumMaximumSimultaneousTileLoads,
cesiumMaximumTextureSize,
cesiumMaximumZoomLevel,
cesiumMinimumLevel,
cesiumMinimumZoomLevel,
cesiumNorth,
cesiumOverlayRenderMethod,
cesiumPreloadAncestors,
cesiumPreloadSiblings,
cesiumProjectDefaultIonAccessToken,
cesiumProjectDefaultIonAccessTokenId,
cesiumRasterOverlayBinding,
cesiumRootTilesX,
cesiumRootTilesY,
cesiumSelectedIonServer,
cesiumShowCreditsOnScreen,
cesiumSmoothNormals,
cesiumSourceType,
cesiumSouth,
cesiumSpecifyTileMatrixSetLabels,
cesiumSpecifyTilingScheme,
cesiumSpecifyZoomLevels,
cesiumStyle,
cesiumSubTileCacheBytes,
cesiumSuspendUpdate,
cesiumTileHeight,
cesiumTileMatrixSetId,
cesiumTileMatrixSetLabelPrefix,
cesiumTileMatrixSetLabels,
cesiumTileWidth,
cesiumUrl,
cesiumUseWebMercatorProjection,
cesiumWest,
clip,
ion,
overlay,
url
})
{
}
TfStaticData<CesiumTokensType> CesiumTokens;
PXR_NAMESPACE_CLOSE_SCOPE
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/session.h | #ifndef CESIUMUSDSCHEMAS_GENERATED_SESSION_H
#define CESIUMUSDSCHEMAS_GENERATED_SESSION_H
/// \file CesiumUsdSchemas/session.h
#include "pxr/pxr.h"
#include ".//api.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/usd/prim.h"
#include "pxr/usd/usd/stage.h"
#include ".//tokens.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/gf/vec3d.h"
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix4d.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"
PXR_NAMESPACE_OPEN_SCOPE
class SdfAssetPath;
// -------------------------------------------------------------------------- //
// CESIUMSESSIONPRIM //
// -------------------------------------------------------------------------- //
/// \class CesiumSession
///
/// Stores session layer state for Cesium for Omniverse/USD.
///
class CesiumSession : public UsdTyped
{
public:
/// Compile time constant representing what kind of schema this class is.
///
/// \sa UsdSchemaKind
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
/// Construct a CesiumSession on UsdPrim \p prim .
/// Equivalent to CesiumSession::Get(prim.GetStage(), prim.GetPath())
/// for a \em valid \p prim, but will not immediately throw an error for
/// an invalid \p prim
explicit CesiumSession(const UsdPrim& prim=UsdPrim())
: UsdTyped(prim)
{
}
/// Construct a CesiumSession on the prim held by \p schemaObj .
/// Should be preferred over CesiumSession(schemaObj.GetPrim()),
/// as it preserves SchemaBase state.
explicit CesiumSession(const UsdSchemaBase& schemaObj)
: UsdTyped(schemaObj)
{
}
/// Destructor.
CESIUMUSDSCHEMAS_API
virtual ~CesiumSession();
/// Return a vector of names of all pre-declared attributes for this schema
/// class and all its ancestor classes. Does not include attributes that
/// may be authored by custom/extended methods of the schemas involved.
CESIUMUSDSCHEMAS_API
static const TfTokenVector &
GetSchemaAttributeNames(bool includeInherited=true);
/// Return a CesiumSession holding the prim adhering to this
/// schema at \p path on \p stage. If no prim exists at \p path on
/// \p stage, or if the prim at that path does not adhere to this schema,
/// return an invalid schema object. This is shorthand for the following:
///
/// \code
/// CesiumSession(stage->GetPrimAtPath(path));
/// \endcode
///
CESIUMUSDSCHEMAS_API
static CesiumSession
Get(const UsdStagePtr &stage, const SdfPath &path);
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
/// is defined (according to UsdPrim::IsDefined()) on this stage.
///
/// If a prim adhering to this schema at \p path is already defined on this
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
/// current EditTarget for any nonexistent, or existing but not \a Defined
/// ancestors.
///
/// The given \a path must be an absolute prim path that does not contain
/// any variant selections.
///
/// If it is impossible to author any of the necessary PrimSpecs, (for
/// example, in case \a path cannot map to the current UsdEditTarget's
/// namespace) issue an error and return an invalid \a UsdPrim.
///
/// Note that this method may return a defined prim whose typeName does not
/// specify this schema class, in case a stronger typeName opinion overrides
/// the opinion at the current EditTarget.
///
CESIUMUSDSCHEMAS_API
static CesiumSession
Define(const UsdStagePtr &stage, const SdfPath &path);
protected:
/// Returns the kind of schema this class belongs to.
///
/// \sa UsdSchemaKind
CESIUMUSDSCHEMAS_API
UsdSchemaKind _GetSchemaKind() const override;
private:
// needs to invoke _GetStaticTfType.
friend class UsdSchemaRegistry;
CESIUMUSDSCHEMAS_API
static const TfType &_GetStaticTfType();
static bool _IsTypedSchema();
// override SchemaBase virtuals.
CESIUMUSDSCHEMAS_API
const TfType &_GetTfType() const override;
public:
// --------------------------------------------------------------------- //
// ECEFTOUSDTRANSFORM
// --------------------------------------------------------------------- //
/// The 4x4 transformation matrix (row major) from global ECEF coordinates to USD stage coordinates based on the georeference origin.
///
/// | ||
/// | -- | -- |
/// | Declaration | `matrix4d cesium:ecefToUsdTransform` |
/// | C++ Type | GfMatrix4d |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Matrix4d |
CESIUMUSDSCHEMAS_API
UsdAttribute GetEcefToUsdTransformAttr() const;
/// See GetEcefToUsdTransformAttr(), and also
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
/// If specified, author \p defaultValue as the attribute's default,
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
/// the default for \p writeSparsely is \c false.
CESIUMUSDSCHEMAS_API
UsdAttribute CreateEcefToUsdTransformAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
public:
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator.
//
// Just remember to:
// - Close the class declaration with };
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
// - Close the include guard with #endif
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/moduleDeps.cpp | #include "pxr/pxr.h"
#include "pxr/base/tf/registryManager.h"
#include "pxr/base/tf/scriptModuleLoader.h"
#include "pxr/base/tf/token.h"
#include <vector>
PXR_NAMESPACE_OPEN_SCOPE
TF_REGISTRY_FUNCTION(TfScriptModuleLoader) {
// List of direct dependencies for this library.
const std::vector<TfToken> reqs = {
TfToken("sdf"),
TfToken("tf"),
TfToken("usd"),
TfToken("vt"),
TfToken("usdGeom"),
};
TfScriptModuleLoader::GetInstance().
RegisterLibrary(TfToken("CesiumUsdSchemas"), TfToken("cesium.usd.plugins.CesiumUsdSchemas"), reqs);
}
PXR_NAMESPACE_CLOSE_SCOPE
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/ionRasterOverlay.cpp | #include ".//ionRasterOverlay.h"
#include "pxr/usd/usd/schemaRegistry.h"
#include "pxr/usd/usd/typed.h"
#include "pxr/usd/sdf/types.h"
#include "pxr/usd/sdf/assetPath.h"
PXR_NAMESPACE_OPEN_SCOPE
// Register the schema with the TfType system.
TF_REGISTRY_FUNCTION(TfType)
{
TfType::Define<CesiumIonRasterOverlay,
TfType::Bases< CesiumRasterOverlay > >();
// Register the usd prim typename as an alias under UsdSchemaBase. This
// enables one to call
// TfType::Find<UsdSchemaBase>().FindDerivedByName("CesiumIonRasterOverlayPrim")
// to find TfType<CesiumIonRasterOverlay>, which is how IsA queries are
// answered.
TfType::AddAlias<UsdSchemaBase, CesiumIonRasterOverlay>("CesiumIonRasterOverlayPrim");
}
/* virtual */
CesiumIonRasterOverlay::~CesiumIonRasterOverlay()
{
}
/* static */
CesiumIonRasterOverlay
CesiumIonRasterOverlay::Get(const UsdStagePtr &stage, const SdfPath &path)
{
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumIonRasterOverlay();
}
return CesiumIonRasterOverlay(stage->GetPrimAtPath(path));
}
/* static */
CesiumIonRasterOverlay
CesiumIonRasterOverlay::Define(
const UsdStagePtr &stage, const SdfPath &path)
{
static TfToken usdPrimTypeName("CesiumIonRasterOverlayPrim");
if (!stage) {
TF_CODING_ERROR("Invalid stage");
return CesiumIonRasterOverlay();
}
return CesiumIonRasterOverlay(
stage->DefinePrim(path, usdPrimTypeName));
}
/* virtual */
UsdSchemaKind CesiumIonRasterOverlay::_GetSchemaKind() const
{
return CesiumIonRasterOverlay::schemaKind;
}
/* static */
const TfType &
CesiumIonRasterOverlay::_GetStaticTfType()
{
static TfType tfType = TfType::Find<CesiumIonRasterOverlay>();
return tfType;
}
/* static */
bool
CesiumIonRasterOverlay::_IsTypedSchema()
{
static bool isTyped = _GetStaticTfType().IsA<UsdTyped>();
return isTyped;
}
/* virtual */
const TfType &
CesiumIonRasterOverlay::_GetTfType() const
{
return _GetStaticTfType();
}
UsdAttribute
CesiumIonRasterOverlay::GetIonAssetIdAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumIonAssetId);
}
UsdAttribute
CesiumIonRasterOverlay::CreateIonAssetIdAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumIonAssetId,
SdfValueTypeNames->Int64,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdAttribute
CesiumIonRasterOverlay::GetIonAccessTokenAttr() const
{
return GetPrim().GetAttribute(CesiumTokens->cesiumIonAccessToken);
}
UsdAttribute
CesiumIonRasterOverlay::CreateIonAccessTokenAttr(VtValue const &defaultValue, bool writeSparsely) const
{
return UsdSchemaBase::_CreateAttr(CesiumTokens->cesiumIonAccessToken,
SdfValueTypeNames->String,
/* custom = */ false,
SdfVariabilityVarying,
defaultValue,
writeSparsely);
}
UsdRelationship
CesiumIonRasterOverlay::GetIonServerBindingRel() const
{
return GetPrim().GetRelationship(CesiumTokens->cesiumIonServerBinding);
}
UsdRelationship
CesiumIonRasterOverlay::CreateIonServerBindingRel() const
{
return GetPrim().CreateRelationship(CesiumTokens->cesiumIonServerBinding,
/* custom = */ false);
}
namespace {
static inline TfTokenVector
_ConcatenateAttributeNames(const TfTokenVector& left,const TfTokenVector& right)
{
TfTokenVector result;
result.reserve(left.size() + right.size());
result.insert(result.end(), left.begin(), left.end());
result.insert(result.end(), right.begin(), right.end());
return result;
}
}
/*static*/
const TfTokenVector&
CesiumIonRasterOverlay::GetSchemaAttributeNames(bool includeInherited)
{
static TfTokenVector localNames = {
CesiumTokens->cesiumIonAssetId,
CesiumTokens->cesiumIonAccessToken,
};
static TfTokenVector allNames =
_ConcatenateAttributeNames(
CesiumRasterOverlay::GetSchemaAttributeNames(true),
localNames);
if (includeInherited)
return allNames;
else
return localNames;
}
PXR_NAMESPACE_CLOSE_SCOPE
// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
|
CesiumGS/cesium-omniverse/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapRasterOverlay.cpp | #include ".//rasterOverlay.h"
#include "pxr/usd/usd/schemaBase.h"
#include "pxr/usd/sdf/primSpec.h"
#include "pxr/usd/usd/pyConversions.h"
#include "pxr/base/tf/pyContainerConversions.h"
#include "pxr/base/tf/pyResultConversions.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/base/tf/wrapTypeHelpers.h"
#include <boost/python.hpp>
#include <string>
using namespace boost::python;
PXR_NAMESPACE_USING_DIRECTIVE
namespace {
#define WRAP_CUSTOM \
template <class Cls> static void _CustomWrapCode(Cls &_class)
// fwd decl.
WRAP_CUSTOM;
static UsdAttribute
_CreateShowCreditsOnScreenAttr(CesiumRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateShowCreditsOnScreenAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Bool), writeSparsely);
}
static UsdAttribute
_CreateAlphaAttr(CesiumRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateAlphaAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Float), writeSparsely);
}
static UsdAttribute
_CreateOverlayRenderMethodAttr(CesiumRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateOverlayRenderMethodAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Token), writeSparsely);
}
static UsdAttribute
_CreateMaximumScreenSpaceErrorAttr(CesiumRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMaximumScreenSpaceErrorAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Float), writeSparsely);
}
static UsdAttribute
_CreateMaximumTextureSizeAttr(CesiumRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMaximumTextureSizeAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateMaximumSimultaneousTileLoadsAttr(CesiumRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateMaximumSimultaneousTileLoadsAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static UsdAttribute
_CreateSubTileCacheBytesAttr(CesiumRasterOverlay &self,
object defaultVal, bool writeSparsely) {
return self.CreateSubTileCacheBytesAttr(
UsdPythonToSdfType(defaultVal, SdfValueTypeNames->Int), writeSparsely);
}
static std::string
_Repr(const CesiumRasterOverlay &self)
{
std::string primRepr = TfPyRepr(self.GetPrim());
return TfStringPrintf(
"CesiumUsdSchemas.RasterOverlay(%s)",
primRepr.c_str());
}
} // anonymous namespace
void wrapCesiumRasterOverlay()
{
typedef CesiumRasterOverlay This;
class_<This, bases<UsdTyped> >
cls("RasterOverlay");
cls
.def(init<UsdPrim>(arg("prim")))
.def(init<UsdSchemaBase const&>(arg("schemaObj")))
.def(TfTypePythonClass())
.def("Get", &This::Get, (arg("stage"), arg("path")))
.staticmethod("Get")
.def("GetSchemaAttributeNames",
&This::GetSchemaAttributeNames,
arg("includeInherited")=true,
return_value_policy<TfPySequenceToList>())
.staticmethod("GetSchemaAttributeNames")
.def("_GetStaticTfType", (TfType const &(*)()) TfType::Find<This>,
return_value_policy<return_by_value>())
.staticmethod("_GetStaticTfType")
.def(!self)
.def("GetShowCreditsOnScreenAttr",
&This::GetShowCreditsOnScreenAttr)
.def("CreateShowCreditsOnScreenAttr",
&_CreateShowCreditsOnScreenAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetAlphaAttr",
&This::GetAlphaAttr)
.def("CreateAlphaAttr",
&_CreateAlphaAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetOverlayRenderMethodAttr",
&This::GetOverlayRenderMethodAttr)
.def("CreateOverlayRenderMethodAttr",
&_CreateOverlayRenderMethodAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMaximumScreenSpaceErrorAttr",
&This::GetMaximumScreenSpaceErrorAttr)
.def("CreateMaximumScreenSpaceErrorAttr",
&_CreateMaximumScreenSpaceErrorAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMaximumTextureSizeAttr",
&This::GetMaximumTextureSizeAttr)
.def("CreateMaximumTextureSizeAttr",
&_CreateMaximumTextureSizeAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetMaximumSimultaneousTileLoadsAttr",
&This::GetMaximumSimultaneousTileLoadsAttr)
.def("CreateMaximumSimultaneousTileLoadsAttr",
&_CreateMaximumSimultaneousTileLoadsAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("GetSubTileCacheBytesAttr",
&This::GetSubTileCacheBytesAttr)
.def("CreateSubTileCacheBytesAttr",
&_CreateSubTileCacheBytesAttr,
(arg("defaultValue")=object(),
arg("writeSparsely")=false))
.def("__repr__", ::_Repr)
;
_CustomWrapCode(cls);
}
// ===================================================================== //
// Feel free to add custom code below this line, it will be preserved by
// the code generator. The entry point for your custom code should look
// minimally like the following:
//
// WRAP_CUSTOM {
// _class
// .def("MyCustomMethod", ...)
// ;
// }
//
// Of course any other ancillary or support code may be provided.
//
// Just remember to wrap code in the appropriate delimiters:
// 'namespace {', '}'.
//
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--
namespace {
WRAP_CUSTOM {
}
}
|
CesiumGS/cesium-omniverse/src/public/CesiumOmniverse.cpp | #define CARB_EXPORTS
#include "cesium/omniverse/CesiumOmniverse.h"
#include "cesium/omniverse/AssetRegistry.h"
#include "cesium/omniverse/CesiumIonServerManager.h"
#include "cesium/omniverse/CesiumIonSession.h"
#include "cesium/omniverse/Context.h"
#include "cesium/omniverse/FabricUtil.h"
#include "cesium/omniverse/OmniData.h"
#include "cesium/omniverse/OmniIonServer.h"
#include "cesium/omniverse/OmniTileset.h"
#include "cesium/omniverse/UsdUtil.h"
#include "cesium/omniverse/Viewport.h"
#include <CesiumGeospatial/Cartographic.h>
#include <CesiumUtility/CreditSystem.h>
#include <carb/PluginUtils.h>
#include <omni/fabric/IFabric.h>
#include <omni/kit/IApp.h>
#include <gsl/span>
namespace cesium::omniverse {
class CesiumOmniversePlugin final : public ICesiumOmniverseInterface {
protected:
void onStartup(const char* cesiumExtensionLocation) noexcept override {
_pContext = std::make_unique<Context>(cesiumExtensionLocation);
}
void onShutdown() noexcept override {
_pContext = nullptr;
}
void reloadTileset(const char* tilesetPath) noexcept override {
const auto pTileset = _pContext->getAssetRegistry().getTileset(pxr::SdfPath(tilesetPath));
if (pTileset) {
pTileset->reload();
}
}
void onUpdateFrame(const ViewportApi* viewports, uint64_t count, bool waitForLoadingTiles) noexcept override {
const auto span = gsl::span<const Viewport>(reinterpret_cast<const Viewport*>(viewports), count);
_pContext->onUpdateFrame(span, waitForLoadingTiles);
}
void onUsdStageChanged(long stageId) noexcept override {
_pContext->onUsdStageChanged(stageId);
}
void connectToIon() noexcept override {
_pContext->getCesiumIonServerManager().connectToIon();
}
std::optional<std::shared_ptr<CesiumIonSession>> getSession() noexcept override {
return _pContext->getCesiumIonServerManager().getCurrentIonSession();
}
std::string getServerPath() noexcept override {
const auto pIonServer = _pContext->getCesiumIonServerManager().getCurrentIonServer();
if (!pIonServer) {
return "";
}
return pIonServer->getPath().GetString();
}
std::vector<std::shared_ptr<CesiumIonSession>> getSessions() noexcept override {
const auto& ionServers = _pContext->getAssetRegistry().getIonServers();
std::vector<std::shared_ptr<CesiumIonSession>> result;
result.reserve(ionServers.size());
for (const auto& pIonServer : ionServers) {
result.push_back(pIonServer->getSession());
}
return result;
}
std::vector<std::string> getServerPaths() noexcept override {
const auto& ionServers = _pContext->getAssetRegistry().getIonServers();
std::vector<std::string> result;
result.reserve(ionServers.size());
for (const auto& pIonServer : ionServers) {
result.push_back(pIonServer->getPath().GetString());
}
return result;
}
SetDefaultTokenResult getSetDefaultTokenResult() noexcept override {
return _pContext->getCesiumIonServerManager().getSetDefaultTokenResult();
}
bool isDefaultTokenSet() noexcept override {
return _pContext->getCesiumIonServerManager().isDefaultTokenSet();
}
void createToken(const char* name) noexcept override {
_pContext->getCesiumIonServerManager().createToken(name);
}
void selectToken(const char* id, const char* token) noexcept override {
CesiumIonClient::Token t{id, "", token};
_pContext->getCesiumIonServerManager().selectToken(t);
}
void specifyToken(const char* token) noexcept override {
_pContext->getCesiumIonServerManager().specifyToken(token);
}
std::optional<AssetTroubleshootingDetails> getAssetTroubleshootingDetails() noexcept override {
return _pContext->getCesiumIonServerManager().getAssetTroubleshootingDetails();
}
std::optional<TokenTroubleshootingDetails> getAssetTokenTroubleshootingDetails() noexcept override {
return _pContext->getCesiumIonServerManager().getAssetTokenTroubleshootingDetails();
}
std::optional<TokenTroubleshootingDetails> getDefaultTokenTroubleshootingDetails() noexcept override {
return _pContext->getCesiumIonServerManager().getDefaultTokenTroubleshootingDetails();
}
void updateTroubleshootingDetails(
const char* tilesetPath,
int64_t tilesetIonAssetId,
uint64_t tokenEventId,
uint64_t assetEventId) noexcept override {
return _pContext->getCesiumIonServerManager().updateTroubleshootingDetails(
pxr::SdfPath(tilesetPath), tilesetIonAssetId, tokenEventId, assetEventId);
}
void updateTroubleshootingDetails(
const char* tilesetPath,
int64_t tilesetIonAssetId,
int64_t rasterOverlayIonAssetId,
uint64_t tokenEventId,
uint64_t assetEventId) noexcept override {
return _pContext->getCesiumIonServerManager().updateTroubleshootingDetails(
pxr::SdfPath(tilesetPath), tilesetIonAssetId, rasterOverlayIonAssetId, tokenEventId, assetEventId);
}
std::string printFabricStage() noexcept override {
return FabricUtil::printFabricStage(_pContext->getFabricStage());
}
RenderStatistics getRenderStatistics() noexcept override {
return _pContext->getRenderStatistics();
}
bool creditsAvailable() noexcept override {
return _pContext->getCreditSystem()->getCreditsToShowThisFrame().size() > 0;
}
std::vector<std::pair<std::string, bool>> getCredits() noexcept override {
const auto& pCreditSystem = _pContext->getCreditSystem();
const auto& credits = pCreditSystem->getCreditsToShowThisFrame();
std::vector<std::pair<std::string, bool>> result;
result.reserve(credits.size());
for (const auto& item : credits) {
const auto showOnScreen = pCreditSystem->shouldBeShownOnScreen(item);
result.emplace_back(pCreditSystem->getHtml(item), showOnScreen);
}
return result;
}
void creditsStartNextFrame() noexcept override {
return _pContext->getCreditSystem()->startNextFrame();
}
bool isTracingEnabled() noexcept override {
#if CESIUM_TRACING_ENABLED
return true;
#else
return false;
#endif
}
void clearAccessorCache() override {
_pContext->clearAccessorCache();
}
private:
std::unique_ptr<Context> _pContext;
};
} // namespace cesium::omniverse
const struct carb::PluginImplDesc pluginImplDesc = {
"cesium.omniverse.plugin",
"Cesium Omniverse Carbonite Plugin.",
"Cesium",
carb::PluginHotReload::eDisabled,
"dev"};
#ifdef CESIUM_OMNI_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
CARB_PLUGIN_IMPL(pluginImplDesc, cesium::omniverse::CesiumOmniversePlugin)
CARB_PLUGIN_IMPL_DEPS(omni::fabric::IFabric, omni::kit::IApp, carb::settings::ISettings)
#ifdef CESIUM_OMNI_CLANG
#pragma clang diagnostic pop
#endif
void fillInterface([[maybe_unused]] cesium::omniverse::CesiumOmniversePlugin& iface) {}
|
CesiumGS/cesium-omniverse/src/public/CMakeLists.txt | include(Macros)
glob_files(SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp")
get_property(ADDITIONAL_LIBRARIES GLOBAL PROPERTY NVIDIA_ADDITIONAL_LIBRARIES_PROPERTY)
# cmake-format: off
setup_lib(
TARGET_NAME
cesium.omniverse.plugin
TYPE
# Carbonite Plugins needs to be shared libraries
SHARED
SOURCES
${SOURCES}
INCLUDE_DIRS
"${PROJECT_SOURCE_DIR}/include"
LIBRARIES
CesiumOmniverseCore
ADDITIONAL_LIBRARIES
# Unfortunately we need this in both cesium.omniverse.plugin and CesiumOmniverseCore because we're bypassing
# CMake's built-in dependency system
"${ADDITIONAL_LIBRARIES}"
CXX_FLAGS
${CESIUM_OMNI_CXX_FLAGS}
CXX_FLAGS_DEBUG
${CESIUM_OMNI_CXX_FLAGS_DEBUG}
CXX_DEFINES
${CESIUM_OMNI_CXX_DEFINES}
CXX_DEFINES_DEBUG
${CESIUM_OMNI_CXX_DEFINES_DEBUG}
)
# cmake-format: on
|
CesiumGS/cesium-omniverse/cmake/InstallHooks.cmake | function(install_git_hooks)
cmake_parse_arguments(
""
""
"PROJECT_ROOT_DIRECTORY;GIT_HOOKS_SOURCE_DIRECTORY"
""
${ARGN})
if(NOT _PROJECT_ROOT_DIRECTORY)
message(FATAL_ERROR "PROJECT_ROOT_DIRECTORY was not specified")
endif()
if(NOT _GIT_HOOKS_SOURCE_DIRECTORY)
message(FATAL_ERROR "GIT_HOOKS_SOURCE_DIRECTORY was not specified")
endif()
get_git_directory(
PROJECT_ROOT_DIRECTORY
${_PROJECT_ROOT_DIRECTORY}
RESULT_GIT_HOOKS_DIRECTORY
GIT_HOOKS_DESTINATION_DIRECTORY)
file(COPY "${_GIT_HOOKS_SOURCE_DIRECTORY}/pre-commit" DESTINATION "${GIT_HOOKS_DESTINATION_DIRECTORY}/")
file(MAKE_DIRECTORY "${GIT_HOOKS_DESTINATION_DIRECTORY}/utils/")
file(COPY "${_GIT_HOOKS_SOURCE_DIRECTORY}/utils/" DESTINATION "${GIT_HOOKS_DESTINATION_DIRECTORY}/utils")
endfunction()
function(uninstall_git_hooks)
cmake_parse_arguments(
""
""
"PROJECT_ROOT_DIRECTORY;"
""
${ARGN})
if(NOT _PROJECT_ROOT_DIRECTORY)
message(FATAL_ERROR "PROJECT_ROOT_DIRECTORY was not specified")
endif()
get_git_directory(
PROJECT_ROOT_DIRECTORY
${_PROJECT_ROOT_DIRECTORY}
RESULT_GIT_HOOKS_DIRECTORY
GIT_HOOKS_DIRECTORY)
file(REMOVE "${GIT_HOOKS_DIRECTORY}/pre-commit")
file(REMOVE_RECURSE "${GIT_HOOKS_DIRECTORY}/utils/")
endfunction()
function(get_git_directory)
cmake_parse_arguments(
""
""
"PROJECT_ROOT_DIRECTORY;RESULT_GIT_HOOKS_DIRECTORY"
""
${ARGN})
if(NOT _PROJECT_ROOT_DIRECTORY)
message(FATAL_ERROR "PROJECT_ROOT_DIRECTORY was not specified")
endif()
if(NOT _RESULT_GIT_HOOKS_DIRECTORY)
message(FATAL_ERROR "RESULT_GIT_HOOKS_DIRECTORY was not specified")
endif()
# Use git rev-parse --git-common-dir to support installing the hooks even if we're in a git worktree
set(GIT_DIR_CMD git rev-parse --git-common-dir)
execute_process(
COMMAND ${GIT_DIR_CMD}
WORKING_DIRECTORY "${_PROJECT_ROOT_DIRECTORY}"
ERROR_VARIABLE GIT_DIR_CMD_ERROR
OUTPUT_VARIABLE GIT_DIRECTORY
RESULT_VARIABLE GIT_DIR_CMD_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
# cmake-format: off
if(GIT_DIR_CMD_RESULT AND NOT GIT_DIR_CMD_RESULT EQUAL 0)
message(FATAL_ERROR "Command ${GIT_DIR_CMD} in directory ${_PROJECT_ROOT_DIRECTORY} returned non-zero result: ${GIT_DIR_CMD_RESULT}\nCommand output:${GIT_DIRECTORY}\nError: ${GIT_DIR_CMD_ERROR}")
endif()
# cmake-format: on
if(NOT IS_ABSOLUTE ${GIT_DIRECTORY})
set(GIT_DIRECTORY "${_PROJECT_ROOT_DIRECTORY}/${GIT_DIRECTORY}")
endif()
set(GIT_HOOKS_DESTINATION_DIRECTORY "${GIT_DIRECTORY}/hooks")
# Normalize paths so they don't end with a trailing slash.
cmake_path(
NATIVE_PATH
GIT_HOOKS_DESTINATION_DIRECTORY
NORMALIZE
GIT_HOOKS_DESTINATION_DIRECTORY_NORMALIZED)
set(${_RESULT_GIT_HOOKS_DIRECTORY}
"${GIT_HOOKS_DESTINATION_DIRECTORY_NORMALIZED}"
PARENT_SCOPE)
endfunction()
|
CesiumGS/cesium-omniverse/cmake/Macros.cmake | # Utility Macros
# Set up a library
function(setup_lib)
cmake_parse_arguments(
""
""
"TARGET_NAME;TYPE"
"SOURCES;INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS;LIBRARIES;ADDITIONAL_LIBRARIES;ADDITIONAL_LINK_DIRECTORIES;DEPENDENCIES;CXX_FLAGS;CXX_FLAGS_DEBUG;CXX_DEFINES;CXX_DEFINES_DEBUG"
${ARGN})
if(_TYPE)
set(TYPE ${_TYPE})
elseif(BUILD_SHARED_LIBS)
set(TYPE SHARED)
else()
set(TYPE STATIC)
endif()
add_library(${_TARGET_NAME} ${TYPE})
if(_DEPENDENCIES)
add_dependencies(${_TARGET_NAME} ${_DEPENDENCIES})
endif()
add_dependencies(${_TARGET_NAME} ${_LIBRARIES})
target_sources(${_TARGET_NAME} PRIVATE ${_SOURCES})
target_include_directories(
${_TARGET_NAME}
PUBLIC ${_INCLUDE_DIRS}
PRIVATE ${_PRIVATE_INCLUDE_DIRS})
target_compile_options(${_TARGET_NAME} PRIVATE ${_CXX_FLAGS} "$<$<CONFIG:DEBUG>:${_CXX_FLAGS_DEBUG}>")
target_compile_definitions(${_TARGET_NAME} PRIVATE ${_CXX_DEFINES} "$<$<CONFIG:DEBUG>:${_CXX_DEFINES_DEBUG}>")
# Eventually we should mark all third party libraries not in the public API as PRIVATE.
# Note that third party libraries in the public API will need to be installed.
target_link_libraries(${_TARGET_NAME} PUBLIC ${_LIBRARIES})
if(CESIUM_OMNI_ENABLE_COVERAGE AND NOT WIN32)
target_link_libraries(${_TARGET_NAME} PUBLIC gcov)
endif()
if(_ADDITIONAL_LINK_DIRECTORIES)
target_link_directories(${_TARGET_NAME} PUBLIC ${_ADDITIONAL_LINK_DIRECTORIES})
endif()
if(WIN32 AND ${TYPE} STREQUAL "SHARED")
add_custom_command(
TARGET ${_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${_TARGET_NAME}> $<TARGET_FILE_DIR:${_TARGET_NAME}>
COMMAND_EXPAND_LISTS)
endif()
if(WIN32 AND _ADDITIONAL_LIBRARIES)
# TARGET_RUNTIME_DLLS only works for IMPORTED targets. In some cases we can't create IMPORTED targets
# because there's no import library (.lib) just a shared library (.dll)
# We need to copy these to the build folder manually
add_custom_command(
TARGET ${_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${_ADDITIONAL_LIBRARIES} $<TARGET_FILE_DIR:${_TARGET_NAME}>
COMMAND_EXPAND_LISTS)
endif()
endfunction(setup_lib)
# Set up a python module
function(setup_python_module)
cmake_parse_arguments(
""
""
"TARGET_NAME;PYTHON_DIR"
"SOURCES;LIBRARIES;DEPENDENCIES;CXX_FLAGS;CXX_FLAGS_DEBUG;CXX_DEFINES;CXX_DEFINES_DEBUG"
${ARGN})
add_library(${_TARGET_NAME} MODULE)
if(_DEPENDENCIES)
add_dependencies(${_TARGET_NAME} ${_DEPENDENCIES})
endif()
add_dependencies(${_TARGET_NAME} ${_LIBRARIES})
target_sources(${_TARGET_NAME} PRIVATE ${_SOURCES})
target_compile_options(${_TARGET_NAME} PRIVATE ${_CXX_FLAGS} "$<$<CONFIG:DEBUG>:${_CXX_FLAGS_DEBUG}>")
target_compile_definitions(${_TARGET_NAME} PRIVATE ${_CXX_DEFINES} "$<$<CONFIG:DEBUG>:${_CXX_DEFINES_DEBUG}>")
target_link_libraries(${_TARGET_NAME} PRIVATE ${_LIBRARIES})
if(CESIUM_OMNI_ENABLE_COVERAGE AND NOT WIN32)
target_link_libraries(${_TARGET_NAME} PRIVATE gcov)
endif()
# Pybind11 module name needs to match the file name so remove any prefix / suffix
set_target_properties(${_TARGET_NAME} PROPERTIES DEBUG_POSTFIX "")
set_target_properties(${_TARGET_NAME} PROPERTIES RELEASE_POSTFIX "")
set_target_properties(${_TARGET_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "")
set_target_properties(${_TARGET_NAME} PROPERTIES MINSIZEREL_POSTFIX "")
if(_PYTHON_DIR)
# Using a specific version of Python
# Since we called find_package already in the root CMakeLists we have
# to unset some variables. These are the variables that pybind11 cares about.
unset(Python3_EXECUTABLE)
unset(Python3_INTERPRETER_ID)
unset(Python3_VERSION)
unset(Python3_INCLUDE_DIRS)
set(Python3_ROOT_DIR "${_PYTHON_DIR}")
find_package(
Python3
COMPONENTS Interpreter
REQUIRED)
endif()
# We only use pybind11 from conan for its cmake helpers
# Note that we don't link pybind11::headers, pybind11::module, or pybind11::embed
# The code below is a simplified version of pybind11_add_module: https://github.com/pybind/pybind11/blob/master/tools/pybind11NewTools.cmake#L174
find_package(pybind11)
pybind11_extension(${_TARGET_NAME})
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
target_link_libraries(${_TARGET_NAME} PRIVATE pybind11::lto)
endif()
if(MSVC)
target_link_libraries(${_TARGET_NAME} PRIVATE pybind11::windows_extras)
endif()
target_link_libraries(${_TARGET_NAME} PRIVATE pybind11::opt_size)
if(WIN32)
add_custom_command(
TARGET ${_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${_TARGET_NAME}> $<TARGET_FILE_DIR:${_TARGET_NAME}>
COMMAND_EXPAND_LISTS)
endif()
endfunction(setup_python_module)
# Set up a USD python library
function(setup_usd_python_lib)
cmake_parse_arguments(
""
""
"TARGET_NAME;PYTHON_DIR;PYTHON_MODULE_NAME;PACKAGE_NAME"
"SOURCES;LIBRARIES;DEPENDENCIES;CXX_FLAGS;CXX_FLAGS_DEBUG;CXX_DEFINES;CXX_DEFINES_DEBUG"
${ARGN})
add_library(${_TARGET_NAME} SHARED)
if(_DEPENDENCIES)
add_dependencies(${_TARGET_NAME} ${_DEPENDENCIES})
endif()
add_dependencies(${_TARGET_NAME} ${_LIBRARIES})
target_sources(${_TARGET_NAME} PRIVATE ${_SOURCES})
target_compile_options(${_TARGET_NAME} PRIVATE ${_CXX_FLAGS} "$<$<CONFIG:DEBUG>:${_CXX_FLAGS_DEBUG}>")
target_compile_definitions(${_TARGET_NAME} PRIVATE ${_CXX_DEFINES} "$<$<CONFIG:DEBUG>:${_CXX_DEFINES_DEBUG}>")
# cmake-format: off
target_compile_definitions(${_TARGET_NAME}
PRIVATE
MFB_PACKAGE_NAME=${_PACKAGE_NAME}
MFB_ALT_PACKAGE_NAME=${_PACKAGE_NAME}
MFB_PACKAGE_MODULE=${_PYTHON_MODULE_NAME})
# cmake-format: on
target_link_libraries(${_TARGET_NAME} PRIVATE ${_LIBRARIES})
if(CESIUM_OMNI_ENABLE_COVERAGE AND NOT WIN32)
target_link_libraries(${_TARGET_NAME} PRIVATE gcov)
endif()
if(WIN32)
set_target_properties(${_TARGET_NAME} PROPERTIES SUFFIX ".pyd")
else()
set_target_properties(${_TARGET_NAME} PROPERTIES SUFFIX ".so")
endif()
set_target_properties(${_TARGET_NAME} PROPERTIES PREFIX "")
if(_PYTHON_DIR)
# Using a specific version of Python
# Since we called find_package already in the root CMakeLists we have
# to unset some variables. These are the variables that pybind11 cares about.
unset(Python3_EXECUTABLE)
unset(Python3_INTERPRETER_ID)
unset(Python3_VERSION)
unset(Python3_INCLUDE_DIRS)
set(Python3_ROOT_DIR "${_PYTHON_DIR}")
find_package(
Python3
COMPONENTS Interpreter
REQUIRED)
endif()
if(WIN32)
add_custom_command(
TARGET ${_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${_TARGET_NAME}> $<TARGET_FILE_DIR:${_TARGET_NAME}>
COMMAND_EXPAND_LISTS)
endif()
endfunction(setup_usd_python_lib)
# set up an application
function(setup_app)
cmake_parse_arguments(
""
""
"TARGET_NAME"
"SOURCES;LIBRARIES;DEPENDENCIES;CXX_FLAGS;CXX_FLAGS_DEBUG;CXX_DEFINES;CXX_DEFINES_DEBUG;LINKER_FLAGS;LINKER_FLAGS_DEBUG"
${ARGN})
add_executable(${_TARGET_NAME})
if(_DEPENDENCIES)
add_dependencies(${_TARGET_NAME} ${_DEPENDENCIES})
endif()
add_dependencies(${_TARGET_NAME} ${_LIBRARIES})
target_sources(${_TARGET_NAME} PRIVATE ${_SOURCES})
target_compile_options(${_TARGET_NAME} PRIVATE ${_CXX_FLAGS} "$<$<CONFIG:DEBUG>:${_CXX_FLAGS_DEBUG}>")
target_compile_definitions(${_TARGET_NAME} PRIVATE ${_CXX_DEFINES} "$<$<CONFIG:DEBUG>:${_CXX_DEFINES_DEBUG}>")
target_link_options(
${_TARGET_NAME}
PRIVATE
${_LINKER_FLAGS}
"$<$<CONFIG:DEBUG>:${_LINKER_FLAGS_DEBUG}>")
target_link_libraries(${_TARGET_NAME} PRIVATE ${_LIBRARIES})
if(WIN32)
add_custom_command(
TARGET ${_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${_TARGET_NAME}> $<TARGET_FILE_DIR:${_TARGET_NAME}>
COMMAND_EXPAND_LISTS)
endif()
endfunction(setup_app)
function(glob_files out_var_name regexes)
set(files "")
foreach(arg ${ARGV})
list(APPEND regexes_only "${arg}")
endforeach()
list(POP_FRONT regexes_only)
file(
GLOB_RECURSE
files
CONFIGURE_DEPENDS
${regexes_only})
set(${ARGV0}
"${files}"
PARENT_SCOPE)
endfunction()
function(add_external_project)
cmake_parse_arguments(
""
""
"PROJECT_NAME;PROJECT_EXTERN_DIRECTORY;EXPECTED_DEBUG_POSTFIX;EXPECTED_RELEASE_POSTFIX;EXPECTED_RELWITHDEBINFO_POSTFIX;EXPECTED_MINSIZEREL_POSTFIX"
"LIBRARIES;OPTIONS"
${ARGN})
include(ExternalProject) # built-in CMake include for ExternalProject_Add
# Expands to ${_EXPECTED_<CONFIG>_POSTFIX} at configuration time (usually 'd' or '')
set(BUILD_TIME_POSTFIX
"\
$<$<CONFIG:Debug>:${_EXPECTED_DEBUG_POSTFIX}>\
$<$<CONFIG:Release>:${_EXPECTED_RELEASE_POSTFIX}>\
$<$<CONFIG:RelWithDebInfo>:${_EXPECTED_RELWITHDEBINFO_POSTFIX}>\
$<$<CONFIG:MinSizeRel>:${_EXPECTED_MINSIZEREL_POSTFIX}>")
set(LIBRARY_OUTPUT_PATHS "")
if(DEFINED _LIBRARIES)
foreach(lib IN LISTS _LIBRARIES)
list(
APPEND
LIBRARY_OUTPUT_PATHS
"${PROJECT_BINARY_DIR}/${_PROJECT_NAME}/${CMAKE_INSTALL_LIBDIR}/$<CONFIG>/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${BUILD_TIME_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endforeach()
endif()
set(PROJECT_INCLUDE_DIR "${PROJECT_BINARY_DIR}/${_PROJECT_NAME}/${CMAKE_INSTALL_INCLUDEDIR}")
# Force include directory to exist
# See https://stackoverflow.com/questions/45516209/cmake-how-to-use-interface-include-directories-with-externalproject
file(MAKE_DIRECTORY ${PROJECT_INCLUDE_DIR})
set(EXTERN_CXX_FLAGS "")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Build with old C++ ABI. See top-level CMakeLists.txt for explanation.
set(EXTERN_CXX_FLAGS ${EXTERN_CXX_FLAGS} "-D_GLIBCXX_USE_CXX11_ABI=0")
endif()
if(MSVC)
# See https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4530?view=msvc-170
set(EXTERN_CXX_FLAGS ${EXTERN_CXX_FLAGS} "/EHsc")
endif()
# Prepend options with -D
list(TRANSFORM _OPTIONS PREPEND -D)
# CMAKE_ARGS doesn't escape ; characters properly so we need to do this hack for list args like CMAKE_CONFIGURATION_TYPES
# See https://public.kitware.com/Bug/view.php?id=16137
# cmake-format: off
string(REPLACE ";" "|" CMAKE_CONFIGURATION_TYPES_ALT_SEP "${CMAKE_CONFIGURATION_TYPES}")
# cmake-format: on
ExternalProject_Add(
${_PROJECT_NAME}-external
SOURCE_DIR "${_PROJECT_EXTERN_DIRECTORY}/${_PROJECT_NAME}"
PREFIX ${_PROJECT_NAME}
BUILD_ALWAYS
1 # Set this to 0 to always skip the external project build step. Be sure to reset to 1 when modifying cesium-native as it's needed there.
LIST_SEPARATOR | # Use the alternate list separator
CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES_ALT_SEP}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/${_PROJECT_NAME}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}/$<CONFIG>
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCMAKE_CXX_FLAGS=${EXTERN_CXX_FLAGS}
${_OPTIONS}
BUILD_BYPRODUCTS ${LIBRARY_OUTPUT_PATHS})
if(NOT DEFINED _LIBRARIES)
# Header only
add_library(
${_PROJECT_NAME}
INTERFACE
IMPORTED
GLOBAL)
target_include_directories(${_PROJECT_NAME} INTERFACE "${PROJECT_INCLUDE_DIR}")
else()
foreach(lib IN LISTS _LIBRARIES)
add_library(
${lib}
STATIC
IMPORTED
GLOBAL)
target_include_directories(${lib} INTERFACE "${PROJECT_INCLUDE_DIR}")
set_target_properties(
${lib}
PROPERTIES
IMPORTED_LOCATION_DEBUG
"${PROJECT_BINARY_DIR}/${_PROJECT_NAME}/${CMAKE_INSTALL_LIBDIR}/Debug/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${_EXPECTED_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LOCATION_RELEASE
"${PROJECT_BINARY_DIR}/${_PROJECT_NAME}/${CMAKE_INSTALL_LIBDIR}/Release/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${_EXPECTED_RELEASE_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LOCATION_RELWITHDEBINFO
"${PROJECT_BINARY_DIR}/${_PROJECT_NAME}/${CMAKE_INSTALL_LIBDIR}/RelWithDebInfo/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${_EXPECTED_RELWITHDEBINFO_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LOCATION_MINSIZEREL
"${PROJECT_BINARY_DIR}/${_PROJECT_NAME}/${CMAKE_INSTALL_LIBDIR}/MinSizeRel/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${_EXPECTED_MINSIZEREL_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endforeach()
endif()
endfunction()
function(add_prebuilt_project)
cmake_parse_arguments(
""
""
"RELEASE_INCLUDE_DIR;DEBUG_INCLUDE_DIR;RELEASE_LIBRARY_DIR;RELEASE_DLL_DIR;DEBUG_LIBRARY_DIR;DEBUG_DLL_DIR"
"RELEASE_LIBRARIES;RELEASE_DLL_LIBRARIES;DEBUG_LIBRARIES;DEBUG_DLL_LIBRARIES;TARGET_NAMES"
${ARGN})
if(NOT DEFINED _RELEASE_DLL_LIBRARIES)
set(_RELEASE_DLL_LIBRARIES ${_RELEASE_LIBRARIES})
endif()
if(NOT DEFINED _DEBUG_DLL_LIBRARIES)
set(_DEBUG_DLL_LIBRARIES ${_DEBUG_LIBRARIES})
endif()
if(NOT DEFINED _RELEASE_DLL_DIR)
set(_RELEASE_DLL_DIR ${_RELEASE_LIBRARY_DIR})
endif()
if(NOT DEFINED _DEBUG_DLL_DIR)
set(_DEBUG_DLL_DIR ${_DEBUG_LIBRARY_DIR})
endif()
foreach(
lib IN
ZIP_LISTS
_TARGET_NAMES
_RELEASE_LIBRARIES
_RELEASE_DLL_LIBRARIES
_DEBUG_LIBRARIES
_DEBUG_DLL_LIBRARIES)
set(TARGET_NAME ${lib_0})
set(RELEASE_NAME ${lib_1})
set(RELEASE_DLL_NAME ${lib_2})
set(DEBUG_NAME ${lib_3})
set(DEBUG_DLL_NAME ${lib_4})
add_library(
${TARGET_NAME}
SHARED
IMPORTED
GLOBAL)
set(TARGET_INCLUDE_DIRECTORY
"\
$<$<CONFIG:Debug>:${_DEBUG_INCLUDE_DIR}>\
$<$<CONFIG:Release>:${_RELEASE_INCLUDE_DIR}>\
$<$<CONFIG:RelWithDebInfo>:${_RELEASE_INCLUDE_DIR}>\
$<$<CONFIG:MinSizeRel>:${_RELEASE_INCLUDE_DIR}>")
target_include_directories(${TARGET_NAME} INTERFACE "${TARGET_INCLUDE_DIRECTORY}")
if(WIN32)
find_library(
${TARGET_NAME}_IMPLIB_RELEASE
NAMES ${RELEASE_NAME}
PATHS ${_RELEASE_LIBRARY_DIR}
NO_DEFAULT_PATH NO_CACHE)
find_library(
${TARGET_NAME}_IMPLIB_DEBUG
NAMES ${DEBUG_NAME}
PATHS ${_DEBUG_LIBRARY_DIR}
NO_DEFAULT_PATH NO_CACHE)
set(${TARGET_NAME}_LIBRARY_RELEASE "${_RELEASE_DLL_DIR}/${RELEASE_DLL_NAME}.dll")
set(${TARGET_NAME}_LIBRARY_DEBUG "${_DEBUG_DLL_DIR}/${DEBUG_DLL_NAME}.dll")
else()
find_library(
${TARGET_NAME}_LIBRARY_RELEASE
NAMES ${RELEASE_NAME}
PATHS ${_RELEASE_LIBRARY_DIR}
NO_DEFAULT_PATH NO_CACHE)
find_library(
${TARGET_NAME}_LIBRARY_DEBUG
NAMES ${DEBUG_NAME}
PATHS ${_DEBUG_LIBRARY_DIR}
NO_DEFAULT_PATH NO_CACHE)
endif()
mark_as_advanced(${TARGET_NAME}_LIBRARY_RELEASE ${TARGET_NAME}_IMPLIB_RELEASE)
mark_as_advanced(${TARGET_NAME}_LIBRARY_DEBUG ${TARGET_NAME}_IMPLIB_DEBUG)
if(WIN32)
set_target_properties(
${TARGET_NAME}
PROPERTIES IMPORTED_IMPLIB_DEBUG "${${TARGET_NAME}_IMPLIB_DEBUG}"
IMPORTED_IMPLIB_RELEASE "${${TARGET_NAME}_IMPLIB_RELEASE}"
IMPORTED_IMPLIB_RELWITHDEBINFO "${${TARGET_NAME}_IMPLIB_RELEASE}"
IMPORTED_IMPLIB_MINSIZEREL "${${TARGET_NAME}_IMPLIB_RELEASE}")
endif()
set_target_properties(
${TARGET_NAME}
PROPERTIES IMPORTED_LOCATION_DEBUG "${${TARGET_NAME}_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${${TARGET_NAME}_LIBRARY_RELEASE}"
IMPORTED_LOCATION_RELWITHDEBINFO "${${TARGET_NAME}_LIBRARY_RELEASE}"
IMPORTED_LOCATION_MINSIZEREL "${${TARGET_NAME}_LIBRARY_RELEASE}")
endforeach()
endfunction()
function(add_prebuilt_project_import_library_only)
cmake_parse_arguments(
""
""
"RELEASE_INCLUDE_DIR;DEBUG_INCLUDE_DIR;RELEASE_LIBRARY_DIR;DEBUG_LIBRARY_DIR"
"RELEASE_LIBRARIES;DEBUG_LIBRARIES;TARGET_NAMES"
${ARGN})
foreach(
lib IN
ZIP_LISTS
_TARGET_NAMES
_RELEASE_LIBRARIES
_DEBUG_LIBRARIES)
set(TARGET_NAME ${lib_0})
set(RELEASE_NAME ${lib_1})
set(DEBUG_NAME ${lib_2})
add_library(
${TARGET_NAME}
STATIC
IMPORTED
GLOBAL)
set(TARGET_INCLUDE_DIRECTORY
"\
$<$<CONFIG:Debug>:${_DEBUG_INCLUDE_DIR}>\
$<$<CONFIG:Release>:${_RELEASE_INCLUDE_DIR}>\
$<$<CONFIG:RelWithDebInfo>:${_RELEASE_INCLUDE_DIR}>\
$<$<CONFIG:MinSizeRel>:${_RELEASE_INCLUDE_DIR}>")
target_include_directories(${TARGET_NAME} INTERFACE "${TARGET_INCLUDE_DIRECTORY}")
find_library(
${TARGET_NAME}_LIBRARY_RELEASE
NAMES ${RELEASE_NAME}
PATHS ${_RELEASE_LIBRARY_DIR}
NO_DEFAULT_PATH NO_CACHE)
find_library(
${TARGET_NAME}_LIBRARY_DEBUG
NAMES ${DEBUG_NAME}
PATHS ${_DEBUG_LIBRARY_DIR}
NO_DEFAULT_PATH NO_CACHE)
set_target_properties(
${TARGET_NAME}
PROPERTIES IMPORTED_LOCATION_DEBUG "${${TARGET_NAME}_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${${TARGET_NAME}_LIBRARY_RELEASE}"
IMPORTED_LOCATION_RELWITHDEBINFO "${${TARGET_NAME}_LIBRARY_RELEASE}"
IMPORTED_LOCATION_MINSIZEREL "${${TARGET_NAME}_LIBRARY_RELEASE}")
endforeach()
endfunction()
function(add_prebuilt_project_header_only)
cmake_parse_arguments(
""
""
"INCLUDE_DIR;TARGET_NAME"
""
${ARGN})
add_library(
${_TARGET_NAME}
INTERFACE
IMPORTED
GLOBAL)
target_include_directories(${_TARGET_NAME} INTERFACE "${_INCLUDE_DIR}")
endfunction()
|
CesiumGS/cesium-omniverse/cmake/ConfigureConan.cmake | # cmake-conan configuration
macro(configure_conan)
cmake_parse_arguments(
""
""
"PROJECT_BUILD_DIRECTORY"
"REQUIRES;OPTIONS"
${ARGN})
if(NOT _PROJECT_BUILD_DIRECTORY)
message(FATAL_ERROR "PROJECT_BUILD_DIRECTORY was not specified")
endif()
if(NOT _REQUIRES)
message(FATAL_ERROR "REQUIRES was not specified")
endif()
if(NOT EXISTS "${_PROJECT_BUILD_DIRECTORY}/conan-0.17.0.cmake")
message(STATUS "Copying Conan 0.17.0 into build folder")
file(COPY "${CMAKE_MODULE_PATH}/conan-0.17.0.cmake" DESTINATION "${_PROJECT_BUILD_DIRECTORY}")
endif()
include("${_PROJECT_BUILD_DIRECTORY}/conan-0.17.0.cmake")
# Execute conan config init to ensure ~/.conan/settings.yml exists
find_program(CONAN_CMD_PATH conan)
if(NOT CONAN_CMD_PATH)
message(FATAL_ERROR "Could not find conan in system path!")
endif()
execute_process(COMMAND "${CONAN_CMD_PATH}" config init)
# Find the location of the .conan directory.
execute_process(
COMMAND "${CONAN_CMD_PATH}" config home
OUTPUT_VARIABLE CONAN_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Conan doesn't support marking a dependency as "always build if not cached" directly.
# You're allowed to mark a dependency as "always build" (which ignores the cache on rebuilds) or build if "missing".
# Build if missing means that Conan will only build the package if and only if your local settings are incompatible
# with the binary version of the package at https://conan.io/center/
#
# You can force incompatible settings by using custom settings, but these settings have to be present in your ~/.conan/settings.yml
# or Conan will throw an error about an unrecognized option. This is an (ugly) workaround that injects a os.distro="BuildFromSource"
# option in that file so that we can trigger package incompatibility intentionally and avoid downloading binary packages.
#
# See the following links for details:
# https://docs.conan.io/en/latest/extending/custom_settings.html?highlight=glibc#adding-new-settings
# https://github.com/conan-io/conan/issues/2749
# https://github.com/conan-io/conan/issues/1692
# https://github.com/conan-io/conan/issues/7117
if(WIN32)
set(CONAN_OS_NAME "Windows")
elseif(APPLE)
set(CONAN_OS_NAME "Macos")
elseif(UNIX)
set(CONAN_OS_NAME "Linux")
endif()
set(CONAN_SETTINGS_FILE "${CONAN_DIRECTORY}/settings.yml")
set(ADD_DISTRO "${CONAN_OS_NAME}:\n distro: [None, \"BuildFromSource\"]")
file(READ "${CONAN_SETTINGS_FILE}" settings_text)
string(FIND ${settings_text} "${ADD_DISTRO}" position)
if(position EQUAL "-1")
string(
REPLACE "${CONAN_OS_NAME}:"
${ADD_DISTRO}
new_settings_text
${settings_text})
file(WRITE "${CONAN_SETTINGS_FILE}" "${new_settings_text}")
endif()
# Add "revisions_enabled = 1" to ~/.conan/conan.conf
# This is needed in order for the Dependency Graph build target to work
set(CONAN_CONF_FILE "${CONAN_DIRECTORY}/conan.conf")
set(ADD_REVISIONS_ENABLED "[general]\nrevisions_enabled = 1")
file(READ "${CONAN_CONF_FILE}" conf_text)
string(FIND ${conf_text} "${ADD_REVISIONS_ENABLED}" position)
if(position EQUAL "-1")
string(
REPLACE "[general]"
${ADD_REVISIONS_ENABLED}
new_conf_text
${conf_text})
file(WRITE "${CONAN_CONF_FILE}" "${new_conf_text}")
endif()
conan_cmake_configure(
REQUIRES
${_REQUIRES}
OPTIONS
${_OPTIONS}
GENERATORS
cmake_find_package_multi)
# CMAKE_CONFIGURATION_TYPES will not be defined with single configuration
# generators, so populate with CMAKE_BUILD_TYPE as a fallback.
# CMAKE_BUILD type is always defined in the root CMakeLists.txt
set(CONAN_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}")
if(NOT CONAN_CONFIGURATION_TYPES)
set(CONAN_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
endif()
set(CONAN_PACKAGE_INSTALL_FOLDER "${_PROJECT_BUILD_DIRECTORY}/Conan_Packages")
list(APPEND CMAKE_MODULE_PATH ${CONAN_PACKAGE_INSTALL_FOLDER})
list(APPEND CMAKE_PREFIX_PATH ${CONAN_PACKAGE_INSTALL_FOLDER})
foreach(type ${CONAN_CONFIGURATION_TYPES})
conan_cmake_autodetect(settings BUILD_TYPE ${type})
list(APPEND settings "os.distro=BuildFromSource")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Build with old C++ ABI. See top-level CMakeLists.txt for explanation.
# See https://docs.conan.io/en/latest/howtos/manage_gcc_abi.html
list(APPEND settings "compiler.libcxx=libstdc++")
endif()
conan_cmake_install(
PATH_OR_REFERENCE
${_PROJECT_BUILD_DIRECTORY}
BUILD
missing
INSTALL_FOLDER
${CONAN_PACKAGE_INSTALL_FOLDER}
REMOTE
conancenter
SETTINGS
${settings}
UPDATE)
endforeach()
# Hide CONAN_CMD from the CMake GUI
mark_as_advanced(CONAN_CMD)
endmacro()
|
CesiumGS/cesium-omniverse/cmake/Linters.cmake | include(CompilerToolFinder)
# Additional steps to perform clang-format and clang-tidy
function(setup_linters)
cmake_parse_arguments(
""
""
"PROJECT_SCRIPTS_DIRECTORY;PROJECT_BUILD_DIRECTORY;ENABLE_LINTERS_ON_BUILD"
"PROJECT_SOURCE_DIRECTORIES"
${ARGN})
if(NOT _PROJECT_SCRIPTS_DIRECTORY)
message(FATAL_ERROR "PROJECT_SCRIPTS_DIRECTORY was not specified")
endif()
if(NOT _PROJECT_BUILD_DIRECTORY)
message(FATAL_ERROR "PROJECT_BUILD_DIRECTORY was not specified")
endif()
if(NOT DEFINED _ENABLE_LINTERS_ON_BUILD)
message(FATAL_ERROR "ENABLE_LINTERS_ON_BUILD was not specified")
endif()
if(NOT _PROJECT_SOURCE_DIRECTORIES)
message(FATAL_ERROR "PROJECT_SOURCE_DIRECTORIES was not specified")
endif()
# Add clang-format
get_compiler_tool_with_correct_version(
TOOL_NAME
"clang-format"
TOOLCHAIN_NAME
"Clang"
RESULT_TOOL_PATH
CLANG_FORMAT_PATH)
if(NOT CLANG_FORMAT_PATH)
message(FATAL_ERROR "Could not find clang-format in your path.")
endif()
add_custom_target(
clang-format-check-all
COMMAND "${Python3_EXECUTABLE}" "${_PROJECT_SCRIPTS_DIRECTORY}/clang_format.py" --check --all
--clang-format-executable "${CLANG_FORMAT_PATH}" --source-directories ${_PROJECT_SOURCE_DIRECTORIES})
add_custom_target(
clang-format-fix-all
COMMAND "${Python3_EXECUTABLE}" "${_PROJECT_SCRIPTS_DIRECTORY}/clang_format.py" --fix --all
--clang-format-executable "${CLANG_FORMAT_PATH}" --source-directories ${_PROJECT_SOURCE_DIRECTORIES})
add_custom_target(
clang-format-check-staged
COMMAND "${Python3_EXECUTABLE}" "${_PROJECT_SCRIPTS_DIRECTORY}/clang_format.py" --check --staged
--clang-format-executable "${CLANG_FORMAT_PATH}" --source-directories ${_PROJECT_SOURCE_DIRECTORIES})
add_custom_target(
clang-format-fix-staged
COMMAND "${Python3_EXECUTABLE}" "${_PROJECT_SCRIPTS_DIRECTORY}/clang_format.py" --fix --staged
--clang-format-executable "${CLANG_FORMAT_PATH}" --source-directories ${_PROJECT_SOURCE_DIRECTORIES})
# Add clang-tidy
# our clang-tidy options are located in `.clang-tidy` in the root folder
# when clang-tidy runs it will look for this file
get_compiler_tool_with_correct_version(
TOOL_NAME
"clang-tidy"
TOOLCHAIN_NAME
"Clang"
RESULT_TOOL_PATH
CLANG_TIDY_PATH)
if(NOT CLANG_TIDY_PATH)
message(FATAL_ERROR "Could not find clang-tidy in your path.")
endif()
# CMake has built-in support for running clang-tidy during the build
if(_ENABLE_LINTERS_ON_BUILD)
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_PATH})
set(CMAKE_CXX_CLANG_TIDY
${CMAKE_CXX_CLANG_TIDY}
PARENT_SCOPE)
endif()
add_custom_target(
clang-tidy-staged
COMMAND "${Python3_EXECUTABLE}" "${_PROJECT_SCRIPTS_DIRECTORY}/clang_tidy.py" --clang-tidy-executable
"${CLANG_TIDY_PATH}" -p "${_PROJECT_BUILD_DIRECTORY}" # path that contains a compile_commands.json
)
# Generate a CMake target that runs clang-tidy by itself
# `run-clang-tidy` is a python script that comes with llvm that runs clang-tidy in parallel over a compile_commands.json
# See: https://clang.llvm.org/extra/doxygen/run-clang-tidy_8py_source.html
get_compiler_tool_with_correct_version(
TOOL_NAME
"run-clang-tidy"
TOOLCHAIN_NAME
"Clang"
RESULT_TOOL_PATH
CLANG_TIDY_RUNNER_PATH)
set(SOURCE_EXTENSIONS
"*.cpp"
"*.h"
"*.cxx"
"*.hxx"
"*.hpp"
"*.cc"
"*.inl")
foreach(source_directory ${_PROJECT_SOURCE_DIRECTORIES})
foreach(source_extension ${SOURCE_EXTENSIONS})
file(GLOB_RECURSE source_directory_files ${source_directory}/${source_extension})
list(APPEND all_source_files ${source_directory_files})
endforeach()
endforeach()
if(CLANG_TIDY_RUNNER_PATH)
add_custom_target(
clang-tidy
COMMAND
${Python3_EXECUTABLE} ${CLANG_TIDY_RUNNER_PATH} -clang-tidy-binary ${CLANG_TIDY_PATH} -p
${_PROJECT_BUILD_DIRECTORY} # path that contains a compile_commands.json
${all_source_files})
add_custom_target(
clang-tidy-fix
COMMAND
${Python3_EXECUTABLE} ${CLANG_TIDY_RUNNER_PATH} -fix -clang-tidy-binary ${CLANG_TIDY_PATH} -p
${_PROJECT_BUILD_DIRECTORY} # path that contains a compile_commands.json
${all_source_files})
else()
# run-clang-tidy was not found, so call clang-tidy directly.
# this takes a lot longer because it's not parallelized.
add_custom_target(
clang-tidy
COMMAND ${CLANG_TIDY_PATH} -p ${_PROJECT_BUILD_DIRECTORY} # path that contains a compile_commands.json
${all_source_files})
add_custom_target(
clang-tidy-fix
COMMAND
${CLANG_TIDY_PATH} --fix -p ${_PROJECT_BUILD_DIRECTORY} # path that contains a compile_commands.json
${all_source_files})
endif()
endfunction()
|
CesiumGS/cesium-omniverse/cmake/CompilerToolFinder.cmake | # Utility function for getting the path of a compiler tool
function(get_compiler_tool_with_correct_version)
cmake_parse_arguments(
""
""
"TOOL_NAME;TOOLCHAIN_NAME;RESULT_TOOL_PATH"
""
${ARGN})
if(NOT _TOOL_NAME)
message(FATAL_ERROR "TOOL_NAME was not specified")
endif()
if(NOT _TOOLCHAIN_NAME)
message(FATAL_ERROR "TOOLCHAIN_NAME was not specified")
endif()
if(NOT _RESULT_TOOL_PATH)
message(FATAL_ERROR "RESULT_TOOL_PATH was not specified")
endif()
set(search_name_without_version "${_TOOL_NAME}")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "${_TOOLCHAIN_NAME}")
# Check if this tool is available with the same version as the compiler
set(semver_regex "^([0-9]+)")
# cmake-format: off
string(REGEX MATCH ${semver_regex} _ "${CMAKE_CXX_COMPILER_VERSION}")
# cmake-format: on
set(compiler_major_version "${CMAKE_MATCH_1}")
set(search_name_with_version "${search_name_without_version}-${compiler_major_version}")
find_program(search_path "${search_name_with_version}" NO_CACHE)
if(NOT search_path)
find_program(search_path "${search_name_without_version}" NO_CACHE)
endif()
else()
# The tool isn't part of the active compiler, so just use the
# default tool name instead of guessing a version number.
find_program(search_path "${search_name_without_version}" NO_CACHE)
endif()
set(${_RESULT_TOOL_PATH}
"${search_path}"
PARENT_SCOPE)
endfunction()
|
CesiumGS/cesium-omniverse/cmake/conan-0.17.0.cmake | # The MIT License (MIT)
# Copyright (c) 2018 JFrog
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This file comes from: https://github.com/conan-io/cmake-conan. Please refer
# to this repository for issues and documentation.
# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called.
# It will take CMake current settings (os, compiler, compiler version, architecture)
# and translate them to conan settings for installing and retrieving dependencies.
# It is intended to facilitate developers building projects that have conan dependencies,
# but it is only necessary on the end-user side. It is not necessary to create conan
# packages, in fact it shouldn't be use for that. Check the project documentation.
# version: 0.17.0
include(CMakeParseArguments)
function(_get_msvc_ide_version result)
set(${result} "" PARENT_SCOPE)
if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
set(${result} 8 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
set(${result} 9 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
set(${result} 10 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
set(${result} 11 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
set(${result} 12 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910)
set(${result} 14 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920)
set(${result} 15 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930)
set(${result} 16 PARENT_SCOPE)
elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940)
set(${result} 17 PARENT_SCOPE)
else()
message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]")
endif()
endfunction()
macro(_conan_detect_build_type)
conan_parse_arguments(${ARGV})
if(ARGUMENTS_BUILD_TYPE)
set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE})
elseif(CMAKE_BUILD_TYPE)
set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE})
else()
message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
endif()
string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER)
if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG")
set(_CONAN_SETTING_BUILD_TYPE "Debug")
elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE")
set(_CONAN_SETTING_BUILD_TYPE "Release")
elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO")
set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo")
elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL")
set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel")
endif()
endmacro()
macro(_conan_check_system_name)
#handle -s os setting
if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
#use default conan os setting if CMAKE_SYSTEM_NAME is not defined
set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(CONAN_SYSTEM_NAME Macos)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX")
set(CONAN_SYSTEM_NAME Neutrino)
endif()
set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino)
list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index)
if (${_index} GREATER -1)
#check if the cmake system is a conan supported one
set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME})
else()
message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}")
endif()
endif()
endmacro()
macro(_conan_check_language)
get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
if (";${_languages};" MATCHES ";CXX;")
set(LANGUAGE CXX)
set(USING_CXX 1)
elseif (";${_languages};" MATCHES ";C;")
set(LANGUAGE C)
set(USING_CXX 0)
else ()
message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.")
endif()
endmacro()
macro(_conan_detect_compiler)
conan_parse_arguments(${ARGV})
if(ARGUMENTS_ARCH)
set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH})
endif()
if(USING_CXX)
set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD})
endif()
if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
# using GCC
# TODO: Handle other params
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
set(COMPILER_VERSION ${MAJOR}.${MINOR})
if(${MAJOR} GREATER 4)
set(COMPILER_VERSION ${MAJOR})
endif()
set(_CONAN_SETTING_COMPILER gcc)
set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
if (USING_CXX)
conan_cmake_detect_unix_libcxx(_LIBCXX)
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
endif ()
elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel)
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
set(COMPILER_VERSION ${MAJOR}.${MINOR})
set(_CONAN_SETTING_COMPILER intel)
set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
if (USING_CXX)
conan_cmake_detect_unix_libcxx(_LIBCXX)
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
endif ()
elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang)
# using AppleClang
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
set(_CONAN_SETTING_COMPILER apple-clang)
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
if (USING_CXX)
conan_cmake_detect_unix_libcxx(_LIBCXX)
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
endif ()
elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang)
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
set(_CONAN_SETTING_COMPILER clang)
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
if(APPLE)
cmake_policy(GET CMP0025 APPLE_CLANG_POLICY)
if(NOT APPLE_CLANG_POLICY STREQUAL NEW)
message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it")
set(_CONAN_SETTING_COMPILER apple-clang)
endif()
endif()
if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7)
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR})
endif()
if (USING_CXX)
conan_cmake_detect_unix_libcxx(_LIBCXX)
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
endif ()
elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC)
set(_VISUAL "Visual Studio")
_get_msvc_ide_version(_VISUAL_VERSION)
if("${_VISUAL_VERSION}" STREQUAL "")
message(FATAL_ERROR "Conan: Visual Studio not recognized")
else()
set(_CONAN_SETTING_COMPILER ${_VISUAL})
set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION})
endif()
if(NOT _CONAN_SETTING_ARCH)
if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64")
set(_CONAN_SETTING_ARCH x86_64)
elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM")
message(STATUS "Conan: Using default ARM architecture from MSVC")
set(_CONAN_SETTING_ARCH armv6)
elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86")
set(_CONAN_SETTING_ARCH x86)
else ()
message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]")
endif()
endif()
conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV})
message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}")
set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime})
if (CMAKE_GENERATOR_TOOLSET)
set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja"))
set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
endif()
else()
message(FATAL_ERROR "Conan: compiler setup not recognized")
endif()
endmacro()
function(conan_cmake_settings result)
#message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER})
#message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID})
#message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION})
#message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS})
#message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE})
#message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE})
#message(STATUS "GENERATOR " ${CMAKE_GENERATOR})
#message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64})
message(STATUS "Conan: Automatic detection of conan settings from cmake")
conan_parse_arguments(${ARGV})
_conan_detect_build_type(${ARGV})
_conan_check_system_name()
_conan_check_language()
_conan_detect_compiler(${ARGV})
# If profile is defined it is used
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE)
set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE})
elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE)
set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE})
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE)
set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE})
elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE)
set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE})
elseif(ARGUMENTS_PROFILE)
set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE})
endif()
foreach(ARG ${_APPLIED_PROFILES})
set(_SETTINGS ${_SETTINGS} -pr=${ARG})
endforeach()
foreach(ARG ${ARGUMENTS_PROFILE_BUILD})
conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET)
set(_SETTINGS ${_SETTINGS} -pr:b=${ARG})
endforeach()
if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL")
set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version
compiler.runtime compiler.libcxx compiler.toolset)
endif()
# remove any manually specified settings from the autodetected settings
foreach(ARG ${ARGUMENTS_SETTINGS})
string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}")
message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.")
list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}")
endforeach()
# Automatic from CMake
foreach(ARG ${ARGUMENTS_PROFILE_AUTO})
string(TOUPPER ${ARG} _arg_name)
string(REPLACE "." "_" _arg_name ${_arg_name})
if(_CONAN_SETTING_${_arg_name})
set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}})
endif()
endforeach()
foreach(ARG ${ARGUMENTS_SETTINGS})
set(_SETTINGS ${_SETTINGS} -s ${ARG})
endforeach()
message(STATUS "Conan: Settings= ${_SETTINGS}")
set(${result} ${_SETTINGS} PARENT_SCOPE)
endfunction()
function(conan_cmake_detect_unix_libcxx result)
# Take into account any -stdlib in compile options
get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS)
string(GENEX_STRIP "${compile_options}" compile_options)
# Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions
get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
string(GENEX_STRIP "${defines}" defines)
foreach(define ${defines})
if(define MATCHES "_GLIBCXX_USE_CXX11_ABI")
if(define MATCHES "^-D")
set(compile_options ${compile_options} "${define}")
else()
set(compile_options ${compile_options} "-D${define}")
endif()
endif()
endforeach()
# add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable
set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER})
if(CMAKE_CXX_COMPILER_ARG1)
# CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz"
# without this, ccache, winegcc, or other wrappers might lose all their arguments
separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1})
list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1})
endif()
if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET)
# without --target= we may be calling the wrong underlying GCC
list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}")
endif()
if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
endif()
if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT)
# without --sysroot= we may find the wrong #include <string>
if(CMAKE_SYSROOT_COMPILE)
list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}")
elseif(CMAKE_SYSROOT)
list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}")
endif()
endif()
separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS})
if(CMAKE_OSX_SYSROOT)
set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "#include <string>"
COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM -
OUTPUT_VARIABLE string_defines
)
if(string_defines MATCHES "#define __GLIBCXX__")
# Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake
if(DEFINED _GLIBCXX_USE_CXX11_ABI)
if(_GLIBCXX_USE_CXX11_ABI)
set(${result} libstdc++11 PARENT_SCOPE)
return()
else()
set(${result} libstdc++ PARENT_SCOPE)
return()
endif()
endif()
if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n")
set(${result} libstdc++11 PARENT_SCOPE)
else()
# Either the compiler is missing the define because it is old, and so
# it can't use the new abi, or the compiler was configured to use the
# old abi by the user or distro (e.g. devtoolset on RHEL/AlmaLinux)
set(${result} libstdc++ PARENT_SCOPE)
endif()
else()
set(${result} libc++ PARENT_SCOPE)
endif()
endfunction()
function(conan_cmake_detect_vs_runtime result)
conan_parse_arguments(${ARGV})
if(ARGUMENTS_BUILD_TYPE)
set(build_type "${ARGUMENTS_BUILD_TYPE}")
elseif(CMAKE_BUILD_TYPE)
set(build_type "${CMAKE_BUILD_TYPE}")
else()
message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
endif()
if(build_type)
string(TOUPPER "${build_type}" build_type)
endif()
set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
foreach(variable ${variables})
if(NOT "${${variable}}" STREQUAL "")
string(REPLACE " " ";" flags "${${variable}}")
foreach (flag ${flags})
if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd")
string(SUBSTRING "${flag}" 1 -1 runtime)
set(${result} "${runtime}" PARENT_SCOPE)
return()
endif()
endforeach()
endif()
endforeach()
if("${build_type}" STREQUAL "DEBUG")
set(${result} "MDd" PARENT_SCOPE)
else()
set(${result} "MD" PARENT_SCOPE)
endif()
endfunction()
function(_collect_settings result)
set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version
compiler.runtime compiler.libcxx compiler.toolset
compiler.cppstd)
foreach(ARG ${ARGUMENTS_PROFILE_AUTO})
string(TOUPPER ${ARG} _arg_name)
string(REPLACE "." "_" _arg_name ${_arg_name})
if(_CONAN_SETTING_${_arg_name})
set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}})
endif()
endforeach()
set(${result} ${detected_setings} PARENT_SCOPE)
endfunction()
function(conan_cmake_autodetect detected_settings)
_conan_detect_build_type(${ARGV})
_conan_check_system_name()
_conan_check_language()
_conan_detect_compiler(${ARGV})
_collect_settings(collected_settings)
set(${detected_settings} ${collected_settings} PARENT_SCOPE)
endfunction()
macro(conan_parse_arguments)
set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD)
set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND)
set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE
PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO
INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES)
cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
endmacro()
function(old_conan_cmake_install)
# Calls "conan install"
# Argument BUILD is equivalant to --build={missing, PkgName,...} or
# --build when argument is 'BUILD all' (which builds all packages from source)
# Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source
# cmake does not identify conan as command, even if it is +x and it is in the path
conan_parse_arguments(${ARGV})
if(CONAN_CMAKE_MULTI)
set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi)
else()
set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake)
endif()
set(CONAN_BUILD_POLICY "")
foreach(ARG ${ARGUMENTS_BUILD})
if(${ARG} STREQUAL "all")
set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build)
break()
else()
set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG})
endif()
endforeach()
if(ARGUMENTS_CONAN_COMMAND)
set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND})
else()
conan_check(REQUIRED)
endif()
set(CONAN_OPTIONS "")
if(ARGUMENTS_CONANFILE)
if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE})
set(CONANFILE ${ARGUMENTS_CONANFILE})
else()
set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})
endif()
else()
set(CONANFILE ".")
endif()
foreach(ARG ${ARGUMENTS_OPTIONS})
set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG})
endforeach()
if(ARGUMENTS_UPDATE)
set(CONAN_INSTALL_UPDATE --update)
endif()
if(ARGUMENTS_NO_IMPORTS)
set(CONAN_INSTALL_NO_IMPORTS --no-imports)
endif()
set(CONAN_INSTALL_FOLDER "")
if(ARGUMENTS_INSTALL_FOLDER)
set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER})
endif()
foreach(ARG ${ARGUMENTS_GENERATORS})
set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG})
endforeach()
foreach(ARG ${ARGUMENTS_ENV})
set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG})
endforeach()
set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS})
string (REPLACE ";" " " _conan_args "${conan_args}")
message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}")
if(ARGUMENTS_OUTPUT_QUIET)
execute_process(COMMAND ${CONAN_CMD} ${conan_args}
RESULT_VARIABLE return_code
OUTPUT_VARIABLE conan_output
ERROR_VARIABLE conan_output
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
else()
execute_process(COMMAND ${CONAN_CMD} ${conan_args}
RESULT_VARIABLE return_code
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
if(NOT "${return_code}" STREQUAL "0")
message(FATAL_ERROR "Conan install failed='${return_code}'")
endif()
endfunction()
function(conan_cmake_install)
if(DEFINED CONAN_COMMAND)
set(CONAN_CMD ${CONAN_COMMAND})
else()
conan_check(REQUIRED)
endif()
set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET)
set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER)
set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE
PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD)
cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN})
foreach(arg ${installOptions})
if(ARGS_${arg})
set(${arg} ${${arg}} ${ARGS_${arg}})
endif()
endforeach()
foreach(arg ${installOneValueArgs})
if(DEFINED ARGS_${arg})
if("${arg}" STREQUAL "REMOTE")
set(flag "--remote")
elseif("${arg}" STREQUAL "LOCKFILE")
set(flag "--lockfile")
elseif("${arg}" STREQUAL "LOCKFILE_OUT")
set(flag "--lockfile-out")
elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID")
set(flag "--lockfile-node-id")
elseif("${arg}" STREQUAL "INSTALL_FOLDER")
set(flag "--install-folder")
endif()
set(${arg} ${${arg}} ${flag} ${ARGS_${arg}})
endif()
endforeach()
foreach(arg ${installMultiValueArgs})
if(DEFINED ARGS_${arg})
if("${arg}" STREQUAL "GENERATOR")
set(flag "--generator")
elseif("${arg}" STREQUAL "BUILD")
set(flag "--build")
elseif("${arg}" STREQUAL "ENV")
set(flag "--env")
elseif("${arg}" STREQUAL "ENV_HOST")
set(flag "--env:host")
elseif("${arg}" STREQUAL "ENV_BUILD")
set(flag "--env:build")
elseif("${arg}" STREQUAL "OPTIONS")
set(flag "--options")
elseif("${arg}" STREQUAL "OPTIONS_HOST")
set(flag "--options:host")
elseif("${arg}" STREQUAL "OPTIONS_BUILD")
set(flag "--options:build")
elseif("${arg}" STREQUAL "PROFILE")
set(flag "--profile")
elseif("${arg}" STREQUAL "PROFILE_HOST")
set(flag "--profile:host")
elseif("${arg}" STREQUAL "PROFILE_BUILD")
set(flag "--profile:build")
elseif("${arg}" STREQUAL "SETTINGS")
set(flag "--settings")
elseif("${arg}" STREQUAL "SETTINGS_HOST")
set(flag "--settings:host")
elseif("${arg}" STREQUAL "SETTINGS_BUILD")
set(flag "--settings:build")
endif()
list(LENGTH ARGS_${arg} numargs)
foreach(item ${ARGS_${arg}})
if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD")
set(${arg} "--build")
break()
endif()
set(${arg} ${${arg}} ${flag} ${item})
endforeach()
endif()
endforeach()
if(DEFINED UPDATE)
set(UPDATE --update)
endif()
if(DEFINED NO_IMPORTS)
set(NO_IMPORTS --no-imports)
endif()
set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER}
${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD}
${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD})
string(REPLACE ";" " " _install_args "${install_args}")
message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}")
if(ARGS_OUTPUT_QUIET)
set(OUTPUT_OPT OUTPUT_QUIET)
endif()
if(ARGS_ERROR_QUIET)
set(ERROR_OPT ERROR_QUIET)
endif()
execute_process(COMMAND ${CONAN_CMD} ${install_args}
RESULT_VARIABLE return_code
${OUTPUT_OPT}
${ERROR_OPT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(NOT "${return_code}" STREQUAL "0")
if (ARGS_ERROR_QUIET)
message(WARNING "Conan install failed='${return_code}'")
else()
message(FATAL_ERROR "Conan install failed='${return_code}'")
endif()
endif()
endfunction()
function(conan_cmake_setup_conanfile)
conan_parse_arguments(${ARGV})
if(ARGUMENTS_CONANFILE)
get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME)
# configure_file will make sure cmake re-runs when conanfile is updated
configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk)
else()
conan_cmake_generate_conanfile(ON ${ARGV})
endif()
endfunction()
function(conan_cmake_configure)
conan_cmake_generate_conanfile(OFF ${ARGV})
endfunction()
# Generate, writing in disk a conanfile.txt with the requires, options, and imports
# specified as arguments
# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR)
function(conan_cmake_generate_conanfile DEFAULT_GENERATOR)
conan_parse_arguments(${ARGV})
set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt")
file(WRITE ${_FN} "")
if(DEFINED ARGUMENTS_REQUIRES)
file(APPEND ${_FN} "[requires]\n")
foreach(REQUIRE ${ARGUMENTS_REQUIRES})
file(APPEND ${_FN} ${REQUIRE} "\n")
endforeach()
endif()
if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS)
file(APPEND ${_FN} "[generators]\n")
if (DEFAULT_GENERATOR)
file(APPEND ${_FN} "cmake\n")
endif()
if (DEFINED ARGUMENTS_GENERATORS)
foreach(GENERATOR ${ARGUMENTS_GENERATORS})
file(APPEND ${_FN} ${GENERATOR} "\n")
endforeach()
endif()
endif()
if(DEFINED ARGUMENTS_BUILD_REQUIRES)
file(APPEND ${_FN} "[build_requires]\n")
foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES})
file(APPEND ${_FN} ${BUILD_REQUIRE} "\n")
endforeach()
endif()
if(DEFINED ARGUMENTS_IMPORTS)
file(APPEND ${_FN} "[imports]\n")
foreach(IMPORTS ${ARGUMENTS_IMPORTS})
file(APPEND ${_FN} ${IMPORTS} "\n")
endforeach()
endif()
if(DEFINED ARGUMENTS_OPTIONS)
file(APPEND ${_FN} "[options]\n")
foreach(OPTION ${ARGUMENTS_OPTIONS})
file(APPEND ${_FN} ${OPTION} "\n")
endforeach()
endif()
endfunction()
macro(conan_load_buildinfo)
if(CONAN_CMAKE_MULTI)
set(_CONANBUILDINFO conanbuildinfo_multi.cmake)
else()
set(_CONANBUILDINFO conanbuildinfo.cmake)
endif()
if(ARGUMENTS_INSTALL_FOLDER)
set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER})
else()
set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR})
endif()
# Checks for the existence of conanbuildinfo.cmake, and loads it
# important that it is macro, so variables defined at parent scope
if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}")
message(STATUS "Conan: Loading ${_CONANBUILDINFO}")
include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO})
else()
message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}")
endif()
endmacro()
macro(conan_cmake_run)
conan_parse_arguments(${ARGV})
if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES)
message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators")
elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE)
message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.")
endif()
if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED
AND NOT ARGUMENTS_BUILD_TYPE)
set(CONAN_CMAKE_MULTI ON)
if (NOT ARGUMENTS_CONFIGURATION_TYPES)
set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug")
endif()
message(STATUS "Conan: Using cmake-multi generator")
else()
set(CONAN_CMAKE_MULTI OFF)
endif()
if(NOT CONAN_EXPORTED)
conan_cmake_setup_conanfile(${ARGV})
if(CONAN_CMAKE_MULTI)
foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES})
set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE})
conan_cmake_settings(settings ${ARGV})
old_conan_cmake_install(SETTINGS ${settings} ${ARGV})
endforeach()
set(CMAKE_BUILD_TYPE)
else()
conan_cmake_settings(settings ${ARGV})
old_conan_cmake_install(SETTINGS ${settings} ${ARGV})
endif()
endif()
if (NOT ARGUMENTS_NO_LOAD)
conan_load_buildinfo()
endif()
if(ARGUMENTS_BASIC_SETUP)
foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD)
if(ARGUMENTS_${_option})
if(${_option} STREQUAL "CMAKE_TARGETS")
list(APPEND _setup_options "TARGETS")
else()
list(APPEND _setup_options ${_option})
endif()
endif()
endforeach()
conan_basic_setup(${_setup_options})
endif()
endmacro()
macro(conan_check)
# Checks conan availability in PATH
# Arguments REQUIRED, DETECT_QUIET and VERSION are optional
# Example usage:
# conan_check(VERSION 1.0.0 REQUIRED)
set(options REQUIRED DETECT_QUIET)
set(oneValueArgs VERSION)
cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN})
if(NOT CONAN_DETECT_QUIET)
message(STATUS "Conan: checking conan executable")
endif()
find_program(CONAN_CMD conan)
if(NOT CONAN_CMD AND CONAN_REQUIRED)
message(FATAL_ERROR "Conan executable not found! Please install conan.")
endif()
if(NOT CONAN_DETECT_QUIET)
message(STATUS "Conan: Found program ${CONAN_CMD}")
endif()
execute_process(COMMAND ${CONAN_CMD} --version
RESULT_VARIABLE return_code
OUTPUT_VARIABLE CONAN_VERSION_OUTPUT
ERROR_VARIABLE CONAN_VERSION_OUTPUT)
if(NOT "${return_code}" STREQUAL "0")
message(FATAL_ERROR "Conan --version failed='${return_code}'")
endif()
if(NOT CONAN_DETECT_QUIET)
string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT)
message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}")
endif()
if(DEFINED CONAN_VERSION)
string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO
"${CONAN_VERSION_OUTPUT}")
if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION})
message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \
required: ${CONAN_VERSION}. Consider updating via 'pip \
install conan==${CONAN_VERSION}'.")
endif()
endif()
endmacro()
function(conan_add_remote)
# Adds a remote
# Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional
# Example usage:
# conan_add_remote(NAME bincrafters INDEX 1
# URL https://api.bintray.com/conan/bincrafters/public-conan
# VERIFY_SSL True)
set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL)
cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN})
if(DEFINED CONAN_INDEX)
set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}")
endif()
if(DEFINED CONAN_COMMAND)
set(CONAN_CMD ${CONAN_COMMAND})
else()
conan_check(REQUIRED DETECT_QUIET)
endif()
set(CONAN_VERIFY_SSL_ARG "True")
if(DEFINED CONAN_VERIFY_SSL)
set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL})
endif()
message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})")
execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG}
RESULT_VARIABLE return_code)
if(NOT "${return_code}" STREQUAL "0")
message(FATAL_ERROR "Conan remote failed='${return_code}'")
endif()
endfunction()
macro(conan_config_install)
# install a full configuration from a local or remote zip file
# Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional
# Example usage:
# conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git
# TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false)
set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL)
set(multiValueArgs ARGS)
cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
find_program(CONAN_CMD conan)
if(NOT CONAN_CMD AND CONAN_REQUIRED)
message(FATAL_ERROR "Conan executable not found!")
endif()
if(DEFINED CONAN_VERIFY_SSL)
set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}")
endif()
if(DEFINED CONAN_TYPE)
set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}")
endif()
if(DEFINED CONAN_ARGS)
set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"")
endif()
if(DEFINED CONAN_SOURCE)
set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}")
endif()
if(DEFINED CONAN_TARGET)
set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}")
endif()
set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG}
${CONAN_TYPE_ARG}
${CONAN_ARGS_ARGS}
${CONAN_SOURCE_ARGS}
${CONAN_TARGET_ARGS})
message(STATUS "Conan: Installing config from ${CONAN_ITEM}")
execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS}
RESULT_VARIABLE return_code)
if(NOT "${return_code}" STREQUAL "0")
message(FATAL_ERROR "Conan config failed='${return_code}'")
endif()
endmacro()
|
CesiumGS/cesium-omniverse/cmake/AddConanDependencies.cmake | # This file is separate from the root CMakeLists.txt and ConfigureConan.cmake
# since the hash of this file is used as a cache key on CI
include(ConfigureConan)
set(REQUIRES
"cpr/1.10.4@#860d6cd6d8eb5f893e647c2fb016eb61"
"doctest/2.4.9@#ea6440e3cd544c9a25bf3a96bcf16f48"
"openssl/1.1.1w@#42c32b02f62aa987a58201f4c4561d3e"
"pybind11/2.10.1@#561736204506dad955276aaab438aab4"
"stb/cci.20220909@#1c47474f095ef8cd9e4959558525b827"
"zlib/1.2.13@#13c96f538b52e1600c40b88994de240f"
"yaml-cpp/0.7.0@#85b409c274a53d226b71f1bdb9cb4f8b"
"libcurl/8.2.1@#8f62ba7135f5445e5fe6c4bd85143b53"
"nasm/2.15.05@#799d63b1672a337584b09635b0f22fc1")
if(WIN32)
set(REQUIRES ${REQUIRES} "strawberryperl/5.32.1.1@#8f83d05a60363a422f9033e52d106b47")
endif()
# cmake-format: off
configure_conan(
PROJECT_BUILD_DIRECTORY
"${PROJECT_BINARY_DIR}"
REQUIRES
${REQUIRES}
)
# cmake-format: on
|
CesiumGS/cesium-omniverse/cmake/Documentation.cmake | find_package(Doxygen) # System library
function(setup_doxygen_if_available)
if(DOXYGEN_FOUND)
cmake_parse_arguments(
""
""
"PROJECT_ROOT_DIRECTORY;OUTPUT_DIRECTORY"
"PROJECT_INCLUDE_DIRECTORIES"
${ARGN})
if(NOT _PROJECT_ROOT_DIRECTORY)
message(FATAL_ERROR "PROJECT_ROOT_DIRECTORY was not specified")
endif()
if(NOT _OUTPUT_DIRECTORY)
message(FATAL_ERROR "OUTPUT_DIRECTORY was not specified")
endif()
if(NOT _PROJECT_INCLUDE_DIRECTORIES)
message(FATAL_ERROR "PROJECT_INCLUDE_DIRECTORIES was not specified")
endif()
set(DOXYGEN_OUTPUT_DIRECTORY "${_OUTPUT_DIRECTORY}")
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${_PROJECT_ROOT_DIRECTORY}/README.md")
# Hide namespace and class scopes before all functions
# See https://www.doxygen.nl/manual/config.html#cfg_hide_scope_names
set(DOXYGEN_HIDE_SCOPE_NAMES YES)
doxygen_add_docs(
generate-documentation "${_PROJECT_INCLUDE_DIRECTORIES}" "${_PROJECT_ROOT_DIRECTORY}/README.md"
WORKING_DIRECTORY "${_PROJECT_ROOT_DIRECTORY}"
COMMENT "Generate HTML documentation")
endif()
endfunction()
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/extension.py | from functools import partial
import asyncio
from typing import Optional, List
import logging
import omni.ext
import omni.ui as ui
import omni.kit.ui
from .powertools_window import CesiumPowertoolsWindow
from cesium.omniverse.utils import wait_n_frames, dock_window_async
from cesium.omniverse.install import WheelInfo, WheelInstaller
class CesiumPowertoolsExtension(omni.ext.IExt):
def __init__(self):
super().__init__()
self._logger = logging.getLogger(__name__)
self._powertools_window: Optional[CesiumPowertoolsWindow] = None
self._install_py_dependencies()
def on_startup(self):
self._logger.info("Starting Cesium Power Tools...")
self._setup_menus()
self._show_and_dock_startup_windows()
def on_shutdown(self):
self._destroy_powertools_window()
def _setup_menus(self):
ui.Workspace.set_show_window_fn(
CesiumPowertoolsWindow.WINDOW_NAME, partial(self._show_powertools_window, None)
)
editor_menu = omni.kit.ui.get_editor_menu()
if editor_menu:
editor_menu.add_item(
CesiumPowertoolsWindow.MENU_PATH, self._show_powertools_window, toggle=True, value=True
)
def _show_and_dock_startup_windows(self):
ui.Workspace.show_window(CesiumPowertoolsWindow.WINDOW_NAME)
asyncio.ensure_future(dock_window_async(self._powertools_window, target="Property"))
def _destroy_powertools_window(self):
if self._powertools_window is not None:
self._powertools_window.destroy()
self._powertools_window = None
async def _destroy_window_async(self, path):
# Wait one frame, this is due to the one frame defer in Window::_moveToMainOSWindow()
await wait_n_frames(1)
if path is CesiumPowertoolsWindow.MENU_PATH:
self._destroy_powertools_window()
def _visibility_changed_fn(self, path, visible):
editor_menu = omni.kit.ui.get_editor_menu()
if editor_menu:
editor_menu.set_value(path, visible)
if not visible:
asyncio.ensure_future(self._destroy_window_async(path))
def _show_powertools_window(self, _menu, value):
if value:
self._powertools_window = CesiumPowertoolsWindow(width=300, height=400)
self._powertools_window.set_visibility_changed_fn(
partial(self._visibility_changed_fn, CesiumPowertoolsWindow.MENU_PATH)
)
elif self._powertools_window is not None:
self._powertools_window.visible = False
def _install_py_dependencies(self):
vendor_wheels: List[WheelInfo] = [
WheelInfo(
module="pyproj",
windows_whl="pyproj-3.6.0-cp310-cp310-win_amd64.whl",
linux_x64_whl="pyproj-3.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
linux_aarch_whl="pyproj-3.6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
)
]
for w in vendor_wheels:
installer = WheelInstaller(w, extension_module="cesium.powertools")
if not installer.install():
self._logger.error(f"Could not install wheel for {w.module}")
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/__init__.py | from .extension import * # noqa: F401 F403
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/powertools_window.py | import logging
import omni.ui as ui
from typing import Callable, Optional, List
from cesium.omniverse.ui import CesiumOmniverseDebugWindow
from .georefhelper.georef_helper_window import CesiumGeorefHelperWindow
from .utils import (
extend_far_plane,
save_carb_settings,
save_fabric_stage,
set_sunstudy_from_georef,
)
import os
from functools import partial
from .benchmarking.load_timer_window import CesiumLoadTimerWindow
powertools_extension_location = os.path.join(os.path.dirname(__file__), "../../")
class PowertoolsAction:
def __init__(self, title: str, action: Callable):
self._title = title
self._action = action
self._button: Optional[ui.Button] = None
def destroy(self):
if self._button is not None:
self._button.destroy()
self._button = None
def button(self):
if self._button is None:
self._button = ui.Button(self._title, height=0, clicked_fn=self._action)
return self._button
class CesiumPowertoolsWindow(ui.Window):
WINDOW_NAME = "Cesium Power Tools"
MENU_PATH = f"Window/Cesium/{WINDOW_NAME}"
def __init__(self, **kwargs):
super().__init__(CesiumPowertoolsWindow.WINDOW_NAME, **kwargs)
self._logger = logging.getLogger(__name__)
# You do not necessarily need to create an action function in this window class. If you have a function
# in another window or class, you can absolutely call that instead from here.
self._actions: List[PowertoolsAction] = [
PowertoolsAction("Open Cesium Debugging Window", CesiumOmniverseDebugWindow.show_window),
PowertoolsAction("Open Cesium Georeference Helper Window", CesiumGeorefHelperWindow.create_window),
PowertoolsAction("Open Cesium Load Timer Window", CesiumLoadTimerWindow.create_window),
PowertoolsAction("Extend Far Plane", extend_far_plane),
PowertoolsAction("Save Carb Settings", partial(save_carb_settings, powertools_extension_location)),
PowertoolsAction("Save Fabric Stage", partial(save_fabric_stage, powertools_extension_location)),
PowertoolsAction("Set Sun Study from Georef", set_sunstudy_from_georef),
]
self.frame.set_build_fn(self._build_fn)
def destroy(self) -> None:
for action in self._actions:
action.destroy()
self._actions.clear()
super().destroy()
def _build_fn(self):
with ui.ScrollingFrame():
with ui.VStack(spacing=4):
for action in self._actions:
action.button()
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/benchmarking/load_timer_window.py | import logging
import omni.ui as ui
import carb.events
import omni.kit.app as app
from typing import List
from cesium.omniverse.ui.models.space_delimited_number_model import SpaceDelimitedNumberModel
from cesium.omniverse.utils.cesium_interface import CesiumInterfaceManager
from datetime import datetime
from cesium.omniverse.usdUtils import get_tileset_paths
class CesiumLoadTimerWindow(ui.Window):
WINDOW_NAME = "Cesium Load Timer"
_logger: logging.Logger
_last_tiles_loading_worker = 0
def __init__(self, **kwargs):
super().__init__(CesiumLoadTimerWindow.WINDOW_NAME, **kwargs)
self._logger = logging.getLogger(__name__)
self._timer_active = False
self._tiles_loading_worker_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._load_time_seconds_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._past_results_model: ui.SimpleStringModel = ui.SimpleStringModel("")
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
# Set the function that is called to build widgets when the window is visible
self.frame.set_build_fn(self._build_fn)
self.set_visibility_changed_fn(self._visibility_changed_fn)
def destroy(self):
self._remove_subscriptions()
super().destroy()
def __del__(self):
self.destroy()
def _visibility_changed_fn(self, visible):
if not visible:
self._remove_subscriptions()
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(self._on_update_frame, name="on_update_frame")
)
def _remove_subscriptions(self):
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
def _on_update_frame(self, _e: carb.events.IEvent):
if not self.visible or not self._timer_active:
return
with CesiumInterfaceManager() as interface:
render_statistics = interface.get_render_statistics()
# Loading worker count has changed from last frame, so update the timer
if render_statistics.tiles_loading_worker != self._last_tiles_loading_worker:
# Register a new end-time and calculate the total elapsed time in seconds
self._end_time = datetime.now()
time_elapsed = self._end_time - self._start_time
self._load_time_seconds_model.set_value(time_elapsed.total_seconds())
# If 30 sucessive frames with zero tiles loading occurs, we assume loading has finished
if render_statistics.tiles_loading_worker == 0:
self._zero_counter += 1
if self._zero_counter >= 30:
self._end_load_timer() # Cancel the timer after 30 successful 0 tile frames
else:
self._zero_counter = 0
# Store the number of tile workers for use in the next update cycle
self._last_tiles_loading_worker = render_statistics.tiles_loading_worker
self._tiles_loading_worker_model.set_value(render_statistics.tiles_loading_worker)
def _start_load_timer(self):
self._start_time = datetime.now()
self._end_time = datetime.now()
self._timer_active = True
self._zero_counter = 0
with CesiumInterfaceManager() as interface:
tileset_paths = get_tileset_paths()
for tileset_path in tileset_paths:
interface.reload_tileset(tileset_path)
def _end_load_timer(self):
self._timer_active = False
result_str = f"{self._load_time_seconds_model}\n" + self._past_results_model.get_value_as_string()
self._past_results_model.set_value(result_str)
@staticmethod
def create_window():
return CesiumLoadTimerWindow(width=300, height=370)
def _build_fn(self):
"""Builds out the UI"""
with ui.VStack(spacing=4):
ui.Label(
"This tool records the amount of time taken to reload all tilesets in the stage",
word_wrap=True,
)
def reload_all_tilesets():
self._start_load_timer()
ui.Button("Reload all Tilesets", height=20, clicked_fn=reload_all_tilesets)
ui.Label(
"The timer automatically completes when no tiles are queued to load for 30 successive frames",
word_wrap=True,
)
for label, model in [
("Tiles loading (worker)", self._tiles_loading_worker_model),
("Load time (s)", self._load_time_seconds_model),
]:
with ui.HStack(height=0):
ui.Label(label, height=0)
ui.StringField(model=model, height=0, read_only=True)
ui.Label("Past results:", height=0)
ui.StringField(model=self._past_results_model, multiline=True, height=150)
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/georefhelper/georef_helper_window.py | import logging
import omni.ui as ui
import omni.usd
from .proj import epsg_to_ecef, epsg_to_wgs84, get_crs_name_from_epsg
import math
from cesium.omniverse.utils.custom_fields import string_field_with_label, int_field_with_label, float_field_with_label
from pxr import Sdf
class CesiumGeorefHelperWindow(ui.Window):
WINDOW_NAME = "Cesium Georeference Helper"
_logger: logging.Logger
def __init__(self, **kwargs):
super().__init__(CesiumGeorefHelperWindow.WINDOW_NAME, **kwargs)
self._logger = logging.getLogger(__name__)
# Set the function that is called to build widgets when the window is visible
self.frame.set_build_fn(self._build_fn)
def destroy(self):
# It will destroy all the children
super().destroy()
def __del__(self):
self.destroy()
@staticmethod
def create_window():
return CesiumGeorefHelperWindow(width=250, height=600)
def _convert_coordinates(self):
# Get the CRS and check if it is valid, adjust UI values accordingly
crs = get_crs_name_from_epsg(self._epsg_model.get_value_as_int())
if crs is None:
self._epsg_name_model.set_value("Invalid EPSG Code")
self._wgs84_latitude_model.set_value(math.nan)
self._wgs84_longitude_model.set_value(math.nan)
self._wgs84_height_model.set_value(math.nan)
self._ecef_x_model.set_value(math.nan)
self._ecef_y_model.set_value(math.nan)
self._ecef_z_model.set_value(math.nan)
return
self._epsg_name_model.set_value(crs)
# Convert coords to WGS84 and set in UI
wgs84_coords = epsg_to_wgs84(
self._epsg_model.as_string,
self._easting_model.as_float,
self._northing_model.as_float,
self._elevation_model.as_float,
)
self._wgs84_latitude_model.set_value(wgs84_coords[0])
self._wgs84_longitude_model.set_value(wgs84_coords[1])
self._wgs84_height_model.set_value(wgs84_coords[2])
# Convert coords to ECEF and set in UI
ecef_coords = epsg_to_ecef(
self._epsg_model.as_string,
self._easting_model.as_float,
self._northing_model.as_float,
self._elevation_model.as_float,
)
self._ecef_x_model.set_value(ecef_coords[0])
self._ecef_y_model.set_value(ecef_coords[1])
self._ecef_z_model.set_value(ecef_coords[2])
def _set_georeference_prim(self):
if math.isnan(self._wgs84_latitude_model.get_value_as_float()):
self._logger.warning("Cannot set CesiumGeoreference to NaN")
return
stage = omni.usd.get_context().get_stage()
cesium_prim = stage.GetPrimAtPath("/CesiumGeoreference")
cesium_prim.GetAttribute("cesium:georeferenceOrigin:latitude").Set(
self._wgs84_latitude_model.get_value_as_float()
)
cesium_prim.GetAttribute("cesium:georeferenceOrigin:longitude").Set(
self._wgs84_longitude_model.get_value_as_float()
)
cesium_prim.GetAttribute("cesium:georeferenceOrigin:height").Set(
self._wgs84_height_model.get_value_as_float()
)
@staticmethod
def set_georef_from_environment():
stage = omni.usd.get_context().get_stage()
environment_prim = stage.GetPrimAtPath("/Environment")
cesium_prim = stage.GetPrimAtPath("/CesiumGeoreference")
lat_attr = environment_prim.GetAttribute("location:latitude")
long_attr = environment_prim.GetAttribute("location:longitude")
if lat_attr and long_attr:
cesium_prim.GetAttribute("cesium:georeferenceOrigin:latitude").Set(lat_attr.Get())
cesium_prim.GetAttribute("cesium:georeferenceOrigin:longitude").Set(long_attr.Get())
cesium_prim.GetAttribute("cesium:georeferenceOrigin:height").Set(0.0)
else:
logger = logging.getLogger(__name__)
logger.warning(
"Cannot set CesiumGeoreference as environment prim does not have latitude or longitude attributes"
)
@staticmethod
def set_georef_from_anchor():
logger = logging.getLogger(__name__)
stage = omni.usd.get_context().get_stage()
cesium_prim = stage.GetPrimAtPath("/CesiumGeoreference")
if not cesium_prim.IsValid():
logger.error("No CesiumGeoreference found")
return
selection = omni.usd.get_context().get_selection().get_selected_prim_paths()
for prim_path in selection:
prim = stage.GetPrimAtPath(prim_path)
latitude = prim.GetAttribute("cesium:anchor:latitude").Get()
longitude = prim.GetAttribute("cesium:anchor:longitude").Get()
height = prim.GetAttribute("cesium:anchor:height").Get()
if latitude is not None and longitude is not None and height is not None:
cesium_prim.GetAttribute("cesium:georeferenceOrigin:latitude").Set(latitude)
cesium_prim.GetAttribute("cesium:georeferenceOrigin:longitude").Set(longitude)
cesium_prim.GetAttribute("cesium:georeferenceOrigin:height").Set(height)
return
logger.error("Please select a prim with a globe anchor")
def _build_fn(self):
"""Builds out the UI buttons and their handlers."""
with ui.VStack(spacing=4):
label_style = {"Label": {"font_size": 16}}
ui.Label(
"Enter coordinates in any EPSG CRS to convert them to ECEF and WGS84",
word_wrap=True,
style=label_style,
)
ui.Spacer(height=10)
ui.Label("Your Project Details:", style=label_style)
# TODO: Precision issues to resolve
def on_coordinate_update(event):
self._convert_coordinates()
# Define the SimpleValueModels for the UI
self._epsg_model = ui.SimpleIntModel(28356)
self._epsg_name_model = ui.SimpleStringModel("")
self._easting_model = ui.SimpleFloatModel(503000.0)
self._northing_model = ui.SimpleFloatModel(6950000.0)
self._elevation_model = ui.SimpleFloatModel(0.0)
# Add the value changed callbacks
self._epsg_model.add_value_changed_fn(on_coordinate_update)
self._easting_model.add_value_changed_fn(on_coordinate_update)
self._northing_model.add_value_changed_fn(on_coordinate_update)
self._elevation_model.add_value_changed_fn(on_coordinate_update)
# TODO: Make EPSG an autocomplete field
int_field_with_label("EPSG Code", model=self._epsg_model)
string_field_with_label("EPSG Name", model=self._epsg_name_model, enabled=False)
float_field_with_label("Easting / X", model=self._easting_model)
float_field_with_label("Northing / Y", model=self._northing_model)
float_field_with_label("Elevation / Z", model=self._elevation_model)
ui.Spacer(height=10)
# TODO: It would be nice to be able to copy these fields, or potentially have two way editing
ui.Label("WGS84 Results:", style=label_style)
self._wgs84_latitude_model = ui.SimpleFloatModel(0.0)
self._wgs84_longitude_model = ui.SimpleFloatModel(0.0)
self._wgs84_height_model = ui.SimpleFloatModel(0.0)
float_field_with_label("Latitude", model=self._wgs84_latitude_model, enabled=False)
float_field_with_label("Longitude", model=self._wgs84_longitude_model, enabled=False)
float_field_with_label("Elevation", model=self._wgs84_height_model, enabled=False)
ui.Spacer(height=10)
ui.Label("ECEF Results:", style=label_style)
self._ecef_x_model = ui.SimpleFloatModel(0.0)
self._ecef_y_model = ui.SimpleFloatModel(0.0)
self._ecef_z_model = ui.SimpleFloatModel(0.0)
float_field_with_label("X", model=self._ecef_x_model, enabled=False)
float_field_with_label("Y", model=self._ecef_y_model, enabled=False)
float_field_with_label("Z", model=self._ecef_z_model, enabled=False)
ui.Button("Set Georeference from EPSG", height=20, clicked_fn=self._set_georeference_prim)
ui.Button(
"Set Georeference from Environment Prim", height=20, clicked_fn=self.set_georef_from_environment
)
ui.Button("Set Georef from Selected Anchor", height=20, clicked_fn=self.set_georef_from_anchor)
# Do the first conversion
self._convert_coordinates()
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/georefhelper/proj.py | ECEF_EPSG = 4978
WGS84_EPSG = 4979
def get_crs_name_from_epsg(epsg_code):
import pyproj
try:
return pyproj.crs.CRS.from_epsg(epsg_code).name
except pyproj.exceptions.CRSError:
return None
def epsg_to_epsg(from_epsg, to_epsg, x, y, z):
import pyproj
from_crs = pyproj.crs.CRS.from_epsg(from_epsg)
to_crs = pyproj.crs.CRS.from_epsg(to_epsg)
# Define the from and to coordinate systems
transformer = pyproj.Transformer.from_crs(from_crs, to_crs)
# Convert ECEF coordinates to longitude, latitude, and height
lat, lon, height = transformer.transform(x, y, z)
return lat, lon, height
def epsg_to_wgs84(from_epsg, x, y, z):
return epsg_to_epsg(from_epsg, WGS84_EPSG, x, y, z)
def epsg_to_ecef(from_epsg, x, y, z):
return epsg_to_epsg(from_epsg, ECEF_EPSG, x, y, z)
def ecef_to_wgs84(x, y, z):
return epsg_to_epsg(ECEF_EPSG, WGS84_EPSG, x, y, z)
def wgs84_to_ecef(x, y, z):
return epsg_to_epsg(WGS84_EPSG, ECEF_EPSG, x, y, z)
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/utils/__init__.py | from .utils import * # noqa: F401 F403
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/cesium/powertools/utils/utils.py | import logging
import omni.usd
from omni.kit.viewport.utility import get_active_viewport
from pxr import Gf, UsdGeom, Sdf
import json
import carb.settings
import os
from cesium.omniverse.utils.cesium_interface import CesiumInterfaceManager
from asyncio import ensure_future
# Modified version of ScopedEdit in _build_viewport_cameras in omni.kit.widget.viewport
class ScopedEdit:
def __init__(self, stage):
self.__stage = stage
edit_target = stage.GetEditTarget()
edit_layer = edit_target.GetLayer()
self.__edit_layer = stage.GetSessionLayer()
self.__was_editable = self.__edit_layer.permissionToEdit
if not self.__was_editable:
self.__edit_layer.SetPermissionToEdit(True)
if self.__edit_layer != edit_layer:
stage.SetEditTarget(self.__edit_layer)
self.__edit_target = edit_target
else:
self.__edit_target = None
def __del__(self):
if self.__edit_layer and not self.__was_editable:
self.__edit_layer.SetPermissionToEdit(False)
self.__edit_layer = None
if self.__edit_target:
self.__stage.SetEditTarget(self.__edit_target)
self.__edit_target = None
def extend_far_plane():
stage = omni.usd.get_context().get_stage()
viewport = get_active_viewport()
camera_path = viewport.get_active_camera()
camera = UsdGeom.Camera.Get(stage, camera_path)
assert camera.GetPrim().IsValid()
scoped_edit = ScopedEdit(stage) # noqa: F841
camera.GetClippingRangeAttr().Set(Gf.Vec2f(1.0, 10000000000.0))
def save_carb_settings(powertools_extension_location: str):
carb_settings_path = os.path.join(powertools_extension_location, "carb_settings.txt")
with open(carb_settings_path, "w") as fh:
fh.write(json.dumps(carb.settings.get_settings().get("/"), indent=2))
def save_fabric_stage(powertools_extension_location: str):
with CesiumInterfaceManager() as interface:
fabric_stage_path = os.path.join(powertools_extension_location, "fabric_stage.txt")
with open(fabric_stage_path, "w") as fh:
fh.write(interface.print_fabric_stage())
# Helper function to search for an attribute on a prim, or create it if not present
def get_or_create_attribute(prim, name, type):
attribute = prim.GetAttribute(name)
if not attribute:
attribute = prim.CreateAttribute(name, type)
return attribute
def set_sunstudy_from_georef():
stage = omni.usd.get_context().get_stage()
environment_prim = stage.GetPrimAtPath("/Environment")
cesium_prim = stage.GetPrimAtPath("/CesiumGeoreference")
lat_attr = get_or_create_attribute(environment_prim, "location:latitude", Sdf.ValueTypeNames.Float)
lat_attr.Set(cesium_prim.GetAttribute("cesium:georeferenceOrigin:latitude").Get())
long_attr = get_or_create_attribute(environment_prim, "location:longitude", Sdf.ValueTypeNames.Float)
long_attr.Set(cesium_prim.GetAttribute("cesium:georeferenceOrigin:longitude").Get())
north_attr = get_or_create_attribute(environment_prim, "location:north_orientation", Sdf.ValueTypeNames.Float)
north_attr.Set(90.0) # Always set to 90, otherwise the sun is at the wrong angle
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/doc/README.md | # Cesium for Omniverse Power Tools
This extension provides supporting features and tools that may be useful while developing apps and stages using Cesium for Omniverse, but are provided **on an entirely your milage may vary** basis. All of these tools are considered experimental. If you like a particular tool in this extension, and would like to see it moved to the main Cesium for Omniverse extension, please [feel free to let us know on the Cesium for Omniverse forums](https://community.cesium.com/c/cesium-for-omniverse/14).
## Current Features
### Open Cesium Debugging Window
Easier and quicker way for opening the Cesium Debugging window.
## License
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html). Cesium for Omniverse is free for both commercial and non-commercial use.
|
CesiumGS/cesium-omniverse/exts/cesium.powertools/config/extension.toml | [package]
version = "0.1.0"
category = "simulation"
feature = false
app = false
title = "Cesium for Omniverse Power Tools"
description = "Additional experimental helper features for Cesium for Omniverse."
authors = "Cesium GS Inc."
repository = "https://github.com/CesiumGS/cesium-omniverse"
keywords = [
"cesium",
"omniverse",
"geospatial",
"3D Tiles",
"glTF",
"globe",
"earth",
"simulation",
]
# Paths are relative to the extension folder
readme = "doc/README.md"
icon = "doc/resources/icon.png"
[dependencies]
"cesium.omniverse" = {}
[[python.module]]
name = "cesium.powertools"
[python.pipapi]
archiveDirs = ["vendor"]
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/premake5.lua | local ext = get_current_extension_info()
project_ext (ext)
-- Link only those files and folders into the extension target directory
repo_build.prebuild_link { "bin", ext.target_dir.."/bin" }
repo_build.prebuild_link { "cesium", ext.target_dir.."/cesium" }
repo_build.prebuild_link { "doc", ext.target_dir.."/doc" }
repo_build.prebuild_link { "plugins", ext.target_dir.."/plugins" }
repo_build.prebuild_link { "schemas", ext.target_dir.."/schemas" }
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/cesium/usd/__init__.py | from .plugins import * # noqa: F401 F403
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/cesium/usd/plugins/__init__.py | import os # noqa: F401
from pxr import Plug
pluginsRoot = os.path.join(os.path.dirname(__file__), "../../../plugins")
cesiumUsdSchemasPath = pluginsRoot + "/CesiumUsdSchemas/resources"
Plug.Registry().RegisterPlugins(cesiumUsdSchemasPath)
plugin = Plug.Registry().GetPluginWithName("CesiumUsdSchemas")
if plugin:
plugin.Load()
else:
print("Cannot find plugin")
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.py | from . import _CesiumUsdSchemas
from pxr import Tf
Tf.PrepareModule(_CesiumUsdSchemas, locals())
del Tf
try:
import __DOC
__DOC.Execute(locals())
del __DOC
except Exception:
try:
import __tmpDoc
__tmpDoc.Execute(locals())
del __tmpDoc
except Exception:
pass
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.pyi | from typing import Any, ClassVar
import Boost.Python
import pxr.Usd
import pxr.UsdGeom
__MFB_FULL_PACKAGE_NAME: str
class Data(pxr.Usd.Typed):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateDebugDisableGeometryPoolAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugDisableGeoreferencingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugDisableMaterialPoolAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugDisableMaterialsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugDisableTexturePoolAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugDisableTexturesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugGeometryPoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugMaterialPoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugRandomColorsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDebugTexturePoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSelectedIonServerRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugDisableGeometryPoolAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugDisableGeoreferencingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugDisableMaterialPoolAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugDisableMaterialsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugDisableTexturePoolAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugDisableTexturesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugGeometryPoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugMaterialPoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugRandomColorsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDebugTexturePoolInitialCapacityAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSelectedIonServerRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class Georeference(pxr.Usd.Typed):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateGeoreferenceOriginHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateGeoreferenceOriginLatitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateGeoreferenceOriginLongitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetGeoreferenceOriginHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetGeoreferenceOriginLatitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetGeoreferenceOriginLongitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class GlobeAnchorAPI(pxr.Usd.APISchemaBase):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def Apply(cls, *args, **kwargs) -> Any: ...
@classmethod
def CanApply(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateAdjustOrientationForGlobeWhenMovingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateAnchorHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateAnchorLatitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateAnchorLongitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateDetectTransformChangesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateGeoreferenceBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreatePositionAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetAdjustOrientationForGlobeWhenMovingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetAnchorHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetAnchorLatitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetAnchorLongitudeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDetectTransformChangesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetGeoreferenceBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetPositionAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class IonRasterOverlay(RasterOverlay):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateIonAccessTokenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonAssetIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonServerBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonAccessTokenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonAssetIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonServerBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class IonServer(pxr.Usd.Typed):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateDisplayNameAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonServerApiUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonServerApplicationIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonServerUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateProjectDefaultIonAccessTokenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateProjectDefaultIonAccessTokenIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetDisplayNameAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonServerApiUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonServerApplicationIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonServerUrlAttr(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 _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class PolygonRasterOverlay(RasterOverlay):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateCartographicPolygonBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateCesiumOverlayRenderMethodAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateInvertSelectionAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetCartographicPolygonBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetCesiumOverlayRenderMethodAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetInvertSelectionAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class RasterOverlay(pxr.Usd.Typed):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateAlphaAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumSimultaneousTileLoadsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumTextureSizeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateOverlayRenderMethodAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateShowCreditsOnScreenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSubTileCacheBytesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetAlphaAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumSimultaneousTileLoadsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumTextureSizeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetOverlayRenderMethodAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetShowCreditsOnScreenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSubTileCacheBytesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class Session(pxr.Usd.Typed):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateEcefToUsdTransformAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetEcefToUsdTransformAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class TileMapServiceRasterOverlay(RasterOverlay):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateMaximumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMinimumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSpecifyZoomLevelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMinimumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSpecifyZoomLevelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class Tileset(pxr.UsdGeom.Gprim):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateCulledScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateEnableFogCullingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateEnableFrustumCullingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateEnforceCulledScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateForbidHolesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateGeoreferenceBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonAccessTokenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonAssetIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateIonServerBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateLoadingDescendantLimitAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMainThreadLoadingTimeLimitAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumCachedBytesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumSimultaneousTileLoadsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreatePreloadAncestorsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreatePreloadSiblingsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateRasterOverlayBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateShowCreditsOnScreenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSmoothNormalsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSourceTypeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSuspendUpdateAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetCulledScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetEnableFogCullingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetEnableFrustumCullingAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetEnforceCulledScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetForbidHolesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetGeoreferenceBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonAccessTokenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonAssetIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetIonServerBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetLoadingDescendantLimitAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMainThreadLoadingTimeLimitAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumCachedBytesAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumScreenSpaceErrorAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumSimultaneousTileLoadsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetPreloadAncestorsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetPreloadSiblingsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetRasterOverlayBindingRel(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetShowCreditsOnScreenAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSmoothNormalsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSourceTypeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSuspendUpdateAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class Tokens(Boost.Python.instance):
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def __reduce__(cls) -> Any: ...
@property
def cesiumAlpha(self) -> Any: ...
@property
def cesiumAnchorAdjustOrientationForGlobeWhenMoving(self) -> Any: ...
@property
def cesiumAnchorDetectTransformChanges(self) -> Any: ...
@property
def cesiumAnchorGeoreferenceBinding(self) -> Any: ...
@property
def cesiumAnchorHeight(self) -> Any: ...
@property
def cesiumAnchorLatitude(self) -> Any: ...
@property
def cesiumAnchorLongitude(self) -> Any: ...
@property
def cesiumAnchorPosition(self) -> Any: ...
@property
def cesiumBaseUrl(self) -> Any: ...
@property
def cesiumCartographicPolygonBinding(self) -> Any: ...
@property
def cesiumCulledScreenSpaceError(self) -> Any: ...
@property
def cesiumDebugDisableGeometryPool(self) -> Any: ...
@property
def cesiumDebugDisableGeoreferencing(self) -> Any: ...
@property
def cesiumDebugDisableMaterialPool(self) -> Any: ...
@property
def cesiumDebugDisableMaterials(self) -> Any: ...
@property
def cesiumDebugDisableTexturePool(self) -> Any: ...
@property
def cesiumDebugDisableTextures(self) -> Any: ...
@property
def cesiumDebugGeometryPoolInitialCapacity(self) -> Any: ...
@property
def cesiumDebugMaterialPoolInitialCapacity(self) -> Any: ...
@property
def cesiumDebugRandomColors(self) -> Any: ...
@property
def cesiumDebugTexturePoolInitialCapacity(self) -> Any: ...
@property
def cesiumDisplayName(self) -> Any: ...
@property
def cesiumEast(self) -> Any: ...
@property
def cesiumEcefToUsdTransform(self) -> Any: ...
@property
def cesiumEnableFogCulling(self) -> Any: ...
@property
def cesiumEnableFrustumCulling(self) -> Any: ...
@property
def cesiumEnforceCulledScreenSpaceError(self) -> Any: ...
@property
def cesiumForbidHoles(self) -> Any: ...
@property
def cesiumFormat(self) -> Any: ...
@property
def cesiumGeoreferenceBinding(self) -> Any: ...
@property
def cesiumGeoreferenceOriginHeight(self) -> Any: ...
@property
def cesiumGeoreferenceOriginLatitude(self) -> Any: ...
@property
def cesiumGeoreferenceOriginLongitude(self) -> Any: ...
@property
def cesiumInvertSelection(self) -> Any: ...
@property
def cesiumIonAccessToken(self) -> Any: ...
@property
def cesiumIonAssetId(self) -> Any: ...
@property
def cesiumIonServerApiUrl(self) -> Any: ...
@property
def cesiumIonServerApplicationId(self) -> Any: ...
@property
def cesiumIonServerBinding(self) -> Any: ...
@property
def cesiumIonServerUrl(self) -> Any: ...
@property
def cesiumLayer(self) -> Any: ...
@property
def cesiumLayers(self) -> Any: ...
@property
def cesiumLoadingDescendantLimit(self) -> Any: ...
@property
def cesiumMainThreadLoadingTimeLimit(self) -> Any: ...
@property
def cesiumMaximumCachedBytes(self) -> Any: ...
@property
def cesiumMaximumLevel(self) -> Any: ...
@property
def cesiumMaximumScreenSpaceError(self) -> Any: ...
@property
def cesiumMaximumSimultaneousTileLoads(self) -> Any: ...
@property
def cesiumMaximumTextureSize(self) -> Any: ...
@property
def cesiumMaximumZoomLevel(self) -> Any: ...
@property
def cesiumMinimumLevel(self) -> Any: ...
@property
def cesiumMinimumZoomLevel(self) -> Any: ...
@property
def cesiumNorth(self) -> Any: ...
@property
def cesiumOverlayRenderMethod(self) -> Any: ...
@property
def cesiumPreloadAncestors(self) -> Any: ...
@property
def cesiumPreloadSiblings(self) -> Any: ...
@property
def cesiumProjectDefaultIonAccessToken(self) -> Any: ...
@property
def cesiumProjectDefaultIonAccessTokenId(self) -> Any: ...
@property
def cesiumRasterOverlayBinding(self) -> Any: ...
@property
def cesiumRootTilesX(self) -> Any: ...
@property
def cesiumRootTilesY(self) -> Any: ...
@property
def cesiumSelectedIonServer(self) -> Any: ...
@property
def cesiumShowCreditsOnScreen(self) -> Any: ...
@property
def cesiumSmoothNormals(self) -> Any: ...
@property
def cesiumSourceType(self) -> Any: ...
@property
def cesiumSouth(self) -> Any: ...
@property
def cesiumSpecifyTileMatrixSetLabels(self) -> Any: ...
@property
def cesiumSpecifyTilingScheme(self) -> Any: ...
@property
def cesiumSpecifyZoomLevels(self) -> Any: ...
@property
def cesiumStyle(self) -> Any: ...
@property
def cesiumSubTileCacheBytes(self) -> Any: ...
@property
def cesiumSuspendUpdate(self) -> Any: ...
@property
def cesiumTileHeight(self) -> Any: ...
@property
def cesiumTileMatrixSetId(self) -> Any: ...
@property
def cesiumTileMatrixSetLabelPrefix(self) -> Any: ...
@property
def cesiumTileMatrixSetLabels(self) -> Any: ...
@property
def cesiumTileWidth(self) -> Any: ...
@property
def cesiumUrl(self) -> Any: ...
@property
def cesiumUseWebMercatorProjection(self) -> Any: ...
@property
def cesiumWest(self) -> Any: ...
@property
def clip(self) -> Any: ...
@property
def ion(self) -> Any: ...
@property
def overlay(self) -> Any: ...
@property
def url(self) -> Any: ...
class WebMapServiceRasterOverlay(RasterOverlay):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateBaseUrlAttr(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 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 GetLayersAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMinimumLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetTileHeightAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetTileWidthAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class WebMapTileServiceRasterOverlay(RasterOverlay):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def CreateEastAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateFormatAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateLayerAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMaximumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateMinimumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateNorthAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateRootTilesXAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateRootTilesYAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSouthAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSpecifyTileMatrixSetLabelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSpecifyTilingSchemeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateSpecifyZoomLevelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateStyleAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateTileMatrixSetIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateTileMatrixSetLabelPrefixAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateTileMatrixSetLabelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateUseWebMercatorProjectionAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def CreateWestAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def Define(cls, *args, **kwargs) -> Any: ...
@classmethod
def Get(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetEastAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetFormatAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetLayerAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMaximumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetMinimumZoomLevelAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetNorthAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetRootTilesXAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetRootTilesYAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSchemaAttributeNames(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSouthAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSpecifyTileMatrixSetLabelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSpecifyTilingSchemeAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetSpecifyZoomLevelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetStyleAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetTileMatrixSetIdAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetTileMatrixSetLabelPrefixAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetTileMatrixSetLabelsAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetUrlAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetUseWebMercatorProjectionAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def GetWestAttr(cls, *args, **kwargs) -> Any: ...
@classmethod
def _GetStaticTfType(cls, *args, **kwargs) -> Any: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
class _CanApplyResult(Boost.Python.instance):
__instance_size__: ClassVar[int] = ...
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def __bool__(cls) -> bool: ...
@classmethod
def __eq__(cls, other) -> bool: ...
@classmethod
def __getitem__(cls, index) -> Any: ...
@classmethod
def __ne__(cls, other) -> bool: ...
@classmethod
def __reduce__(cls) -> Any: ...
@property
def whyNot(self) -> Any: ...
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/schemas/cesium_schemas.usda | #usda 1.0
(
""" This file describes an example schema for code generation using
usdGenSchema.
"""
subLayers = [
@usd/schema.usda@,
@usdGeom/schema.usda@
]
)
over "GLOBAL" (
customData = {
string libraryName = "CesiumUsdSchemas"
string libraryPath = "./"
string libraryPrefix = "Cesium"
string tokensPrefix = "Cesium"
}
) {
}
class CesiumDataPrim "CesiumDataPrim" (
doc = """Stores stage level data for Cesium for Omniverse/USD."""
inherits = </Typed>
customData = {
string className = "Data"
}
) {
rel cesium:selectedIonServer (
customData = {
string apiName = "selectedIonServer"
}
displayName = "Selected ion Server context"
doc = "The current ion Server prim used in the Cesium for Omniverse UI."
)
bool cesium:debug:disableMaterials = false (
customData = {
string apiName = "debugDisableMaterials"
}
displayName = "Disable Materials"
doc = "Debug option that renders tilesets with materials disabled."
)
bool cesium:debug:disableTextures = false (
customData = {
string apiName = "debugDisableTextures"
}
displayName = "Disable Textures"
doc = "Debug option that renders tilesets with textures disabled."
)
bool cesium:debug:disableGeometryPool = false (
customData = {
string apiName = "debugDisableGeometryPool"
}
displayName = "Disable Geometry Pool"
doc = "Debug option that disables geometry pooling."
)
bool cesium:debug:disableMaterialPool = false (
customData = {
string apiName = "debugDisableMaterialPool"
}
displayName = "Disable Material Pool"
doc = "Debug option that disables material pooling."
)
bool cesium:debug:disableTexturePool = false (
customData = {
string apiName = "debugDisableTexturePool"
}
displayName = "Disable Texture Pool"
doc = "Debug option that disables texture pooling."
)
uint64 cesium:debug:geometryPoolInitialCapacity = 2048 (
customData = {
string apiName = "debugGeometryPoolInitialCapacity"
}
displayName = "Geometry Pool Initial Capacity"
doc = "Debug option that controls the initial capacity of the geometry pool."
)
uint64 cesium:debug:materialPoolInitialCapacity = 2048 (
customData = {
string apiName = "debugMaterialPoolInitialCapacity"
}
displayName = "Material Pool Initial Capacity"
doc = "Debug option that controls the initial capacity of the material pool."
)
uint64 cesium:debug:texturePoolInitialCapacity = 2048 (
customData = {
string apiName = "debugTexturePoolInitialCapacity"
}
displayName = "Texture Pool Initial Capacity"
doc = "Debug option that controls the initial capacity of the texture pool."
)
bool cesium:debug:randomColors = false (
customData = {
string apiName = "debugRandomColors"
}
displayName = "Random Colors"
doc = "Debug option that renders tiles with random colors."
)
bool cesium:debug:disableGeoreferencing = false (
customData = {
string apiName = "debugDisableGeoreferencing"
}
displayName = "Disable Georeferencing"
doc = "Debug option to disable georeferencing. Tiles will be rendered in EPSG:4978 (ECEF) coordinates where (0, 0, 0) is the center of the globe, the X axis points towards the prime meridian, the Y axis points towards the 90th meridian east, and the Z axis points towards the North Pole."
)
}
class CesiumSessionPrim "CesiumSessionPrim" (
doc = """Stores session layer state for Cesium for Omniverse/USD."""
inherits = </Typed>
customData = {
string className = "Session"
}
) {
matrix4d cesium:ecefToUsdTransform (
customData = {
string apiName = "ecefToUsdTransform"
}
displayName = "ECEF to USD Transform"
doc = "The 4x4 transformation matrix (row major) from global ECEF coordinates to USD stage coordinates based on the georeference origin."
)
}
class CesiumIonServerPrim "CesiumIonServerPrim" (
doc = """Stores metadata related to Cesium ion server connections for tilesets."""
inherits = </Typed>
customData = {
string className = "IonServer"
}
) {
string cesium:displayName (
customData = {
string apiName = "displayName"
}
displayName = "Display Name"
doc = "The name to display for this server."
)
string cesium:ionServerUrl (
customData = {
string apiName = "ionServerUrl"
}
displayName = "Server URL"
doc = "The base URL for the Cesium ion Server."
)
string cesium:ionServerApiUrl (
customData = {
string apiName = "ionServerApiUrl"
}
displayName = "API URL"
doc = "The base URL for the Cesium ion Server API."
)
int64 cesium:ionServerApplicationId (
customData = {
string apiName = "ionServerApplicationId"
}
displayName = "OAuth Application ID"
doc = "The application ID for the Cesium ion Server connection."
)
string cesium:projectDefaultIonAccessToken = "" (
customData = {
string apiName = "projectDefaultIonAccessToken"
}
displayName = "Default Cesium ion Access Token"
doc = "A string representing the token for accessing Cesium ion assets."
)
string cesium:projectDefaultIonAccessTokenId = "" (
customData = {
string apiName = "projectDefaultIonAccessTokenId"
}
displayName = "Default Cesium ion Access Token ID"
doc = "A string representing the token ID for accessing Cesium ion assets."
)
}
class CesiumGeoreferencePrim "CesiumGeoreferencePrim" (
doc = """Stores Georeference data for Cesium for Omniverse. Every stage should have at least one of these."""
inherits = </Typed>
customData = {
string className = "Georeference"
}
) {
double cesium:georeferenceOrigin:longitude = -105.25737 (
customData = {
string apiName = "georeferenceOriginLongitude"
}
displayName = "Georeference Origin Longitude"
doc = "The longitude of the origin in degrees, in the range [-180, 180]."
)
double cesium:georeferenceOrigin:latitude = 39.736401 (
customData = {
string apiName = "georeferenceOriginLatitude"
}
displayName = "Georeference Original Latitude"
doc = "The latitude of the origin in degrees, in the range [-90, 90]."
)
double cesium:georeferenceOrigin:height = 2250.0 (
customData = {
string apiName = "georeferenceOriginHeight"
}
displayName = "Georeference Origin Height"
doc = "The height of the origin in meters above the WGS84 ellipsoid. Do not confuse this with a geoid height or height above mean sea level, which can be tens of meters higher or lower depending on where in the world the origin is located."
)
}
class CesiumTilesetPrim "CesiumTilesetPrim" (
doc = """A prim representing a tileset."""
inherits = </Gprim>
customData = {
string className = "Tileset"
}
) {
uniform token cesium:sourceType = "ion" (
customData = {
string apiName = "sourceType"
}
allowedTokens = ["ion", "url"]
displayName = "Source Type"
doc = "Selects whether to use the Cesium ion Asset ID or the provided URL for this tileset."
)
string cesium:url = "" (
customData = {
string apiName = "url"
}
displayName = "URL"
doc = "The URL of this tileset's tileset.json file. Usually blank if this is an ion asset."
)
int64 cesium:ionAssetId = 0 (
customData = {
string apiName = "ionAssetId"
}
displayName = "ion Asset ID"
doc = "The ID of the Cesium ion asset to use. Usually blank if using URL."
)
string cesium:ionAccessToken = "" (
customData = {
string apiName = "ionAccessToken"
}
displayName = "ion Access Token"
doc = "The access token to use to access the Cesium ion resource. Overrides the default token. Usually blank if using URL."
)
float cesium:maximumScreenSpaceError = 16 (
customData = {
string apiName = "maximumScreenSpaceError"
}
displayName = "Maximum Screen Space Error"
doc = "The maximum number of pixels of error when rendering this tileset. This is used to select an appropriate level-of-detail: A low value will cause many tiles with a high level of detail to be loaded, causing a finer visual representation of the tiles, but with a higher performance cost for loading and rendering. A higher value will cause a coarser visual representation, with lower performance requirements. When a tileset uses the older layer.json / quantized-mesh format rather than 3D Tiles, this value is effectively divided by 8.0. So the default value of 16.0 corresponds to the standard value for quantized-mesh terrain of 2.0."
)
bool cesium:preloadAncestors = true (
customData = {
string apiName = "preloadAncestors"
}
displayName = "Preload Ancestors"
doc = "Whether to preload ancestor tiles. Setting this to true optimizes the zoom-out experience and provides more detail in newly-exposed areas when panning. The down side is that it requires loading more tiles."
)
bool cesium:preloadSiblings = true (
customData = {
string apiName = "preloadSiblings"
}
displayName = "Preload Siblings"
doc = "Whether to preload sibling tiles. Setting this to true causes tiles with the same parent as a rendered tile to be loaded, even if they are culled. Setting this to true may provide a better panning experience at the cost of loading more tiles."
)
bool cesium:forbidHoles = false (
customData = {
string apiName = "forbidHoles"
}
displayName = "Forbid Holes"
doc = "Whether to prevent refinement of a parent tile when a child isn't done loading. When this is set to true, the tileset will guarantee that the tileset will never be rendered with holes in place of tiles that are not yet loaded, even though the tile that is rendered instead may have low resolution. When false, overall loading will be faster, but newly-visible parts of the tileset may initially be blank."
)
uint cesium:maximumSimultaneousTileLoads = 20 (
customData = {
string apiName = "maximumSimultaneousTileLoads"
}
displayName = "Maximum Simultaneous Tile Loads"
doc = "The maximum number of tiles that may be loaded at once. When new parts of the tileset become visible, the tasks to load the corresponding tiles are put into a queue. This value determines how many of these tasks are processed at the same time. A higher value may cause the tiles to be loaded and rendered more quickly, at the cost of a higher network and processing load."
)
uint64 cesium:maximumCachedBytes = 536870912 (
customData = {
string apiName = "maximumCachedBytes"
}
displayName = "Maximum Cached Bytes"
doc = "The maximum number of bytes that may be cached. Note that this value, even if 0, will never cause tiles that are needed for rendering to be unloaded. However, if the total number of loaded bytes is greater than this value, tiles will be unloaded until the total is under this number or until only required tiles remain, whichever comes first."
)
uint cesium:loadingDescendantLimit = 20 (
customData = {
string apiName = "loadingDescendantLimit"
}
displayName = "Loading Descendant Limit"
doc = "The number of loading descendants a tile should allow before deciding to render itself instead of waiting. Setting this to 0 will cause each level of detail to be loaded successively. This will increase the overall loading time, but cause additional detail to appear more gradually. Setting this to a high value like 1000 will decrease the overall time until the desired level of detail is achieved, but this high-detail representation will appear at once, as soon as it is loaded completely."
)
bool cesium:enableFrustumCulling = true (
customData = {
string apiName = "enableFrustumCulling"
}
displayName = "Enable Frustum Culling"
doc = "Whether to cull tiles that are outside the frustum. By default this is true, meaning that tiles that are not visible with the current camera configuration will be ignored. It can be set to false, so that these tiles are still considered for loading, refinement and rendering. This will cause more tiles to be loaded, but helps to avoid holes and provides a more consistent mesh, which may be helpful for physics and shadows. Note that this will always be disabled if Use Lod Transitions is set to true."
)
bool cesium:enableFogCulling = true (
customData = {
string apiName = "enableFogCulling"
}
displayName = "Enable Fog Culling"
doc = "Whether to cull tiles that are occluded by fog. This does not refer to the atmospheric fog rendered by Unity, but to an internal representation of fog: Depending on the height of the camera above the ground, tiles that are far away (close to the horizon) will be culled when this flag is enabled. Note that this will always be disabled if Use Lod Transitions is set to true."
)
bool cesium:enforceCulledScreenSpaceError = true (
customData = {
string apiName = "enforceCulledScreenSpaceError"
}
displayName = "Enforce Culled Screen Space Error"
doc = "Whether a specified screen-space error should be enforced for tiles that are outside the frustum or hidden in fog. When Enable Frustum Culling and Enable Fog Culling are both true, tiles outside the view frustum or hidden in fog are effectively ignored, and so their level-of-detail doesn't matter. And in this scenario, this property is ignored. However, when either of those flags are false, these would-be-culled tiles continue to be processed, and the question arises of how to handle their level-of-detail. When this property is false, refinement terminates at these tiles, no matter what their current screen-space error. The tiles are available for physics, shadows, etc., but their level-of-detail may be very low. When set to true, these tiles are refined until they achieve the specified Culled Screen Space Error. This allows control over the minimum quality of these would-be-culled tiles."
)
float cesium:culledScreenSpaceError = 64 (
customData = {
string apiName = "culledScreenSpaceError"
}
displayName = "Culled Screen Space Error"
doc = "The screen-space error to be enforced for tiles that are outside the frustum or hidden in fog. When Enable Frustum Culling and Enable Fog Culling are both true, tiles outside the view frustum or hidden in fog are effectively ignored, and so their level-of-detail doesn't matter. And in this scenario, this property is ignored. However, when either of those flags are false, these would-be-culled tiles continue to be processed, and the question arises of how to handle their level-of-detail. When this property is false, refinement terminates at these tiles, no matter what their current screen-space error. The tiles are available for physics, shadows, etc., but their level-of-detail may be very low. When set to true, these tiles are refined until they achieve the specified Culled Screen Space Error. This allows control over the minimum quality of these would-be-culled tiles."
)
bool cesium:suspendUpdate = false (
customData = {
string apiName = "suspendUpdate"
}
displayName = "Suspend Update"
doc = "Pauses level-of-detail and culling updates of this tileset."
)
bool cesium:smoothNormals = false (
customData = {
string apiName = "smoothNormals"
}
displayName = "Smooth Normals"
doc = "Generate smooth normals instead of flat normals when normals are missing."
)
bool cesium:showCreditsOnScreen = false (
customData = {
string apiName = "showCreditsOnScreen"
}
displayName = "Show Credits On Screen"
doc = "Whether or not to show this tileset's credits on screen."
)
float cesium:mainThreadLoadingTimeLimit = 0.0 (
customData = {
string apiName = "mainThreadLoadingTimeLimit"
}
displayName = "Main Thread Loading Time Limit"
doc = "A soft limit on how long (in milliseconds) to spend on the main-thread part of tile loading each frame. A value of 0.0 indicates that all pending main-thread loads should be completed each tick."
)
rel cesium:georeferenceBinding (
customData = {
string apiName = "georeferenceBinding"
}
displayName = "Georeference Binding"
doc = "Specifies which Cesium Georeference object to use for this tileset."
)
rel cesium:ionServerBinding (
customData = {
string apiName = "ionServerBinding"
}
displayName = "Cesium ion Server Binding"
doc = "Specifies which Cesium ion Server prim to use for this tileset."
)
rel cesium:rasterOverlayBinding (
customData = {
string apiName = "rasterOverlayBinding"
}
displayName = "Raster Overlay Binding"
doc = "Specifies which raster overlays to use for this tileset."
)
}
class "CesiumRasterOverlayPrim" (
doc = """Abstract base class for prims that represent a raster overlay."""
inherits = </Typed>
customData = {
string className = "RasterOverlay"
}
) {
uniform bool cesium:showCreditsOnScreen = false (
customData = {
string apiName = "showCreditsOnScreen"
}
displayName = "Show Credits on Screen"
doc = "Whether or not to show this raster overlay's credits on screen."
)
uniform float cesium:alpha = 1.0 (
customData = {
string apiName = "alpha"
}
displayName = "Alpha"
doc = "The alpha blending value, from 0.0 to 1.0, where 1.0 is fully opaque."
)
uniform token cesium:overlayRenderMethod = "overlay" (
customData = {
string apiName = "overlayRenderMethod"
}
allowedTokens = ["overlay", "clip"]
displayName = "Overlay Render Method"
doc = "The Cesium default material will give the raster overlay a different rendering treatment based on this selection."
)
uniform float cesium:maximumScreenSpaceError = 2.0 (
customData = {
string apiName = "maximumScreenSpaceError"
}
displayName = "Maximum Screen Space Error"
doc = "The maximum number of pixels of error when rendering this overlay. This is used to select an appropriate level-of-detail. When this property has its default value, 2.0, it means that raster overlay images will be sized so that, when zoomed in closest, a single pixel in the raster overlay maps to approximately 2x2 pixels on the screen."
)
uniform int cesium:maximumTextureSize = 2048 (
customData = {
string apiName = "maximumTextureSize"
}
displayName = "Maximum Texture Size"
doc = "The maximum texel size of raster overlay textures, in either direction. Images created by this overlay will be no more than this number of texels in either direction. This may result in reduced raster overlay detail in some cases."
)
uniform int cesium:maximumSimultaneousTileLoads = 20 (
customData = {
string apiName = "maximumSimultaneousTileLoads"
}
displayName = "Maximum Simultaneous Tile Loads"
doc = "The maximum number of overlay tiles that may simultaneously be in the process of loading."
)
uniform int cesium:subTileCacheBytes = 16777216 (
customData = {
string apiName = "subTileCacheBytes"
}
displayName = "Sub Tile Cache Bytes"
doc = "The maximum number of bytes to use to cache sub-tiles in memory. This is used by provider types, that have an underlying tiling scheme that may not align with the tiling scheme of the geometry tiles on which the raster overlay tiles are draped. Because a single sub-tile may overlap multiple geometry tiles, it is useful to cache loaded sub-tiles in memory in case they're needed again soon. This property controls the maximum size of that cache."
)
}
class CesiumIonRasterOverlayPrim "CesiumIonRasterOverlayPrim" (
doc = """Adds a prim for representing an ion raster overlay."""
inherits = </CesiumRasterOverlayPrim>
customData = {
string className = "IonRasterOverlay"
}
) {
int64 cesium:ionAssetId = 0 (
customData = {
string apiName = "ionAssetId"
}
displayName = "ion Asset ID"
doc = "The ID of the Cesium ion asset to use."
)
string cesium:ionAccessToken = "" (
customData = {
string apiName = "ionAccessToken"
}
displayName = "ion Access Token"
doc = "The access token to use to access the Cesium ion resource. Overrides the default token. Blank if using URL."
)
rel cesium:ionServerBinding (
customData = {
string apiName = "ionServerBinding"
}
displayName = "Cesium ion Server Binding"
doc = "Specifies which Cesium ion Server prim to use for this tileset."
)
}
class CesiumPolygonRasterOverlayPrim "CesiumPolygonRasterOverlayPrim" (
doc = """Adds a prim for representing a polygon raster overlay."""
inherits = </CesiumRasterOverlayPrim>
customData = {
string className = "PolygonRasterOverlay"
}
) {
rel cesium:cartographicPolygonBinding (
customData = {
string apiName = "cartographicPolygonBinding"
}
displayName = "Cartographic Polygon Binding"
doc = "Specifies which Cartographic Polygons to use in the raster overlay"
)
bool cesium:invertSelection = false (
customData = {
string apiName = "invertSelection"
}
displayName = "Invert Selection"
doc = "Whether to invert the selection specified by the polygons. If this is true, only the areas outside of the polygons will be rasterized."
)
bool cesium:excludeSelectedTiles = true (
customData = {
string apiName = "excludeSelectedTiles"
}
displayName = "Exclude Selected Tiles"
doc = "Whether tiles that fall entirely within the rasterized selection should be excluded from loading and rendering. For better performance, this should be enabled when this overlay will be used for clipping. But when this overlay is used for other effects, this option should be disabled to avoid missing tiles. Note that if InvertSelection is true, this will cull tiles that are outside of all the polygons. If it is false, this will cull tiles that are completely inside at least one polygon."
)
uniform token cesium:overlayRenderMethod = "clip"
}
class CesiumWebMapServiceRasterOverlayPrim "CesiumWebMapServiceRasterOverlayPrim" (
doc = """Adds a prim for representing a Web Map Service raster overlay."""
inherits = </CesiumRasterOverlayPrim>
customData = {
string className = "WebMapServiceRasterOverlay"
}
) {
string cesium:baseUrl = "" (
customData = {
string apiName = "baseUrl"
}
displayName = "Base URL"
doc = "The base url of the Web Map Service (WMS). e.g. https://services.ga.gov.au/gis/services/NM_Culture_and_Infrastructure/MapServer/WMSServer"
)
string cesium:layers = "1" (
customData = {
string apiName = "layers"
}
displayName = "Layers"
doc = "Comma-separated layer names to request from the server."
)
int cesium:tileWidth = 256 (
customData = {
string apiName = "tileWidth"
}
displayName = "Tile Width"
doc = "Image width"
)
int cesium:tileHeight = 256 (
customData = {
string apiName = "tileHeight"
}
displayName = "Tile Height"
doc = "Image height"
)
int cesium:minimumLevel = 0 (
customData = {
string apiName = "minimumLevel"
}
displayName = "Minimum Level"
doc = "Take care when specifying this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely to result in rendering problems."
)
int cesium:maximumLevel = 14 (
customData = {
string apiName = "maximumLevel"
}
displayName = "Maximum Level"
doc = "Maximum zoom level."
)
}
class CesiumTileMapServiceRasterOverlayPrim "CesiumTileMapServiceRasterOverlayPrim" (
doc = """Adds a prim for representing a Tile Map Service (TMS) raster overlay."""
inherits = </CesiumRasterOverlayPrim>
customData = {
string className = "TileMapServiceRasterOverlay"
}
) {
string cesium:url = "" (
customData = {
string apiName = "url"
}
displayName = "Url"
doc = "The base url of the Tile Map Service (TMS)."
)
bool cesium:specifyZoomLevels = false (
customData = {
string apiName = "specifyZoomLevels"
}
displayName = "Specify Zoom Levels"
doc = "True to directly specify minum and maximum zoom levels available from the server, or false to automatically determine the minimum and maximum zoom levels from the server's tilemapresource.xml file."
)
int cesium:minimumZoomLevel = 0 (
customData = {
string apiName = "minimumZoomLevel"
}
displayName = "Minimum Zoom Level"
doc = "Minimum zoom level"
)
int cesium:maximumZoomLevel = 10 (
customData = {
string apiName = "maximumZoomLevel"
}
displayName = "Maximum Zoom Level"
doc = "Maximum zoom level"
)
}
class CesiumWebMapTileServiceRasterOverlayPrim "CesiumWebMapTileServiceRasterOverlayPrim" (
doc = """Adds a prim for representing a Web Map Tile Service (WMTS) raster overlay."""
inherits = </CesiumRasterOverlayPrim>
customData = {
string className = "WebMapTileServiceRasterOverlay"
}
) {
string cesium:url = "" (
customData = {
string apiName = "url"
}
displayName = "Url"
doc = "The base url of the Web Map Tile Service (WMTS)."
)
string cesium:layer = "" (
customData = {
string apiName = "layer"
}
displayName = "Layer"
doc = "Layer name."
)
string cesium:style = "" (
customData = {
string apiName = "style"
}
displayName = "Style"
doc = "Style."
)
string cesium:format = "image/jpeg" (
customData = {
string apiName = "format"
}
displayName = "Format"
doc = "Format."
)
string cesium:tileMatrixSetId = "" (
customData = {
string apiName = "tileMatrixSetId"
}
displayName = "Tile Matrix Set ID"
doc = "Tile Matrix Set ID"
)
bool cesium:specifyTileMatrixSetLabels = false (
customData = {
string apiName = "specifyTileMatrixSetLabels"
}
displayName = "Specify Tile Matrix Set Labels"
doc = "True to specify tile matrix set labels manually, or false to automatically determine from level and prefix."
)
string cesium:tileMatrixSetLabelPrefix = "" (
customData = {
string apiName = "tileMatrixSetLabelPrefix"
}
displayName = "Tile Matrix Set Label Prefix"
doc = 'Prefix for tile matrix set labels. For instance, setting "EPSG:4326:" as prefix generates label list ["EPSG:4326:0", "EPSG:4326:1", "EPSG:4326:2", ...]'
)
string cesium:tileMatrixSetLabels (
customData = {
string apiName = "tileMatrixSetLabels"
}
displayName = "Tile Matrix Set Labels"
doc = "Comma-separated tile matrix set labels"
)
bool cesium:useWebMercatorProjection = true (
customData = {
string apiName = "useWebMercatorProjection"
}
displayName = "Use Web Mercator Projection"
doc = "False to use geographic projection, true to use webmercator projection. For instance, EPSG:4326 uses geographic and EPSG:3857 uses webmercator."
)
bool cesium:specifyTilingScheme = false (
customData = {
string apiName = "specifyTilingScheme"
}
displayName = "Specify Tiling Scheme"
doc = "True to specify quadtree tiling scheme according to projection and bounding rectangle, or false to automatically determine from projection."
)
int cesium:rootTilesX = 1 (
customData = {
string apiName = "rootTilesX"
}
displayName = "Root Tiles X"
doc = "Tile number corresponding to TileCol, also known as TileMatrixWidth"
)
int cesium:rootTilesY = 1 (
customData = {
string apiName = "rootTilesY"
}
displayName = "Root Tiles Y"
doc = "Tile number corresponding to TileRow, also known as TileMatrixHeight"
)
double cesium:west = -180 (
customData = {
string apiName = "west"
}
displayName = "West"
doc = "The longitude of the west boundary on globe in degrees, in the range [-180, 180]"
)
double cesium:east = 180 (
customData = {
string apiName = "east"
}
displayName = "East"
doc = "The longitude of the east boundary on globe in degrees, in the range [-180, 180]"
)
double cesium:south = -90 (
customData = {
string apiName = "south"
}
displayName = "South"
doc = "The longitude of the south boundary on globe in degrees, in the range [-90, 90]"
)
double cesium:north = 90 (
customData = {
string apiName = "north"
}
displayName = "North"
doc = "The longitude of the north boundary on globe in degrees, in the range [-90, 90]"
)
bool cesium:specifyZoomLevels = false (
customData = {
string apiName = "specifyZoomLevels"
}
displayName = "Specify Zoom Levels"
doc = "True to directly specify minum and maximum zoom levels available from the server, or false to automatically determine the minimum and maximum zoom levels from the server's tilemapresource.xml file."
)
int cesium:minimumZoomLevel = 0 (
customData = {
string apiName = "minimumZoomLevel"
}
displayName = "Minimum Zoom Level"
doc = "Minimum zoom level"
)
int cesium:maximumZoomLevel = 25 (
customData = {
string apiName = "maximumZoomLevel"
}
displayName = "Maximum Zoom Level"
doc = "Maximum zoom level"
)
}
class "CesiumGlobeAnchorSchemaAPI" (
doc = """Adds Globe Anchoring information to a Prim for use with Cesium for Omniverse."""
inherits = </APISchemaBase>
customData = {
string className = "GlobeAnchorAPI"
token apiSchemaType = "singleApply"
}
) {
bool cesium:anchor:adjustOrientationForGlobeWhenMoving = true (
customData = {
string apiName = "adjustOrientationForGlobeWhenMoving"
}
displayName = "Adjust Orientation for Globe when Moving"
doc = "Gets or sets whether to adjust the Prim's orientation based on globe curvature as the game object moves."
)
bool cesium:anchor:detectTransformChanges = true (
customData = {
string apiName = "detectTransformChanges"
}
displayName = "Detect Transform Changes"
doc = "Gets or sets whether to automatically detect changes in the Prim's transform and update the precise globe coordinates accordingly."
)
double cesium:anchor:longitude = 0.0 (
customData = {
string apiName = "anchorLongitude"
}
displayName = "Longitude"
doc = "The longitude in degrees, in the range [-180, 180]."
)
double cesium:anchor:latitude = 0.0 (
customData = {
string apiName = "anchorLatitude"
}
displayName = "Latitude"
doc = "The latitude in degrees, in the range [-90, 90]."
)
double cesium:anchor:height = 0.0 (
customData = {
string apiName = "anchorHeight"
}
displayName = "Height"
doc = "The height in meters above the ellipsoid."
)
double3 cesium:anchor:position = (0.0, 0.0, 0.0) (
customData = {
string apiName = "position"
}
displayName = "Position (ECEF)"
doc = "The actual position of the globally anchored prim in the ECEF coordinate system."
)
rel cesium:anchor:georeferenceBinding (
customData = {
string apiName = "georeferenceBinding"
}
displayName = "Georeference Origin Binding"
doc = "The Georeference Origin prim used for the globe anchor calculations."
)
}
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/doc/CHANGES.md | # Change Log
### v0.1.0 - 2023-03-20
- Split the Cesium USD plugins into a separate extension.
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/doc/README.md | # Cesium for Omniverse USD Plugins
Supporting package for Cesium for Omniverse containing Cesium's USD plugins and schemas.
|
CesiumGS/cesium-omniverse/exts/cesium.usd.plugins/config/extension.toml | [core]
# Load after omni.usd.libs (-1000) and before omni.usd (0)
# See https://docs.omniverse.nvidia.com/py/kit/docs/guide/usd_schema.html
order = -100
[package]
version = "0.4.0"
category = "simulation"
feature = false
app = false
title = "Cesium for Omniverse USD Plugins"
description = "Supporting USD Plugins for Cesium for Omniverse"
authors = "Cesium GS Inc."
repository = "https://github.com/CesiumGS/cesium-omniverse"
keywords = [
"cesium",
"omniverse",
"geospatial",
"3D Tiles",
"glTF",
"globe",
"earth",
"simulation",
]
toggleable = false
# Paths are relative to the extension folder
changelog = "doc/CHANGES.md"
readme = "doc/README.md"
preview_image = "doc/images/preview.jpg"
icon = "doc/images/icon.png"
[package.target]
kit = ["105.1"]
[package.writeTarget]
kit = true
python = false
# Which extensions this extension depends on
[dependencies]
"omni.usd.libs" = {}
# Main python module this extension provides, it will be publicly available as "import cesium.usd.plugins"
[[python.module]]
name = "cesium.usd.plugins"
[[native.library]]
path = "bin/${lib_prefix}CesiumUsdSchemas${lib_ext}"
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/extension.py | import os
import omni.ext
import omni.usd
import omni.kit.ui
import omni.kit.app
from .bindings import acquire_cesium_omniverse_tests_interface, release_cesium_omniverse_tests_interface
class CesiumOmniverseCppTestsExtension(omni.ext.IExt):
def __init__(self):
super().__init__()
self.tests_set_up = False
self.frames_since_stage_opened = 0
self.frame_count_delta = 0
self.frames_between_setup_and_tests = 15
def on_startup(self):
print("Starting Cesium Tests Extension...")
global tests_interface
tests_interface = acquire_cesium_omniverse_tests_interface()
tests_interface.on_startup(os.path.join(os.path.dirname(__file__), "../../../../../cesium.omniverse"))
update_stream = omni.kit.app.get_app().get_update_event_stream()
# To ensure the tests only run after the stage has been opened, we
# attach a handler to an event that occurs every frame. That handler
# checks if the stage has opened, runs once, then detaches itself
self._run_once_sub = update_stream.create_subscription_to_pop(
self.run_once_after_stage_opens, name="Run once after stage opens"
)
print("Started Cesium Tests Extension.")
def run_once_after_stage_opens(self, _):
# wait until the USD stage is fully set up
if omni.usd.get_context().get_stage_state() == omni.usd.StageState.OPENED:
# set up tests on one frame, then run the tests on the next frame
# note we can't use wait_n_frames here as this is a subscribed function
# so it cannot be async
if not self.tests_set_up:
self.tests_set_up = True
print("Beginning Cesium Tests Extension tests")
stageId = omni.usd.get_context().get_stage_id()
tests_interface.set_up_tests(stageId)
self.frame_count_delta = 1
elif self.frames_since_stage_opened >= self.frames_between_setup_and_tests:
# unsubscribe so there's no way the next frame triggers another run
self._run_once_sub.unsubscribe()
tests_interface.run_all_tests()
print("Cesium Tests Extension tests complete")
self.frames_since_stage_opened += self.frame_count_delta
def on_shutdown(self):
print("Stopping Cesium Tests Extension...")
tests_interface.on_shutdown()
release_cesium_omniverse_tests_interface(tests_interface)
print("Stopped Cesium Tests Extension.")
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/__init__.py | from .extension import * # noqa: F401 F403
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/__init__.py | from .CesiumOmniverseCppTestsPythonBindings import * # noqa: F401 F403
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse.cpp.tests/cesium/omniverse/cpp/tests/bindings/CesiumOmniverseCppTestsPythonBindings.pyi | class ICesiumOmniverseCppTestsInterface:
def __init__(self, *args, **kwargs) -> None: ...
def on_shutdown(self) -> None: ...
def on_startup(self, arg0: str) -> None: ...
def run_all_tests(self) -> None: ...
def set_up_tests(self, arg0: int) -> None: ...
def acquire_cesium_omniverse_tests_interface(
plugin_name: str = ..., library_path: str = ...
) -> ICesiumOmniverseCppTestsInterface: ...
def release_cesium_omniverse_tests_interface(arg0: ICesiumOmniverseCppTestsInterface) -> None: ...
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse.cpp.tests/doc/README.md | # Cesium for Omniverse Tests Extension
This extension is designed to run tests against the Cesium for Omniverse Extension.
## License
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html). Cesium for Omniverse is free for both commercial and non-commercial use.
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse.cpp.tests/config/extension.toml | [package]
version = "0.1.0"
category = "simulation"
feature = false
app = false
title = "Cesium for Omniverse Tests"
description = "An extention to run tests against Cesium for Omniverse."
authors = "Cesium GS Inc."
repository = "https://github.com/CesiumGS/cesium-omniverse"
keywords = [
"cesium",
"omniverse",
"geospatial",
"3D Tiles",
"glTF",
"globe",
"earth",
"simulation",
"test",
]
# Paths are relative to the extension folder
readme = "doc/README.md"
preview_image = "doc/resources/icon.png"
icon = "doc/resources/icon.png"
[package.target]
kit = ["105.*"]
# Which extensions this extension depends on
[dependencies]
"cesium.usd.plugins" = {}
"usdrt.scenegraph" = {}
# Main python module this extension provides, it will be publicly available as "import cesium.omniverse"
[[python.module]]
name = "cesium.omniverse.cpp.tests"
[[native.plugin]]
path = "bin/cesium.omniverse.cpp.tests.plugin"
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/premake5.lua | local ext = get_current_extension_info()
project_ext (ext)
-- Link only those files and folders into the extension target directory
repo_build.prebuild_link { "bin", ext.target_dir.."/bin" }
repo_build.prebuild_link { "certs", ext.target_dir.."/certs" }
repo_build.prebuild_link { "cesium", ext.target_dir.."/cesium" }
repo_build.prebuild_link { "doc", ext.target_dir.."/doc" }
repo_build.prebuild_link { "images", ext.target_dir.."/images" }
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/mdl/cesium.mdl | mdl 1.8;
import ::anno::*;
import ::state::*;
import ::tex::*;
import ::scene::*;
import ::math::*;
using ::gltf::pbr import *;
module [[
anno::version( 1, 0, 0),
anno::display_name("Cesium MDL functions")
]];
annotation annotation_not_connectable();
export const auto DEFAULT_NULL_FEATURE_ID = -1;
export const auto DEFAULT_PROPERTY_VALUE_INT = 0;
export const auto DEFAULT_PROPERTY_VALUE_INT2 = int2(0);
export const auto DEFAULT_PROPERTY_VALUE_INT3 = int3(0);
export const auto DEFAULT_PROPERTY_VALUE_INT4 = int4(0);
export const auto DEFAULT_PROPERTY_VALUE_FLOAT = 0.0;
export const auto DEFAULT_PROPERTY_VALUE_FLOAT2 = float2(0.0);
export const auto DEFAULT_PROPERTY_VALUE_FLOAT3 = float3(0.0);
export const auto DEFAULT_PROPERTY_VALUE_FLOAT4 = float4(0.0);
const auto DEFAULT_CHANNELS = int4(0, 1, 2, 3);
export enum up_axis_mode {
Y,
Z
};
//-----------------------------------
// Internal helper functions
//-----------------------------------
float2 world_coordinate_2d(float2 min_world, float2 max_world, up_axis_mode up_axis)
{
// Get the world pos of the pixel
auto world_pos = state::transform_vector(state::coordinate_internal, state::coordinate_world, state::position());
auto world_pos_horizontal = float2(world_pos.x, up_axis == Y ? world_pos.z : world_pos.y);
// Return 0-1 UVs based on the min/max world coordinates provided
return (world_pos_horizontal - min_world) / (max_world - min_world);
}
float4 alpha_blend(float4 src, float4 dst) {
return src * float4(src.w, src.w, src.w, 1.0) + dst * (1.0 - src.w);
}
float4 compute_base_color(
color base_color_factor,
float base_alpha,
float4 base_color_texture,
float4 raster_overlay,
float4 tile_color,
float alpha_clip) {
if (alpha_clip > 0.5) return float4(0.0);
auto base_color_factor_float3 = float3(base_color_factor);
auto base_color = float4(1.0);
base_color = alpha_blend(base_color_texture, base_color);
base_color *= float4(base_color_factor_float3.x, base_color_factor_float3.y, base_color_factor_float3.z, base_alpha);
base_color *= scene::data_lookup_float4("COLOR_0", float4(1.0));
base_color = alpha_blend(raster_overlay, base_color);
base_color *= tile_color;
return base_color;
}
// Copied from gltf/pbr.mdl since it's not exported
float2 khr_texture_transform_apply(
float2 coord,
float2 offset,
float rotation,
float2 scale
)
{
// MDL expects the texture coordinate origin at the bottom left (gltf at top left)
// Assuming the renderer follows the MDL specification in which case the coordinates
// have been flipped either while loading the glTF geometry or while setting up the state.
// Undo the flipping for the transformation to get into the original glTF texture space.
coord = float2(coord.x, 1.0f - coord.y);
// first scale
coord = coord * scale;
// then rotate
float cos_rotation = math::cos(rotation);
float sin_rotation = math::sin(rotation);
coord = float2(cos_rotation * coord.x + sin_rotation * coord.y, cos_rotation * coord.y - sin_rotation * coord.x);
// then translate
coord = coord + offset;
// flip back
coord = float2(coord.x, 1.0f - coord.y);
return coord;
}
int mod(int a, int n) {
return (a % n + n) % n;
}
int mirror(int a) {
return a >= 0 ? a : -(1 + a);
}
int apply_mirrored_repeat(int x, int size) {
return (size - 1) - mirror(mod(x, 2 * size) - size);
}
int apply_clamp_to_edge(int x, int size) {
return math::clamp(x, 0, size - 1);
}
int apply_repeat(int x, int size) {
return mod(x, size);
}
struct texel_fetch_value_int
{
bool valid = false;
int4 value = int4(0, 0, 0, 0);
};
texel_fetch_value_int texel_fetch_int(
uniform texture_2d texture,
int2 pixel_index,
)
{
texel_fetch_value_int tex_ret;
if (!tex::texture_isvalid(texture)) {
return tex_ret;
}
// texel_int4 doesn't exist in MDL so use texel_float4 instead.
// texel_float4 only works with float or unorm texture formats, so integer values
// must be converted to one of these formats. This causes precision loss for
// values above 2^24 which can't be accuracutely represented with float32.
auto value = tex::texel_float4(
tex: texture,
coord: pixel_index);
tex_ret.value = int4(math::round(value));
tex_ret.valid = true;
return tex_ret;
}
struct texel_fetch_value_float
{
bool valid = false;
float4 value = float4(0.0, 0.0, 0.0, 0.0);
};
texel_fetch_value_float texel_fetch_float(
uniform texture_2d texture,
int2 pixel_index,
)
{
texel_fetch_value_float tex_ret;
if (!tex::texture_isvalid(texture)) {
return tex_ret;
}
auto value = tex::texel_float4(
tex: texture,
coord: pixel_index);
tex_ret.value = value;
tex_ret.valid = true;
return tex_ret;
}
// Modified version of gltf_texture_lookup that uses texel_float4 instead of lookup_float4 to avoid
// linearly interpolating texture values which would be incorrect for feature ID textures and
// property textures. Unfortunately texel_float4 doesn't do texcoord wrapping so we need to do it ourselves.
texel_fetch_value_int texel_fetch_int_rgba8_unorm(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t
)
{
texel_fetch_value_int tex_ret;
if (!tex::texture_isvalid(texture)) {
return tex_ret;
}
auto tex_coord3 = state::texture_coordinate(tex_coord_index);
auto tex_coord = khr_texture_transform_apply(
coord: float2(tex_coord3.x, tex_coord3.y),
offset: tex_coord_offset,
rotation: tex_coord_rotation,
scale: tex_coord_scale);
auto width = tex::width(texture);
auto height = tex::height(texture);
auto pixel_x = int(tex_coord.x * width);
auto pixel_y = int(tex_coord.y * height);
switch (wrap_s) {
case clamp_to_edge:
pixel_x = apply_clamp_to_edge(pixel_x, width);
break;
case mirrored_repeat:
pixel_x = apply_mirrored_repeat(pixel_x, width);
break;
case repeat:
pixel_x = apply_repeat(pixel_x, width);
break;
}
switch (wrap_t) {
case clamp_to_edge:
pixel_y = apply_clamp_to_edge(pixel_y, height);
break;
case mirrored_repeat:
pixel_y = apply_mirrored_repeat(pixel_y, height);
break;
case repeat:
pixel_y = apply_repeat(pixel_y, height);
break;
}
auto value = tex::texel_float4(
tex: texture,
coord: int2(pixel_x, pixel_y));
// Assumes 8-bit per-channel texture
tex_ret.value = int4(math::round(value * 255.0));
tex_ret.valid = true;
return tex_ret;
}
int unpack_channels(int4 value, int4 channels, int channel_count) {
auto unpacked_value = 0;
for (int i = 0; i < channel_count; i++) {
unpacked_value |= (value[channels[i]] << (i * 8));
}
return unpacked_value;
}
int read_channels_int(int4 values, int4 channels) {
return values[channels[0]];
}
int2 read_channels_int2(int4 values, int4 channels) {
return int2(values[channels[0]], values[channels[1]]);
}
int3 read_channels_int3(int4 values, int4 channels) {
return int3(values[channels[0]], values[channels[1]], values[channels[2]]);
}
int4 read_channels_int4(int4 values, int4 channels) {
return int4(values[channels[0]], values[channels[1]], values[channels[2]], values[channels[3]]);
}
float read_channels_float(float4 values, int4 channels) {
return values[channels[0]];
}
float2 read_channels_float2(float4 values, int4 channels) {
return float2(values[channels[0]], values[channels[1]]);
}
float3 read_channels_float3(float4 values, int4 channels) {
return float3(values[channels[0]], values[channels[1]], values[channels[2]]);
}
float4 read_channels_float4(float4 values, int4 channels) {
return float4(values[channels[0]], values[channels[1]], values[channels[2]], values[channels[3]]);
}
// The normalize functions work for both signed and unsigned ints
float normalize_int(int value, int maximum_value) {
return math::max(float(value) / float(maximum_value), -1.0);
}
float2 normalize_int2(int2 value, int2 maximum_value) {
return math::max(float2(value) / float2(maximum_value), float2(-1.0));
}
float3 normalize_int3(int3 value, int3 maximum_value) {
return math::max(float3(value) / float3(maximum_value), float3(-1.0));
}
float4 normalize_int4(int4 value, int4 maximum_value) {
return math::max(float4(value) / float4(maximum_value), float4(-1.0));
}
int finalize_int(int raw_value, bool has_no_data, int no_data, int default_value) {
auto is_no_data = has_no_data && raw_value == no_data;
return is_no_data ? default_value : raw_value;
}
int2 finalize_int2(int2 raw_value, bool has_no_data, int2 no_data, int2 default_value) {
auto is_no_data = has_no_data && raw_value == no_data;
return is_no_data ? default_value : raw_value;
}
int3 finalize_int3(int3 raw_value, bool has_no_data, int3 no_data, int3 default_value) {
auto is_no_data = has_no_data && raw_value == no_data;
return is_no_data ? default_value : raw_value;
}
int4 finalize_int4(int4 raw_value, bool has_no_data, int4 no_data, int4 default_value) {
auto is_no_data = has_no_data && raw_value == no_data;
return is_no_data ? default_value : raw_value;
}
float finalize_normalized_int(int raw_value, bool has_no_data, int no_data, float default_value, float offset, float scale, int maximum_value) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto normalized_value = normalize_int(raw_value, maximum_value);
auto transformed_value = normalized_value * scale + offset;
return transformed_value;
}
float2 finalize_normalized_int2(int2 raw_value, bool has_no_data, int2 no_data, float2 default_value, float2 offset, float2 scale, int2 maximum_value) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto normalized_value = normalize_int2(raw_value, maximum_value);
auto transformed_value = normalized_value * scale + offset;
return transformed_value;
}
float3 finalize_normalized_int3(int3 raw_value, bool has_no_data, int3 no_data, float3 default_value, float3 offset, float3 scale, int3 maximum_value) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto normalized_value = normalize_int3(raw_value, maximum_value);
auto transformed_value = normalized_value * scale + offset;
return transformed_value;
}
float4 finalize_normalized_int4(int4 raw_value, bool has_no_data, int4 no_data, float4 default_value, float4 offset, float4 scale, int4 maximum_value) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto normalized_value = normalize_int4(raw_value, maximum_value);
auto transformed_value = normalized_value * scale + offset;
return transformed_value;
}
float finalize_float(float raw_value, bool has_no_data, float no_data, float default_value, float offset, float scale) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto transformed_value = raw_value * scale + offset;
return transformed_value;
}
float2 finalize_float2(float2 raw_value, bool has_no_data, float2 no_data, float2 default_value, float2 offset, float2 scale) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto transformed_value = raw_value * scale + offset;
return transformed_value;
}
float3 finalize_float3(float3 raw_value, bool has_no_data, float3 no_data, float3 default_value, float3 offset, float3 scale) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto transformed_value = raw_value * scale + offset;
return transformed_value;
}
float4 finalize_float4(float4 raw_value, bool has_no_data, float4 no_data, float4 default_value, float4 offset, float4 scale) {
auto is_no_data = has_no_data && raw_value == no_data;
if (is_no_data) {
return default_value;
}
auto transformed_value = raw_value * scale + offset;
return transformed_value;
}
int2 get_property_table_pixel_index(int feature_id, uniform texture_2d property_table_texture) {
auto width = tex::width(property_table_texture);
auto pixel_x = feature_id % width;
auto pixel_y = feature_id / width;
return int2(pixel_x, pixel_y);
}
//-----------------------------------
// Exported functions (public)
//-----------------------------------
export float4 cesium_lookup_world_texture_float4(
uniform texture_2d texture = texture_2d(),
float2 min_world = float2(-5000.0, -5000.0),
float2 max_world = float2(5000.0, 5000.0),
up_axis_mode up_axis = Y)
[[
anno::display_name("Cesium world-mapped texture lookup float4"),
anno::description("Returns float4 from a texture mapped to world UV coordinates"),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return tex::lookup_float4(
tex: texture,
coord: world_coordinate_2d(min_world, max_world, up_axis),
wrap_u: tex::wrap_clamp,
wrap_v: tex::wrap_clamp);
}
export float3 cesium_lookup_world_texture_float3(
uniform texture_2d texture = texture_2d(),
float2 min_world = float2(-5000.0, -5000.0),
float2 max_world = float2(5000.0, 5000.0),
up_axis_mode up_axis = Y)
[[
anno::display_name("Cesium world-mapped texture lookup float3"),
anno::description("Returns float3 from a texture mapped to world UV coordinates"),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return tex::lookup_float3(
tex: texture,
coord: world_coordinate_2d(min_world, max_world, up_axis),
wrap_u: tex::wrap_clamp,
wrap_v: tex::wrap_clamp);
}
export color cesium_lookup_world_texture_color(
uniform texture_2d texture = texture_2d(),
float2 min_world = float2(-5000.0, -5000.0),
float2 max_world = float2(5000.0, 5000.0),
up_axis_mode up_axis = Y)
[[
anno::display_name("Cesium world-mapped texture lookup color"),
anno::description("Returns color from a texture mapped to world UV coordinates"),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return tex::lookup_color(
tex: texture,
coord: world_coordinate_2d(min_world, max_world, up_axis),
wrap_u: tex::wrap_clamp,
wrap_v: tex::wrap_clamp);
}
export float4 cesium_base_color_texture_float4(
gltf_texture_lookup_value base_color_texture = gltf_texture_lookup_value()
[[
anno::hidden(),
annotation_not_connectable()
]]
)
[[
anno::display_name("Cesium base color texture lookup float4"),
anno::description("Returns the base color texture as a float4. Returns [0, 0, 0, 0] if the base color texture does not exist."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return base_color_texture.valid ? base_color_texture.value : float4(0.0);
}
export float4 cesium_raster_overlay_float4(
gltf_texture_lookup_value raster_overlay = gltf_texture_lookup_value()
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform int raster_overlay_index = 0
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium raster overlay lookup float4"),
anno::description("Returns the raster overlay at the given index as a float4. Returns [0, 0, 0, 0] if the raster overlay does not exist."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return raster_overlay.valid ? raster_overlay.value : float4(0.0);
}
export int cesium_feature_id_int(
int feature_id = DEFAULT_NULL_FEATURE_ID
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform int feature_id_set_index = 0
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium feature ID lookup int"),
anno::description("Returns the feature ID for the given feature ID set. Returns -1 if the feature ID set does not exist or the feature ID is equal to nullFeatureId in the EXT_mesh_features extension."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return feature_id;
}
export int cesium_property_int(
int property_value = DEFAULT_PROPERTY_VALUE_INT
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup int"),
anno::description("Returns the property value. Returns 0 if the property does not exist or is an incompatible type. Must be a scalar unnormalized integer type. Values that exceed the 32-bit signed integer range are clamped."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export int2 cesium_property_int2(
int2 property_value = DEFAULT_PROPERTY_VALUE_INT2
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup int2"),
anno::description("Returns the property value. Returns int2(0) if the property does not exist or is an incompatible type. Must be a 2-component unnormalized integer. Values that exceed the 32-bit signed integer range are clamped."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export int3 cesium_property_int3(
int3 property_value = DEFAULT_PROPERTY_VALUE_INT3
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup int3"),
anno::description("Returns the property value. Returns int3(0) if the property does not exist or is an incompatible type. Must be a 3-component unnormalized integer. Values that exceed the 32-bit signed integer range are clamped."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export int4 cesium_property_int4(
int4 property_value = DEFAULT_PROPERTY_VALUE_INT4
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup int4"),
anno::description("Returns the property value. Returns int4(0) if the property does not exist or is an incompatible type. Must be a 4-component unnormalized integer. Values that exceed the 32-bit signed integer range are clamped."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export float cesium_property_float(
float property_value = DEFAULT_PROPERTY_VALUE_FLOAT
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup float"),
anno::description("Returns the property value. Returns 0.0 if the property does not exist or is an incompatible type. Must be a scalar floating point or normalized integer type. 64-bit floating point values are converted to 32-bit floating point values."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export float2 cesium_property_float2(
float2 property_value = DEFAULT_PROPERTY_VALUE_FLOAT2
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup float2"),
anno::description("Returns the property value. Returns float2(0.0) if the property does not exist or is an incompatible type. Must be a 2-component floating point or normalized integer type. 64-bit floating point values are converted to 32-bit floating point values."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export float3 cesium_property_float3(
float3 property_value = DEFAULT_PROPERTY_VALUE_FLOAT3
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup float3"),
anno::description("Returns the property value. Returns float3(0.0) if the property does not exist or is an incompatible type. Must be a 3-component floating point or normalized integer type. 64-bit floating point values are converted to 32-bit floating point values."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export float4 cesium_property_float4(
float4 property_value = DEFAULT_PROPERTY_VALUE_FLOAT4
[[
anno::hidden(),
annotation_not_connectable()
]],
uniform string property_id = string("")
[[
anno::unused()
]]
)
[[
anno::display_name("Cesium property lookup float4"),
anno::description("Returns the property value. Returns float4(0.0) if the property does not exist or is an incompatible type. Must be a 4-component floating point or normalized integer type. 64-bit floating point values are converted to 32-bit floating point values."),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]]
{
return property_value;
}
export material cesium_material(
color base_color_factor = color(1.0)
[[
anno::display_name("Base Color Factor"),
anno::description("The base color of the material.")
]],
float metallic_factor = 0.0
[[
anno::hard_range(0.0, 1.0),
anno::display_name("Metallic Factor"),
anno::description("The metalness of the material. Select between dielectric (0.0) and metallic (1.0).")
]],
float roughness_factor = 1.0
[[
anno::hard_range(0.0, 1.0),
anno::display_name("Roughness Factor"),
anno::description("The roughness of the material. Select between very glossy (0.0) and dull (1.0).")
]],
color emissive_factor = color(0.0)
[[
anno::display_name("Emissive Factor"),
anno::description("The emissive color of the material.")
]],
uniform gltf_alpha_mode alpha_mode = opaque
[[
anno::display_name("Alpha Mode"),
anno::description("Select how to interpret the alpha value.")
]],
float base_alpha = 1.0
[[
anno::hard_range(0.0, 1.0),
anno::display_name("Base Alpha"),
anno::description("Select between transparent (0.0) and opaque (1.0)."),
anno::enable_if("alpha_mode!=opaque")
]],
uniform float alpha_cutoff = 0.5
[[
anno::hard_range(0.0, 1.0),
anno::display_name("Alpha Cutoff"),
anno::description("Threshold to decide between fully transparent and fully opaque when alpha mode is 'mask'."),
anno::enable_if("alpha_mode==mask")
]]
) [[
anno::display_name("Cesium PBR material"),
anno::description("Cesium metallic-roughness material based off glTF PBR model"),
anno::author("Cesium GS Inc."),
anno::in_group("Cesium")
]] = let {
auto base_color = float3(base_color_factor);
auto emissive = float3(emissive_factor);
// We can't pass varyings (things not marked "uniform") to uniforms like base_color_factor, base_alpha, etc
// To work around this, treat them as if they were texture values, which are varying.
// If you look at gltf/pbr.mdl the math works out the same in either case.
//
// Previously our inputs were marked "uniform" but this caused a bunch of warnings like:
// uniform parameter 'base_color_factor' of material got varying attachment
material base = gltf_material(
base_color_texture: gltf_texture_lookup_value(true, float4(base_color.x, base_color.y, base_color.z, base_alpha)),
metallic_roughness_texture: gltf_texture_lookup_value(true, float4(1.0, roughness_factor, metallic_factor, 1.0)),
emissive_texture: gltf_texture_lookup_value(true, float4(emissive.x, emissive.y, emissive.z, 1.0)),
alpha_mode: alpha_mode,
alpha_cutoff: alpha_cutoff
);
} in material(
thin_walled: base.thin_walled,
surface: base.surface,
volume: base.volume,
ior: base.ior,
geometry: base.geometry
);
//-----------------------------------
// Exported functions (private)
//-----------------------------------
export int cesium_internal_feature_id_texture_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform int channel_count,
uniform int null_feature_id
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_NULL_FEATURE_ID;
}
// Feature IDs can be packed in multiple channels of the texture
auto feature_id = unpack_channels(texel_value.value, channels, channel_count);
return feature_id == null_feature_id ? DEFAULT_NULL_FEATURE_ID : feature_id;
}
export int cesium_internal_feature_id_attribute_lookup(
uniform string primvar_name,
uniform int null_feature_id
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_NULL_FEATURE_ID;
}
// Even if all feature ids in a triangle are the same value, the primvar interpolation math can yield non integer
// results (e.g. 0.99999999 or 1.00000001), which when accessed as ints (i.e. floored) can cause variance across
// the triangle surface. The fix is to read the primvar as a float, round the value, and cast to int.
auto feature_id = int(::math::round(::scene::data_lookup_float(primvar_name)));
return feature_id == null_feature_id ? DEFAULT_NULL_FEATURE_ID : feature_id;
}
// See comment in DataType.h for why these are data_lookup_float instead of data_lookup_int
export int cesium_internal_property_attribute_int_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int no_data,
uniform int default_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_INT;
}
auto raw_value = int(::math::round(::scene::data_lookup_float(primvar_name)));
return finalize_int(raw_value, has_no_data, no_data, default_value);
}
export int2 cesium_internal_property_attribute_int2_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int2 no_data,
uniform int2 default_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_INT2;
}
auto raw_value = int2(::math::round(::scene::data_lookup_float2(primvar_name)));
return finalize_int2(raw_value, has_no_data, no_data, default_value);
}
export int3 cesium_internal_property_attribute_int3_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int3 no_data,
uniform int3 default_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_INT3;
}
auto raw_value = int3(::math::round(::scene::data_lookup_float3(primvar_name)));
return finalize_int3(raw_value, has_no_data, no_data, default_value);
}
export int4 cesium_internal_property_attribute_int4_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int4 no_data,
uniform int4 default_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_INT4;
}
auto raw_value = int4(::math::round(::scene::data_lookup_float4(primvar_name)));
return finalize_int4(raw_value, has_no_data, no_data, default_value);
}
export float cesium_internal_property_attribute_normalized_int_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int no_data,
uniform float default_value,
uniform float offset,
uniform float scale,
uniform int maximum_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT;
}
auto raw_value = int(::math::round(::scene::data_lookup_float(primvar_name)));
return finalize_normalized_int(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float2 cesium_internal_property_attribute_normalized_int2_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int2 no_data,
uniform float2 default_value,
uniform float2 offset,
uniform float2 scale,
uniform int2 maximum_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT2;
}
auto raw_value = int2(::math::round(::scene::data_lookup_float2(primvar_name)));
return finalize_normalized_int2(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float3 cesium_internal_property_attribute_normalized_int3_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int3 no_data,
uniform float3 default_value,
uniform float3 offset,
uniform float3 scale,
uniform int3 maximum_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT3;
}
auto raw_value = int3(::math::round(::scene::data_lookup_float3(primvar_name)));
return finalize_normalized_int3(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float4 cesium_internal_property_attribute_normalized_int4_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform int4 no_data,
uniform float4 default_value,
uniform float4 offset,
uniform float4 scale,
uniform int4 maximum_value
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT4;
}
auto raw_value = int4(::math::round(::scene::data_lookup_float4(primvar_name)));
return finalize_normalized_int4(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float cesium_internal_property_attribute_float_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform float no_data,
uniform float default_value,
uniform float offset,
uniform float scale
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT;
}
auto raw_value = scene::data_lookup_float(primvar_name);
return finalize_float(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export float2 cesium_internal_property_attribute_float2_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform float2 no_data,
uniform float2 default_value,
uniform float2 offset,
uniform float2 scale
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT2;
}
auto raw_value = scene::data_lookup_float2(primvar_name);
return finalize_float2(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export float3 cesium_internal_property_attribute_float3_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform float3 no_data,
uniform float3 default_value,
uniform float3 offset,
uniform float3 scale
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT3;
}
auto raw_value = scene::data_lookup_float3(primvar_name);
return finalize_float3(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export float4 cesium_internal_property_attribute_float4_lookup(
uniform string primvar_name,
uniform bool has_no_data,
uniform float4 no_data,
uniform float4 default_value,
uniform float4 offset,
uniform float4 scale
) [[ anno::hidden() ]] {
if (!scene::data_isvalid(primvar_name)) {
return DEFAULT_PROPERTY_VALUE_FLOAT4;
}
auto raw_value = scene::data_lookup_float4(primvar_name);
return finalize_float4(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export int cesium_internal_property_texture_int_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int no_data,
uniform int default_value,
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT;
}
auto raw_value = read_channels_int(texel_value.value, channels);
return finalize_int(raw_value, has_no_data, no_data, default_value);
}
export int2 cesium_internal_property_texture_int2_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int2 no_data,
uniform int2 default_value
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT2;
}
auto raw_value = read_channels_int2(texel_value.value, channels);
return finalize_int2(raw_value, has_no_data, no_data, default_value);
}
export int3 cesium_internal_property_texture_int3_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int3 no_data,
uniform int3 default_value
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT3;
}
auto raw_value = read_channels_int3(texel_value.value, channels);
return finalize_int3(raw_value, has_no_data, no_data, default_value);
}
export int4 cesium_internal_property_texture_int4_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int4 no_data,
uniform int4 default_value
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT4;
}
auto raw_value = read_channels_int4(texel_value.value, channels);
return finalize_int4(raw_value, has_no_data, no_data, default_value);
}
export float cesium_internal_property_texture_normalized_int_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int no_data,
uniform float default_value,
uniform float offset,
uniform float scale,
uniform int maximum_value
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT;
}
auto raw_value = read_channels_int(texel_value.value, channels);
return finalize_normalized_int(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float2 cesium_internal_property_texture_normalized_int2_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int2 no_data,
uniform float2 default_value,
uniform float2 offset,
uniform float2 scale,
uniform int2 maximum_value
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT2;
}
auto raw_value = read_channels_int2(texel_value.value, channels);
return finalize_normalized_int2(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float3 cesium_internal_property_texture_normalized_int3_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int3 no_data,
uniform float3 default_value,
uniform float3 offset,
uniform float3 scale,
uniform int3 maximum_value
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT3;
}
auto raw_value = read_channels_int3(texel_value.value, channels);
return finalize_normalized_int3(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float4 cesium_internal_property_texture_normalized_int4_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform int4 channels,
uniform bool has_no_data,
uniform int4 no_data,
uniform float4 default_value,
uniform float4 offset,
uniform float4 scale,
uniform int4 maximum_value
) [[ anno::hidden() ]] {
auto texel_value = texel_fetch_int_rgba8_unorm(texture, tex_coord_index, tex_coord_offset, tex_coord_rotation, tex_coord_scale, wrap_s, wrap_t);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT4;
}
auto raw_value = read_channels_int4(texel_value.value, channels);
return finalize_normalized_int4(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export int cesium_internal_property_table_int_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int no_data,
uniform int default_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_INT;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT;
}
auto raw_value = read_channels_int(texel_value.value, DEFAULT_CHANNELS);
return finalize_int(raw_value, has_no_data, no_data, default_value);
}
export int2 cesium_internal_property_table_int2_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int2 no_data,
uniform int2 default_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_INT2;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT2;
}
auto raw_value = read_channels_int2(texel_value.value, DEFAULT_CHANNELS);
return finalize_int2(raw_value, has_no_data, no_data, default_value);
}
export int3 cesium_internal_property_table_int3_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int3 no_data,
uniform int3 default_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_INT3;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT3;
}
auto raw_value = read_channels_int3(texel_value.value, DEFAULT_CHANNELS);
return finalize_int3(raw_value, has_no_data, no_data, default_value);
}
export int4 cesium_internal_property_table_int4_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int4 no_data,
uniform int4 default_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_INT4;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_INT4;
}
auto raw_value = read_channels_int4(texel_value.value, DEFAULT_CHANNELS);
return finalize_int4(raw_value, has_no_data, no_data, default_value);
}
export float cesium_internal_property_table_normalized_int_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int no_data,
uniform float default_value,
uniform float offset,
uniform float scale,
uniform int maximum_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT;
}
auto raw_value = read_channels_int(texel_value.value, DEFAULT_CHANNELS);
return finalize_normalized_int(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float2 cesium_internal_property_table_normalized_int2_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int2 no_data,
uniform float2 default_value,
uniform float2 offset,
uniform float2 scale,
uniform int2 maximum_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT2;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT2;
}
auto raw_value = read_channels_int2(texel_value.value, DEFAULT_CHANNELS);
return finalize_normalized_int2(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float3 cesium_internal_property_table_normalized_int3_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int3 no_data,
uniform float3 default_value,
uniform float3 offset,
uniform float3 scale,
uniform int3 maximum_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT3;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT3;
}
auto raw_value = read_channels_int3(texel_value.value, DEFAULT_CHANNELS);
return finalize_normalized_int3(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float4 cesium_internal_property_table_normalized_int4_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform int4 no_data,
uniform float4 default_value,
uniform float4 offset,
uniform float4 scale,
uniform int4 maximum_value,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT4;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_int(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT4;
}
auto raw_value = read_channels_int4(texel_value.value, DEFAULT_CHANNELS);
return finalize_normalized_int4(raw_value, has_no_data, no_data, default_value, offset, scale, maximum_value);
}
export float cesium_internal_property_table_float_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform float no_data,
uniform float default_value,
uniform float offset,
uniform float scale,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_float(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT;
}
auto raw_value = read_channels_float(texel_value.value, DEFAULT_CHANNELS);
return finalize_float(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export float2 cesium_internal_property_table_float2_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform float2 no_data,
uniform float2 default_value,
uniform float2 offset,
uniform float2 scale,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT2;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_float(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT2;
}
auto raw_value = read_channels_float2(texel_value.value, DEFAULT_CHANNELS);
return finalize_float2(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export float3 cesium_internal_property_table_float3_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform float3 no_data,
uniform float3 default_value,
uniform float3 offset,
uniform float3 scale,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT3;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_float(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT3;
}
auto raw_value = read_channels_float3(texel_value.value, DEFAULT_CHANNELS);
return finalize_float3(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export float4 cesium_internal_property_table_float4_lookup(
uniform texture_2d property_table_texture,
uniform bool has_no_data,
uniform float4 no_data,
uniform float4 default_value,
uniform float4 offset,
uniform float4 scale,
int feature_id = DEFAULT_NULL_FEATURE_ID
) [[ anno::hidden() ]] {
if (feature_id == DEFAULT_NULL_FEATURE_ID) {
return DEFAULT_PROPERTY_VALUE_FLOAT4;
}
auto pixel_index = get_property_table_pixel_index(feature_id, property_table_texture);
auto texel_value = texel_fetch_float(property_table_texture, pixel_index);
if (!texel_value.valid) {
return DEFAULT_PROPERTY_VALUE_FLOAT4;
}
auto raw_value = read_channels_float4(texel_value.value, DEFAULT_CHANNELS);
return finalize_float4(raw_value, has_no_data, no_data, default_value, offset, scale);
}
export gltf_texture_lookup_value cesium_internal_texture_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t
) [[ anno::hidden() ]] {
return gltf_texture_lookup(
texture: texture,
tex_coord_index: tex_coord_index,
offset: tex_coord_offset,
rotation: tex_coord_rotation,
scale: tex_coord_scale,
wrap_s: wrap_s,
wrap_t: wrap_t
);
}
export gltf_texture_lookup_value cesium_internal_raster_overlay_lookup(
uniform texture_2d texture,
uniform int tex_coord_index,
uniform float2 tex_coord_offset,
uniform float tex_coord_rotation,
uniform float2 tex_coord_scale,
uniform gltf_wrapping_mode wrap_s,
uniform gltf_wrapping_mode wrap_t,
uniform float alpha
) [[ anno::hidden() ]] {
auto raster_overlay = gltf_texture_lookup(
texture: texture,
tex_coord_index: tex_coord_index,
offset: tex_coord_offset,
rotation: tex_coord_rotation,
scale: tex_coord_scale,
wrap_s: wrap_s,
wrap_t: wrap_t
);
if (raster_overlay.valid) {
raster_overlay.value.w *= alpha;
}
return raster_overlay;
}
export material cesium_internal_material(
uniform color base_color_factor,
uniform float metallic_factor,
uniform float roughness_factor,
uniform color emissive_factor,
uniform gltf_alpha_mode alpha_mode,
uniform float base_alpha,
uniform float alpha_cutoff,
uniform float4 tile_color,
gltf_texture_lookup_value base_color_texture = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay = gltf_texture_lookup_value(),
gltf_texture_lookup_value alpha_clip = gltf_texture_lookup_value()
) [[ anno::hidden() ]] = let {
auto base_color = compute_base_color(
base_color_factor,
base_alpha,
base_color_texture.valid ? base_color_texture.value : float4(0.0),
raster_overlay.valid ? raster_overlay.value : float4(0.0),
tile_color,
alpha_clip.valid ? alpha_clip.value.x : 0.0
);
material base = gltf_material(
base_color_texture: gltf_texture_lookup_value(true, base_color),
metallic_factor: metallic_factor,
roughness_factor: roughness_factor,
emissive_factor: emissive_factor,
alpha_mode: alpha_mode,
alpha_cutoff: alpha_cutoff
);
} in material(
thin_walled: base.thin_walled,
surface: base.surface,
volume: base.volume,
ior: base.ior,
geometry: base.geometry
);
export gltf_texture_lookup_value cesium_internal_raster_overlay_resolver(
uniform int raster_overlay_count = 0,
gltf_texture_lookup_value raster_overlay_0 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_1 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_2 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_3 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_4 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_5 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_6 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_7 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_8 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_9 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_10 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_11 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_12 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_13 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_14 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_15 = gltf_texture_lookup_value()
) [[ anno::hidden() ]] {
// The array length should match MAX_RASTER_OVERLAY_COUNT in FabricMaterial.cpp
gltf_texture_lookup_value[] raster_overlays(
raster_overlay_0,
raster_overlay_1,
raster_overlay_2,
raster_overlay_3,
raster_overlay_4,
raster_overlay_5,
raster_overlay_6,
raster_overlay_7,
raster_overlay_8,
raster_overlay_9,
raster_overlay_10,
raster_overlay_11,
raster_overlay_12,
raster_overlay_13,
raster_overlay_14,
raster_overlay_15,
);
auto resolved_value = float4(0.0);
for (int i = 0; i < raster_overlay_count; i++) {
auto raster_overlay = raster_overlays[i];
if (raster_overlay.valid) {
resolved_value = alpha_blend(raster_overlay.value, resolved_value);
}
}
return gltf_texture_lookup_value(true, resolved_value);
}
export gltf_texture_lookup_value cesium_internal_clipping_raster_overlay_resolver(
uniform int raster_overlay_count = 0,
gltf_texture_lookup_value raster_overlay_0 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_1 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_2 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_3 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_4 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_5 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_6 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_7 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_8 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_9 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_10 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_11 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_12 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_13 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_14 = gltf_texture_lookup_value(),
gltf_texture_lookup_value raster_overlay_15 = gltf_texture_lookup_value()
) [[ anno::hidden() ]] {
// The array length should match MAX_RASTER_OVERLAY_COUNT in FabricMaterial.cpp
gltf_texture_lookup_value[] raster_overlays(
raster_overlay_0,
raster_overlay_1,
raster_overlay_2,
raster_overlay_3,
raster_overlay_4,
raster_overlay_5,
raster_overlay_6,
raster_overlay_7,
raster_overlay_8,
raster_overlay_9,
raster_overlay_10,
raster_overlay_11,
raster_overlay_12,
raster_overlay_13,
raster_overlay_14,
raster_overlay_15,
);
auto resolved_value = float4(0.0);
for (int i = 0; i < raster_overlay_count; i++) {
auto raster_overlay = raster_overlays[i];
if (raster_overlay.valid) {
resolved_value += raster_overlay.value;
}
}
return gltf_texture_lookup_value(true, resolved_value);
}
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/images/FontAwesome/attribution.txt | The SVG icons in this directory are from the "Font Awesome" project.
They are published under the CC BY 4.0 License. See
https://fontawesome.com/license/free for further information.
The SVG files have been edited to change the fill color from
the "currentColor" to "#cccccc".
For "sync-alt-solid.svg", it was set to #ffffff, to be used
on a Cesium-styled button.
For "times-solid.svg" and "check-solid.svg" it was set to #ff0000 and #00ff00 respectively.
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/extension.py | from .bindings import acquire_cesium_omniverse_interface, release_cesium_omniverse_interface, Viewport
from .ui.add_menu_controller import CesiumAddMenuController
from .install import perform_vendor_install
from .utils import wait_n_frames, dock_window_async, perform_action_after_n_frames_async
from .usdUtils import (
add_tileset_ion,
add_raster_overlay_ion,
add_cartographic_polygon,
get_or_create_cesium_data,
get_or_create_cesium_georeference,
)
from .ui.asset_window import CesiumOmniverseAssetWindow
from .ui.debug_window import CesiumOmniverseDebugWindow
from .ui.main_window import CesiumOmniverseMainWindow
from .ui.settings_window import CesiumOmniverseSettingsWindow
from .ui.credits_viewport_frame import CesiumCreditsViewportFrame
from .ui.fabric_modal import CesiumFabricModal
from .models import AssetToAdd, RasterOverlayToAdd
from .ui import CesiumAttributesWidgetController
import asyncio
from functools import partial
import logging
import carb.events
import carb.settings as omni_settings
import omni.ext
import omni.kit.app as omni_app
import omni.kit.ui
import omni.kit.pipapi
from omni.kit.viewport.window import get_viewport_window_instances
import omni.ui as ui
import omni.usd
import os
from typing import List, Optional, Callable
from .ui.credits_viewport_controller import CreditsViewportController
from cesium.usd.plugins.CesiumUsdSchemas import Data as CesiumData, IonServer as CesiumIonServer
from omni.kit.capture.viewport import CaptureExtension
CESIUM_DATA_PRIM_PATH = "/Cesium"
cesium_extension_location = os.path.join(os.path.dirname(__file__), "../../")
class CesiumOmniverseExtension(omni.ext.IExt):
@staticmethod
def _set_menu(path, value):
# Set the menu to create this window on and off
editor_menu = omni.kit.ui.get_editor_menu()
if editor_menu:
editor_menu.set_value(path, value)
def __init__(self) -> None:
super().__init__()
self._main_window: Optional[CesiumOmniverseMainWindow] = None
self._asset_window: Optional[CesiumOmniverseAssetWindow] = None
self._debug_window: Optional[CesiumOmniverseDebugWindow] = None
self._settings_window: Optional[CesiumOmniverseSettingsWindow] = None
self._credits_viewport_frames: List[CesiumCreditsViewportFrame] = []
self._on_stage_subscription: Optional[carb.events.ISubscription] = None
self._on_update_subscription: Optional[carb.events.ISubscription] = None
self._show_asset_window_subscription: Optional[carb.events.ISubscription] = None
self._token_set_subscription: Optional[carb.events.ISubscription] = None
self._add_ion_asset_subscription: Optional[carb.events.ISubscription] = None
self._add_blank_asset_subscription: Optional[carb.events.ISubscription] = None
self._add_raster_overlay_subscription: Optional[carb.events.ISubscription] = None
self._add_cartographic_polygon_subscription: Optional[carb.events.ISubscription] = None
self._assets_to_add_after_token_set: List[AssetToAdd] = []
self._raster_overlay_to_add_after_token_set: List[RasterOverlayToAdd] = []
self._adding_assets = False
self._attributes_widget_controller: Optional[CesiumAttributesWidgetController] = None
self._credits_viewport_controller: Optional[CreditsViewportController] = None
self._add_menu_controller: Optional[CesiumAddMenuController] = None
self._logger: logging.Logger = logging.getLogger(__name__)
self._menus = []
self._num_credits_viewport_frames: int = 0
self._capture_instance = None
perform_vendor_install()
def on_startup(self):
# The ability to show up the window if the system requires it. We use it in QuickLayout.
ui.Workspace.set_show_window_fn(CesiumOmniverseMainWindow.WINDOW_NAME, partial(self.show_main_window, None))
ui.Workspace.set_show_window_fn(
CesiumOmniverseAssetWindow.WINDOW_NAME, partial(self.show_assets_window, None)
)
ui.Workspace.set_show_window_fn(CesiumOmniverseDebugWindow.WINDOW_NAME, partial(self.show_debug_window, None))
ui.Workspace.set_show_window_fn(
CesiumOmniverseSettingsWindow.WINDOW_NAME, partial(self.show_settings_window, None)
)
settings = omni_settings.get_settings()
show_on_startup = settings.get_as_bool("/exts/cesium.omniverse/showOnStartup")
self._add_to_menu(CesiumOmniverseMainWindow.MENU_PATH, self.show_main_window, show_on_startup)
self._add_to_menu(CesiumOmniverseAssetWindow.MENU_PATH, self.show_assets_window, False)
self._add_to_menu(CesiumOmniverseDebugWindow.MENU_PATH, self.show_debug_window, False)
self._add_to_menu(CesiumOmniverseSettingsWindow.MENU_PATH, self.show_settings_window, False)
self._logger.info("CesiumOmniverse startup")
# Acquire the Cesium Omniverse interface.
global _cesium_omniverse_interface
_cesium_omniverse_interface = acquire_cesium_omniverse_interface()
_cesium_omniverse_interface.on_startup(cesium_extension_location)
settings.set("/rtx/hydra/TBNFrameMode", 1)
# Allow material graph to find cesium mdl exports
mdl_custom_paths_name = "materialConfig/searchPaths/custom"
mdl_user_allow_list_name = "materialConfig/materialGraph/userAllowList"
mdl_renderer_custom_paths_name = "/renderer/mdl/searchPaths/custom"
cesium_mdl_search_path = os.path.join(cesium_extension_location, "mdl")
cesium_mdl_name = "cesium.mdl"
mdl_custom_paths = settings.get(mdl_custom_paths_name) or []
mdl_user_allow_list = settings.get(mdl_user_allow_list_name) or []
mdl_custom_paths.append(cesium_mdl_search_path)
mdl_user_allow_list.append(cesium_mdl_name)
mdl_renderer_custom_paths = settings.get_as_string(mdl_renderer_custom_paths_name)
mdl_renderer_custom_paths_sep = "" if mdl_renderer_custom_paths == "" else ";"
mdl_renderer_custom_paths = mdl_renderer_custom_paths + mdl_renderer_custom_paths_sep + cesium_mdl_search_path
settings.set_string_array(mdl_custom_paths_name, mdl_custom_paths)
settings.set_string_array(mdl_user_allow_list_name, mdl_user_allow_list)
settings.set_string(mdl_renderer_custom_paths_name, mdl_renderer_custom_paths)
# Show the window. It will call `self.show_window`
if show_on_startup:
asyncio.ensure_future(perform_action_after_n_frames_async(15, CesiumOmniverseExtension._open_window))
self._credits_viewport_controller = CreditsViewportController(_cesium_omniverse_interface)
self._add_menu_controller = CesiumAddMenuController(_cesium_omniverse_interface)
# Subscribe to stage event stream
usd_context = omni.usd.get_context()
if usd_context.get_stage_state() == omni.usd.StageState.OPENED:
_cesium_omniverse_interface.on_stage_change(usd_context.get_stage_id())
self._on_stage_subscription = usd_context.get_stage_event_stream().create_subscription_to_pop(
self._on_stage_event, name="cesium.omniverse.ON_STAGE_EVENT"
)
self._on_update_subscription = (
omni_app.get_app()
.get_update_event_stream()
.create_subscription_to_pop(self._on_update_frame, name="cesium.omniverse.extension.ON_UPDATE_FRAME")
)
bus = omni_app.get_app().get_message_bus_event_stream()
show_asset_window_event = carb.events.type_from_string("cesium.omniverse.SHOW_ASSET_WINDOW")
self._show_asset_window_subscription = bus.create_subscription_to_pop_by_type(
show_asset_window_event, self._on_show_asset_window_event
)
token_set_event = carb.events.type_from_string("cesium.omniverse.SET_DEFAULT_TOKEN_SUCCESS")
self._token_set_subscription = bus.create_subscription_to_pop_by_type(token_set_event, self._on_token_set)
add_ion_asset_event = carb.events.type_from_string("cesium.omniverse.ADD_ION_ASSET")
self._add_ion_asset_subscription = bus.create_subscription_to_pop_by_type(
add_ion_asset_event, self._on_add_ion_asset_event
)
add_blank_asset_event = carb.events.type_from_string("cesium.omniverse.ADD_BLANK_ASSET")
self._add_blank_asset_subscription = bus.create_subscription_to_pop_by_type(
add_blank_asset_event, self._on_add_blank_asset_event
)
add_cartographic_polygon_event = carb.events.type_from_string("cesium.omniverse.ADD_CARTOGRAPHIC_POLYGON")
self._add_cartographic_polygon_subscription = bus.create_subscription_to_pop_by_type(
add_cartographic_polygon_event, self._on_add_cartographic_polygon_event
)
add_raster_overlay_event = carb.events.type_from_string("cesium.omniverse.ADD_RASTER_OVERLAY")
self._add_raster_overlay_subscription = bus.create_subscription_to_pop_by_type(
add_raster_overlay_event, self._on_add_raster_overlay_to_tileset
)
self._capture_instance = CaptureExtension.get_instance()
def on_shutdown(self):
self._menus.clear()
if self._main_window is not None:
self._main_window.destroy()
self._main_window = None
if self._asset_window is not None:
self._asset_window.destroy()
self._asset_window = None
if self._debug_window is not None:
self._debug_window.destroy()
self._debug_window = None
if self._settings_window is not None:
self._settings_window.destroy()
self._settings_window = None
if self._credits_viewport_controller is not None:
self._credits_viewport_controller.destroy()
self._credits_viewport_controller = None
# Deregister the function that shows the window from omni.ui
ui.Workspace.set_show_window_fn(CesiumOmniverseMainWindow.WINDOW_NAME, None)
ui.Workspace.set_show_window_fn(CesiumOmniverseAssetWindow.WINDOW_NAME, None)
ui.Workspace.set_show_window_fn(CesiumOmniverseDebugWindow.WINDOW_NAME, None)
ui.Workspace.set_show_window_fn(CesiumOmniverseSettingsWindow.WINDOW_NAME, None)
if self._on_stage_subscription is not None:
self._on_stage_subscription.unsubscribe()
self._on_stage_subscription = None
if self._on_update_subscription is not None:
self._on_update_subscription.unsubscribe()
self._on_update_subscription = None
if self._token_set_subscription is not None:
self._token_set_subscription.unsubscribe()
self._token_set_subscription = None
if self._add_ion_asset_subscription is not None:
self._add_ion_asset_subscription.unsubscribe()
self._add_ion_asset_subscription = None
if self._add_blank_asset_subscription is not None:
self._add_blank_asset_subscription.unsubscribe()
self._add_blank_asset_subscription = None
if self._add_raster_overlay_subscription is not None:
self._add_raster_overlay_subscription.unsubscribe()
self._add_raster_overlay_subscription = None
if self._add_cartographic_polygon_subscription is not None:
self._add_cartographic_polygon_subscription.unsubscribe()
self._add_cartographic_polygon_subscription = None
if self._show_asset_window_subscription is not None:
self._show_asset_window_subscription.unsubscribe()
self._show_asset_window_subscription = None
if self._attributes_widget_controller is not None:
self._attributes_widget_controller.destroy()
self._attributes_widget_controller = None
if self._add_menu_controller is not None:
self._add_menu_controller.destroy()
self._add_menu_controller = None
self._capture_instance = None
self._destroy_credits_viewport_frames()
self._logger.info("CesiumOmniverse shutdown")
# Release the Cesium Omniverse interface.
_cesium_omniverse_interface.on_shutdown()
release_cesium_omniverse_interface(_cesium_omniverse_interface)
def _on_update_frame(self, _):
if omni.usd.get_context().get_stage_state() != omni.usd.StageState.OPENED:
return
viewports = []
for instance in get_viewport_window_instances():
viewport_api = instance.viewport_api
viewport = Viewport()
viewport.viewMatrix = viewport_api.view
viewport.projMatrix = viewport_api.projection
viewport.width = float(viewport_api.resolution[0])
viewport.height = float(viewport_api.resolution[1])
viewports.append(viewport)
if len(viewports) != self._num_credits_viewport_frames:
self._setup_credits_viewport_frames()
self._num_credits_viewport_frames = len(viewports)
wait_for_loading_tiles = (
self._capture_instance.progress.capture_status == omni.kit.capture.viewport.CaptureStatus.CAPTURING
)
_cesium_omniverse_interface.on_update_frame(viewports, wait_for_loading_tiles)
def _on_stage_event(self, event):
if _cesium_omniverse_interface is None:
return
if event.type == int(omni.usd.StageEventType.OPENED):
_cesium_omniverse_interface.on_stage_change(omni.usd.get_context().get_stage_id())
self._attributes_widget_controller = CesiumAttributesWidgetController(_cesium_omniverse_interface)
# Show Fabric modal if Fabric is disabled.
fabric_enabled = omni_settings.get_settings().get_as_bool("/app/useFabricSceneDelegate")
if not fabric_enabled:
asyncio.ensure_future(perform_action_after_n_frames_async(15, CesiumOmniverseExtension._open_modal))
get_or_create_cesium_data()
get_or_create_cesium_georeference()
self._setup_ion_server_prims()
elif event.type == int(omni.usd.StageEventType.CLOSED):
_cesium_omniverse_interface.on_stage_change(0)
if self._attributes_widget_controller is not None:
self._attributes_widget_controller.destroy()
self._attributes_widget_controller = None
def _on_show_asset_window_event(self, _):
self.do_show_assets_window()
def _on_token_set(self, _: carb.events.IEvent):
if self._adding_assets:
return
self._adding_assets = True
for asset in self._assets_to_add_after_token_set:
self._add_ion_assets(asset)
self._assets_to_add_after_token_set.clear()
for raster_overlay in self._raster_overlay_to_add_after_token_set:
self._add_raster_overlay_to_tileset(raster_overlay)
self._raster_overlay_to_add_after_token_set.clear()
self._adding_assets = False
def _on_add_ion_asset_event(self, event: carb.events.IEvent):
asset_to_add = AssetToAdd.from_event(event)
self._add_ion_assets(asset_to_add)
def _on_add_blank_asset_event(self, event: carb.events.IEvent):
asset_to_add = AssetToAdd.from_event(event)
self._add_ion_assets(asset_to_add, skip_ion_checks=True)
def _on_add_cartographic_polygon_event(self, event: carb.events.IEvent):
self._add_cartographic_polygon_assets()
def _add_ion_assets(self, asset_to_add: Optional[AssetToAdd], skip_ion_checks=False):
if asset_to_add is None:
self._logger.warning("Insufficient information to add asset.")
return
if not skip_ion_checks:
session = _cesium_omniverse_interface.get_session()
if not session.is_connected():
self._logger.warning("Must be logged in to add ion asset.")
return
if not _cesium_omniverse_interface.is_default_token_set():
bus = omni_app.get_app().get_message_bus_event_stream()
show_token_window_event = carb.events.type_from_string("cesium.omniverse.SHOW_TOKEN_WINDOW")
bus.push(show_token_window_event)
self._assets_to_add_after_token_set.append(asset_to_add)
return
if asset_to_add.raster_overlay_name is not None and asset_to_add.raster_overlay_ion_asset_id is not None:
tileset_path = add_tileset_ion(asset_to_add.tileset_name, asset_to_add.tileset_ion_asset_id)
add_raster_overlay_ion(
tileset_path, asset_to_add.raster_overlay_name, asset_to_add.raster_overlay_ion_asset_id
)
else:
tileset_path = add_tileset_ion(asset_to_add.tileset_name, asset_to_add.tileset_ion_asset_id)
if tileset_path == "":
self._logger.warning("Error adding tileset and raster overlay to stage")
def _add_cartographic_polygon_assets(self):
add_cartographic_polygon()
def _on_add_raster_overlay_to_tileset(self, event: carb.events.IEvent):
raster_overlay_to_add = RasterOverlayToAdd.from_event(event)
if raster_overlay_to_add is None:
self._logger.warning("Insufficient information to add raster overlay.")
self._add_raster_overlay_to_tileset(raster_overlay_to_add)
def _add_raster_overlay_to_tileset(self, raster_overlay_to_add: RasterOverlayToAdd):
session = _cesium_omniverse_interface.get_session()
if not session.is_connected():
self._logger.warning("Must be logged in to add ion asset.")
return
if not _cesium_omniverse_interface.is_default_token_set():
bus = omni_app.get_app().get_message_bus_event_stream()
show_token_window_event = carb.events.type_from_string("cesium.omniverse.SHOW_TOKEN_WINDOW")
bus.push(show_token_window_event)
self._raster_overlay_to_add_after_token_set.append(raster_overlay_to_add)
return
add_raster_overlay_ion(
raster_overlay_to_add.tileset_path,
raster_overlay_to_add.raster_overlay_name,
raster_overlay_to_add.raster_overlay_ion_asset_id,
)
_cesium_omniverse_interface.reload_tileset(raster_overlay_to_add.tileset_path)
def _add_to_menu(self, path, callback: Callable[[bool], None], show_on_startup):
editor_menu = omni.kit.ui.get_editor_menu()
if editor_menu:
self._menus.append(editor_menu.add_item(path, callback, toggle=True, value=show_on_startup))
async def _destroy_window_async(self, path):
# Wait one frame, this is due to the one frame defer in Window::_moveToMainOSWindow()
await wait_n_frames(1)
if path is CesiumOmniverseMainWindow.MENU_PATH:
if self._main_window is not None:
self._main_window.destroy()
self._main_window = None
elif path is CesiumOmniverseAssetWindow.MENU_PATH:
if self._asset_window is not None:
self._asset_window.destroy()
self._asset_window = None
elif path is CesiumOmniverseDebugWindow.MENU_PATH:
if self._debug_window is not None:
self._debug_window.destroy()
self._debug_window = None
elif path is CesiumOmniverseSettingsWindow.MENU_PATH:
if self._settings_window is not None:
self._settings_window.destroy()
self._settings_window = None
def _visibility_changed_fn(self, path, visible):
# Called when the user pressed "X"
self._set_menu(path, visible)
if not visible:
# Destroy the window, since we are creating new window in show_window
asyncio.ensure_future(self._destroy_window_async(path))
def show_main_window(self, _menu, value):
if _cesium_omniverse_interface is None:
logging.error("Cesium Omniverse Interface is not set.")
return
if value:
self._main_window = CesiumOmniverseMainWindow(_cesium_omniverse_interface, width=300, height=400)
self._main_window.set_visibility_changed_fn(
partial(self._visibility_changed_fn, CesiumOmniverseMainWindow.MENU_PATH)
)
asyncio.ensure_future(dock_window_async(self._main_window))
elif self._main_window is not None:
self._main_window.visible = False
def do_show_assets_window(self):
if self._asset_window:
self._asset_window.focus()
return
self._asset_window = CesiumOmniverseAssetWindow(_cesium_omniverse_interface, width=700, height=300)
self._asset_window.set_visibility_changed_fn(
partial(self._visibility_changed_fn, CesiumOmniverseAssetWindow.MENU_PATH)
)
asyncio.ensure_future(dock_window_async(self._asset_window, "Content"))
def show_assets_window(self, _menu, value):
if _cesium_omniverse_interface is None:
logging.error("Cesium Omniverse Interface is not set.")
return
if value:
self.do_show_assets_window()
elif self._asset_window is not None:
self._asset_window.visible = False
def show_debug_window(self, _menu, value):
if _cesium_omniverse_interface is None:
logging.error("Cesium Omniverse Interface is not set.")
return
if value:
self._debug_window = CesiumOmniverseDebugWindow(
_cesium_omniverse_interface, CesiumOmniverseDebugWindow.WINDOW_NAME, width=300, height=365
)
self._debug_window.set_visibility_changed_fn(
partial(self._visibility_changed_fn, CesiumOmniverseDebugWindow.MENU_PATH)
)
asyncio.ensure_future(dock_window_async(self._debug_window))
elif self._debug_window is not None:
self._debug_window.visible = False
def show_settings_window(self, _menu, value):
if _cesium_omniverse_interface is None:
logging.error("Cesium Omniverse Interface is not set.")
return
if value:
self._settings_window = CesiumOmniverseSettingsWindow(
_cesium_omniverse_interface, CesiumOmniverseSettingsWindow.WINDOW_NAME, width=300, height=365
)
self._settings_window.set_visibility_changed_fn(
partial(self._visibility_changed_fn, CesiumOmniverseSettingsWindow.MENU_PATH)
)
asyncio.ensure_future(dock_window_async(self._settings_window))
elif self._settings_window is not None:
self._settings_window.visible = False
def _setup_credits_viewport_frames(self):
self._destroy_credits_viewport_frames()
self._credits_viewport_frames = [
CesiumCreditsViewportFrame(_cesium_omniverse_interface, i) for i in get_viewport_window_instances()
]
if self._credits_viewport_controller is not None:
self._credits_viewport_controller.broadcast_credits()
def _destroy_credits_viewport_frames(self):
for credits_viewport_frame in self._credits_viewport_frames:
credits_viewport_frame.destroy()
self._credits_viewport_frames.clear()
@staticmethod
def _open_window():
ui.Workspace.show_window(CesiumOmniverseMainWindow.WINDOW_NAME)
@staticmethod
def _open_modal():
CesiumFabricModal()
def _setup_ion_server_prims(self):
# TODO: Move a lot of this to usdUtils.py
stage = omni.usd.get_context().get_stage()
server_prims: List[CesiumIonServer] = [x for x in stage.Traverse() if x.IsA(CesiumIonServer)]
if len(server_prims) < 1:
# If we have no ion server prims, lets add a default one for the official ion servers.
path = "/CesiumServers/IonOfficial"
prim: CesiumIonServer = CesiumIonServer.Define(stage, path)
prim.GetDisplayNameAttr().Set("ion.cesium.com")
prim.GetIonServerUrlAttr().Set("https://ion.cesium.com/")
prim.GetIonServerApiUrlAttr().Set("https://api.cesium.com/")
prim.GetIonServerApplicationIdAttr().Set(413)
data_prim: CesiumData = CesiumData.Get(stage, CESIUM_DATA_PRIM_PATH)
data_prim.GetSelectedIonServerRel().AddTarget(path)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/__init__.py | from .extension import * # noqa: F401 F403 F405
from .utils import * # noqa: F401 F403 F405
from .usdUtils import * # noqa: F401 F403 F405
from .ui import * # noqa: F401 F403 F405
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/usdUtils/usdUtils.py | import omni.usd
import re
from pxr import Sdf
from typing import List, Optional
from pxr import UsdGeom
from cesium.usd.plugins.CesiumUsdSchemas import (
Data as CesiumData,
Tileset as CesiumTileset,
IonRasterOverlay as CesiumIonRasterOverlay,
Georeference as CesiumGeoreference,
GlobeAnchorAPI as CesiumGlobeAnchorAPI,
Tokens as CesiumTokens,
)
CESIUM_DATA_PRIM_PATH = "/Cesium"
CESIUM_GEOREFERENCE_PRIM_PATH = "/CesiumGeoreference"
def get_safe_name(name: str) -> str:
return re.sub("[\\W]+", "_", name)
def get_or_create_cesium_data() -> CesiumData:
stage = omni.usd.get_context().get_stage()
path = CESIUM_DATA_PRIM_PATH
prim = stage.GetPrimAtPath(path)
if prim.IsValid():
return CesiumData.Get(stage, path)
return CesiumData.Define(stage, path)
def get_or_create_cesium_georeference() -> CesiumGeoreference:
stage = omni.usd.get_context().get_stage()
georeference_paths = get_georeference_paths()
if len(georeference_paths) < 1:
return CesiumGeoreference.Define(stage, CESIUM_GEOREFERENCE_PRIM_PATH)
return CesiumGeoreference.Get(stage, georeference_paths[0])
def add_tileset_ion(name: str, asset_id: int, token: str = "") -> str:
stage = omni.usd.get_context().get_stage()
safe_name = get_safe_name(name)
if not safe_name.startswith("/"):
safe_name = "/" + safe_name
# get_stage_next_free_path will increment the path name if there is a collision
tileset_path = omni.usd.get_stage_next_free_path(stage, safe_name, False)
tileset = CesiumTileset.Define(stage, tileset_path)
tileset.GetIonAssetIdAttr().Set(asset_id)
tileset.GetIonAccessTokenAttr().Set(token)
tileset.GetSourceTypeAttr().Set(CesiumTokens.ion)
georeference = get_or_create_cesium_georeference()
georeference_path = georeference.GetPath().pathString
tileset.GetGeoreferenceBindingRel().AddTarget(georeference_path)
server_prim_path = get_path_to_current_ion_server()
if server_prim_path != "":
tileset.GetIonServerBindingRel().AddTarget(server_prim_path)
return tileset_path
def add_raster_overlay_ion(tileset_path: str, name: str, asset_id: int, token: str = "") -> str:
stage = omni.usd.get_context().get_stage()
safe_name = get_safe_name(name)
raster_overlay_path = Sdf.Path(tileset_path).AppendPath(safe_name).pathString
# get_stage_next_free_path will increment the path name if there is a collision
raster_overlay_path = omni.usd.get_stage_next_free_path(stage, raster_overlay_path, False)
raster_overlay = CesiumIonRasterOverlay.Define(stage, raster_overlay_path)
tileset_prim = CesiumTileset.Get(stage, tileset_path)
tileset_prim.GetRasterOverlayBindingRel().AddTarget(raster_overlay_path)
raster_overlay.GetIonAssetIdAttr().Set(asset_id)
raster_overlay.GetIonAccessTokenAttr().Set(token)
server_prim_path = get_path_to_current_ion_server()
if server_prim_path != "":
raster_overlay.GetIonServerBindingRel().AddTarget(server_prim_path)
return raster_overlay_path
def add_cartographic_polygon() -> str:
stage = omni.usd.get_context().get_stage()
name = "cartographic_polygon"
cartographic_polygon_path = Sdf.Path("/CesiumCartographicPolygons").AppendPath(name).pathString
cartographic_polygon_path = omni.usd.get_stage_next_free_path(stage, cartographic_polygon_path, False)
basis_curves = UsdGeom.BasisCurves.Define(stage, cartographic_polygon_path)
basis_curves.GetTypeAttr().Set("linear")
basis_curves.GetWrapAttr().Set("periodic")
# Set curve to have 10m edge lengths
curve_size = 10 / UsdGeom.GetStageMetersPerUnit(stage)
basis_curves.GetPointsAttr().Set(
[
(-curve_size, 0, -curve_size),
(-curve_size, 0, curve_size),
(curve_size, 0, curve_size),
(curve_size, 0, -curve_size),
]
)
basis_curves.GetCurveVertexCountsAttr().Set([4])
# Set curve to a 0.5m width
curve_width = 0.5 / UsdGeom.GetStageMetersPerUnit(stage)
basis_curves.GetWidthsAttr().Set([curve_width, curve_width, curve_width, curve_width])
add_globe_anchor_to_prim(cartographic_polygon_path)
return cartographic_polygon_path
def is_tileset(path: str) -> bool:
stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath(path)
return prim.IsA(CesiumTileset)
def remove_tileset(path: str) -> None:
stage = omni.usd.get_context().get_stage()
stage.RemovePrim(path)
def get_path_to_current_ion_server() -> Optional[str]:
data = get_or_create_cesium_data()
rel = data.GetSelectedIonServerRel()
targets = rel.GetForwardedTargets()
if len(targets) < 1:
return None
return targets[0].pathString
def set_path_to_current_ion_server(path: str) -> None:
data = get_or_create_cesium_data()
rel = data.GetSelectedIonServerRel()
# This check helps avoid sending unnecessary USD notifications
# See https://github.com/CesiumGS/cesium-omniverse/issues/640
if get_path_to_current_ion_server() != path:
rel.SetTargets([path])
def get_tileset_paths() -> List[str]:
stage = omni.usd.get_context().get_stage()
paths = [x.GetPath().pathString for x in stage.Traverse() if x.IsA(CesiumTileset)]
return paths
def get_georeference_paths() -> List[str]:
stage = omni.usd.get_context().get_stage()
paths = [x.GetPath().pathString for x in stage.Traverse() if x.IsA(CesiumGeoreference)]
return paths
def add_globe_anchor_to_prim(path: str) -> CesiumGlobeAnchorAPI:
stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath(path)
georeference_path = get_or_create_cesium_georeference().GetPath().pathString
globe_anchor = CesiumGlobeAnchorAPI.Apply(prim)
globe_anchor.GetGeoreferenceBindingRel().AddTarget(georeference_path)
return globe_anchor
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/usdUtils/__init__.py | from .usdUtils import * # noqa: F401 F403
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/install/wheel_installer.py | from dataclasses import dataclass
import logging
from pathlib import Path
import platform
import omni.kit.app as app
import omni.kit.pipapi
from ..utils.utils import str_is_empty_or_none
@dataclass
class WheelInfo:
"""
Data class containing the module and wheel file names for each platform.
"""
module: str
windows_whl: str
linux_x64_whl: str
linux_aarch_whl: str
class WheelInstaller:
"""
Class for installing wheel files bundled with the extension.
"""
def __init__(self, info: WheelInfo, extension_module="cesium.omniverse"):
"""
Creates a new instance of a wheel installer for installing a python package.
:param info: A WheelInfo data class containing the information for wheel installation.
:param extension_module: The full module for the extension, if a different extension is using this class.
:raises ValueError: If any arguments are null or empty strings.
"""
self._logger = logging.getLogger(__name__)
if (
str_is_empty_or_none(info.windows_whl)
or str_is_empty_or_none(info.linux_x64_whl)
or str_is_empty_or_none(info.linux_aarch_whl)
):
raise ValueError(f"One or more wheels is missing for {info.module}.")
self._info = info
manager = app.get_app().get_extension_manager()
ext_id = manager.get_extension_id_by_module(extension_module)
self._vendor_directory_path = Path(manager.get_extension_path(ext_id)).joinpath("vendor")
def install(self) -> bool:
"""
Installs the correct wheel for the current platform.
:return: ``True`` if the installation was successful.
"""
if platform.system() == "Windows":
return self._perform_install(self._info.windows_whl)
else:
machine = platform.machine()
if machine.startswith("arm") or machine.startswith("aarch"):
return self._perform_install(self._info.linux_aarch_whl)
return self._perform_install(self._info.linux_x64_whl)
def _perform_install(self, wheel_file_name: str) -> bool:
"""
Performs the actual installation of the wheel file.
:param wheel_file_name: The file name of the wheel to install.
:return: ``True`` if the installation was successful.
"""
path = self._vendor_directory_path.joinpath(wheel_file_name)
return omni.kit.pipapi.install(
package=str(path),
module=self._info.module,
use_online_index=False,
ignore_cache=True,
ignore_import_check=False,
)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/install/vendor_install.py | import logging
from typing import List
from .wheel_installer import WheelInfo, WheelInstaller
def perform_vendor_install():
logger = logging.getLogger(__name__)
# Only vendor wheels for the main Cesium Omniverse extension should be placed here.
# This action needs to be mirrored for each extension.
vendor_wheels: List[WheelInfo] = [
WheelInfo(
module="lxml",
windows_whl="lxml-4.9.2-cp310-cp310-win_amd64.whl",
linux_x64_whl=(
"lxml-4.9.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl"
),
linux_aarch_whl=(
"lxml-4.9.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl"
),
)
]
for w in vendor_wheels:
installer = WheelInstaller(w)
if not installer.install():
logger.error(f"Could not install wheel for {w.module}")
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/install/__init__.py | from .wheel_installer import WheelInfo, WheelInstaller # noqa: F401 F403
from .vendor_install import perform_vendor_install # noqa: F401 F403
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/asset_details_widget.py | from typing import Optional
import carb.events
import omni.kit.app as app
import omni.ui as ui
import omni.usd as usd
from ..bindings import ICesiumOmniverseInterface
from .models import IonAssetItem
from ..models import AssetToAdd, RasterOverlayToAdd
from .styles import CesiumOmniverseUiStyles
from ..usdUtils import is_tileset, get_tileset_paths
class CesiumAssetDetailsWidget(ui.ScrollingFrame):
def __init__(
self, cesium_omniverse_interface: ICesiumOmniverseInterface, asset: Optional[IonAssetItem] = None, **kwargs
):
super().__init__(**kwargs)
self._cesium_omniverse_interface = cesium_omniverse_interface
self.style = CesiumOmniverseUiStyles.asset_detail_frame
self._name = asset.name.as_string if asset else ""
self._id = asset.id.as_int if asset else 0
self._description = asset.description.as_string if asset else ""
self._attribution = asset.attribution.as_string if asset else ""
self._asset_type = asset.type.as_string if asset else ""
self._name_label: Optional[ui.Label] = None
self._id_label: Optional[ui.Label] = None
self._description_label: Optional[ui.Label] = None
self._attribution_label: Optional[ui.Label] = None
self.set_build_fn(self._build_fn)
def __del__(self):
self.destroy()
def destroy(self) -> None:
if self._name_label is not None:
self._name_label.destroy()
if self._id_label is not None:
self._id_label.destroy()
if self._description_label is not None:
self._description_label.destroy()
if self._attribution_label is not None:
self._attribution_label.destroy()
def update_selection(self, asset: Optional[IonAssetItem]):
self._name = asset.name.as_string if asset else ""
self._id = asset.id.as_int if asset else 0
self._description = asset.description.as_string if asset else ""
self._attribution = asset.attribution.as_string if asset else ""
self._asset_type = asset.type.as_string if asset else ""
self.rebuild()
def _should_be_visible(self):
return self._name != "" or self._id != 0 or self._description != "" or self._attribution != ""
def _add_overlay_with_tileset(self):
asset_to_add = AssetToAdd("Cesium World Terrain", 1, self._name, self._id)
add_asset_event = carb.events.type_from_string("cesium.omniverse.ADD_ION_ASSET")
app.get_app().get_message_bus_event_stream().push(add_asset_event, payload=asset_to_add.to_dict())
def _add_tileset_button_clicked(self):
asset_to_add = AssetToAdd(self._name, self._id)
add_asset_event = carb.events.type_from_string("cesium.omniverse.ADD_ION_ASSET")
app.get_app().get_message_bus_event_stream().push(add_asset_event, payload=asset_to_add.to_dict())
def _add_raster_overlay_button_clicked(self):
context = usd.get_context()
selection = context.get_selection().get_selected_prim_paths()
tileset_path: Optional[str] = None
if len(selection) > 0 and is_tileset(context.get_stage().GetPrimAtPath(selection[0])):
tileset_path = selection[0]
if tileset_path is None:
all_tileset_paths = get_tileset_paths()
if len(all_tileset_paths) > 0:
tileset_path = all_tileset_paths[0]
else:
self._add_overlay_with_tileset()
return
raster_overlay_to_add = RasterOverlayToAdd(tileset_path, self._id, self._name)
add_raster_overlay_event = carb.events.type_from_string("cesium.omniverse.ADD_RASTER_OVERLAY")
app.get_app().get_message_bus_event_stream().push(
add_raster_overlay_event, payload=raster_overlay_to_add.to_dict()
)
def _build_fn(self):
with self:
if self._should_be_visible():
with ui.VStack(spacing=20):
with ui.VStack(spacing=5):
ui.Label(
self._name,
style=CesiumOmniverseUiStyles.asset_detail_name_label,
height=0,
word_wrap=True,
)
ui.Label(
f"(ID: {self._id})",
style=CesiumOmniverseUiStyles.asset_detail_id_label,
height=0,
word_wrap=True,
)
with ui.HStack(spacing=0, height=0):
ui.Spacer(height=0)
if self._asset_type == "3DTILES" or self._asset_type == "TERRAIN":
ui.Button(
"Add to Stage",
width=0,
height=0,
style=CesiumOmniverseUiStyles.blue_button_style,
clicked_fn=self._add_tileset_button_clicked,
)
elif self._asset_type == "RASTER_OVERLAY":
ui.Button(
"Use as Terrain Tileset Base Layer",
width=0,
height=0,
style=CesiumOmniverseUiStyles.blue_button_style,
clicked_fn=self._add_raster_overlay_button_clicked,
)
else:
# Skipping adding a button for things we cannot add for now.
pass
ui.Spacer(height=0)
with ui.VStack(spacing=5):
ui.Label("Description", style=CesiumOmniverseUiStyles.asset_detail_header_label, height=0)
ui.Label(self._description, word_wrap=True, alignment=ui.Alignment.TOP, height=0)
with ui.VStack(spacing=5):
ui.Label("Attribution", style=CesiumOmniverseUiStyles.asset_detail_header_label, height=0)
ui.Label(self._attribution, word_wrap=True, alignment=ui.Alignment.TOP, height=0)
else:
ui.Spacer()
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/debug_window.py | import logging
from typing import Optional
import omni.ui as ui
from .statistics_widget import CesiumOmniverseStatisticsWidget
from ..bindings import ICesiumOmniverseInterface
from ..usdUtils import remove_tileset, get_tileset_paths
class CesiumOmniverseDebugWindow(ui.Window):
WINDOW_NAME = "Cesium Debugging"
MENU_PATH = f"Window/Cesium/{WINDOW_NAME}"
_logger: logging.Logger
_cesium_omniverse_interface: Optional[ICesiumOmniverseInterface] = None
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, title: str, **kwargs):
super().__init__(title, **kwargs)
self._logger = logging.getLogger(__name__)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._statistics_widget: Optional[CesiumOmniverseStatisticsWidget] = None
# Set the function that is called to build widgets when the window is visible
self.frame.set_build_fn(self._build_fn)
def destroy(self):
if self._statistics_widget is not None:
self._statistics_widget.destroy()
self._statistics_widget = None
# It will destroy all the children
super().destroy()
def __del__(self):
self.destroy()
@staticmethod
def show_window():
ui.Workspace.show_window(CesiumOmniverseDebugWindow.WINDOW_NAME)
def _build_fn(self):
"""Builds out the UI buttons and their handlers."""
def remove_all_tilesets():
"""Removes all tilesets from the stage."""
tileset_paths = get_tileset_paths()
for tileset_path in tileset_paths:
remove_tileset(tileset_path)
def reload_all_tilesets():
"""Reloads all tilesets."""
tileset_paths = get_tileset_paths()
for tileset_path in tileset_paths:
self._cesium_omniverse_interface.reload_tileset(tileset_path)
with ui.VStack(spacing=10):
with ui.VStack():
ui.Button("Remove all Tilesets", height=20, clicked_fn=remove_all_tilesets)
ui.Button("Reload all Tilesets", height=20, clicked_fn=reload_all_tilesets)
self._statistics_widget = CesiumOmniverseStatisticsWidget(self._cesium_omniverse_interface)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/uri_image.py | import urllib.request
from io import BytesIO
from PIL import Image
import omni.ui as ui
class CesiumUriImage:
"""A wrapper around an ui.ImageProvider that provides a clean way to load images from URIs or base64 encoded data
strings."""
def __init__(self, src: str, padding=0, height=None, **kwargs):
style_type = kwargs.pop("style_type_name_override", self.__class__.__name__)
name = kwargs.pop("name", "")
with ui.ZStack(height=0, width=0):
# This is copied from uri_image.py since we seem to blow the stack if we nest any deeper when rendering.
data = urllib.request.urlopen(src).read()
img_data = BytesIO(data)
image = Image.open(img_data)
if image.mode != "RGBA":
image = image.convert("RGBA")
pixels = list(image.getdata())
provider = ui.ByteImageProvider()
provider.set_bytes_data(pixels, [image.size[0], image.size[1]])
if height is None:
width = image.size[0]
height = image.size[1]
else:
# If the user is explicitely setting the height of the image, we need to calc an appropriate width
width = image.size[0] * (height / image.size[1])
# Add padding for all sides
height += padding * 2
width += padding * 2
self._image = ui.ImageWithProvider(
provider,
width=width,
height=height,
fill_policy=ui.IwpFillPolicy.IWP_PRESERVE_ASPECT_FIT,
style={"alignment": ui.Alignment.CENTER, "margin": padding},
style_type_name_override=style_type,
name=name,
)
def get_image(self):
return self._image
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/styles.py | from omni.ui import Alignment, color as cl, Direction
class CesiumOmniverseUiStyles:
intro_label_style = {
"font_size": 16,
}
troubleshooter_header_style = {
"font_size": 18,
}
attribution_header_style = {
"font_size": 18,
}
quick_add_section_label = {
"font_size": 20,
"margin": 5,
}
quick_add_button = {"Button.Label": {"font_size": 16}}
blue_button_style = {
"Button": {
"background_color": cl("#4BA1CA"),
"padding": 12,
},
"Button.Label": {
"color": cl("#FFF"),
"font_size": 16,
},
"Button:hovered": {
"background_color": cl("#3C81A2"),
},
"Button:pressed": {"background_color": cl("#2D6179")},
}
top_bar_button_style = {
"Button": {"padding": 10.0, "stack_direction": Direction.TOP_TO_BOTTOM},
"Button.Image": {
"alignment": Alignment.CENTER,
},
"Button.Label": {"alignment": Alignment.CENTER_BOTTOM},
"Button.Image:disabled": {"color": cl("#808080")},
"Button.Label:disabled": {"color": cl("#808080")},
}
asset_detail_frame = {"ScrollingFrame": {"background_color": cl("#1F2123"), "padding": 10}}
asset_detail_name_label = {"font_size": 22}
asset_detail_header_label = {"font_size": 18}
asset_detail_id_label = {"font_size": 14}
asset_detail_content_label = {"font_size": 16}
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/credits_parser.py | import logging
import omni.ui as ui
import webbrowser
from dataclasses import dataclass
from functools import partial
from typing import Optional, List, Tuple
from .uri_image import CesiumUriImage
from .image_button import CesiumImageButton
@dataclass
class ParsedCredit:
text: Optional[str] = None
image_uri: Optional[str] = None
link: Optional[str] = None
class CesiumCreditsParser:
"""Takes in a credits array and outputs the elements necessary to show the credits.
Should be embedded in a VStack or HStack."""
def _parse_element(self, element, link: Optional[str] = None) -> List[ParsedCredit]:
results = []
tag = element.tag
if tag == "html" or tag == "body":
for child in element.iterchildren():
results.extend(self._parse_element(child, link))
elif tag == "a":
# TODO: We probably need to do some sanitization of the href.
link = element.attrib["href"]
text = "".join(element.itertext())
if text != "":
results.append(ParsedCredit(text=text, link=link))
for child in element.iterchildren():
results.extend(self._parse_element(child, link))
elif tag == "img":
src = element.attrib["src"]
if link is None:
results.append(ParsedCredit(image_uri=src))
else:
results.append(ParsedCredit(image_uri=src, link=link))
elif tag == "span" or tag == "div":
for child in element.iterchildren():
results.extend(self._parse_element(child, link))
# Sometimes divs or spans have text.
text = "".join(element.itertext())
if text:
results.append(ParsedCredit(text=text))
else:
text = "".join(element.itertext())
if link is None:
results.append(ParsedCredit(text=text))
else:
results.append(ParsedCredit(text=text, link=link))
return results
def _parse_credits(
self, asset_credits: List[Tuple[str, bool]], should_show_on_screen: bool, perform_fallback=False
) -> List[ParsedCredit]:
results = []
try:
from lxml import etree
parser = etree.HTMLParser()
for credit, show_on_screen in asset_credits:
if credit == "" or show_on_screen is not should_show_on_screen:
continue
if credit[0] == "<":
try:
doc = etree.fromstring(credit, parser)
results.extend(self._parse_element(doc))
continue
except etree.XMLSyntaxError as err:
self._logger.info(err)
results.append(ParsedCredit(text=credit))
except Exception as e:
self._logger.debug(e)
if perform_fallback:
self._logger.warning("Performing credits fallback.")
for credit, _ in asset_credits:
results.append(ParsedCredit(text=credit))
return results
@staticmethod
def _button_clicked(link: str):
webbrowser.open_new_tab(link)
def _build_ui_elements(self, parsed_credits: List[ParsedCredit], label_alignment: ui.Alignment):
for parsed_credit in parsed_credits:
# VStack + Spacer pushes our content to the bottom of the Stack to account for varying heights
with ui.VStack(spacing=0, width=0):
ui.Spacer()
if parsed_credit.image_uri is not None:
if parsed_credit.link is not None:
CesiumImageButton(
src=parsed_credit.image_uri,
padding=4,
height=28,
clicked_fn=partial(self._button_clicked, parsed_credit.link),
)
else:
CesiumUriImage(src=parsed_credit.image_uri, padding=4, height=28)
elif parsed_credit.text is not None:
if parsed_credit.link is not None:
ui.Button(
parsed_credit.text,
clicked_fn=partial(self._button_clicked, parsed_credit.link),
height=0,
width=0,
)
else:
ui.Label(parsed_credit.text, height=0, word_wrap=True, alignment=label_alignment)
def _build_ui(self, parsed_credits: List[ParsedCredit], combine_labels: bool, label_alignment: ui.Alignment):
if combine_labels:
label_strings = []
other_credits = []
for credit in parsed_credits:
if credit.text is not None and credit.link is None:
label_strings.append(credit.text)
else:
other_credits.append(credit)
label_strings_combined = " - ".join(label_strings)
# Add the label even if the string is empty. The label will expand to fill the parent HStack
# which acts like a spacer that right-aligns the image and button elements. Eventually we
# should find a different solution here.
# VStack + Spacer pushes our content to the bottom of the Stack to account for varying heights
with ui.VStack(spacing=0):
ui.Spacer()
ui.Label(label_strings_combined, height=0, word_wrap=True, alignment=label_alignment)
self._build_ui_elements(other_credits, label_alignment)
else:
self._build_ui_elements(parsed_credits, label_alignment)
# There is a builtin name called credits, which is why this argument is called asset_credits.
def __init__(
self,
asset_credits: List[Tuple[str, bool]],
should_show_on_screen: bool,
perform_fallback=False,
combine_labels=False,
label_alignment=ui.Alignment.LEFT,
):
self._logger = logging.getLogger(__name__)
parsed_credits = self._parse_credits(asset_credits, should_show_on_screen, perform_fallback)
self._build_ui(parsed_credits, combine_labels, label_alignment)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/quick_add_widget.py | import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
import omni.usd
from typing import List, Optional
from ..bindings import ICesiumOmniverseInterface
from ..models import AssetToAdd
from .styles import CesiumOmniverseUiStyles
from cesium.usd.plugins.CesiumUsdSchemas import IonServer as CesiumIonServer
LABEL_HEIGHT = 24
BUTTON_HEIGHT = 40
class CesiumOmniverseQuickAddWidget(ui.Frame):
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, **kwargs):
self._logger = logging.getLogger(__name__)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._ion_quick_add_frame: Optional[ui.Frame] = None
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
super().__init__(build_fn=self._build_ui, **kwargs)
def destroy(self) -> None:
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(self._on_update_frame, name="on_update_frame")
)
def _on_update_frame(self, _: carb.events.IEvent):
if self._ion_quick_add_frame is None:
return
if omni.usd.get_context().get_stage_state() != omni.usd.StageState.OPENED:
return
session = self._cesium_omniverse_interface.get_session()
if session is not None:
stage = omni.usd.get_context().get_stage()
current_server_path = self._cesium_omniverse_interface.get_server_path()
current_server = CesiumIonServer.Get(stage, current_server_path)
current_server_url = current_server.GetIonServerUrlAttr().Get()
# Temporary workaround to only show quick add assets for official ion server
# until quick add route is implemented
self._ion_quick_add_frame.visible = (
session.is_connected() and current_server_url == "https://ion.cesium.com/"
)
@staticmethod
def _add_blank_button_clicked():
asset_to_add = AssetToAdd("Cesium Tileset", 0)
add_blank_asset_event = carb.events.type_from_string("cesium.omniverse.ADD_BLANK_ASSET")
app.get_app().get_message_bus_event_stream().push(add_blank_asset_event, payload=asset_to_add.to_dict())
@staticmethod
def _add_cartographic_polygon_button_clicked():
add_cartographic_polygon_event = carb.events.type_from_string("cesium.omniverse.ADD_CARTOGRAPHIC_POLYGON")
app.get_app().get_message_bus_event_stream().push(add_cartographic_polygon_event, payload={})
def _photorealistic_tiles_button_clicked(self):
self._add_ion_assets(AssetToAdd("Google Photorealistic 3D Tiles", 2275207))
def _cwt_bing_maps_button_clicked(self):
self._add_ion_assets(AssetToAdd("Cesium World Terrain", 1, "Bing Maps Aerial imagery", 2))
def _cwt_bing_maps_labels_button_clicked(self):
self._add_ion_assets(AssetToAdd("Cesium World Terrain", 1, "Bing Maps Aerial with Labels imagery", 3))
def _cwt_bing_maps_roads_button_clicked(self):
self._add_ion_assets(AssetToAdd("Cesium World Terrain", 1, "Bing Maps Road imagery", 4))
def _cwt_sentinel_button_clicked(self):
self._add_ion_assets(AssetToAdd("Cesium World Terrain", 1, "Sentinel-2 imagery", 3954))
def _cesium_osm_buildings_clicked(self):
self._add_ion_assets(AssetToAdd("Cesium OSM Buildings", 96188))
@staticmethod
def _add_ion_assets(asset_to_add: AssetToAdd):
add_asset_event = carb.events.type_from_string("cesium.omniverse.ADD_ION_ASSET")
app.get_app().get_message_bus_event_stream().push(add_asset_event, payload=asset_to_add.to_dict())
def _build_ui(self):
with self:
with ui.VStack(spacing=10):
with ui.VStack(spacing=5):
ui.Label(
"Quick Add Basic Assets",
style=CesiumOmniverseUiStyles.quick_add_section_label,
height=LABEL_HEIGHT,
)
ui.Button(
"Blank 3D Tiles Tileset",
style=CesiumOmniverseUiStyles.quick_add_button,
clicked_fn=self._add_blank_button_clicked,
height=BUTTON_HEIGHT,
)
ui.Button(
"Cesium Cartographic Polygon",
style=CesiumOmniverseUiStyles.quick_add_button,
clicked_fn=self._add_cartographic_polygon_button_clicked,
height=BUTTON_HEIGHT,
)
self._ion_quick_add_frame = ui.Frame(visible=False, height=0)
with self._ion_quick_add_frame:
with ui.VStack(spacing=5):
ui.Label(
"Quick Add Cesium ion Assets",
style=CesiumOmniverseUiStyles.quick_add_section_label,
height=LABEL_HEIGHT,
)
ui.Button(
"Google Photorealistic 3D Tiles",
style=CesiumOmniverseUiStyles.quick_add_button,
height=BUTTON_HEIGHT,
clicked_fn=self._photorealistic_tiles_button_clicked,
)
ui.Button(
"Cesium World Terrain + Bing Maps Aerial imagery",
style=CesiumOmniverseUiStyles.quick_add_button,
height=BUTTON_HEIGHT,
clicked_fn=self._cwt_bing_maps_button_clicked,
)
ui.Button(
"Cesium World Terrain + Bing Maps with Labels imagery",
style=CesiumOmniverseUiStyles.quick_add_button,
height=BUTTON_HEIGHT,
clicked_fn=self._cwt_bing_maps_labels_button_clicked,
)
ui.Button(
"Cesium World Terrain + Bing Maps Road imagery",
style=CesiumOmniverseUiStyles.quick_add_button,
height=BUTTON_HEIGHT,
clicked_fn=self._cwt_bing_maps_roads_button_clicked,
)
ui.Button(
"Cesium World Terrain + Sentinel-2 imagery",
style=CesiumOmniverseUiStyles.quick_add_button,
height=BUTTON_HEIGHT,
clicked_fn=self._cwt_sentinel_button_clicked,
)
ui.Button(
"Cesium OSM Buildings",
style=CesiumOmniverseUiStyles.quick_add_button,
height=BUTTON_HEIGHT,
clicked_fn=self._cesium_osm_buildings_clicked,
)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/troubleshooter_window.py | import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
import webbrowser
from typing import List, Optional
from ..bindings import ICesiumOmniverseInterface
from .pass_fail_widget import CesiumPassFailWidget
from .styles import CesiumOmniverseUiStyles
class CesiumTroubleshooterWindow(ui.Window):
WINDOW_BASE_NAME = "Token Troubleshooting"
def __init__(
self,
cesium_omniverse_interface: ICesiumOmniverseInterface,
name: str,
tileset_path: str,
tileset_ion_asset_id: int,
raster_overlay_ion_asset_id: int,
message: str,
**kwargs,
):
window_name = f"{CesiumTroubleshooterWindow.WINDOW_BASE_NAME} - {name}"
super().__init__(window_name, **kwargs)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._logger = logging.getLogger(__name__)
self._name = name
self._tileset_path = tileset_path
self._tileset_ion_asset_id = tileset_ion_asset_id
self.raster_overlay_ion_asset_id = raster_overlay_ion_asset_id
ion_id = raster_overlay_ion_asset_id if raster_overlay_ion_asset_id > 0 else tileset_ion_asset_id
self._message = (
f"{name} tried to access Cesium ion for asset id {ion_id}, but it didn't work, probably "
+ "due to a problem with the access token. This panel will help you fix it!"
)
self.height = 400
self.width = 700
self.padding_x = 12
self.padding_y = 12
self._token_details_event_type = carb.events.type_from_string("cesium.omniverse.TOKEN_DETAILS_READY")
self._asset_details_event_type = carb.events.type_from_string("cesium.omniverse.ASSET_DETAILS_READY")
self._default_token_stack: Optional[ui.VStack] = None
self._default_token_is_valid_widget: Optional[CesiumPassFailWidget] = None
self._default_token_has_access_widget: Optional[CesiumPassFailWidget] = None
self._default_token_associated_to_account_widget: Optional[CesiumPassFailWidget] = None
self._asset_token_stack: Optional[ui.VStack] = None
self._asset_token_is_valid_widget: Optional[CesiumPassFailWidget] = None
self._asset_token_has_access_widget: Optional[CesiumPassFailWidget] = None
self._asset_token_associated_to_account_widget: Optional[CesiumPassFailWidget] = None
self._asset_on_account_widget: Optional[CesiumPassFailWidget] = None
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
if raster_overlay_ion_asset_id > 0:
self._cesium_omniverse_interface.update_troubleshooting_details(
tileset_path,
tileset_ion_asset_id,
raster_overlay_ion_asset_id,
self._token_details_event_type,
self._asset_details_event_type,
)
else:
self._cesium_omniverse_interface.update_troubleshooting_details(
tileset_path, tileset_ion_asset_id, self._token_details_event_type, self._asset_details_event_type
)
self.frame.set_build_fn(self._build_ui)
def __del__(self):
self.destroy()
def destroy(self):
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions = None
def _setup_subscriptions(self):
bus = app.get_app().get_message_bus_event_stream()
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
self._token_details_event_type,
self._on_token_details_ready,
name="cesium.omniverse.TOKEN_DETAILS_READY",
)
)
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
self._asset_details_event_type,
self._on_asset_details_ready,
name="cesium.omniverse.ASSET_DETAILS_READY",
)
)
def _on_token_details_ready(self, _e: carb.events.IEvent):
self._logger.info("Received token details event.")
default_token_details = self._cesium_omniverse_interface.get_default_token_troubleshooting_details()
if self._default_token_stack is not None:
self._default_token_stack.visible = default_token_details.show_details
if self._default_token_is_valid_widget is not None:
self._default_token_is_valid_widget.passed = default_token_details.is_valid
if self._default_token_has_access_widget is not None:
self._default_token_has_access_widget.passed = default_token_details.allows_access_to_asset
if self._default_token_associated_to_account_widget is not None:
self._default_token_associated_to_account_widget.passed = (
default_token_details.associated_with_user_account
)
asset_token_details = self._cesium_omniverse_interface.get_asset_token_troubleshooting_details()
if self._asset_token_stack is not None:
self._asset_token_stack.visible = asset_token_details.show_details
if self._asset_token_is_valid_widget is not None:
self._asset_token_is_valid_widget.passed = asset_token_details.is_valid
if self._asset_token_has_access_widget is not None:
self._asset_token_has_access_widget.passed = asset_token_details.allows_access_to_asset
if self._asset_token_associated_to_account_widget is not None:
self._asset_token_associated_to_account_widget.passed = asset_token_details.associated_with_user_account
def _on_asset_details_ready(self, _e: carb.events.IEvent):
asset_details = self._cesium_omniverse_interface.get_asset_troubleshooting_details()
if self._asset_on_account_widget is not None:
self._asset_on_account_widget.passed = asset_details.asset_exists_in_user_account
@staticmethod
def _on_open_ion_button_clicked():
webbrowser.open("https://ion.cesium.com")
def _build_ui(self):
with ui.VStack(spacing=10):
ui.Label(self._message, height=54, word_wrap=True)
with ui.VGrid(spacing=10, column_count=2):
self._asset_token_stack = ui.VStack(spacing=5, visible=False)
with self._asset_token_stack:
ui.Label(
f"{self._name}'s Access Token",
height=16,
style=CesiumOmniverseUiStyles.troubleshooter_header_style,
)
with ui.HStack(height=16, spacing=10):
self._asset_token_is_valid_widget = CesiumPassFailWidget()
ui.Label("Is a valid Cesium ion Token")
with ui.HStack(height=16, spacing=10):
self._asset_token_has_access_widget = CesiumPassFailWidget()
ui.Label("Allows access to this asset")
with ui.HStack(height=16, spacing=10):
self._asset_token_associated_to_account_widget = CesiumPassFailWidget()
ui.Label("Is associated with your user account")
self._default_token_stack = ui.VStack(spacing=5, visible=False)
with self._default_token_stack:
ui.Label(
"Project Default Access Token",
height=16,
style=CesiumOmniverseUiStyles.troubleshooter_header_style,
)
with ui.HStack(height=16, spacing=10):
self._default_token_is_valid_widget = CesiumPassFailWidget()
ui.Label("Is a valid Cesium ion Token")
with ui.HStack(height=16, spacing=10):
self._default_token_has_access_widget = CesiumPassFailWidget()
ui.Label("Allows access to this asset")
with ui.HStack(height=16, spacing=10):
self._default_token_associated_to_account_widget = CesiumPassFailWidget()
ui.Label("Is associated with your user account")
with ui.VStack(spacing=5):
ui.Label("Asset", height=16, style=CesiumOmniverseUiStyles.troubleshooter_header_style)
with ui.HStack(height=16, spacing=10):
self._asset_on_account_widget = CesiumPassFailWidget()
ui.Label("Asset ID exists in your user account")
ui.Spacer()
ui.Button(
"Open Cesium ion on the Web",
alignment=ui.Alignment.CENTER,
height=36,
style=CesiumOmniverseUiStyles.blue_button_style,
clicked_fn=self._on_open_ion_button_clicked,
)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/sign_in_widget.py | import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
import omni.kit.clipboard as clipboard
import webbrowser
from pathlib import Path
from typing import List, Optional
from ..bindings import ICesiumOmniverseInterface
from .styles import CesiumOmniverseUiStyles
class CesiumOmniverseSignInWidget(ui.Frame):
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, **kwargs):
manager = app.get_app().get_extension_manager()
ext_id = manager.get_extension_id_by_module("cesium.omniverse")
self._logger = logging.getLogger(__name__)
self._images_path = Path(manager.get_extension_path(ext_id)).joinpath("images")
self._cesium_omniverse_interface = cesium_omniverse_interface
self._connect_button: Optional[ui.Button] = None
self._waiting_message_frame: Optional[ui.Frame] = None
self._authorize_url_field: Optional[ui.StringField] = None
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
super().__init__(build_fn=self._build_ui, **kwargs)
def destroy(self):
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(self._on_update_frame, name="on_update_frame")
)
def _on_update_frame(self, _e: carb.events.IEvent):
if not self.visible:
return
session = self._cesium_omniverse_interface.get_session()
if session is not None and self._waiting_message_frame is not None:
self._waiting_message_frame.visible = session.is_connecting()
if session.is_connecting():
authorize_url = session.get_authorize_url()
if self._authorize_url_field.model.get_value_as_string() != authorize_url:
self._authorize_url_field.model.set_value(authorize_url)
webbrowser.open(authorize_url)
def _build_ui(self):
with self:
with ui.VStack(alignment=ui.Alignment.CENTER_TOP, spacing=ui.Length(20, ui.UnitType.PIXEL)):
ui.Spacer(height=0)
ui.Image(
f"{self._images_path}/placeholder_logo.png",
alignment=ui.Alignment.CENTER,
fill_policy=ui.FillPolicy.PRESERVE_ASPECT_FIT,
height=140,
)
with ui.HStack(height=0):
ui.Spacer()
ui.Label(
"Access global high-resolution 3D content, including photogrammetry, "
"terrain, imagery, and buildings. Bring your own data for tiling, hosting, "
"and streaming to Omniverse.",
alignment=ui.Alignment.CENTER,
style=CesiumOmniverseUiStyles.intro_label_style,
width=ui.Length(80, ui.UnitType.PERCENT),
word_wrap=True,
)
ui.Spacer()
with ui.HStack(height=0):
ui.Spacer()
self._connect_button = ui.Button(
"Connect to Cesium ion",
alignment=ui.Alignment.CENTER,
height=ui.Length(36, ui.UnitType.PIXEL),
width=ui.Length(180, ui.UnitType.PIXEL),
style=CesiumOmniverseUiStyles.blue_button_style,
clicked_fn=self._connect_button_clicked,
)
ui.Spacer()
self._waiting_message_frame = ui.Frame(visible=False, height=0)
with self._waiting_message_frame:
with ui.VStack(spacing=10):
ui.Label("Waiting for you to sign into Cesium ion with your web browser...")
ui.Button("Open web browser again", clicked_fn=self._open_web_browser_again_clicked)
ui.Label("Or copy the URL below into your web browser.")
with ui.HStack():
self._authorize_url_field = ui.StringField(read_only=True)
self._authorize_url_field.model.set_value("https://cesium.com")
ui.Button("Copy to Clipboard", clicked_fn=self._copy_to_clipboard_clicked)
ui.Spacer(height=10)
def _connect_button_clicked(self) -> None:
self._cesium_omniverse_interface.connect_to_ion()
def _open_web_browser_again_clicked(self) -> None:
webbrowser.open(self._authorize_url_field.model.get_value_as_string())
def _copy_to_clipboard_clicked(self) -> None:
if self._authorize_url_field is not None:
clipboard.copy(self._authorize_url_field.model.get_value_as_string())
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/main_window.py | from ..bindings import ICesiumOmniverseInterface, CesiumIonSession
import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
import webbrowser
from pathlib import Path
from typing import List, Optional
from .quick_add_widget import CesiumOmniverseQuickAddWidget
from .sign_in_widget import CesiumOmniverseSignInWidget
from .profile_widget import CesiumOmniverseProfileWidget
from .token_window import CesiumOmniverseTokenWindow
from .troubleshooter_window import CesiumTroubleshooterWindow
from .asset_window import CesiumOmniverseAssetWindow
from .styles import CesiumOmniverseUiStyles
HELP_URL = "https://community.cesium.com/c/cesium-for-omniverse"
LEARN_URL = "https://cesium.com/learn/omniverse/"
UPLOAD_URL = "https://ion.cesium.com/addasset"
class CesiumOmniverseMainWindow(ui.Window):
"""
The main window for working with Cesium for Omniverse. Docked in the same area as "Stage".
"""
WINDOW_NAME = "Cesium"
MENU_PATH = f"Window/Cesium/{WINDOW_NAME}"
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, **kwargs):
super().__init__(CesiumOmniverseMainWindow.WINDOW_NAME, **kwargs)
manager = app.get_app().get_extension_manager()
ext_id = manager.get_extension_id_by_module("cesium.omniverse")
self._cesium_omniverse_interface = cesium_omniverse_interface
self._logger = logging.getLogger(__name__)
self._icon_path = Path(manager.get_extension_path(ext_id)).joinpath("images")
# Buttons aren't created until the build function is called.
self._add_button: Optional[ui.Button] = None
self._upload_button: Optional[ui.Button] = None
self._token_button: Optional[ui.Button] = None
self._learn_button: Optional[ui.Button] = None
self._help_button: Optional[ui.Button] = None
self._sign_out_button: Optional[ui.Button] = None
self._quick_add_widget: Optional[CesiumOmniverseQuickAddWidget] = None
self._sign_in_widget: Optional[CesiumOmniverseSignInWidget] = None
self._profile_widget: Optional[CesiumOmniverseProfileWidget] = None
self._troubleshooter_window: Optional[CesiumTroubleshooterWindow] = None
self._asset_window: Optional[CesiumOmniverseAssetWindow] = None
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
self.frame.set_build_fn(self._build_fn)
def destroy(self) -> None:
for subscription in self._subscriptions:
subscription.unsubscribe()
if self._sign_in_widget is not None:
self._sign_in_widget.destroy()
self._sign_in_widget = None
if self._profile_widget is not None:
self._profile_widget.destroy()
self._profile_widget = None
if self._quick_add_widget is not None:
self._quick_add_widget.destroy()
self._quick_add_widget = None
if self._troubleshooter_window is not None:
self._troubleshooter_window.destroy()
self._troubleshooter_window = None
super().destroy()
def __del__(self):
self.destroy()
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
bus = app.get_app().get_message_bus_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(self._on_update_frame, name="on_update_frame")
)
assets_updated_event = carb.events.type_from_string("cesium.omniverse.ASSETS_UPDATED")
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
assets_updated_event, self._on_assets_updated, name="assets_updated"
)
)
connection_updated_event = carb.events.type_from_string("cesium.omniverse.CONNECTION_UPDATED")
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
connection_updated_event, self._on_connection_updated, name="connection_updated"
)
)
profile_updated_event = carb.events.type_from_string("cesium.omniverse.PROFILE_UPDATED")
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
profile_updated_event, self._on_profile_updated, name="profile_updated"
)
)
tokens_updated_event = carb.events.type_from_string("cesium.omniverse.TOKENS_UPDATED")
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
tokens_updated_event, self._on_tokens_updated, name="tokens_updated"
)
)
show_token_window_event = carb.events.type_from_string("cesium.omniverse.SHOW_TOKEN_WINDOW")
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
show_token_window_event, self._on_show_token_window, name="cesium.omniverse.SHOW_TOKEN_WINDOW"
)
)
show_troubleshooter_event = carb.events.type_from_string("cesium.omniverse.SHOW_TROUBLESHOOTER")
self._subscriptions.append(
bus.create_subscription_to_pop_by_type(
show_troubleshooter_event,
self._on_show_troubleshooter_window,
name="cesium.omniverse.SHOW_TROUBLESHOOTER",
)
)
def _on_update_frame(self, _e: carb.events.IEvent):
session: CesiumIonSession = self._cesium_omniverse_interface.get_session()
if session is not None and self._sign_in_widget is not None:
# Since this goes across the pybind barrier, just grab it once.
is_connected = session.is_connected()
self._sign_in_widget.visible = not is_connected
self._set_top_bar_button_status(is_connected)
def _on_assets_updated(self, _e: carb.events.IEvent):
self._logger.info("Received ion Assets updated event.")
def _on_connection_updated(self, _e: carb.events.IEvent):
self._logger.info("Received ion Connection updated event.")
def _on_profile_updated(self, _e: carb.events.IEvent):
self._logger.info("Received ion Profile updated event.")
def _on_tokens_updated(self, _e: carb.events.IEvent):
self._logger.info("Received ion Tokens updated event.")
def _on_show_token_window(self, _e: carb.events.IEvent):
self._show_token_window()
def _on_show_troubleshooter_window(self, _e: carb.events.IEvent):
tileset_path = _e.payload["tilesetPath"]
tileset_ion_asset_id = _e.payload["tilesetIonAssetId"]
raster_overlay_ion_asset_id = _e.payload["rasterOverlayIonAssetId"]
message = _e.payload["message"]
name = _e.payload["rasterOverlayName"] if _e.payload["rasterOverlayName"] else _e.payload["tilesetName"]
if self._troubleshooter_window:
self._troubleshooter_window.destroy()
self._troubleshooter_window = None
self._troubleshooter_window = CesiumTroubleshooterWindow(
self._cesium_omniverse_interface,
name,
tileset_path,
tileset_ion_asset_id,
raster_overlay_ion_asset_id,
message,
)
def _set_top_bar_button_status(self, enabled: bool):
self._add_button.enabled = enabled
self._upload_button.enabled = enabled
self._sign_out_button.enabled = enabled
def _build_fn(self):
"""Builds all UI components."""
with ui.VStack(spacing=0):
button_style = CesiumOmniverseUiStyles.top_bar_button_style
self._profile_widget = CesiumOmniverseProfileWidget(self._cesium_omniverse_interface, height=20)
with ui.HStack(height=ui.Length(80, ui.UnitType.PIXEL)):
self._add_button = ui.Button(
"Add",
image_url=f"{self._icon_path}/FontAwesome/plus-solid.png",
style=button_style,
clicked_fn=self._add_button_clicked,
enabled=False,
)
self._upload_button = ui.Button(
"Upload",
image_url=f"{self._icon_path}/FontAwesome/cloud-upload-alt-solid.png",
style=button_style,
clicked_fn=self._upload_button_clicked,
enabled=False,
)
self._token_button = ui.Button(
"Token",
image_url=f"{self._icon_path}/FontAwesome/key-solid.png",
style=button_style,
clicked_fn=self._token_button_clicked,
)
self._learn_button = ui.Button(
"Learn",
image_url=f"{self._icon_path}/FontAwesome/book-reader-solid.png",
style=button_style,
clicked_fn=self._learn_button_clicked,
)
self._help_button = ui.Button(
"Help",
image_url=f"{self._icon_path}/FontAwesome/hands-helping-solid.png",
style=button_style,
clicked_fn=self._help_button_clicked,
)
self._sign_out_button = ui.Button(
"Sign Out",
image_url=f"{self._icon_path}/FontAwesome/sign-out-alt-solid.png",
# style=button_style,
style=button_style,
clicked_fn=self._sign_out_button_clicked,
enabled=False,
)
with ui.ScrollingFrame():
with ui.VStack(spacing=0):
self._quick_add_widget = CesiumOmniverseQuickAddWidget(self._cesium_omniverse_interface)
self._sign_in_widget = CesiumOmniverseSignInWidget(
self._cesium_omniverse_interface, visible=False
)
def _add_button_clicked(self) -> None:
if not self._add_button or not self._add_button.enabled:
return
show_asset_window_event = carb.events.type_from_string("cesium.omniverse.SHOW_ASSET_WINDOW")
app.get_app().get_message_bus_event_stream().push(show_asset_window_event)
def _upload_button_clicked(self) -> None:
if not self._upload_button or not self._upload_button.enabled:
return
webbrowser.open_new_tab(UPLOAD_URL)
def _token_button_clicked(self) -> None:
if not self._token_button:
return
self._show_token_window()
def _learn_button_clicked(self) -> None:
if not self._learn_button:
return
webbrowser.open_new_tab(LEARN_URL)
def _help_button_clicked(self) -> None:
if not self._help_button:
return
webbrowser.open_new_tab(HELP_URL)
def _sign_out_button_clicked(self) -> None:
if not self._sign_out_button or not self._sign_out_button.enabled:
return
session = self._cesium_omniverse_interface.get_session()
if session is not None:
session.disconnect()
self._set_top_bar_button_status(False)
def _show_token_window(self):
self._cesium_omniverse_interface.get_session().refresh_tokens()
CesiumOmniverseTokenWindow(self._cesium_omniverse_interface)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/settings_window.py | import logging
import carb.settings
from typing import Optional
import omni.ui as ui
from ..bindings import ICesiumOmniverseInterface
from cesium.omniverse.utils.custom_fields import int_field_with_label
class CesiumOmniverseSettingsWindow(ui.Window):
WINDOW_NAME = "Cesium Settings"
MENU_PATH = f"Window/Cesium/{WINDOW_NAME}"
_logger: logging.Logger
_cesium_omniverse_interface: Optional[ICesiumOmniverseInterface] = None
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, title: str, **kwargs):
super().__init__(title, **kwargs)
self._logger = logging.getLogger(__name__)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._cache_items_setting = "/persistent/exts/cesium.omniverse/maxCacheItems"
# Set the function that is called to build widgets when the window is visible
self.frame.set_build_fn(self._build_fn)
def destroy(self):
# It will destroy all the children
super().destroy()
def __del__(self):
self.destroy()
@staticmethod
def show_window():
ui.Workspace.show_window(CesiumOmniverseSettingsWindow.WINDOW_NAME)
def _build_fn(self):
"""Builds out the UI buttons and their handlers."""
def set_cache_parameters():
newval = self._cache_items_model.get_value_as_int()
carb.settings.get_settings().set(self._cache_items_setting, newval)
def clear_cache():
self._cesium_omniverse_interface.clear_accessor_cache()
with ui.VStack(spacing=4):
cache_items = carb.settings.get_settings().get(self._cache_items_setting)
self._cache_items_model = ui.SimpleIntModel(cache_items)
int_field_with_label("Maximum cache items", model=self._cache_items_model)
ui.Button("Set cache parameters (requires restart)", height=20, clicked_fn=set_cache_parameters)
ui.Button("Clear cache", height=20, clicked_fn=clear_cache)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/credits_viewport_frame.py | import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
from typing import List, Optional, Tuple
from ..bindings import ICesiumOmniverseInterface
from .credits_parser import CesiumCreditsParser
from .credits_window import CesiumOmniverseCreditsWindow
import json
from .events import EVENT_CREDITS_CHANGED
class CesiumCreditsViewportFrame:
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, instance):
self._logger = logging.getLogger(__name__)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._credits_viewport_frame = instance.get_frame("cesium.omniverse.viewport.ION_CREDITS")
self._credits_window: Optional[CesiumOmniverseCreditsWindow] = None
self._data_attribution_button: Optional[ui.Button] = None
self._on_credits_changed_event = EVENT_CREDITS_CHANGED
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
self._credits: List[Tuple[str, bool]] = []
self._new_credits: List[Tuple[str, bool]] = []
self._build_fn()
def getFrame(self):
return self._credits_viewport_frame
def __del__(self):
self.destroy()
def destroy(self):
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
if self._credits_window is not None:
self._credits_window.destroy()
self._credits_window = None
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(
self._on_update_frame, name="cesium.omniverse.viewport.ON_UPDATE_FRAME"
)
)
message_bus = app.get_app().get_message_bus_event_stream()
self._subscriptions.append(
message_bus.create_subscription_to_pop_by_type(EVENT_CREDITS_CHANGED, self._on_credits_changed)
)
def _on_update_frame(self, _e: carb.events.IEvent):
if self._data_attribution_button is None:
return
if self._new_credits != self._credits:
self._credits.clear()
self._credits.extend(self._new_credits)
self._build_fn()
has_offscreen_credits = False
for _, show_on_screen in self._new_credits:
if not show_on_screen:
has_offscreen_credits = True
if has_offscreen_credits != self._data_attribution_button.visible:
if has_offscreen_credits:
self._logger.info("Show Data Attribution")
else:
self._logger.info("Hide Data Attribution")
self._data_attribution_button.visible = has_offscreen_credits
def _on_data_attribution_button_clicked(self):
self._credits_window = CesiumOmniverseCreditsWindow(self._cesium_omniverse_interface, self._credits)
def _build_fn(self):
with self._credits_viewport_frame:
with ui.VStack():
ui.Spacer()
with ui.HStack(height=0):
# Prevent credits from overlapping the axis display
ui.Spacer(width=100)
with ui.HStack(height=0, spacing=4):
CesiumCreditsParser(
self._credits,
should_show_on_screen=True,
combine_labels=True,
label_alignment=ui.Alignment.RIGHT,
)
# VStack + Spacer pushes our content to the bottom of the Stack to account for varying heights
with ui.VStack(spacing=0, width=0):
ui.Spacer()
self._data_attribution_button = ui.Button(
"Data Attribution",
visible=False,
width=0,
height=0,
clicked_fn=self._on_data_attribution_button_clicked,
)
def _on_credits_changed(self, _e: carb.events.IEvent):
credits_json = _e.payload["credits"]
credits = json.loads(credits_json)
if credits is not None:
self._new_credits = credits
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/__init__.py | from .styles import CesiumOmniverseUiStyles # noqa: F401
from .quick_add_widget import CesiumOmniverseQuickAddWidget # noqa: F401
from .sign_in_widget import CesiumOmniverseSignInWidget # noqa: F401
from .profile_widget import CesiumOmniverseProfileWidget # noqa: F401
from .token_window import CesiumOmniverseTokenWindow # noqa: F401
from .main_window import CesiumOmniverseMainWindow # noqa: F401
from .asset_window import CesiumOmniverseAssetWindow # noqa: F401
from .debug_window import CesiumOmniverseDebugWindow # noqa: F401
from .attributes_widget_controller import CesiumAttributesWidgetController # noqa: F401
from .fabric_modal import CesiumFabricModal # noqa: F401
from .credits_window import CesiumOmniverseCreditsWindow # noqa: F401
from .credits_viewport_frame import CesiumCreditsViewportFrame # noqa: F401
from .credits_parser import CesiumCreditsParser # noqa: F401
from .search_field_widget import CesiumSearchFieldWidget # noqa: F401
from .statistics_widget import CesiumOmniverseStatisticsWidget # noqa: F401
from .models import * # noqa: F401 F403
from .credits_viewport_controller import CreditsViewportController # noqa: F401
from .add_menu_controller import CesiumAddMenuController # noqa: F401
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/search_field_widget.py | from typing import Callable, List, Optional
import carb.events
import omni.ui as ui
from omni.ui import color as cl
class CesiumSearchFieldWidget(ui.Frame):
def __init__(
self, callback_fn: Callable[[ui.AbstractValueModel], None], default_value="", font_size=14, **kwargs
):
self._callback_fn = callback_fn
self._search_value = ui.SimpleStringModel(default_value)
self._font_size = font_size
self._clear_button_stack: Optional[ui.Stack] = None
self._subscriptions: List[carb.Subscription] = []
self._setup_subscriptions()
super().__init__(build_fn=self._build_fn, **kwargs)
def destroy(self):
super().destroy()
@property
def search_value(self) -> str:
return self._search_value.get_value_as_string()
@search_value.setter
def search_value(self, value: str):
self._search_value.set_value(value)
self._set_clear_button_visibility()
def _update_visibility(self, _e):
self._set_clear_button_visibility()
def _setup_subscriptions(self):
self._subscriptions.append(self._search_value.subscribe_value_changed_fn(self._callback_fn))
self._subscriptions.append(self._search_value.subscribe_value_changed_fn(self._update_visibility))
def _on_clear_click(self):
self._search_value.set_value("")
self._set_clear_button_visibility()
def _set_clear_button_visibility(self):
self._clear_button_stack.visible = self._search_value.as_string != ""
def _build_fn(self):
with self:
with ui.ZStack(height=0):
ui.Rectangle(style={"background_color": cl("#1F2123"), "border_radius": 3})
with ui.HStack(alignment=ui.Alignment.CENTER):
image_size = self._font_size * 2
ui.Image(
"resources/glyphs/menu_search.svg",
width=image_size,
height=image_size,
style={"margin": 4},
)
with ui.VStack():
ui.Spacer()
ui.StringField(
model=self._search_value, height=self._font_size, style={"font_size": self._font_size}
)
ui.Spacer()
self._clear_button_stack = ui.VStack(width=0, visible=False)
with self._clear_button_stack:
ui.Spacer()
ui.Button(
image_url="resources/icons/Close.png",
width=0,
height=0,
image_width=self._font_size,
image_height=self._font_size,
style={"margin": 4, "background_color": cl("#1F2123")},
clicked_fn=self._on_clear_click,
opaque_for_mouse_events=True,
)
ui.Spacer()
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/credits_window.py | import logging
import omni.kit.app as app
import omni.ui as ui
from pathlib import Path
from typing import List, Tuple
from .credits_parser import CesiumCreditsParser
from ..bindings import ICesiumOmniverseInterface
from .styles import CesiumOmniverseUiStyles
class CesiumOmniverseCreditsWindow(ui.Window):
WINDOW_NAME = "Data Attribution"
# There is a builtin name called credits, which is why this argument is called asset_credits.
def __init__(
self, cesium_omniverse_interface: ICesiumOmniverseInterface, asset_credits: List[Tuple[str, bool]], **kwargs
):
super().__init__(CesiumOmniverseCreditsWindow.WINDOW_NAME, **kwargs)
manager = app.get_app().get_extension_manager()
ext_id = manager.get_extension_id_by_module("cesium.omniverse")
self._cesium_omniverse_interface = cesium_omniverse_interface
self._logger = logging.getLogger(__name__)
self._images_path = Path(manager.get_extension_path(ext_id)).joinpath("images")
self.height = 500
self.width = 400
self.padding_x = 12
self.padding_y = 12
self._credits = asset_credits
self.frame.set_build_fn(self._build_ui)
def __del__(self):
self.destroy()
def destroy(self):
super().destroy()
def _build_ui(self):
with ui.VStack(spacing=5):
ui.Label("Data Provided By:", height=0, style=CesiumOmniverseUiStyles.attribution_header_style)
CesiumCreditsParser(self._credits, should_show_on_screen=False, perform_fallback=True)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/pass_fail_widget.py | from pathlib import Path
import carb.events
import omni.kit.app as app
import omni.ui as ui
from typing import List
class CesiumPassFailWidget(ui.Frame):
def __init__(self, passed=False, **kwargs):
self._passed_model = ui.SimpleBoolModel(passed)
manager = app.get_app().get_extension_manager()
ext_id = manager.get_extension_id_by_module("cesium.omniverse")
self._icon_path = Path(manager.get_extension_path(ext_id)).joinpath("images")
self._subscriptions: List[carb.Subscription] = []
self._setup_subscriptions()
super().__init__(build_fn=self._build_ui, **kwargs)
def __del__(self):
self.destroy()
def destroy(self):
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
@property
def passed(self) -> bool:
return self._passed_model.get_value_as_bool()
@passed.setter
def passed(self, value: bool):
self._passed_model.set_value(value)
def _setup_subscriptions(self):
self._subscriptions.append(self._passed_model.subscribe_value_changed_fn(lambda _e: self.rebuild()))
def _build_ui(self):
with self:
with ui.VStack(width=16, height=16):
path_root = f"{self._icon_path}/FontAwesome"
icon = (
f"{path_root}/check-solid.svg"
if self._passed_model.get_value_as_bool()
else f"{path_root}/times-solid.svg"
)
ui.Image(
icon,
fill_policy=ui.FillPolicy.PRESERVE_ASPECT_FIT,
alignment=ui.Alignment.CENTER_BOTTOM,
width=16,
height=16,
)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/events.py | from carb.events import type_from_string
# Event base path. Do not use directly outside of events.py
_EVENT_BASE = "cesium.omniverse.event"
# Signals the credits have changed. Currently, this only triggers when the displayed
# credits are changed. It is possible for the credit payload that shows under
# the "Data Attribution" button to change, but this event will not fire for that.
EVENT_CREDITS_CHANGED = type_from_string(f"{_EVENT_BASE}.viewport.CREDITS_CHANGED")
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/attributes_widget_controller.py | import logging
import omni.kit.window.property
from .attributes import (
CesiumDataSchemaAttributesWidget,
CesiumGeoreferenceSchemaAttributesWidget,
CesiumTilesetAttributesWidget,
CesiumGlobeAnchorAttributesWidget,
CesiumIonServerAttributesWidget,
CesiumIonRasterOverlayAttributesWidget,
CesiumPolygonRasterOverlayAttributesWidget,
CesiumTileMapServiceRasterOverlayAttributesWidget,
CesiumWebMapServiceRasterOverlayAttributesWidget,
CesiumWebMapTileServiceRasterOverlayAttributesWidget,
)
from ..bindings import ICesiumOmniverseInterface
class CesiumAttributesWidgetController:
"""
This is designed as a helpful function for separating out the registration and
unregistration of Cesium's attributes widgets.
"""
def __init__(self, _cesium_omniverse_interface: ICesiumOmniverseInterface):
self._cesium_omniverse_interface = _cesium_omniverse_interface
self._logger = logging.getLogger(__name__)
self._register_data_attributes_widget()
self._register_georeference_attributes_widget()
self._register_tileset_attributes_widget()
self._register_global_anchor_attributes_widget()
self._register_ion_server_attributes_widget()
self._register_ion_raster_overlay_attributes_widget()
self._register_polygon_raster_overlay_attributes_widget()
self._register_tile_map_service_raster_overlay_attributes_widget()
self._register_web_map_service_raster_overlay_attributes_widget()
self._register_web_map_tile_service_raster_overlay_attributes_widget()
def destroy(self):
self._unregister_data_attributes_widget()
self._unregister_georeference_attributes_widget()
self._unregister_tileset_attributes_widget()
self._unregister_global_anchor_attributes_widget()
self._unregister_ion_server_attributes_widget()
self._unregister_ion_raster_overlay_attributes_widget()
self._unregister_polygon_raster_overlay_attributes_widget()
self._unregister_tile_map_service_raster_overlay_attributes_widget()
self._unregister_web_map_service_raster_overlay_attributes_widget()
self._unregister_web_map_tile_service_raster_overlay_attributes_widget()
@staticmethod
def _register_data_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget("prim", "cesiumData", CesiumDataSchemaAttributesWidget())
@staticmethod
def _unregister_data_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumData")
@staticmethod
def _register_georeference_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget("prim", "cesiumGeoreference", CesiumGeoreferenceSchemaAttributesWidget())
@staticmethod
def _unregister_georeference_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumGeoreference")
def _register_tileset_attributes_widget(self):
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget(
"prim", "cesiumTileset", CesiumTilesetAttributesWidget(self._cesium_omniverse_interface)
)
@staticmethod
def _unregister_tileset_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumTileset")
@staticmethod
def _register_ion_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget("prim", "cesiumIonRasterOverlay", CesiumIonRasterOverlayAttributesWidget())
@staticmethod
def _unregister_ion_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumIonRasterOverlay")
@staticmethod
def _register_polygon_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget("prim", "cesiumPolygonRasterOverlay", CesiumPolygonRasterOverlayAttributesWidget())
@staticmethod
def _unregister_polygon_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumPolygonRasterOverlay")
@staticmethod
def _register_web_map_service_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget(
"prim", "cesiumWebMapServiceRasterOverlay", CesiumWebMapServiceRasterOverlayAttributesWidget()
)
@staticmethod
def _register_tile_map_service_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget(
"prim", "cesiumTileMapServiceRasterOverlay", CesiumTileMapServiceRasterOverlayAttributesWidget()
)
@staticmethod
def _register_web_map_tile_service_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget(
"prim", "cesiumWebMapTileServiceRasterOverlay", CesiumWebMapTileServiceRasterOverlayAttributesWidget()
)
@staticmethod
def _unregister_web_map_service_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumWebMapServiceRasterOverlay")
@staticmethod
def _unregister_tile_map_service_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumTileMapServiceRasterOverlay")
@staticmethod
def _unregister_web_map_tile_service_raster_overlay_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumWebMapTileServiceRasterOverlay")
def _register_global_anchor_attributes_widget(self):
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget(
"prim", "cesiumGlobeAnchorAPI", CesiumGlobeAnchorAttributesWidget(self._cesium_omniverse_interface)
)
@staticmethod
def _unregister_global_anchor_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumGlobalAnchorAPI")
def _register_ion_server_attributes_widget(self):
window = omni.kit.window.property.get_window()
if window is not None:
window.register_widget(
"prim", "cesiumIonServer", CesiumIonServerAttributesWidget(self._cesium_omniverse_interface)
)
@staticmethod
def _unregister_ion_server_attributes_widget():
window = omni.kit.window.property.get_window()
if window is not None:
window.unregister_widget("prim", "cesiumIonServer")
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/statistics_widget.py | import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
from typing import List
from ..bindings import ICesiumOmniverseInterface
from .models.space_delimited_number_model import SpaceDelimitedNumberModel
from .models.human_readable_bytes_model import HumanReadableBytesModel
MATERIALS_CAPACITY_TEXT = "Materials capacity"
MATERIALS_LOADED_TEXT = "Materials loaded"
GEOMETRIES_CAPACITY_TEXT = "Geometries capacity"
GEOMETRIES_LOADED_TEXT = "Geometries loaded"
GEOMETRIES_RENDERED_TEXT = "Geometries rendered"
TRIANGLES_LOADED_TEXT = "Triangles loaded"
TRIANGLES_RENDERED_TEXT = "Triangles rendered"
TILESET_CACHED_BYTES_TEXT = "Tileset cached bytes"
TILESET_CACHED_BYTES_HUMAN_READABLE_TEXT = "Tileset cached bytes (Human-readable)"
TILES_VISITED_TEXT = "Tiles visited"
CULLED_TILES_VISITED_TEXT = "Culled tiles visited"
TILES_RENDERED_TEXT = "Tiles rendered"
TILES_CULLED_TEXT = "Tiles culled"
MAX_DEPTH_VISITED_TEXT = "Max depth visited"
TILES_LOADING_WORKER_TEXT = "Tiles loading (worker)"
TILES_LOADING_MAIN_TEXT = "Tiles loading (main)"
TILES_LOADED_TEXT = "Tiles loaded"
class CesiumOmniverseStatisticsWidget(ui.Frame):
"""
Widget that displays statistics about the scene.
"""
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, **kwargs):
super().__init__(build_fn=self._build_fn, **kwargs)
self._logger = logging.getLogger(__name__)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._materials_capacity_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._materials_loaded_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._geometries_capacity_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._geometries_loaded_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._geometries_rendered_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._triangles_loaded_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._triangles_rendered_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._tileset_cached_bytes_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._tileset_cached_bytes_human_readable_model: HumanReadableBytesModel = HumanReadableBytesModel(0)
self._tiles_visited_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._culled_tiles_visited_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._tiles_rendered_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._tiles_culled_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._max_depth_visited_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._tiles_loading_worker_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._tiles_loading_main_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._tiles_loaded_model: SpaceDelimitedNumberModel = SpaceDelimitedNumberModel(0)
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
def __del__(self):
self.destroy()
def destroy(self):
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
super().destroy()
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(self._on_update_frame, name="on_update_frame")
)
def _on_update_frame(self, _e: carb.events.IEvent):
if not self.visible:
return
render_statistics = self._cesium_omniverse_interface.get_render_statistics()
self._materials_capacity_model.set_value(render_statistics.materials_capacity)
self._materials_loaded_model.set_value(render_statistics.materials_loaded)
self._geometries_capacity_model.set_value(render_statistics.geometries_capacity)
self._geometries_loaded_model.set_value(render_statistics.geometries_loaded)
self._geometries_rendered_model.set_value(render_statistics.geometries_rendered)
self._triangles_loaded_model.set_value(render_statistics.triangles_loaded)
self._triangles_rendered_model.set_value(render_statistics.triangles_rendered)
self._tileset_cached_bytes_model.set_value(render_statistics.tileset_cached_bytes)
self._tileset_cached_bytes_human_readable_model.set_value(render_statistics.tileset_cached_bytes)
self._tiles_visited_model.set_value(render_statistics.tiles_visited)
self._culled_tiles_visited_model.set_value(render_statistics.culled_tiles_visited)
self._tiles_rendered_model.set_value(render_statistics.tiles_rendered)
self._tiles_culled_model.set_value(render_statistics.tiles_culled)
self._max_depth_visited_model.set_value(render_statistics.max_depth_visited)
self._tiles_loading_worker_model.set_value(render_statistics.tiles_loading_worker)
self._tiles_loading_main_model.set_value(render_statistics.tiles_loading_main)
self._tiles_loaded_model.set_value(render_statistics.tiles_loaded)
def _build_fn(self):
"""Builds all UI components."""
with ui.VStack(spacing=4):
with ui.HStack(height=16):
ui.Label("Statistics", height=0)
ui.Spacer()
for label, model in [
(MATERIALS_CAPACITY_TEXT, self._materials_capacity_model),
(MATERIALS_LOADED_TEXT, self._materials_loaded_model),
(GEOMETRIES_CAPACITY_TEXT, self._geometries_capacity_model),
(GEOMETRIES_LOADED_TEXT, self._geometries_loaded_model),
(GEOMETRIES_RENDERED_TEXT, self._geometries_rendered_model),
(TRIANGLES_LOADED_TEXT, self._triangles_loaded_model),
(TRIANGLES_RENDERED_TEXT, self._triangles_rendered_model),
(TILESET_CACHED_BYTES_TEXT, self._tileset_cached_bytes_model),
(TILESET_CACHED_BYTES_HUMAN_READABLE_TEXT, self._tileset_cached_bytes_human_readable_model),
(TILES_VISITED_TEXT, self._tiles_visited_model),
(CULLED_TILES_VISITED_TEXT, self._culled_tiles_visited_model),
(TILES_RENDERED_TEXT, self._tiles_rendered_model),
(TILES_CULLED_TEXT, self._tiles_culled_model),
(MAX_DEPTH_VISITED_TEXT, self._max_depth_visited_model),
(TILES_LOADING_WORKER_TEXT, self._tiles_loading_worker_model),
(TILES_LOADING_MAIN_TEXT, self._tiles_loading_main_model),
(TILES_LOADED_TEXT, self._tiles_loaded_model),
]:
with ui.HStack(height=0):
ui.Label(label, height=0)
ui.StringField(model=model, height=0, read_only=True)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/token_window.py | import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
import omni.usd
from pathlib import Path
from enum import Enum
from typing import List, Optional
from ..bindings import ICesiumOmniverseInterface, Token
from .styles import CesiumOmniverseUiStyles
from cesium.usd.plugins.CesiumUsdSchemas import IonServer as CesiumIonServer
from ..usdUtils import get_path_to_current_ion_server
SELECT_TOKEN_TEXT = (
"Cesium for Omniverse embeds a Cesium ion token in your stage in order to allow it "
"to access the assets you add. Select the Cesium ion token to use."
)
CREATE_NEW_LABEL_TEXT = "Create a new token"
USE_EXISTING_LABEL_TEXT = "Use an existing token"
SPECIFY_TOKEN_LABEL_TEXT = "Specify a token"
CREATE_NEW_FIELD_LABEL_TEXT = "Name"
USE_EXISTING_FIELD_LABEL_TEXT = "Token"
SPECIFY_TOKEN_FIELD_LABEL_TEXT = "Token"
SELECT_BUTTON_TEXT = "Use as Project Default Token"
DEFAULT_TOKEN_PLACEHOLDER_BASE = "{0} (Created by Cesium For Omniverse)"
OUTER_SPACING = 10
CHECKBOX_WIDTH = 20
INNER_HEIGHT = 20
FIELD_SPACING = 8
FIELD_LABEL_WIDTH = 40
class TokenOptionEnum(Enum):
CREATE_NEW = 1
USE_EXISTING = 2
SPECIFY_TOKEN = 3
class UseExistingComboItem(ui.AbstractItem):
def __init__(self, token: Token):
super().__init__()
self.id = ui.SimpleStringModel(token.id)
self.name = ui.SimpleStringModel(token.name)
self.token = ui.SimpleStringModel(token.token)
def __str__(self):
return f"{self.id.get_value_as_string()}:{self.name.get_value_as_string()}:{self.token.get_value_as_string()}"
class UseExistingComboModel(ui.AbstractItemModel):
def __init__(self, item_list):
super().__init__()
self._logger = logging.getLogger(__name__)
self._current_index = ui.SimpleIntModel(0)
self._current_index.add_value_changed_fn(lambda index_model: self._item_changed(None))
self._items = [UseExistingComboItem(text) for text in item_list]
def replace_all_items(self, items: List[str]):
self._items.clear()
self._items = [UseExistingComboItem(text) for text in items]
self._current_index.set_value(0)
self._item_changed(None)
def append_child_item(self, parent_item: ui.AbstractItem, model: str):
self._items.append(UseExistingComboItem(model))
self._item_changed(None)
def get_item_children(self, item=None):
return self._items
def get_item_value_model(self, item: UseExistingComboItem = None, column_id: int = 0):
if item is None:
return self._current_index
return item.name
def get_current_selection(self):
if len(self._items) < 1:
return None
return self._items[self._current_index.get_value_as_int()]
class CesiumOmniverseTokenWindow(ui.Window):
WINDOW_NAME = "Select Cesium ion Token"
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, **kwargs):
super().__init__(CesiumOmniverseTokenWindow.WINDOW_NAME, **kwargs)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._logger = logging.getLogger(__name__)
self.height = 400
self.width = 600
self.padding_x = 12
self.padding_y = 12
session = self._cesium_omniverse_interface.get_session()
self._is_connected: bool = session.is_connected()
if self._is_connected:
self._selected_option = TokenOptionEnum.CREATE_NEW
else:
self._selected_option = TokenOptionEnum.SPECIFY_TOKEN
self._create_new_radio_button_model = ui.SimpleBoolModel(self._is_connected)
self._create_new_radio_button_model.add_value_changed_fn(
lambda m: self._radio_button_changed(m, TokenOptionEnum.CREATE_NEW)
)
self._use_existing_radio_button_model = ui.SimpleBoolModel(False)
self._use_existing_radio_button_model.add_value_changed_fn(
lambda m: self._radio_button_changed(m, TokenOptionEnum.USE_EXISTING)
)
self._specify_token_radio_button_model = ui.SimpleBoolModel(not self._is_connected)
self._specify_token_radio_button_model.add_value_changed_fn(
lambda m: self._radio_button_changed(m, TokenOptionEnum.SPECIFY_TOKEN)
)
self._use_existing_combo_box: Optional[ui.ComboBox] = None
stage = omni.usd.get_context().get_stage()
root_identifier = stage.GetRootLayer().identifier
# In the event that the stage has been saved and the root layer identifier is a file path then we want to
# grab just the final bit of that.
if not root_identifier.startswith("anon:"):
try:
root_identifier = Path(root_identifier).name
except NotImplementedError as e:
self._logger.warning(
f"Unknown stage identifier type. Passed {root_identifier} to Path. Exception: {e}"
)
self._create_new_field_model = ui.SimpleStringModel(DEFAULT_TOKEN_PLACEHOLDER_BASE.format(root_identifier))
self._use_existing_combo_model = UseExistingComboModel([])
server_prim_path = get_path_to_current_ion_server()
server_prim = CesiumIonServer.Get(stage, server_prim_path)
if server_prim.GetPrim().IsValid():
current_token = server_prim.GetProjectDefaultIonAccessTokenAttr().Get()
self._specify_token_field_model = ui.SimpleStringModel(current_token if current_token is not None else "")
else:
self._specify_token_field_model = ui.SimpleStringModel()
self._reload_next_frame = False
# _handle_select_result is different from most subscriptions. We delete it when we are done, so it is separate
# from the subscriptions array.
self._handle_select_result_sub: Optional[carb.events.ISubscription] = None
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
self.frame.set_build_fn(self._build_ui)
def __del__(self):
self.destroy()
def destroy(self):
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
if self._handle_select_result_sub is not None:
self._handle_select_result_sub.unsubscribe()
self._handle_select_result_sub = None
super().destroy()
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(self._on_update_frame, name="on_update_frame")
)
def _on_update_frame(self, _e: carb.events.IEvent):
session = self._cesium_omniverse_interface.get_session()
if self._reload_next_frame and session.is_token_list_loaded():
token_list = session.get_tokens()
self._use_existing_combo_model.replace_all_items(token_list)
if self._use_existing_combo_box:
self._use_existing_combo_box.enabled = True
self._reload_next_frame = False
elif session.is_loading_token_list():
if self._use_existing_combo_box:
self._use_existing_combo_box.enabled = False
self._reload_next_frame = True
def _select_button_clicked(self):
bus = app.get_app().get_message_bus_event_stream()
completed_event = carb.events.type_from_string("cesium.omniverse.SET_DEFAULT_PROJECT_TOKEN_COMPLETE")
self._handle_select_result_sub = bus.create_subscription_to_pop_by_type(
completed_event, self._handle_select_result, name="cesium.omniverse.HANDLE_SELECT_TOKEN_RESULT"
)
if self._selected_option is TokenOptionEnum.CREATE_NEW:
self._create_token()
elif self._selected_option is TokenOptionEnum.USE_EXISTING:
self._use_existing_token()
elif self._selected_option is TokenOptionEnum.SPECIFY_TOKEN:
self._specify_token()
def _handle_select_result(self, _e: carb.events.IEvent):
# We probably need to put some better error handling here in the future.
result = self._cesium_omniverse_interface.get_set_default_token_result()
if result.code != 0:
self._logger.warning(f"Error when trying to set token: {result.message}")
bus = app.get_app().get_message_bus_event_stream()
success_event = carb.events.type_from_string("cesium.omniverse.SET_DEFAULT_TOKEN_SUCCESS")
bus.push(success_event)
self.visible = False
self.destroy()
def _create_token(self):
name = self._create_new_field_model.get_value_as_string().strip()
if name != "":
self._cesium_omniverse_interface.create_token(name)
def _use_existing_token(self):
token = self._use_existing_combo_model.get_current_selection()
if token is not None:
self._cesium_omniverse_interface.select_token(
token.id.get_value_as_string(), token.token.get_value_as_string()
)
def _specify_token(self):
token = self._specify_token_field_model.get_value_as_string().strip()
if token != "":
self._cesium_omniverse_interface.specify_token(token)
def _radio_button_changed(self, model, selected: TokenOptionEnum):
if not model.get_value_as_bool():
self._reselect_if_none_selected(selected)
return
self._selected_option = selected
if self._selected_option is TokenOptionEnum.CREATE_NEW:
self._create_new_radio_button_model.set_value(True)
self._use_existing_radio_button_model.set_value(False)
self._specify_token_radio_button_model.set_value(False)
elif self._selected_option is TokenOptionEnum.USE_EXISTING:
self._create_new_radio_button_model.set_value(False)
self._use_existing_radio_button_model.set_value(True)
self._specify_token_radio_button_model.set_value(False)
elif self._selected_option is TokenOptionEnum.SPECIFY_TOKEN:
self._create_new_radio_button_model.set_value(False)
self._use_existing_radio_button_model.set_value(False)
self._specify_token_radio_button_model.set_value(True)
def _reselect_if_none_selected(self, selected):
"""
Reselect the checkbox in our "radio buttons" if none are selected. This is necessary because Omniverse
has us using checkboxes to make a radio button rather than a proper radio button.
"""
if (
not self._create_new_radio_button_model.get_value_as_bool()
and not self._use_existing_radio_button_model.get_value_as_bool()
and not self._specify_token_radio_button_model.get_value_as_bool()
):
if selected is TokenOptionEnum.CREATE_NEW:
self._create_new_radio_button_model.set_value(True)
elif selected is TokenOptionEnum.USE_EXISTING:
self._use_existing_radio_button_model.set_value(True)
elif selected is TokenOptionEnum.SPECIFY_TOKEN:
self._specify_token_radio_button_model.set_value(True)
@staticmethod
def _build_field(
label_text: str,
field_label_text: str,
checkbox_model: ui.SimpleBoolModel,
string_field_model: ui.SimpleStringModel,
visible=True,
):
with ui.HStack(spacing=OUTER_SPACING, visible=visible):
ui.CheckBox(checkbox_model, width=CHECKBOX_WIDTH)
with ui.VStack(height=INNER_HEIGHT, spacing=FIELD_SPACING):
ui.Label(label_text)
with ui.HStack():
ui.Label(field_label_text, width=FIELD_LABEL_WIDTH)
ui.StringField(string_field_model)
def _build_ui(self):
with ui.VStack(spacing=10):
ui.Label(SELECT_TOKEN_TEXT, height=40, word_wrap=True)
self._build_field(
CREATE_NEW_LABEL_TEXT,
CREATE_NEW_FIELD_LABEL_TEXT,
self._create_new_radio_button_model,
self._create_new_field_model,
self._is_connected,
)
with ui.HStack(spacing=OUTER_SPACING, visible=self._is_connected):
ui.CheckBox(self._use_existing_radio_button_model, width=CHECKBOX_WIDTH)
with ui.VStack(height=20, spacing=FIELD_SPACING):
ui.Label(USE_EXISTING_LABEL_TEXT)
with ui.HStack():
ui.Label(USE_EXISTING_FIELD_LABEL_TEXT, width=FIELD_LABEL_WIDTH)
self._use_existing_combo_box = ui.ComboBox(self._use_existing_combo_model)
self._build_field(
SPECIFY_TOKEN_LABEL_TEXT,
SPECIFY_TOKEN_FIELD_LABEL_TEXT,
self._specify_token_radio_button_model,
self._specify_token_field_model,
)
ui.Button(
SELECT_BUTTON_TEXT,
alignment=ui.Alignment.CENTER,
height=36,
style=CesiumOmniverseUiStyles.blue_button_style,
clicked_fn=self._select_button_clicked,
)
|
CesiumGS/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/ui/profile_widget.py | import omni.usd
import logging
import carb.events
import omni.kit.app as app
import omni.ui as ui
from typing import List, Optional
from ..bindings import ICesiumOmniverseInterface, CesiumIonSession
from enum import Enum
from cesium.usd.plugins.CesiumUsdSchemas import IonServer as CesiumIonServer
from ..usdUtils import set_path_to_current_ion_server
class SessionState(Enum):
NOT_CONNECTED = 1
LOADING = 2
CONNECTED = 3
def get_session_state(session: CesiumIonSession) -> SessionState:
if session.is_profile_loaded():
return SessionState.CONNECTED
elif session.is_loading_profile():
return SessionState.LOADING
else:
return SessionState.NOT_CONNECTED
def get_profile_id(session: CesiumIonSession) -> Optional[int]:
if session.is_profile_loaded():
profile = session.get_profile()
return profile.id
return None
class SessionComboItem(ui.AbstractItem):
def __init__(self, session: CesiumIonSession, server: CesiumIonServer):
super().__init__()
session_state = get_session_state(session)
prefix = ""
suffix = ""
if session_state == SessionState.NOT_CONNECTED:
suffix += " (not connected)"
elif session_state == SessionState.LOADING:
suffix += " (loading profile...)"
elif session_state == SessionState.CONNECTED:
prefix += session.get_profile().username
prefix += " @ "
# Get the display name from the server prim. If that's empty, use the prim path.
server_name = server.GetDisplayNameAttr().Get()
if server_name == "":
server_name = server.GetPath()
self.text = ui.SimpleStringModel(f"{prefix}{server_name}{suffix}")
self.server = server
class SessionComboModel(ui.AbstractItemModel):
def __init__(self):
super().__init__()
self._logger = logging.getLogger(__name__)
self._current_index = ui.SimpleIntModel(0)
self._current_index.add_value_changed_fn(lambda index_model: self._item_changed(None))
self._items = []
def replace_all_items(
self, sessions: List[CesiumIonSession], servers: List[CesiumIonServer], current_server: CesiumIonServer
):
self._items.clear()
self._items = [SessionComboItem(session, server) for session, server in zip(sessions, servers)]
current_index = 0
for index, server in enumerate(servers):
if server.GetPath() == current_server.GetPath():
current_index = index
break
self._current_index.set_value(current_index)
self._item_changed(None)
def get_item_children(self, item=None):
return self._items
def get_item_value_model(self, item: SessionComboItem = None, column_id: int = 0):
if item is None:
return self._current_index
return item.text
def get_current_selection(self):
if len(self._items) < 1:
return None
return self._items[self._current_index.get_value_as_int()]
class CesiumOmniverseProfileWidget(ui.Frame):
def __init__(self, cesium_omniverse_interface: ICesiumOmniverseInterface, **kwargs):
self._logger = logging.getLogger(__name__)
self._cesium_omniverse_interface = cesium_omniverse_interface
self._profile_ids: List[int] = []
self._session_states: List[SessionState] = []
self._server_paths: List[str] = []
self._server_names: List[str] = []
self._sessions_combo_box: Optional[ui.ComboBox] = None
self._sessions_combo_model = SessionComboModel()
self._sessions_combo_model.add_item_changed_fn(self._on_item_changed)
self._subscriptions: List[carb.events.ISubscription] = []
self._setup_subscriptions()
super().__init__(build_fn=self._build_ui, **kwargs)
def destroy(self) -> None:
for subscription in self._subscriptions:
subscription.unsubscribe()
self._subscriptions.clear()
def _setup_subscriptions(self):
update_stream = app.get_app().get_update_event_stream()
self._subscriptions.append(
update_stream.create_subscription_to_pop(self._on_update_frame, name="on_update_frame")
)
def _on_item_changed(self, item_model, item):
item = self._sessions_combo_model.get_current_selection()
if item is not None:
server_path = item.server.GetPath()
set_path_to_current_ion_server(server_path)
def _on_update_frame(self, _e: carb.events.IEvent):
if omni.usd.get_context().get_stage_state() != omni.usd.StageState.OPENED:
return
stage = omni.usd.get_context().get_stage()
sessions = self._cesium_omniverse_interface.get_sessions()
server_paths = self._cesium_omniverse_interface.get_server_paths()
servers = [CesiumIonServer.Get(stage, server_path) for server_path in server_paths]
server_names = [server.GetDisplayNameAttr().Get() for server in servers]
current_server_path = self._cesium_omniverse_interface.get_server_path()
current_server = CesiumIonServer.Get(stage, current_server_path)
profile_ids = []
session_states = []
for session in sessions:
profile_id = get_profile_id(session)
session_state = get_session_state(session)
if session.is_connected() and not session.is_profile_loaded():
session.refresh_profile()
profile_ids.append(profile_id)
session_states.append(session_state)
if (
profile_ids != self._profile_ids
or session_states != self._session_states
or server_paths != self._server_paths
or server_names != self._server_names
):
self._logger.info("Rebuilding profile widget")
self._profile_ids = profile_ids
self._session_states = session_states
self._server_paths = server_paths
self._server_names = server_names
self._sessions_combo_model.replace_all_items(sessions, servers, current_server)
self.rebuild()
def _build_ui(self):
self._sessions_combo_box = ui.ComboBox(self._sessions_combo_model)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.