Skip to content

Commit

Permalink
fixed on_window_changed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
matiascodesal committed Sep 10, 2022
1 parent b3e4398 commit 7444be3
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,20 @@ def destroy(self):

def on_window_changed(self, *args):
"""Update aspect ratio and rebuild overlay when viewport window changes."""
if self.vp_win is None:
return

settings = carb.settings.get_settings()
fill = settings.get(constants.SETTING_RESOLUTION_FILL)
if type(self.vp_win).__name__ == "LegacyViewportWindow":
fill = settings.get(constants.SETTING_RESOLUTION_FILL)
else:
fill = self.vp_win.viewport_api.fill_frame

if fill:
width = self.vp_win.frame.computed_width + 8
height = self.vp_win.height
else:
res = self.vp_win.viewport_api.resolution
width = res[0]
height = res[1]
width, height = self.vp_win.viewport_api.resolution
self._aspect_ratio = width / height
self.build_viewport_overlay()

Expand Down

0 comments on commit 7444be3

Please sign in to comment.