Skip to content

Commit

Permalink
Feat/use cam by default (#484)
Browse files Browse the repository at this point in the history
Co-authored-by: Mario Ostieri <107915956+mariostieriansys@users.noreply.github.com>
  • Loading branch information
david-bremer and mariostieriansys authored Nov 26, 2024
1 parent 7956fa8 commit 8bf40ba
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/ansys/pyensight/core/utils/omniverse_dsg_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,27 @@ def add_group(self, id: int, view: bool = False) -> None:
cam.transform = c * m.GetInverse()
# set the updated camera
geom_cam.SetFromCamera(cam)
# apply the inverse cam transform to move the center of interest
# from data space to camera space
coi_attr = cam_prim.GetAttribute("omni:kit:centerOfInterest")
if coi_attr.IsValid():
coi_data = coi_attr.Get()
coi_cam = (
Gf.Vec4d(coi_data[0], coi_data[1], coi_data[2], 1.0)
* cam.transform.GetInverse()
)
coi_attr.Set(
Gf.Vec3d(
coi_cam[0] / coi_cam[3],
coi_cam[1] / coi_cam[3],
coi_cam[2] / coi_cam[3],
)
)
# use the camera view by default
self._omni._stage.GetRootLayer().customLayerData = { # type: ignore
"cameraSettings": {"boundCamera": "/Root/Cam"}
}

# We only want to do this once
self._updated_camera = True
matrix = [
Expand Down

0 comments on commit 8bf40ba

Please sign in to comment.