Exemple #1
0
    def post_app_init_studio(self, menu_name="Shotgun"):
        """
        The Nuke Studio specific portion of the engine's post-init process.

        :param menu_name:   The label/name of the menu to be created.
        """
        if self.has_ui:
            # Note! not using the import as this confuses Nuke's callback system
            # (several of the key scene callbacks are in the main init file).
            import tk_nuke
            import hiero
            from hiero.core import env as hiero_env

            # Create the menu!
            self._menu_generator = tk_nuke.NukeStudioMenuGenerator(
                self, menu_name)
            self._menu_generator.create_menu()

            hiero.core.events.registerInterest(
                "kAfterNewProjectCreated",
                self.set_project_root,
            )

            hiero.core.events.registerInterest(
                "kAfterProjectLoad",
                self._on_project_load_callback,
            )

            # Then we need to setup our context switcher.
            import tk_nuke
            self._context_switcher = tk_nuke.StudioContextSwitcher(self)

            # On selection change we have to check what was selected and pre-load
            # the context if that environment (ie: shot_step) hasn't already been
            # processed. This ensure that all Nuke gizmos for the target environment
            # will be available.
            hiero.core.events.registerInterest(
                "kSelectionChanged",
                self._handle_studio_selection_change,
            )

            try:
                hiero_ver_str = "%s.%s%s" % (
                    hiero_env["VersionMajor"],
                    hiero_env["VersionMinor"],
                    hiero_env["VersionRelease"],
                )
                self.log_user_attribute_metric("Nuke Studio version",
                                               hiero_ver_str)
            except:
                # ignore all errors. ex: using a core that doesn't support metrics
                pass
Exemple #2
0
    def post_app_init_studio(self, menu_name="Shotgun"):
        """
        The Nuke Studio specific portion of the engine's post-init process.

        :param menu_name:   The label/name of the menu to be created.
        """
        if self.has_ui:
            # Note! not using the import as this confuses Nuke's callback system
            # (several of the key scene callbacks are in the main init file).
            import tk_nuke
            import hiero
            from hiero.core import env as hiero_env

            # Create the menu!
            self._menu_generator = tk_nuke.NukeStudioMenuGenerator(
                self, menu_name)
            self._menu_generator.create_menu()

            # No context switching in plugin mode.
            if self.in_plugin_mode:
                self._context_switcher = tk_nuke.PluginStudioContextSwitcher(
                    self)
            else:
                hiero.core.events.registerInterest(
                    "kAfterNewProjectCreated",
                    self.set_project_root,
                )

                hiero.core.events.registerInterest(
                    "kAfterProjectLoad",
                    self._on_project_load_callback,
                )

                self._context_switcher = tk_nuke.ClassicStudioContextSwitcher(
                    self)
                # On selection change we have to check what was selected and pre-load
                # the context if that environment (ie: shot_step) hasn't already been
                # processed. This ensure that all Nuke gizmos for the target environment
                # will be available.
                hiero.core.events.registerInterest(
                    "kSelectionChanged",
                    self._handle_studio_selection_change,
                )