Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

MenuButton Populator

An asset by Toorah
The page banner background of a mountain and forest
MenuButton Populator thumbnail image
MenuButton Populator thumbnail image
MenuButton Populator thumbnail image
MenuButton Populator hero image

Quick Information

0 ratings
MenuButton Populator icon image
Toorah
MenuButton Populator

Adds a quick method to populate a MenuButton with Items.By adding the custom PopupChild Node as a child of the MenuButtonPopulator Node (inherits MenuButton), you can quickly add items, in the order of the children in the Scene Tree.You can also add a PopupMenu Node as a child of the MenuButtonPopulator and add more PopupChild nodes to it, to create submenus. Currently this only supports the first layer of submenus, no recursion.Optionally, you can also use the Signal onPopupItemSelected() found on each PopupChild node, instead of having to create a function and filter the ids manually.

Supported Engine Version
4.2
Version String
1.1
License Version
GPLv3
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

MenuButtonPopulator

Made for Godot 4.2 .NET & GDScript

README format-list-text-custom

Adds a quick method to populate a MenuButton with Items.

README MenuPopup_1

By adding the custom PopupChild Node as a child of the MenuButtonPopulator Node (inherits MenuButton), you can quickly add items, in the order of the children in the Scene Tree.

You can also add a PopupMenu Node as a child of the MenuButtonPopulator and add more PopupChild nodes to it, to create submenus. Currently this only supports the first layer of submenus, no recursion.

Optionally, you can also use the Signal onPopupItemSelected() found on each PopupChild node, instead of having to create a function and filter the ids manually.

README MenuPopup_3

Inherits from MenuButton

  • Clear Items (boolean) : If true, it will clear any items added manually to the MenuButton >Items field, before creating new ones.
  • (Debug) Log Pressed Items (bool) : If true, will log the selected item.

README MenuPopup_4

PopupChild

Inherits from Node

  • Is Separator (boolean) : If true, this PopupChild will be used as a Separator instead of an Item.
  • Label Override (string) : If not-empty, it will override the Item Label, instead of using the PopupChild Node Name. This can be useful for disallowed characters in the Scene Tree.

README MenuPopup_2

How to Use

  • Add a MenuButton Node to the Scene. Add the MenuButtonPopulator.cs Script to the MenuButton Node

OR

  • Add the MenuButtonPopulator Node directly, from the Create New Node Menu

Adding Items

  • Add PopupChild Nodes under the MenuButtonPopulator. The name of each child will be used as a Popup Item.
  • (Optional) Set the PopupChild as a Separator to create a separation Line instead
  • (Optional) Set the Label Override to use a different Item Name than the Node Name, this is useful for using special characters not allowed in Godot's SceneTree.
  • (Optional) Use the Signal of each PopupChild Node to get a specific event for each, instead of using the IdPressed Signal manually.

Creating Submenus

  • Add a PopupMenu Node to the MenuButtonPopulator Node. The Name of the PopupMenu Node will be used as the Submenu Name.
  • Add PopupChild Nodes to the PopupMenu and repeat the steps outlined in Adding Items.

Todo

  • Add recursive menu building
  • Disabled Items
  • Add gdscipt version
  • verify all godot 4.x version compatibility
  • overall UX improvement

Adds a quick method to populate a MenuButton with Items.

By adding the custom PopupChild Node as a child of the MenuButtonPopulator Node (inherits MenuButton), you can quickly add items, in the order of the children in the Scene Tree.

You can also add a PopupMenu Node as a child of the MenuButtonPopulator and add more PopupChild nodes to it, to create submenus. Currently this only supports the first layer of submenus, no recursion.

Optionally, you can also use the Signal onPopupItemSelected() found on each PopupChild node, instead of having to create a function and filter the ids manually.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
MenuButton Populator icon image
Toorah
MenuButton Populator

Adds a quick method to populate a MenuButton with Items.By adding the custom PopupChild Node as a child of the MenuButtonPopulator Node (inherits MenuButton), you can quickly add items, in the order of the children in the Scene Tree.You can also add a PopupMenu Node as a child of the MenuButtonPopulator and add more PopupChild nodes to it, to create submenus. Currently this only supports the first layer of submenus, no recursion.Optionally, you can also use the Signal onPopupItemSelected() found on each PopupChild node, instead of having to create a function and filter the ids manually.

Supported Engine Version
4.2
Version String
1.1
License Version
GPLv3
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers