Skip to content

Editor

Extends: CanvasLayer

Description

The core class where editing and UI elements of Dungeondraft are held.

Accessed by Global.Editor.

Properties

Tool ActiveTool
String ActiveToolName
Toolset Toolset
bool SuppressTool
PreviewContainer Preview
Dictionary TagsPanels
ObjectLibraryPanel ObjectLibraryPanel
PathLibraryPanel PathLibraryPanel
bool IsSnapping
String CurrentMapFile
bool SearchHasFocus
Dictionary Tools
Dictionary Windows
Control floatBar
MenuButton menuButton
Button newButton
Button openButton
Button saveButton
Button exportButton
Button undoButton
Button redoButton
Button assetsButton
Button modsButton
Button reloadModsButton
Button aboutButton
PopupMenu openRecentMenu
Control content
CheckBox CompareToggle
Sprite PackPreview
Node windowsNode
Panel WindowShade
bool isSettingGuide
bool isMeasuring
CheckBox GridToggle
CheckBox LightingToggle
OptionButton ZoomOptions
OptionButton LevelOptions
float[] ZoomLevels

Methods

void DisableMenuButtons ( )
void EnableMapButtons ( )
void EnableTools ( bool value )
void OnSelectTool ( String tool )
void OnDeselectTool ( )
bool IsToolActive ( String tool )
void OnWindowOpen ( WindowDialog window )
void OnWindowClose ( WindowDialog window )
bool IsActiveModal ( Control control )
void OnOpenedOrSaved ( String path = "" )
void OnUpdateTitle ( String title )
void SetCursorShape ( int shape )
void SetDisableCompareToggle ( bool disable )
void SaveMap ( bool saveAs )
void OpenMap ( )
void InitMenu ( )
void UpdateOpenRecent ( )
void UpdateLevelOptions ( )
void SetLevelOptionsByID ( int ID )
void ToggleGrid ( bool enabled )
void ToggleLighting ( bool enabled )
void SetZoomOptionByRaw ( float zoom )
void OnLevelChanged ( )
void OpenTagsBrowser ( )
void Warn ( String title, String text )
void OnFilesDropped ( String[] files )
void ForceOpenMap ( String file )
void EnlargeControls ( Node parent )
void EnlargeButton ( Button button )

Property Descriptions

  • Tool ActiveTool:
    Get the currently active tool. Change with OnSelectTool().

  • String ActiveToolName:
    Get the name of the currently active tool.

  • Toolset Toolset:
    Get the toolset.

  • bool SuppressTool:
    Get or set if the active tool is blocked from being used.

  • PreviewContainer Preview:
    Get the preview container used by the object library.

  • Dictionary TagsPanels:
    Lookup table for tag panels. Valid options are: "ObjectTool" and "ScatterTool".

  • ObjectLibraryPanel ObjectLibraryPanel:
    Gets the panel that displays the object library menu.

  • PathLibraryPanel PathLibraryPanel:
    Gets the panel that displays the path library menu.

  • bool IsSnapping:
    Get the if the user has grid snapping enabled.

  • String CurrentMapFile:
    Get the path of the current opened map.

  • bool SearchHasFocus:
    Gets if the search has the user input focus.



  • Control floatBar:
    Parent of the bottom bar.

  • MenuButton menuButton:
    The main menu button on the top bar.

  • Button newButton:
    The new button on the top bar.

  • Button openButton:
    The open button on the top bar.

  • Button saveButton:
    The save button on the top bar.

  • Button exportButton:
    The export button on the top bar.

  • Button undoButton:
    The undo button on the top bar.

  • Button redoButton:
    The redo button on the top bar.

  • Button assetsButton:
    The assets button on the top bar.

  • Button modsButton:
    The mods button on the top bar.

  • Button reloadModsButton:
    The reload mods button on the top bar.

  • Button aboutButton:
    The about button on the top bar.

  • PopupMenu openRecentMenu:
    The sub menu inside the main menu to open recently opened maps.

  • CheckBox CompareToggle:
    The toggle to turn on level comparisons.

  • Sprite PackPreview:
    The image displayed when the mouse hovers over an Asset Pack preview image.

  • Node windowsNode:
    Parent node of all the windows.

  • Panel WindowShade:
    A box that darkens the window behind a modal window when it is opened.

  • bool isSettingGuide:
    Get if the user is in the process of adding a guide line

  • bool isMeasuring:
    Gets if the user is in the process of adding a ruler.

  • CheckBox GridToggle:
    The toggle that controls if the grid is visible.

  • CheckBox LightingToggle:
    The toggle that controls if the lighting is enabled.

  • OptionButton ZoomOptions:
    The bottom bar dropdown used to select a map zoom level.

  • OptionButton LevelOptions:
    The bottom bar dropdown used change the level/floor of the map.

  • float[] ZoomLevels:
    Read only array of zoom levels used by Dungeondraft.

Method Descriptions


  • void EnableMapButtons ( ):
    Enable the top menu bar and enable the map options in the main menu.


  • void OnSelectTool ( String tool ):
    Set the properties to a new tool. Called by ToolbarButton.

  • void OnDeselectTool ( ):
    Clear the tool properties after deselecting a tool.


  • void OnWindowOpen ( WindowDialog window ):
    Called by modal windows when they are about_to_show. You can connect a new window you made and its about_to_show signal to this method to also make it modal when it is opened.

  • void OnWindowClose ( WindowDialog window ):
    Called by modal windows when they closing. You can connect a new window you made and its popup_hide signal to this method to also make it no longer modal when it is closed.


  • void OnOpenedOrSaved ( String path = "" ):
    Tell Dungeondraft a map does not have any new changes and the same as the file.




  • void SaveMap ( bool saveAs ):
    Save the map. If the map is new, prompt the user for a map file name.

  • void OpenMap ( ):
    Prompt the user to open a new map.

  • void InitMenu ( ):
    Initialize the main menu. Called once on Launch.

  • void UpdateOpenRecent ( ):
    Initialize the recently opened sub menu in the main menu

  • void UpdateLevelOptions ( ):
    Update the LevelOptions menu to reflect the currently selected level.

  • void SetLevelOptionsByID ( int ID ):
    Change the LevelOptions menu to select a different level manually. Does not change level.



  • void SetZoomOptionByRaw ( float zoom ):
    Set the camera by a raw zoom value and have the ZoomOptions menu reflect the change.

  • void OnLevelChanged ( ):
    Called when the level is changed by the user to inform the active tool that the level changed.


  • void Warn ( String title, String text ):
    Prompts the user with a warning text box.

  • void OnFilesDropped ( String[] files ):
    Trigger files being dropped. Will open a map if dropped, and will embed an image as a Prop if dropped.


  • void EnlargeControls ( Node parent ):
    Doubles the size of a UI element and all its children. Use with care.

  • void EnlargeButton ( Button button ):
    Look for a double sized icon for a button if available.