ToolPanel
Extends: ScrollContainer
Description
ToolPanel is the class representing the UI controls on the left side of the Dungeondraft interface. Every single tool in Dungeondraft, including new ones you create through Global.Editor.CreateModTool() is associated with a ToolPanel. This is the primary way a tool displays options available to a cartographer. The main concern for the modder should be creating new UI controls and associating any options or functionality to them. Whenever you see the property variable in a UI creation method, it automatically modifies that property in the associated Tool.
To see how to use a ToolPanel instance, check out this example script: Example UI Script
Properties
VBoxContainer | Align |
Tool | Tool |
bool | UsesObjectLibrary |
bool | UsesPathLibrary |
bool | UsesModRightsidePanel |
bool | IsRightsidePanel |
Methods
Property Descriptions
- VBoxContainer Align:
This is the control that every UI control is attached to unless inside a section.
- Tool Tool:
The Tool associated with this ToolPanel.
- bool UsesObjectLibrary:
Opens the Object Library Panel on the right side when this tool is active.
- bool UsesPathLibrary:
Opens the Path Library Panel on the right side when this tool is active.
- bool UsesModRightsidePanel:
Opens the Custom Mod Rightside Panel on the right side when this tool is active. DO NOT MANUALLY SET.
- bool IsRightsidePanel:
Tells Dungeondraft this panel is the mod rightside panel. DO NOT MANUALLY SET.
Method Descriptions
- VBoxContainer BeginSection ( bool stretch = true ):
Encloses all UI controls created afterwards inside a section. Must be closed with EndSection(). The parameter stretch causes the section to extend all the way to the bottom of the panel.
- VBoxContainer BeginNamedSection ( String name, bool stretch = true ):
Create a UI control section that can be referenced through Tool.Controls[name].
- void EndSection ( ):
Ends the section and all UI controls created afterwards will not be included in the previous section.
- Button CreateButton ( String label, String icon ):
Creates and returns a Godot Button with label as display text and icon_path as the path to the icon displayed.
- Button CreateToggle ( String property, bool default, String onLabel, String onIcon, String offLabel, String offIcon ):
Creates and returns a toggle style Godot Button.
Creates a radio style Godot Button and pass in a ButtonGroup to allow a radio toggle.
:
- void CreateToggleGroup ( String property, String[] options, String[] labels, String[] icons, int default = 0 ):
Creates a set of radio toggle but looks like tabbed buttons.
- CheckButton CreateCheckButton ( String label, String property, bool default ):
Creates and returns a Godot CheckButton.
- void CreateLabel ( String label ):
Creates a label.
- void CreateSeparator ( ):
Creates a horizontal separator.
- void CreateNote ( String text ):
Creates a framed label for a dev note.
- CheckBox[] CreateRadioMenu ( String property, String[] options ):
Creates a radio menu and returns the array of all the CheckBox.
- OptionButton CreateDropdownMenu ( String property, String[] options, String default ):
Creates and returns a Godot OptionButton (which is a dropdown menu) and autofill the menu with options.
- OptionButton CreateLabeledDropdownMenu ( String property, String label, String[] options, String default ):
Creates a labelled dropdown menu. The option Array are of type String.
- OptionButton CreateLayerMenu ( ):
Creates and returns the dropdown menu representing the layer system for Objects, Paths, and Materials for Dungeondraft. There should only ever be a single instance of this UI control per tool if needed. To inspect the current selected layer, check the variable Global.Editor.Tools["mod_tool_id"].ActiveLayer which returns the int of the layer value.
- void CreateIconMenu ( String property, int default, String[] options, bool sizeControl, ButtonGroup group ):
Create a horizontal set of icon menu buttons like those used to select brush shapes.
- HSlider CreateSlider ( String property, float default, float minimum, float maximum, float step, bool exponential ):
Creates and returns a Godot HSlider. The exponential parameter is an option that makes the slider use an exponential scale.
- RangeSlider CreateRange ( String property, float minimum, float maximum, float step, float minDefault, float maxDefault ):
Creates and returns a Dungeondraft unique UI control RangeSlider. This control allows the user to pick a range of values instead of a single value.
- void CreateFileSelector ( String property, String filter, String directory ):
Creates a special UI control dedicated to selecting a file. The file_filter parameter is the file extension filter that is unique to each operating system. A modder needs to account for Windows, OSX, and Linux in the filter. The directory is the path to the default starting location for the file dialog that opens.
- ColorPickerButton CreateColorButton ( String name, bool propertyOnly, String default, String[] presets ):
Create a simple color selection control without a color palette. The presets Array are of type String.
- ColorPalette CreateColorPalette ( String name, bool propertyOnly, String default, String[] presets, bool multiselect, bool initToolColor = true ):
Creates and returns a Dungeondraft UI control called a ColorPalette and fills it through the presets array. The Strings should be in hex color code format. The presets Array are of type String.
- void CreateTextureListMenu ( String property, String[] textures, String[] labels ):
Create a texture selection menu in list format. No longer used/deprecated. The Arrays are of type String.
- GridMenu CreateTextureGridMenu ( String property, String textureCategory, bool showsPreview ):
Creates and returns a Godot GridMenu filled with assets from the specified Dungeondraft asset category.
- GridMenu CreateWideTextureGridMenu ( String property, String textureCategory, bool showsPreview ):
Creates and returns a Godot GridMenu in wide format filled with assets from the specified Dungeondraft asset category.
- void CreateTilesetMenu ( String property ):
Generate the menu that displays the floor tile options.
- void CreateTerrainListMenu ( String property ):
Generate the menu to select Terrain options. Passes the index of the selected option to property.
- void CreateExpandSlotsButton ( ):
Generate the CheckButton used to expand the Terrain slots.
- TagsPanel CreateTagsPanel ( ):
Generate the TagsPanel and adds it to the UI.
- void UpdateToggleVisuals ( bool value, Button toggle, String onLabel, Texture onIcon, String offLabel, Texture offIcon ):
Update a toggle button's icons and labels.
- ToolPanel CreateRightsidePanel ( String title ):
Creates and returns a Dungeondraft right-side panel that behaves like the left-side tool panel and allows you to add more UI controls for your mod. Must be called from a ToolPanel you created for your mod tool, as it is registered to the tool. It will automatically open and close when your tool is selected. Only one is supported per tool. See Example UI Script for a usage example.
- void ForwardMethod ( String method ):
Helper function to forward a method invocation to the Tool. Not typically called manually.
- void ForwardProperty ( value, String property ):
Helper function to forward a property change to the Tool. Not typically called manually.
- void ForwardProperty_Enum ( String value, String property ):
Helper function to forward an enum change to the Tool. Not typically called manually.