diff --git a/app.py b/app.py index 6fc38598..85f175a1 100644 --- a/app.py +++ b/app.py @@ -29,15 +29,33 @@ def init_app(self): self._current_dialog = None self._current_panel = None - # Register the app as a panel. - self._unique_panel_id = self.engine.register_panel(self.create_panel) - - # Register a menu entry on the ShotGrid menu so that users can launch the panel. - self.engine.register_command( - "Scene Breakdown...", - self.create_panel, - {"type": "panel", "short_name": "breakdown"}, - ) + if self.get_setting("app_display_mode") == "panel": + + # Register the app as a panel. + self._unique_panel_id = self.engine.register_panel(self.create_panel) + + # Register a menu entry on the ShotGrid menu so that users can launch the panel. + self.engine.register_command( + "Scene Breakdown...", + self.create_panel, + {"type": "panel", "short_name": "breakdown"}, + ) + + elif self.get_setting("app_display_mode") == "dialog": + + # Register the app as a dialog + # Register a menu entry on the ShotGrid menu so that users can launch the dialog. + self.engine.register_command( + "Scene Breakdown...", + lambda: self.create_dialog(), + {"type": "dialog", "short_name": "breakdown"}, + ) + + else: + self.logger.error( + "An invalid app_display_mode was configured. `{}` is not a valid app_display_mode " + "setting!".format(self.get_setting("app_display_mode")) + ) def show_dialog(self): """Show the Scene Breakdown 2 App dialog.""" diff --git a/info.yml b/info.yml index 8f5a7845..8fce079c 100644 --- a/info.yml +++ b/info.yml @@ -10,6 +10,11 @@ configuration: + app_display_mode: + type: str + default_value: panel + description: Specify if the app should launch as `panel` or `dialog`. Not all engines support panels. + hook_scene_operations: type: hook default_value: "{self}/{engine_name}_scene_operations.py"