Skip to content

Commit 846d41f

Browse files
committed
Initial Public Release
1 parent aac4c95 commit 846d41f

File tree

9 files changed

+94
-57
lines changed

9 files changed

+94
-57
lines changed

README.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
1-
# Extension Project Template
21

3-
This project was automatically generated.
2+
# Mead & Hunt Enscape Camera Loader
3+
![Enscape Loader Screenshot](/exts/meadhunt.enscape.loader/data/preview_enscapeloader.png)
44

5-
- `app` - It is a folder link to the location of your *Omniverse Kit* based app.
6-
- `exts` - It is a folder where you can add new extensions. It was automatically added to extension search path. (Extension Manager -> Gear Icon -> Extension Search Path).
5+
## Inspiration
6+
`Enscape Loader` was created based on a tool I previously created, but was written from the ground up in Python for Omniverse.
77

8-
Open this folder using Visual Studio Code. It will suggest you to install few extensions that will make python experience better.
8+
## About
9+
This tool was created as a way to exchange camera data from Enscape to Omniverse. Not all Designers/Architects may be comfortable in a tool like Omniverse so this allows them to do their work in Enscape, but bring it to Omniverse for fine tuning and advanced visualization.
910

10-
Look for "meadhunt.enscape.loader" extension in extension manager and enable it. Try applying changes to any python files, it will hot-reload and you can observe results immediately.
11+
## Usage
12+
After installation the dialog can be opened from **`Window > Mead & Hunt > Enscape Camera Loader`**.
1113

12-
Alternatively, you can launch your app from console with this folder added to search path and your extension enabled, e.g.:
14+
![Enscape Loader UI](images/enscapeloader_ui.png)
1315

14-
```
15-
> app\omni.code.bat --ext-folder exts --enable omni.hello.world
16-
```
16+
**XML Path:** Path to the XML you want to import.
17+
18+
**Scene Path:** `/World/Cameras (default)`Path in the Omniverse Stage where you want the Cameras to be placed.
19+
20+
**Name:** `EnscapeCamera` `(default)`Name to be appended by Unique number (`EnscapeCamera_01`).
21+
22+
**Mode:** Drop-down of what to do with the XML file.
23+
- **`NOTE:`** Currently only `Import` is supported. A future release may support `Export`.
24+
25+
**Method:** Drop-down of how to process the time/keyframes for the XML data.
26+
- `Continuous: Smooth:` Currently in development.
27+
- `Continuous: Linear:` One camera with linear animation between all key frames.
28+
- `Multiple: Linear:` Multiple cameras with a Linear animation between every 2 keys.
29+
- `Multiple: Static (default):` Each keyframe comes in as a static camera.
1730

18-
# App Link Setup
31+
**Timeline:** Drop-down of how to adjust the current timeline.
32+
- `Match XML (default):` Match the timeline time to the XML.
33+
- `Grow to Fit:` Match the last keyframe if it is greater than the current timeline.
34+
- `Shrink to Fit:` Match the last keyframe if it is less than the current timeline.
1935

36+
**Click Me:** Button to process the file.
37+
38+
## Adding This Extension
39+
To add this extension to your Omniverse app:
40+
1. Go into: Extension Manager -> Gear Icon -> Extension Search Path
41+
2. Add this as a search path: `git://github.com/ericcraft-mh/meadhunt-enscape-loader.git?branch=main&dir=exts`
42+
43+
## App Link Setup
2044
If `app` folder link doesn't exist or broken it can be created again. For better developer experience it is recommended to create a folder link named `app` to the *Omniverse Kit* app installed from *Omniverse Launcher*. Convenience script to use is included.
2145

2246
Run:
@@ -39,14 +63,8 @@ You can also just pass a path to create link to:
3963
> link_app.bat --path "C:/Users/bob/AppData/Local/ov/pkg/create-2021.3.4"
4064
```
4165

66+
## Contributing
67+
The source code for this repository is provided as-is, but I am accepting outside contributions.
4268

43-
# Sharing Your Extensions
44-
45-
This folder is ready to be pushed to any git repository. Once pushed direct link to a git repository can be added to *Omniverse Kit* extension search paths.
46-
47-
Link might look like this: `git://github.com/ericcraft-mh/meadhunt-enscape-loader.git?branch=main&dir=exts`
48-
49-
Notice `exts` is repo subfolder with extensions. More information can be found in "Git URL as Extension Search Paths" section of developers manual.
50-
51-
To add a link to your *Omniverse Kit* based app go into: Extension Manager -> Gear Icon -> Extension Search Path
69+
Issues, Feature Requests, and Pull Requests are welcomed.
5270

exts/meadhunt.enscape.loader/config/extension.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
version = "1.0.0"
44

55
# The title and description fields are primarily for displaying extension info in UI
6-
title = "Mead & Hunt Enscape Camera IO"
6+
title = "Mead & Hunt Enscape Camera Loader"
77
description="Importer/exporter to exchange Enscape camera data through animation .xml."
88

99
# Path (relative to the root) or content of readme markdown file for UI.
1010
readme = "docs/README.md"
11+
changelog = "docs/CHANGELOG.md"
1112

1213
# URL of the extension source repository.
1314
repository = "https://github.com/ericcraft-mh/meadhunt-enscape-loader"
@@ -18,6 +19,10 @@ category = "Other"
1819
# Keywords for the extension
1920
keywords = ["kit", "enscape"]
2021

22+
# Preview image and icon. Folder named "data" automatically goes in git lfs (see .gitattributes file).
23+
# Preview image is shown in "Overview" of Extensions window. Screenshot of an extension might be a good preview image.
24+
preview_image = "data/preview_enscapeloader.png"
25+
2126
# Use omni.ui to build simple UI
2227
[dependencies]
2328
"omni.kit.uiapp" = {}
305 KB
Loading

exts/meadhunt.enscape.loader/docs/CHANGELOG.md

Whitespace-only changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
# Mead & Hunt Enscape Camera Loader
3+
4+
### Inspiration
5+
Enscape Loader was created based on a tool I previously created, but was written from the ground up in Python for Omniverse.
6+
7+
### About
8+
This tool was created as a way to exchange camera data from Enscape to Omniverse. Not all Designers/Architects may be comfortable in a tool like Omniverse so this allows them to do their work in Enscape, but bring it to Omniverse for fine tuning and advanced visualization.
9+
10+
### Usage
11+
After installation the dialog can be opened from Window > Mead & Hunt > Enscape Camera Loader.
12+
13+
XML Path: Path to the XML you want to import.
14+
15+
Scene Path: /World/Cameras (default)Path in the Omniverse Stage where you want the Cameras to be placed.
16+
17+
Name: EnscapeCamera (default)Name to be appended by Unique number (EnscapeCamera_01).
18+
19+
Mode: Drop-down of what to do with the XML file.
20+
- NOTE: Currently only Import is supported. A future release may support Export.
21+
22+
Method: Drop-down of how to process the time/keyframes for the XML data.
23+
- Continuous: Smooth: Currently in development.
24+
- Continuous: Linear: One camera with linear animation between all key frames.
25+
- Multiple: Linear: Multiple cameras with a Linear animation between every 2 keys.
26+
- Multiple: Static (default): Each keyframe comes in as a static camera.
27+
28+
Timeline: Drop-down of how to adjust the current timeline.
29+
- Match XML (default): Match the timeline time to the XML.
30+
- Grow to Fit: Match the last keyframe if it is greater than the current timeline.
31+
- Shrink to Fit: Match the last keyframe if it is less than the current timeline.
32+
33+
Click Me: Button to process the file.
34+
35+
### Adding This Extension
36+
To add this extension to your Omniverse app:
37+
1. Go into: Extension Manager -> Gear Icon -> Extension Search Path
38+
2. Add this as a search path: git://github.com/ericcraft-mh/meadhunt-enscape-loader.git?branch=main&dir=exts
39+

exts/meadhunt.enscape.loader/meadhunt/enscape/loader/extension.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ class EnscapeIO(omni.ext.IExt):
1414

1515
# Class Variables
1616
DEBUG = True
17-
WINDOW_TITLE = "Enscape Camera IO"
17+
WINDOW_TITLE = "Enscape Camera Loader"
1818

1919
def __init__(self):
2020
pass
2121

2222
def on_startup(self, ext_id):
23-
print("[meadhunt.enscape.loader] Enscape Camera IO startup")
23+
print("[meadhunt.enscape.loader] Enscape Camera Loader startup")
2424

2525
# Note the "Window" part of the path that directs the new menu item to the "Window" menu.
2626
self._menu_path = f"Window/Mead & Hunt/{self.WINDOW_TITLE}"
@@ -33,7 +33,7 @@ def on_startup(self, ext_id):
3333
omni.kit.ui.get_editor_menu().set_value(self._menu_path, False)
3434

3535
def on_shutdown(self):
36-
print("[meadhunt.enscape.loader] Enscape Camera IO shutdown")
36+
print("[meadhunt.enscape.loader] Enscape Camera Loader shutdown")
3737

3838
if self._window:
3939
self._window.hide()

exts/meadhunt.enscape.loader/meadhunt/enscape/loader/window.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def _build_ui(self):
5555
with self.frame:
5656
with ui.VStack(height=0):
5757
with ui.VStack(spacing=5, name="frame_v_stack"):
58-
# ui.Spacer(height=0)
58+
5959
self._create_path("XML Path:", "")
60-
# ui.Spacer(height=0)
60+
6161
with ui.HStack():
6262
ui.Label("Scene Path:", name="scenelabel", width=self.LABEL_WIDTH)
6363
self._scene_path = ui.StringField(name="scenepath", height=self.BUTTON_SIZE).model
@@ -66,27 +66,20 @@ def _build_ui(self):
6666
ui.Label("Name:", name="namelabel", width=self.LABEL_WIDTH)
6767
self._camera_name = ui.StringField(name="namefield", height=self.BUTTON_SIZE).model
6868
self._camera_name.set_value("EnscapeCamera")
69-
# ui.Spacer(height=0)
69+
7070
self.COMBO_MODE = self._create_combo("Mode:", self.MODE_LIST, 0)
7171
self.COMBO_MODE.enabled = False
72-
# ui.Spacer(height=0)
72+
7373
self.COMBO_METHOD = self._create_combo("Method:", self.METHOD_LIST, 3)
7474
self.COMBO_METHOD.enabled = True
75-
# ui.Spacer(height=0)
75+
7676
self.COMBO_FIT = self._create_combo("Timeline:", self.FIT_LIST, 0)
7777
self.COMBO_FIT.enabled = True
7878
self.btn_click = ui.Button("Click Me", name="BtnClick", clicked_fn=lambda: self._on_click(), style={"color": cl.shade("aqua", transparent=0x20FFFFFF, white=0xFFFFFFFF)}, enabled=False)
7979
ui.set_shade("transparent")
80-
# ui.Spacer(height=2)
81-
# with ui.CollapsableFrame(title="About", collapsed=True, alignment=ui.Alignment.CENTER):
82-
# with ui.VStack():
83-
# ui.Label("Author: Eric Craft")
84-
# ui.Label("Company: Mead & Hunt")
8580

8681
def _on_filter_xml(self, item) -> bool:
8782
"""Callback to filter the choices of file names in the open or save dialog"""
88-
# if self.DEBUG:
89-
# print(f"current_filter_option: {self._open_file_dialog.current_filter_option}")
9083
if not item or item.is_folder:
9184
return True
9285
if self._open_file_dialog.current_filter_option == 0:
@@ -158,14 +151,6 @@ def _on_click_cancel(file_name: str, directory_path: str):
158151
self._open_file_dialog.hide()
159152
self._open_file_dialog.destroy()
160153

161-
# self._open_file_dialog = FilePickerDialog(
162-
# "Select XML File",
163-
# apply_button_label="Select",
164-
# click_apply_handler=lambda f, d: _on_click_open(f, d),
165-
# click_cancel_handler=lambda f, d: _on_click_cancel(f, d),
166-
# file_extension_options = [("*.xml", "Files (*.xml)")],
167-
# item_filter_fn=lambda item: self._on_filter_xml(item)
168-
# )
169154
self._open_file_dialog = FilePickerDialog(
170155
"Open XML File",
171156
apply_button_label="Open",

exts/meadhunt.enscape.loader/meadhunt/enscape/loader/xml_parser.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,13 @@ def valid_xml(self) -> bool:
6666
return False
6767

6868
def total_time(self):
69-
# try:
7069
if self._root.attrib.get("durationSeconds"):
7170
outval = float(self._root.attrib.get("durationSeconds"))
7271
elif self._root[0][self.keys_count()-1].attrib.get("timestampSeconds"):
7372
outval = float(self._root[0][self.keys_count()-1].attrib.get("timestampSeconds"))
7473
else:
7574
timeval = float(self._root[0][self.keys_count()-2].attrib.get("timestampSeconds"))
7675
outval = (timeval/(self.keys_count()-1))+timeval
77-
# except:
78-
# print("ERROR: Total Time not calculated")
79-
# outval = float(0)
8076
return outval
8177

8278
def time_key(self):
@@ -204,20 +200,16 @@ def create_cameras(self, index=0):
204200
xscale = camera_prim.GetAttribute("xformOp:scale")
205201
else:
206202
xform = UsdGeom.Xformable(camera_prim)
207-
# transform = xform.AddTransformOp()
208203
xposition = xform.AddTranslateOp()
209204
xrotation = xform.AddRotateXYZOp()
210205
xscale = xform.AddScaleOp()
211206
# Set the Camera transform matrix
212207
xform = UsdGeom.Xformable(camera_prim)
213-
# transform = xform.AddTransformOp()
214-
# xposition = xform.AddTranslateOp()
215-
# xrotation = xform.AddRotateXYZOp()
216-
# xscale = xform.AddScaleOp()
208+
217209
xposition.Set(self.get_pos(index))
218210
xrotation.Set(self.get_rot(index))
219211
xscale.Set(Gf.Vec3d(1,1,1))
220-
# transform.Set(self.get_xform(index))
212+
221213
# Debug
222214
if self._debug:
223215
print(f"Camera Path: {camera_path}")
@@ -248,7 +240,7 @@ def parse_xml(self):
248240
if newcam.HasAttribute("xformOp:translate"):
249241
tpath = f"{newcampath}.xformOp:translate"
250242
rpath = f"{newcampath}.xformOp:rotateXYZ"
251-
# omni.kit.commands.execute("AddAnimCurves",paths=[tpath,rpath])
243+
252244
for index in range(0, self._keys_total):
253245
# Set Anim Curve Keys for translate
254246
print(index,": ",self.get_keyTime(index))
@@ -291,5 +283,3 @@ def parse_xml(self):
291283
camerasList[index].GetAttribute("focalLength").Set(self.get_focalLength(camerasList[index],fovList[0]))
292284
if len(fovList) == 0:
293285
camerasList[index].GetAttribute("focalLength").Set(self.get_focalLength(camerasList[index],math.radians(90.0)))
294-
# print(camerasList)
295-
# print(f"{self._root.tag}")

images/enscapeloader_ui.png

15.3 KB
Loading

0 commit comments

Comments
 (0)