EditorSettings

package
v0.0.0-...-c858641 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Object that holds the project-independent editor settings. These settings are generally visible in the Editor > Editor Settings menu.

Property names use slash delimiters to distinguish sections. Setting values can be of any any type. It's recommended to use snake_case for editor settings to be consistent with the Godot editor itself.

Accessing the settings can be done using the following methods, such as:

package main

import (
	"graphics.gd/classdb/EditorInterface"
	"graphics.gd/variant/Object"
)

func ExampleEditorSettings() {
	var settings = EditorInterface.GetEditorSettings()
	settings.SetSetting("some/property", 10)
	settings.GetSetting("some/property")
	var list_of_settings = Object.GetPropertyList(settings)
	_ = list_of_settings
}

Note: This class shouldn't be instantiated directly. Instead, access the singleton using graphics.gd/classdb/EditorInterface.GetEditorSettings.

Index

Constants

View Source
const NotificationEditorSettingsChanged Object.Notification = 10000 //gd:EditorSettings.NOTIFICATION_EDITOR_SETTINGS_CHANGED

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsEditorSettings() Instance
}

type Expanded

type Expanded [1]gdclass.EditorSettings

func (Expanded) GetProjectMetadata

func (self Expanded) GetProjectMetadata(section string, key string, def any) any

Returns project-specific metadata for the 'section' and 'key' specified. If the metadata doesn't exist, 'default' will be returned instead. See also Instance.SetProjectMetadata.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsEditorSettings

func (self *Extension[T]) AsEditorSettings() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.EditorSettings

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddPropertyInfo

func (self Instance) AddPropertyInfo(info Object.PropertyInfo)

Adds a custom property info to a property. The dictionary must contain:

- name: string (the name of the property)

- type: int (see [Variant.Type])

- optionally hint: int (see [PropertyHint]) and hint_string: string

func (Instance) AsEditorSettings

func (self Instance) AsEditorSettings() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) CheckChangedSettingsInGroup

func (self Instance) CheckChangedSettingsInGroup(setting_prefix string) bool

Checks if any settings with the prefix 'setting_prefix' exist in the set of changed settings. See also Instance.GetChangedSettings.

func (Instance) Erase

func (self Instance) Erase(property string)

Erases the setting whose name is specified by 'property'.

func (Instance) GetChangedSettings

func (self Instance) GetChangedSettings() []string

Gets an array of the settings which have been changed since the last save. Note that internally changed_settings is cleared after a successful save, so generally the most appropriate place to use this method is when processing NotificationEditorSettingsChanged.

func (Instance) GetFavorites

func (self Instance) GetFavorites() []string

Returns the list of favorite files and directories for this project.

func (Instance) GetProjectMetadata

func (self Instance) GetProjectMetadata(section string, key string) any

Returns project-specific metadata for the 'section' and 'key' specified. If the metadata doesn't exist, 'default' will be returned instead. See also Instance.SetProjectMetadata.

func (Instance) GetRecentDirs

func (self Instance) GetRecentDirs() []string

Returns the list of recently visited folders in the file dialog for this project.

func (Instance) GetSetting

func (self Instance) GetSetting(name string) any

Returns the value of the setting specified by 'name'. This is equivalent to using graphics.gd/classdb/Object.Instance.Get on the EditorSettings instance.

func (Instance) HasSetting

func (self Instance) HasSetting(name string) bool

Returns true if the setting specified by 'name' exists, false otherwise.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MarkSettingChanged

func (self Instance) MarkSettingChanged(setting string)

Marks the passed editor setting as being changed, see Instance.GetChangedSettings. Only settings which exist (see Instance.HasSetting) will be accepted.

func (Instance) OnSettingsChanged

func (self Instance) OnSettingsChanged(cb func(), flags ...Signal.Flags)

func (Instance) SetBuiltinActionOverride

func (self Instance) SetBuiltinActionOverride(name string, actions_list []InputEvent.Instance)

Overrides the built-in editor action 'name' with the input actions defined in 'actions_list'.

func (Instance) SetFavorites

func (self Instance) SetFavorites(dirs []string)

Sets the list of favorite files and directories for this project.

func (Instance) SetInitialValue

func (self Instance) SetInitialValue(name string, value any, update_current bool)

Sets the initial value of the setting specified by 'name' to 'value'. This is used to provide a value for the Revert button in the Editor Settings. If 'update_current' is true, the setting is reset to 'value' as well.

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetProjectMetadata

func (self Instance) SetProjectMetadata(section string, key string, data any)

Sets project-specific metadata with the 'section', 'key' and 'data' specified. This metadata is stored outside the project folder and therefore won't be checked into version control. See also Instance.GetProjectMetadata.

func (Instance) SetRecentDirs

func (self Instance) SetRecentDirs(dirs []string)

Sets the list of recently visited folders in the file dialog for this project.

func (Instance) SetSetting

func (self Instance) SetSetting(name string, value any)

Sets the 'value' of the setting specified by 'name'. This is equivalent to using graphics.gd/classdb/Object.Instance.Set on the EditorSettings instance.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL