diff --git a/exts/maticodes.viewport.reticle/maticodes/viewport/reticle/views.py b/exts/maticodes.viewport.reticle/maticodes/viewport/reticle/views.py index 9fc56f2..4e54238 100644 --- a/exts/maticodes.viewport.reticle/maticodes/viewport/reticle/views.py +++ b/exts/maticodes.viewport.reticle/maticodes/viewport/reticle/views.py @@ -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()