Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Function getSceneControlButtons

    • A hook event that fires when the Scene controls are initialized.

      Parameters

      • controls: Record<string, SceneControl>

        The SceneControl configurations

      Returns void

      Add a button tool at the bottom of the Token SceneControl that opens or closes an Application.
      Hooks.on("getSceneControlButtons", controls => {
      controls.tokens.tools.myTool = {
      name: "myTool",
      title: "MyTool.Title",
      icon: "fa-solid fa-wrench",
      order: Object.keys(controls.tokens.tools).length,
      button: true,
      visible: game.user.isGM,
      onChange: () => {
      const existing = foundry.applications.instances.get("my-tool");
      if ( existing ) existing.close();
      else new MyTool().render({force: true});
      }
      };
      });