Skip to content

Commit

Permalink
ISIM-1493 update frame imported asset
Browse files Browse the repository at this point in the history
  • Loading branch information
rgasoto committed Jul 31, 2024
1 parent 8af9bab commit ba20067
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ PACKAGE-DEPS.yaml
# Internal CI/CD files.
/.teamcity
/tools/ci
.lastformat
1 change: 0 additions & 1 deletion .lastformat

This file was deleted.

3 changes: 2 additions & 1 deletion source/extensions/omni.importer.mjcf/config/extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ reloadable = true
order = 0

[package]
version = "1.1.0"
version = "1.1.1"
category = "Simulation"
title = "Omniverse MJCF Importer"
description = "MJCF Importer"
Expand All @@ -25,6 +25,7 @@ preview_image = "data/preview.png"
"omni.kit.commands" = {}
"omni.kit.window.extensions" = {}
"omni.kit.window.property" = {}
"omni.kit.viewport.utility" = {}

[[python.module]]
name = "omni.importer.mjcf"
Expand Down
4 changes: 4 additions & 0 deletions source/extensions/omni.importer.mjcf/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.1.1] - 2024-07-10
### Changed
- Importer frames on imported asset when done through GUI.

## [1.1.0] - 2023-10-03
### Changed
- Structural and packaging changes
Expand Down
18 changes: 17 additions & 1 deletion source/extensions/omni.importer.mjcf/python/scripts/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from omni.client._omniclient import Result
from omni.importer.mjcf import _mjcf
from omni.kit.menu.utils import MenuItemDescription, add_menu_items, remove_menu_items
from omni.kit.viewport.utility import get_active_viewport
from omni.kit.window.filepicker import FilePickerDialog
from pxr import Sdf, Usd, UsdGeom, UsdPhysics

Expand Down Expand Up @@ -335,14 +336,29 @@ async def import_with_clean_stage():
if upAxis == "Y":
carb.log_error("The stage Up-Axis must be Z to use the MJCF importer")
add_reference_to_stage()
return prim_path

def _select_picked_file_callback(self, dialog: FilePickerDialog, filename=None, path=None):
if not path.startswith("omniverse://"):
self.root_path = path
self.filename = filename
if path and filename:
self._last_folder = path
self._load_robot(path + "/" + filename)
prim_path = self._load_robot(path + "/" + filename)
task = asyncio.ensure_future(omni.kit.app.get_app().next_update_async())
asyncio.ensure_future(task)
print("update")
viewport_api = get_active_viewport()
stage = viewport_api.stage
mpu = UsdGeom.GetStageMetersPerUnit(stage)
cam_path = viewport_api.camera_path
omni.kit.commands.execute(
"FramePrimsCommand",
prim_to_move=cam_path,
prims_to_frame=[prim_path],
aspect_ratio=1,
zoom=0.05 * (self._models["scale"].get_value_as_float()),
)
else:
carb.log_error("path and filename not specified")
else:
Expand Down

0 comments on commit ba20067

Please sign in to comment.