-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the Cesium Omniverse Python API with a function to create anchors
- Loading branch information
Showing
11 changed files
with
105 additions
and
20 deletions.
There are no files selected for viewing
Empty file.
14 changes: 14 additions & 0 deletions
14
exts/cesium.omniverse/cesium/omniverse/api/globe_anchor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from pxr.Sdf import Path | ||
from typing import Optional | ||
|
||
from ..utils.cesium_interface import CesiumInterfaceManager | ||
|
||
|
||
def anchor_xform_at_path( | ||
path: Path, latitude: Optional[float] = None, longitude: Optional[float] = None, height: Optional[float] = None | ||
): | ||
with CesiumInterfaceManager() as interface: | ||
if latitude is None and longitude is None and height is None: | ||
interface.add_global_anchor_to_prim(str(path)) | ||
else: | ||
interface.add_global_anchor_to_prim(str(path), latitude, longitude, height) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
exts/cesium.omniverse/cesium/omniverse/utils/cesium_interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from ..bindings import acquire_cesium_omniverse_interface | ||
|
||
|
||
class CesiumInterfaceManager: | ||
def __init__(self): | ||
# Acquires the interface. Is a singleton. | ||
self.interface = acquire_cesium_omniverse_interface() | ||
|
||
def __enter__(self): | ||
return self.interface | ||
|
||
def __exit__(self, exc_type, exc_val, exc_tb): | ||
# We release the interface when we pull down the plugin. | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters