Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large refactor of the C++ code #626

Merged
merged 31 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9eb0d9c
Cleanup
lilleyse Jan 5, 2024
5029680
Merge branch 'main' into cleanup
lilleyse Jan 19, 2024
61f2698
Use std::array in dispatchImpl
lilleyse Jan 19, 2024
e5bf365
Fix gcc compile error
lilleyse Jan 19, 2024
ba866c0
Fix formatting
lilleyse Jan 19, 2024
cc0f569
Rename getAll functions
lilleyse Jan 22, 2024
7301121
Merge branch 'main' into cleanup
lilleyse Jan 22, 2024
6ba5e2d
Switch to using Context ref for functions
lilleyse Jan 22, 2024
ab4a455
Fix formatting
lilleyse Jan 22, 2024
ad30353
Fix setting globa anchor by prim local transform
lilleyse Jan 22, 2024
7c91f9e
More globe anchor fixes
lilleyse Jan 23, 2024
9d81e04
Create translate, rotate, scale ops if they don't exist
lilleyse Jan 24, 2024
14b27f3
PXR_NS back to pxr
lilleyse Jan 25, 2024
006ff41
Pass Context to FabricAttributesBuilder
lilleyse Jan 25, 2024
91c1481
Fix setting georeference after coordinates
lilleyse Jan 25, 2024
4f06bcd
Globe anchors and tilesets - use first georeference if binding not su…
lilleyse Jan 25, 2024
89b3252
More careful about not logging unsupported styling properties unless …
lilleyse Jan 25, 2024
a3cc968
Separate geographicCoordinates into three properties
lilleyse Jan 25, 2024
14725a6
Update genStubs so it doesn't conflict with regular build directory
lilleyse Jan 25, 2024
151ba22
Update CHANGES.md
lilleyse Jan 25, 2024
e15c8f9
Fix globe anchor detect transform changes
lilleyse Jan 25, 2024
bb46c2d
Remove ECEF rotation and scale properties
lilleyse Jan 25, 2024
7fd2a07
Add getResolvedIonServerPath for tilesets and imagery, remove workaro…
lilleyse Jan 25, 2024
8401244
Move ScopedEdit into own file
lilleyse Jan 25, 2024
66c14ff
Add UI for bindings
lilleyse Jan 25, 2024
29b1c3a
Update CHANGES.md
lilleyse Jan 25, 2024
1795b92
Fix python formatting
lilleyse Jan 26, 2024
0ab7069
Update UsdNotificationHandler for implicitly referenced bindings
lilleyse Jan 26, 2024
be1024c
Update UsdNotificationHandler for implicitly referenced imagery bindings
lilleyse Jan 26, 2024
5e2755e
Add plugin deps to fix linker error on CI
lilleyse Jan 26, 2024
016dd5b
Disable tests
lilleyse Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
# Linters are turned off because there is no pre-compiled C++20-capable LLVM toolset for CentOS 7. It won't affect the build, it just means there won't be code formatting or linting. It will build fine with GCC.
# Make sure to configure without sanitizers and any other development options
- "git config --global --add safe.directory '*' &&
cmake -B build -D CMAKE_BUILD_TYPE=${{ inputs.build-type }} -D CESIUM_OMNI_ENABLE_LINTERS=OFF -D CESIUM_OMNI_ENABLE_SANITIZERS=OFF &&
cmake -B build -D CMAKE_BUILD_TYPE=${{ inputs.build-type }} -D CESIUM_OMNI_ENABLE_TESTS=OFF -D CESIUM_OMNI_ENABLE_LINTERS=OFF -D CESIUM_OMNI_ENABLE_SANITIZERS=OFF &&
cmake --build build --parallel 2 &&
cmake --build build --target install &&
cmake --build build --target package"
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
# Note: CMAKE_CONFIGURATION_TYPES is used by Windows to generate a single configuration for Release since we don't need Debug, RelWithDebugInfo, and MinSizeRel on CI. It is ignored for Linux.
- name: Configure
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake -B build -D Python3_EXECUTABLE=python3 -D CESIUM_OMNI_ENABLE_COVERAGE=${{ matrix.config.coverage}} -D CMAKE_C_COMPILER=${{ matrix.config.cc }} -D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -D CMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -D CMAKE_CONFIGURATION_TYPES=${{ matrix.config.build-type }} -G "${{ matrix.config.generator }}"
run: cmake -B build -D Python3_EXECUTABLE=python3 -D CESIUM_OMNI_ENABLE_TESTS=OFF -D CESIUM_OMNI_ENABLE_COVERAGE=${{ matrix.config.coverage}} -D CMAKE_C_COMPILER=${{ matrix.config.cc }} -D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -D CMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -D CMAKE_CONFIGURATION_TYPES=${{ matrix.config.build-type }} -G "${{ matrix.config.generator }}"

# Change the ownership from root to user for all files in the Conan cache so
# that DLLs can be used without permission denied errors
Expand Down
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

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

* **Breaking change:** Removed `cesium.omniverse.api.globe_anchor`. Globe anchor prims can now be created directly in USD.
* **Breaking change:** Split `cesium:anchor:geographicCoordinates` into separate properties: `cesium:anchor:latitude`, `cesium:anchor:longitude`, `cesium:anchor:height`
* **Breaking change:** Globe anchors no longer add a `transform:cesium` op to the attached prim. Instead the `translate`, `rotate` (all variants), and `scale` ops are modified directly.
* **Breaking change:** Removed `cesium:anchor:rotation` and `cesium:anchor:scale`. The prim's local rotation and scale should be set instead.
* **Breaking change:** Tilesets and globe anchors now use the scene's default georeference if `cesium:georeferenceBinding` is empty.
* **Breaking change:** Tilesets and imagery now use the scene's default ion server if `cesium:ionServerBinding` is empty.
* Fixed multiple globe anchor related issues.
* Fixed excessive property warnings when using custom material and property lookups.

### v0.16.0 - 2024-01-02

* Fixed issue where the current ion session would be signed out on reload.
Expand Down
Empty file.
14 changes: 0 additions & 14 deletions exts/cesium.omniverse/cesium/omniverse/api/globe_anchor.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,29 @@ class Connection:

class ICesiumOmniverseInterface:
def __init__(self, *args, **kwargs) -> None: ...
@overload
def add_global_anchor_to_prim(self, arg0: str) -> None: ...
@overload
def add_global_anchor_to_prim(self, arg0: str, arg1: float, arg2: float, arg3: float) -> None: ...
def connect_to_ion(self) -> None: ...
def create_token(self, arg0: str) -> None: ...
def credits_available(self) -> bool: ...
def credits_start_next_frame(self) -> None: ...
def get_all_server_paths(self) -> List[str]: ...
def get_all_sessions(self, *args, **kwargs) -> Any: ...
def get_asset_token_troubleshooting_details(self, *args, **kwargs) -> Any: ...
def get_asset_troubleshooting_details(self, *args, **kwargs) -> Any: ...
def get_credits(self) -> List[Tuple[str, bool]]: ...
def get_default_token_troubleshooting_details(self, *args, **kwargs) -> Any: ...
def get_render_statistics(self, *args, **kwargs) -> Any: ...
def get_server_path(self) -> str: ...
def get_server_paths(self) -> List[str]: ...
def get_session(self, *args, **kwargs) -> Any: ...
def get_sessions(self, *args, **kwargs) -> Any: ...
def get_set_default_token_result(self, *args, **kwargs) -> Any: ...
def is_default_token_set(self) -> bool: ...
def is_tracing_enabled(self) -> bool: ...
def on_shutdown(self) -> None: ...
def on_stage_change(self, arg0: int) -> None: ...
def on_startup(self, arg0: str) -> None: ...
def on_update_frame(self, arg0) -> None: ...
def on_update_ui(self) -> None: ...
def on_update_frame(self, arg0: List[ViewportPythonBinding]) -> None: ...
def print_fabric_stage(self) -> str: ...
def reload_tileset(self, arg0: str) -> None: ...
def select_token(self, arg0: str, arg1: str) -> None: ...
def set_georeference_origin(self, arg0: float, arg1: float, arg2: float) -> None: ...
def specify_token(self, arg0: str) -> None: ...
@overload
def update_troubleshooting_details(self, arg0: str, arg1: int, arg2: int, arg3: int) -> None: ...
Expand Down
4 changes: 3 additions & 1 deletion exts/cesium.omniverse/cesium/omniverse/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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_imagery_ion, add_cartographic_polygon
from .usdUtils import add_tileset_ion, add_imagery_ion, add_cartographic_polygon, get_or_create_cesium_data
from .ui.asset_window import CesiumOmniverseAssetWindow
from .ui.debug_window import CesiumOmniverseDebugWindow
from .ui.main_window import CesiumOmniverseMainWindow
Expand Down Expand Up @@ -270,6 +270,8 @@ def _on_stage_event(self, event):
if not fabric_enabled:
asyncio.ensure_future(perform_action_after_n_frames_async(15, CesiumOmniverseExtension._open_modal))

get_or_create_cesium_data()

self._setup_ion_server_prims()
elif event.type == int(omni.usd.StageEventType.CLOSED):
_cesium_omniverse_interface.on_stage_change(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
PolygonImagery as CesiumPolygonImagery,
IonImagery as CesiumIonImagery,
)
from ..api.globe_anchor import anchor_xform_at_path
from ..usdUtils import add_globe_anchor_to_prim
from ..bindings import ICesiumOmniverseInterface


Expand Down Expand Up @@ -49,7 +49,7 @@ def destroy(self):

def _add_globe_anchor_api(self, payload: PrimSelectionPayload):
for path in payload:
anchor_xform_at_path(path)
add_globe_anchor_to_prim(path)
get_property_window().request_rebuild()

def _add_ion_imagery(self, payload: PrimSelectionPayload):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .models import IonAssetItem
from ..models import AssetToAdd, ImageryToAdd
from .styles import CesiumOmniverseUiStyles
from ..usdUtils import is_tileset, get_all_tileset_paths
from ..usdUtils import is_tileset, get_tileset_paths


class CesiumAssetDetailsWidget(ui.ScrollingFrame):
Expand Down Expand Up @@ -80,7 +80,7 @@ def _add_imagery_button_clicked(self):
tileset_path = selection[0]

if tileset_path is None:
all_tileset_paths = get_all_tileset_paths()
all_tileset_paths = get_tileset_paths()

if len(all_tileset_paths) > 0:
tileset_path = all_tileset_paths[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
from omni.kit.property.usd.custom_layout_helper import CustomLayoutFrame, CustomLayoutGroup, CustomLayoutProperty
from omni.kit.property.usd.usd_property_widget import SchemaPropertiesWidget
from ...bindings import ICesiumOmniverseInterface
from cesium.usd.plugins.CesiumUsdSchemas import GlobeAnchorAPI as CesiumGlobeAnchorAPI
from cesium.usd.plugins.CesiumUsdSchemas import (
GlobeAnchorAPI as CesiumGlobeAnchorAPI,
Georeference as CesiumGeoreference,
)


class CesiumGlobeAnchorAttributesWidget(SchemaPropertiesWidget):
Expand All @@ -23,11 +26,23 @@ def _customize_props_layout(self, props):
with CustomLayoutGroup("Options"):
CustomLayoutProperty("cesium:anchor:adjustOrientationForGlobeWhenMoving")
CustomLayoutProperty("cesium:anchor:detectTransformChanges")
CustomLayoutProperty("cesium:anchor:georeferenceBinding")
with CustomLayoutGroup("Global Positioning"):
CustomLayoutProperty("cesium:anchor:geographicCoordinates")
CustomLayoutProperty("cesium:anchor:latitude")
CustomLayoutProperty("cesium:anchor:longitude")
CustomLayoutProperty("cesium:anchor:height")
with CustomLayoutGroup("Advanced Positioning", collapsed=True):
CustomLayoutProperty("cesium:anchor:position")
CustomLayoutProperty("cesium:anchor:rotation")
CustomLayoutProperty("cesium:anchor:scale")

return frame.apply(props)

def _filter_props_to_build(self, props):
filtered_props = super()._filter_props_to_build(props)
filtered_props.extend(prop for prop in props if prop.GetName() == "cesium:anchor:georeferenceBinding")
return filtered_props

def get_additional_kwargs(self, ui_attr):
if ui_attr.prop_name == "cesium:anchor:georeferenceBinding":
return None, {"target_picker_filter_type_list": [CesiumGeoreference], "targets_limit": 1}

return None, {"targets_limit": 0}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from omni.kit.property.usd.custom_layout_helper import CustomLayoutFrame, CustomLayoutGroup, CustomLayoutProperty
from omni.kit.property.usd.usd_property_widget import SchemaPropertiesWidget
from cesium.usd.plugins.CesiumUsdSchemas import Imagery as CesiumImagery
from cesium.usd.plugins.CesiumUsdSchemas import Imagery as CesiumImagery, IonServer as CesiumIonServer


class CesiumImageryAttributesWidget(SchemaPropertiesWidget):
Expand All @@ -28,3 +28,14 @@ def _customize_props_layout(self, props):
CustomLayoutProperty("cesium:overlayRenderMethod")

return frame.apply(props)

def _filter_props_to_build(self, props):
filtered_props = super()._filter_props_to_build(props)
filtered_props.extend(prop for prop in props if prop.GetName() == "cesium:ionServerBinding")
return filtered_props

def get_additional_kwargs(self, ui_attr):
if ui_attr.prop_name == "cesium:ionServerBinding":
return None, {"target_picker_filter_type_list": [CesiumIonServer], "targets_limit": 1}

return None, {"targets_limit": 0}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
from omni.kit.property.usd.usd_property_widget import SchemaPropertiesWidget
import omni.ui as ui
from ...bindings import ICesiumOmniverseInterface
from cesium.usd.plugins.CesiumUsdSchemas import Tileset as CesiumTileset, IonServer as CesiumIonServer
from cesium.usd.plugins.CesiumUsdSchemas import (
Tileset as CesiumTileset,
IonServer as CesiumIonServer,
Georeference as CesiumGeoreference,
)


class CesiumTilesetAttributesWidget(SchemaPropertiesWidget):
Expand Down Expand Up @@ -52,15 +56,24 @@ def _customize_props_layout(self, props):
with CustomLayoutGroup("Rendering"):
CustomLayoutProperty("cesium:suspendUpdate")
CustomLayoutProperty("cesium:smoothNormals")
with CustomLayoutGroup("Georeference"):
CustomLayoutProperty("cesium:georeferenceBinding")

return frame.apply(props)

def _filter_props_to_build(self, props):
filtered_props = super()._filter_props_to_build(props)
filtered_props.extend(prop for prop in props if prop.GetName() == "cesium:ionServerBinding")
filtered_props.extend(
prop
for prop in props
if prop.GetName() == "cesium:ionServerBinding" or prop.GetName() == "cesium:georeferenceBinding"
)
return filtered_props

def get_additional_kwargs(self, ui_attr):
if ui_attr.prop_name == "cesium:ionServerBinding":
return None, {"target_picker_filter_type_list": [CesiumIonServer], "targets_limit": 1}
elif ui_attr.prop_name == "cesium:georeferenceBinding":
return None, {"target_picker_filter_type_list": [CesiumGeoreference], "targets_limit": 1}

return None, {"targets_limit": 0}
6 changes: 3 additions & 3 deletions exts/cesium.omniverse/cesium/omniverse/ui/debug_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import omni.ui as ui
from .statistics_widget import CesiumOmniverseStatisticsWidget
from ..bindings import ICesiumOmniverseInterface
from ..usdUtils import remove_tileset, get_all_tileset_paths
from ..usdUtils import remove_tileset, get_tileset_paths


class CesiumOmniverseDebugWindow(ui.Window):
Expand Down Expand Up @@ -44,15 +44,15 @@ def _build_fn(self):
def remove_all_tilesets():
"""Removes all tilesets from the stage."""

tileset_paths = get_all_tileset_paths()
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_all_tileset_paths()
tileset_paths = get_tileset_paths()

for tileset_path in tileset_paths:
self._cesium_omniverse_interface.reload_tileset(tileset_path)
Expand Down
2 changes: 0 additions & 2 deletions exts/cesium.omniverse/cesium/omniverse/ui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ def _setup_subscriptions(self):
)

def _on_update_frame(self, _e: carb.events.IEvent):
self._cesium_omniverse_interface.on_update_ui()
lilleyse marked this conversation as resolved.
Show resolved Hide resolved

session: CesiumIonSession = self._cesium_omniverse_interface.get_session()

if session is not None and self._sign_in_widget is not None:
Expand Down
4 changes: 2 additions & 2 deletions exts/cesium.omniverse/cesium/omniverse/ui/profile_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def _on_update_frame(self, _e: carb.events.IEvent):

stage = omni.usd.get_context().get_stage()

sessions = self._cesium_omniverse_interface.get_all_sessions()
server_paths = self._cesium_omniverse_interface.get_all_server_paths()
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()
Expand Down
Loading
Loading