diff --git a/exts/cesium.omniverse/cesium/omniverse/usdUtils/usdUtils.py b/exts/cesium.omniverse/cesium/omniverse/usdUtils/usdUtils.py index c27a8fb0..41340913 100644 --- a/exts/cesium.omniverse/cesium/omniverse/usdUtils/usdUtils.py +++ b/exts/cesium.omniverse/cesium/omniverse/usdUtils/usdUtils.py @@ -2,9 +2,9 @@ import re from pxr import Sdf from typing import List, Optional +from pxr import UsdGeom from cesium.usd.plugins.CesiumUsdSchemas import ( - CartographicPolygon as CesiumCartographicPolygon, Data as CesiumData, Tileset as CesiumTileset, IonRasterOverlay as CesiumIonRasterOverlay, @@ -103,7 +103,7 @@ def add_cartographic_polygon() -> str: cartographic_polygon_path = Sdf.Path("/CesiumCartographicPolygons").AppendPath(name).pathString cartographic_polygon_path = omni.usd.get_stage_next_free_path(stage, cartographic_polygon_path, False) - CesiumCartographicPolygon.Define(stage, cartographic_polygon_path) + UsdGeom.BasisCurves.Define(stage, cartographic_polygon_path) add_globe_anchor_to_prim(cartographic_polygon_path) return cartographic_polygon_path diff --git a/exts/cesium.powertools/cesium/powertools/powertools_window.py b/exts/cesium.powertools/cesium/powertools/powertools_window.py index 2b9f1edc..761e3bfd 100644 --- a/exts/cesium.powertools/cesium/powertools/powertools_window.py +++ b/exts/cesium.powertools/cesium/powertools/powertools_window.py @@ -8,7 +8,6 @@ save_carb_settings, save_fabric_stage, set_sunstudy_from_georef, - convert_curves_to_polygons, ) import os from functools import partial @@ -52,7 +51,6 @@ def __init__(self, **kwargs): 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), - PowertoolsAction("BasisCurves to Cartographic Polygons", convert_curves_to_polygons), ] self.frame.set_build_fn(self._build_fn) diff --git a/exts/cesium.powertools/cesium/powertools/utils/utils.py b/exts/cesium.powertools/cesium/powertools/utils/utils.py index a355854d..ce3f14a3 100644 --- a/exts/cesium.powertools/cesium/powertools/utils/utils.py +++ b/exts/cesium.powertools/cesium/powertools/utils/utils.py @@ -5,9 +5,7 @@ import json import carb.settings import os -from cesium.omniverse.usdUtils import add_globe_anchor_to_prim from cesium.omniverse.utils.cesium_interface import CesiumInterfaceManager -from cesium.usd.plugins.CesiumUsdSchemas import CartographicPolygon from asyncio import ensure_future @@ -84,41 +82,3 @@ def set_sunstudy_from_georef(): 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 - -async def convert(): - ctx = omni.usd.get_context() - stage = ctx.get_stage() - logger = logging.getLogger(__name__) - - selection = ctx.get_selection().get_selected_prim_paths() - for curve_path in selection: - curve_prim = stage.GetPrimAtPath(curve_path) - - if curve_prim.GetTypeName() != "BasisCurves": - continue - - polygon_path = curve_path + "_Cesium" - - if stage.GetPrimAtPath(polygon_path).IsValid(): - logger.warning(f"{polygon_path} already exists, skipping") - continue - - # Create a new cartographic polygon - polygon = CartographicPolygon.Define(stage, polygon_path) - polygon_prim = polygon.GetPrim() - - # Add a globe anchor - add_globe_anchor_to_prim(polygon_path) - - # Iterate through the curve attributes and copy them to the new polygon - curve_attributes = curve_prim.GetAttributes() - for attrib in curve_attributes: - value = attrib.Get() - if value is not None: - polygon_prim.GetAttribute(attrib.GetName()).Set(attrib.Get()) - else: - polygon_prim.GetAttribute(attrib.GetName()).Clear() - - -def convert_curves_to_polygons(): - ensure_future(convert()) diff --git a/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.pyi b/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.pyi index e68c25cf..5da8d59b 100644 --- a/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.pyi +++ b/exts/cesium.usd.plugins/cesium/usd/plugins/CesiumUsdSchemas/__init__.pyi @@ -6,23 +6,6 @@ import pxr.UsdGeom __MFB_FULL_PACKAGE_NAME: str -class CartographicPolygon(pxr.UsdGeom.BasisCurves): - __instance_size__: ClassVar[int] = ... - @classmethod - def __init__(cls, *args, **kwargs) -> None: ... - @classmethod - def Define(cls, *args, **kwargs) -> Any: ... - @classmethod - def Get(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 Data(pxr.Usd.Typed): __instance_size__: ClassVar[int] = ... @classmethod diff --git a/exts/cesium.usd.plugins/schemas/cesium_schemas.usda b/exts/cesium.usd.plugins/schemas/cesium_schemas.usda index d46a1ac7..85ce0d2d 100644 --- a/exts/cesium.usd.plugins/schemas/cesium_schemas.usda +++ b/exts/cesium.usd.plugins/schemas/cesium_schemas.usda @@ -502,16 +502,6 @@ class CesiumPolygonRasterOverlayPrim "CesiumPolygonRasterOverlayPrim" ( ) } -class CesiumCartographicPolygonPrim "CesiumCartographicPolygonPrim" ( - doc = """Adds a prim that represents a globe-anchored polygon""" - inherits = - prepend apiSchemas = ["CesiumGlobeAnchorSchemaAPI"] - customData = { - string className = "CartographicPolygon" - } -) { -} - class "CesiumGlobeAnchorSchemaAPI" ( doc = """Adds Globe Anchoring information to a Prim for use with Cesium for Omniverse.""" inherits = diff --git a/src/core/include/cesium/omniverse/UsdUtil.h b/src/core/include/cesium/omniverse/UsdUtil.h index 1068e029..3a348f7e 100644 --- a/src/core/include/cesium/omniverse/UsdUtil.h +++ b/src/core/include/cesium/omniverse/UsdUtil.h @@ -5,10 +5,10 @@ #include #include #include +#include #include PXR_NAMESPACE_OPEN_SCOPE -class CesiumCartographicPolygon; class CesiumData; class CesiumGeoreference; class CesiumGlobeAnchorAPI; @@ -120,8 +120,7 @@ getCesiumPolygonRasterOverlay(const pxr::UsdStageWeakPtr& pStage, const pxr::Sdf pxr::CesiumGeoreference getCesiumGeoreference(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path); pxr::CesiumGlobeAnchorAPI getCesiumGlobeAnchor(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path); pxr::CesiumIonServer getCesiumIonServer(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path); -pxr::CesiumCartographicPolygon -getCesiumCartographicPolygon(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path); +pxr::UsdGeomBasisCurves getCesiumCartographicPolygon(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path); pxr::UsdShadeShader getUsdShader(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path); pxr::UsdGeomBasisCurves getUsdBasisCurves(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path); diff --git a/src/core/src/OmniCartographicPolygon.cpp b/src/core/src/OmniCartographicPolygon.cpp index 587edb16..7bc692de 100644 --- a/src/core/src/OmniCartographicPolygon.cpp +++ b/src/core/src/OmniCartographicPolygon.cpp @@ -7,9 +7,9 @@ #include "cesium/omniverse/UsdUtil.h" #include -#include #include #include +#include namespace cesium::omniverse { diff --git a/src/core/src/UsdUtil.cpp b/src/core/src/UsdUtil.cpp index e092a220..66bc06c3 100644 --- a/src/core/src/UsdUtil.cpp +++ b/src/core/src/UsdUtil.cpp @@ -1,7 +1,5 @@ #include "cesium/omniverse/UsdUtil.h" -#include "CesiumUsdSchemas/cartographicPolygon.h" - #include "cesium/omniverse/AssetRegistry.h" #include "cesium/omniverse/Context.h" #include "cesium/omniverse/MathUtil.h" @@ -18,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -373,9 +370,10 @@ pxr::CesiumIonServer getCesiumIonServer(const pxr::UsdStageWeakPtr& pStage, cons return pxr::CesiumIonServer::Get(pStage, path); } -pxr::CesiumCartographicPolygon -getCesiumCartographicPolygon(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path) { - return pxr::CesiumCartographicPolygon::Get(pStage, path); +// This is currently a pass-through to getUsdBasisCurves until +// issue with crashes in prims that inherit from BasisCurves is resolved +pxr::UsdGeomBasisCurves getCesiumCartographicPolygon(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path) { + return getUsdBasisCurves(pStage, path); } pxr::UsdShadeShader getUsdShader(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path) { @@ -473,8 +471,10 @@ bool isCesiumCartographicPolygon(const pxr::UsdStageWeakPtr& pStage, const pxr:: if (!prim.IsValid()) { return false; } - - return prim.IsA(); + if (!prim.IsA()) { + return false; + } + return prim.HasAPI(); } bool isCesiumSession(const pxr::UsdStageWeakPtr& pStage, const pxr::SdfPath& path) { diff --git a/src/plugins/CesiumUsdSchemas/CMakeLists.txt b/src/plugins/CesiumUsdSchemas/CMakeLists.txt index 0a74e47a..126150ac 100644 --- a/src/plugins/CesiumUsdSchemas/CMakeLists.txt +++ b/src/plugins/CesiumUsdSchemas/CMakeLists.txt @@ -1,7 +1,6 @@ include(Macros) set(SOURCES - "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/cartographicPolygon.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/data.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/globeAnchorAPI.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/georeference.cpp" @@ -16,7 +15,6 @@ set(SOURCES set(PY_BINDING_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/module.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/moduleDeps.cpp" - "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/wrapCartographicPolygon.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/wrapData.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/wrapGlobeAnchorAPI.cpp" "${CMAKE_CURRENT_LIST_DIR}/src/CesiumUsdSchemas/wrapGeoreference.cpp" diff --git a/src/plugins/CesiumUsdSchemas/generatedSchema.usda.in b/src/plugins/CesiumUsdSchemas/generatedSchema.usda.in index 9a717a97..24e6d0bb 100644 --- a/src/plugins/CesiumUsdSchemas/generatedSchema.usda.in +++ b/src/plugins/CesiumUsdSchemas/generatedSchema.usda.in @@ -396,193 +396,6 @@ class CesiumPolygonRasterOverlayPrim "CesiumPolygonRasterOverlayPrim" ( ) } -class CesiumCartographicPolygonPrim "CesiumCartographicPolygonPrim" ( - apiSchemas = ["CesiumGlobeAnchorSchemaAPI"] - doc = "Adds a prim that represents a globe-anchored polygon" -) -{ - vector3f[] accelerations ( - doc = """If provided, 'accelerations' should be used with - velocities to compute positions between samples for the 'points' - attribute rather than interpolating between neighboring 'points' - samples. Acceleration is measured in position units per second-squared. - To convert to position units per squared UsdTimeCode, divide by the - square of UsdStage::GetTimeCodesPerSecond().""" - ) - uniform token basis = "bezier" ( - allowedTokens = ["bezier", "bspline", "catmullRom"] - doc = """The basis specifies the vstep and matrix used for cubic - interpolation. \\note The 'hermite' and 'power' tokens have been - removed. We've provided UsdGeomHermiteCurves - as an alternative for the 'hermite' basis.""" - ) - int[] curveVertexCounts ( - doc = """Curves-derived primitives can represent multiple distinct, - potentially disconnected curves. The length of 'curveVertexCounts' - gives the number of such curves, and each element describes the - number of vertices in the corresponding curve""" - ) - uniform bool doubleSided = 0 ( - doc = """Although some renderers treat all parametric or polygonal - surfaces as if they were effectively laminae with outward-facing - normals on both sides, some renderers derive significant optimizations - by considering these surfaces to have only a single outward side, - typically determined by control-point winding order and/or - orientation. By doing so they can perform \"backface culling\" to - avoid drawing the many polygons of most closed surfaces that face away - from the viewer. - - However, it is often advantageous to model thin objects such as paper - and cloth as single, open surfaces that must be viewable from both - sides, always. Setting a gprim's doubleSided attribute to - \\c true instructs all renderers to disable optimizations such as - backface culling for the gprim, and attempt (not all renderers are able - to do so, but the USD reference GL renderer always will) to provide - forward-facing normals on each side of the surface for lighting - calculations.""" - ) - float3[] extent ( - doc = """Extent is a three dimensional range measuring the geometric - extent of the authored gprim in its own local space (i.e. its own - transform not applied), without accounting for any shader-induced - displacement. If __any__ extent value has been authored for a given - Boundable, then it should be authored at every timeSample at which - geometry-affecting properties are authored, to ensure correct - evaluation via ComputeExtent(). If __no__ extent value has been - authored, then ComputeExtent() will call the Boundable's registered - ComputeExtentFunction(), which may be expensive, which is why we - strongly encourage proper authoring of extent. - \\sa ComputeExtent() - \\sa \\ref UsdGeom_Boundable_Extent. - - An authored extent on a prim which has children is expected to include - the extent of all children, as they will be pruned from BBox computation - during traversal.""" - ) - normal3f[] normals ( - doc = """Provide an object-space orientation for individual points, - which, depending on subclass, may define a surface, curve, or free - points. Note that 'normals' should not be authored on any Mesh that - is subdivided, since the subdivision algorithm will define its own - normals. 'normals' is not a generic primvar, but the number of elements - in this attribute will be determined by its 'interpolation'. See - . If 'normals' and 'primvars:normals' - are both specified, the latter has precedence.""" - ) - uniform token orientation = "rightHanded" ( - allowedTokens = ["rightHanded", "leftHanded"] - doc = """Orientation specifies whether the gprim's surface normal - should be computed using the right hand rule, or the left hand rule. - Please see for a deeper explanation and - generalization of orientation to composed scenes with transformation - hierarchies.""" - ) - point3f[] points ( - doc = """The primary geometry attribute for all PointBased - primitives, describes points in (local) space.""" - ) - color3f[] primvars:displayColor ( - doc = '''It is useful to have an "official" colorSet that can be used - as a display or modeling color, even in the absence of any specified - shader for a gprim. DisplayColor serves this role; because it is a - UsdGeomPrimvar, it can also be used as a gprim override for any shader - that consumes a displayColor parameter.''' - ) - float[] primvars:displayOpacity ( - doc = """Companion to displayColor that specifies opacity, broken - out as an independent attribute rather than an rgba color, both so that - each can be independently overridden, and because shaders rarely consume - rgba parameters.""" - ) - rel proxyPrim ( - doc = '''The proxyPrim relationship allows us to link a - prim whose purpose is "render" to its (single target) - purpose="proxy" prim. This is entirely optional, but can be - useful in several scenarios: - - - In a pipeline that does pruning (for complexity management) - by deactivating prims composed from asset references, when we - deactivate a purpose="render" prim, we will be able to discover - and additionally deactivate its associated purpose="proxy" prim, - so that preview renders reflect the pruning accurately. - - - DCC importers may be able to make more aggressive optimizations - for interactive processing and display if they can discover the proxy - for a given render prim. - - - With a little more work, a Hydra-based application will be able - to map a picked proxy prim back to its render geometry for selection. - - \\note It is only valid to author the proxyPrim relationship on - prims whose purpose is "render".''' - ) - uniform token purpose = "default" ( - allowedTokens = ["default", "render", "proxy", "guide"] - doc = """Purpose is a classification of geometry into categories that - can each be independently included or excluded from traversals of prims - on a stage, such as rendering or bounding-box computation traversals. - - See for more detail about how - purpose is computed and used.""" - ) - uniform token type = "cubic" ( - allowedTokens = ["linear", "cubic"] - doc = """Linear curves interpolate linearly between two vertices. - Cubic curves use a basis matrix with four vertices to interpolate a segment.""" - ) - vector3f[] velocities ( - doc = """If provided, 'velocities' should be used by renderers to - - compute positions between samples for the 'points' attribute, rather - than interpolating between neighboring 'points' samples. This is the - only reasonable means of computing motion blur for topologically - varying PointBased primitives. It follows that the length of each - 'velocities' sample must match the length of the corresponding - 'points' sample. Velocity is measured in position units per second, - as per most simulation software. To convert to position units per - UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). - - See also .""" - ) - token visibility = "inherited" ( - allowedTokens = ["inherited", "invisible"] - doc = '''Visibility is meant to be the simplest form of "pruning" - visibility that is supported by most DCC apps. Visibility is - animatable, allowing a sub-tree of geometry to be present for some - segment of a shot, and absent from others; unlike the action of - deactivating geometry prims, invisible geometry is still - available for inspection, for positioning, for defining volumes, etc.''' - ) - float[] widths ( - doc = """Provides width specification for the curves, whose application - will depend on whether the curve is oriented (normals are defined for - it), in which case widths are \"ribbon width\", or unoriented, in which - case widths are cylinder width. 'widths' is not a generic Primvar, - but the number of elements in this attribute will be determined by - its 'interpolation'. See . If 'widths' - and 'primvars:widths' are both specified, the latter has precedence.""" - ) - uniform token wrap = "nonperiodic" ( - allowedTokens = ["nonperiodic", "periodic", "pinned"] - doc = """If wrap is set to periodic, the curve when rendered will - repeat the initial vertices (dependent on the vstep) to close the - curve. If wrap is set to 'pinned', phantom points may be created - to ensure that the curve interpolation starts at P[0] and ends at P[n-1]. - """ - ) - uniform token[] xformOpOrder ( - doc = """Encodes the sequence of transformation operations in the - order in which they should be pushed onto a transform stack while - visiting a UsdStage's prims in a graph traversal that will effect - the desired positioning for this prim and its descendant prims. - - You should rarely, if ever, need to manipulate this attribute directly. - It is managed by the AddXformOp(), SetResetXformStack(), and - SetXformOpOrder(), and consulted by GetOrderedXformOps() and - GetLocalTransformation().""" - ) -} - class "CesiumGlobeAnchorSchemaAPI" ( doc = "Adds Globe Anchoring information to a Prim for use with Cesium for Omniverse." ) diff --git a/src/plugins/CesiumUsdSchemas/plugInfo.json.in b/src/plugins/CesiumUsdSchemas/plugInfo.json.in index b9da3cd0..8e082979 100644 --- a/src/plugins/CesiumUsdSchemas/plugInfo.json.in +++ b/src/plugins/CesiumUsdSchemas/plugInfo.json.in @@ -6,16 +6,6 @@ { "Info": { "Types": { - "CesiumCartographicPolygon": { - "alias": { - "UsdSchemaBase": "CesiumCartographicPolygonPrim" - }, - "autoGenerated": true, - "bases": [ - "UsdGeomBasisCurves" - ], - "schemaKind": "concreteTyped" - }, "CesiumData": { "alias": { "UsdSchemaBase": "CesiumDataPrim" diff --git a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/cartographicPolygon.cpp b/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/cartographicPolygon.cpp deleted file mode 100644 index f33cea5c..00000000 --- a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/cartographicPolygon.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include ".//cartographicPolygon.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 >(); - - // Register the usd prim typename as an alias under UsdSchemaBase. This - // enables one to call - // TfType::Find().FindDerivedByName("CesiumCartographicPolygonPrim") - // to find TfType, which is how IsA queries are - // answered. - TfType::AddAlias("CesiumCartographicPolygonPrim"); -} - -/* virtual */ -CesiumCartographicPolygon::~CesiumCartographicPolygon() -{ -} - -/* static */ -CesiumCartographicPolygon -CesiumCartographicPolygon::Get(const UsdStagePtr &stage, const SdfPath &path) -{ - if (!stage) { - TF_CODING_ERROR("Invalid stage"); - return CesiumCartographicPolygon(); - } - return CesiumCartographicPolygon(stage->GetPrimAtPath(path)); -} - -/* static */ -CesiumCartographicPolygon -CesiumCartographicPolygon::Define( - const UsdStagePtr &stage, const SdfPath &path) -{ - static TfToken usdPrimTypeName("CesiumCartographicPolygonPrim"); - if (!stage) { - TF_CODING_ERROR("Invalid stage"); - return CesiumCartographicPolygon(); - } - return CesiumCartographicPolygon( - stage->DefinePrim(path, usdPrimTypeName)); -} - -/* virtual */ -UsdSchemaKind CesiumCartographicPolygon::_GetSchemaKind() const -{ - return CesiumCartographicPolygon::schemaKind; -} - -/* static */ -const TfType & -CesiumCartographicPolygon::_GetStaticTfType() -{ - static TfType tfType = TfType::Find(); - return tfType; -} - -/* static */ -bool -CesiumCartographicPolygon::_IsTypedSchema() -{ - static bool isTyped = _GetStaticTfType().IsA(); - return isTyped; -} - -/* virtual */ -const TfType & -CesiumCartographicPolygon::_GetTfType() const -{ - return _GetStaticTfType(); -} - -/*static*/ -const TfTokenVector& -CesiumCartographicPolygon::GetSchemaAttributeNames(bool includeInherited) -{ - static TfTokenVector localNames; - static TfTokenVector allNames = - UsdGeomBasisCurves::GetSchemaAttributeNames(true); - - 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)-- diff --git a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/cartographicPolygon.h b/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/cartographicPolygon.h deleted file mode 100644 index 4a187692..00000000 --- a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/cartographicPolygon.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef CESIUMUSDSCHEMAS_GENERATED_CARTOGRAPHICPOLYGON_H -#define CESIUMUSDSCHEMAS_GENERATED_CARTOGRAPHICPOLYGON_H - -/// \file CesiumUsdSchemas/cartographicPolygon.h - -#include "pxr/pxr.h" -#include ".//api.h" -#include "pxr/usd/usdGeom/basisCurves.h" -#include "pxr/usd/usd/prim.h" -#include "pxr/usd/usd/stage.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; - -// -------------------------------------------------------------------------- // -// CESIUMCARTOGRAPHICPOLYGONPRIM // -// -------------------------------------------------------------------------- // - -/// \class CesiumCartographicPolygon -/// -/// Adds a prim that represents a globe-anchored polygon -/// -class CesiumCartographicPolygon : public UsdGeomBasisCurves -{ -public: - /// Compile time constant representing what kind of schema this class is. - /// - /// \sa UsdSchemaKind - static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped; - - /// Construct a CesiumCartographicPolygon on UsdPrim \p prim . - /// Equivalent to CesiumCartographicPolygon::Get(prim.GetStage(), prim.GetPath()) - /// for a \em valid \p prim, but will not immediately throw an error for - /// an invalid \p prim - explicit CesiumCartographicPolygon(const UsdPrim& prim=UsdPrim()) - : UsdGeomBasisCurves(prim) - { - } - - /// Construct a CesiumCartographicPolygon on the prim held by \p schemaObj . - /// Should be preferred over CesiumCartographicPolygon(schemaObj.GetPrim()), - /// as it preserves SchemaBase state. - explicit CesiumCartographicPolygon(const UsdSchemaBase& schemaObj) - : UsdGeomBasisCurves(schemaObj) - { - } - - /// Destructor. - CESIUMUSDSCHEMAS_API - virtual ~CesiumCartographicPolygon(); - - /// 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 CesiumCartographicPolygon 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 - /// CesiumCartographicPolygon(stage->GetPrimAtPath(path)); - /// \endcode - /// - CESIUMUSDSCHEMAS_API - static CesiumCartographicPolygon - 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 CesiumCartographicPolygon - 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: - // ===================================================================== // - // 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 diff --git a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/module.cpp b/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/module.cpp index af7db819..d4c5ddea 100644 --- a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/module.cpp +++ b/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/module.cpp @@ -5,7 +5,6 @@ PXR_NAMESPACE_USING_DIRECTIVE TF_WRAP_MODULE { - TF_WRAP(CesiumCartographicPolygon); TF_WRAP(CesiumData); TF_WRAP(CesiumGeoreference); TF_WRAP(CesiumGlobeAnchorAPI); diff --git a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapCartographicPolygon.cpp b/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapCartographicPolygon.cpp deleted file mode 100644 index b077c069..00000000 --- a/src/plugins/CesiumUsdSchemas/src/CesiumUsdSchemas/wrapCartographicPolygon.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include ".//cartographicPolygon.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 - -#include - -using namespace boost::python; - -PXR_NAMESPACE_USING_DIRECTIVE - -namespace { - -#define WRAP_CUSTOM \ - template static void _CustomWrapCode(Cls &_class) - -// fwd decl. -WRAP_CUSTOM; - - -static std::string -_Repr(const CesiumCartographicPolygon &self) -{ - std::string primRepr = TfPyRepr(self.GetPrim()); - return TfStringPrintf( - "CesiumUsdSchemas.CartographicPolygon(%s)", - primRepr.c_str()); -} - -} // anonymous namespace - -void wrapCesiumCartographicPolygon() -{ - typedef CesiumCartographicPolygon This; - - class_ > - cls("CartographicPolygon"); - - cls - .def(init(arg("prim"))) - .def(init(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()) - .staticmethod("GetSchemaAttributeNames") - - .def("_GetStaticTfType", (TfType const &(*)()) TfType::Find, - return_value_policy()) - .staticmethod("_GetStaticTfType") - - .def(!self) - - - .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 { -} - -}