EditorSettings

package
v0.0.0-...-59761c8 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package EditorSettings provides methods for working with EditorSettings object instances.

Index

Constants

This section is empty.

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 Instance

type Instance [1]gdclass.EditorSettings

Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor > Editor Settings[/b] menu. Property names use slash delimiters to distinguish sections. Setting values can be of any [Variant] type. It's recommended to use [code]snake_case[/code] for editor settings to be consistent with the Godot editor itself. Accessing the settings can be done using the following methods, such as: [codeblocks] [gdscript] var settings = EditorInterface.get_editor_settings() # `settings.set("some/property", 10)` also works as this class overrides `_set()` internally. settings.set_setting("some/property", 10) # `settings.get("some/property")` also works as this class overrides `_get()` internally. settings.get_setting("some/property") var list_of_settings = settings.get_property_list() [/gdscript] [csharp] EditorSettings settings = EditorInterface.Singleton.GetEditorSettings(); // `settings.set("some/property", value)` also works as this class overrides `_set()` internally. settings.SetSetting("some/property", Value); // `settings.get("some/property", value)` also works as this class overrides `_get()` internally. settings.GetSetting("some/property"); Godot.Collections.Array<Godot.Collections.Dictionary> listOfSettings = settings.GetPropertyList(); [/csharp] [/codeblocks] [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].

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 PropertyInfo)

Adds a custom property info to a property. The dictionary must contain: - [code]name[/code]: [String] (the name of the property) - [code]type[/code]: [int] (see [enum Variant.Type]) - optionally [code]hint[/code]: [int] (see [enum PropertyHint]) and [code]hint_string[/code]: [String] [codeblocks] [gdscript] var settings = EditorInterface.get_editor_settings() settings.set("category/property_name", 0)

var property_info = {
    "name": "category/property_name",
    "type": TYPE_INT,
    "hint": PROPERTY_HINT_ENUM,
    "hint_string": "one,two,three"
}

settings.add_property_info(property_info) [/gdscript] [csharp] var settings = GetEditorInterface().GetEditorSettings(); settings.Set("category/property_name", 0);

var propertyInfo = new Godot.Collections.Dictionary

{
    {"name", "category/propertyName"},
    {"type", Variant.Type.Int},
    {"hint", PropertyHint.Enum},
    {"hint_string", "one,two,three"}
};

settings.AddPropertyInfo(propertyInfo); [/csharp] [/codeblocks]

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 [param setting_prefix] exist in the set of changed settings. See also [method get_changed_settings].

func (Instance) Erase

func (self Instance) Erase(property string)

Erases the setting whose name is specified by [param 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 [code]changed_settings[/code] is cleared after a successful save, so generally the most appropriate place to use this method is when processing [constant NOTIFICATION_EDITOR_SETTINGS_CHANGED].

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 [param section] and [param key] specified. If the metadata doesn't exist, [param default] will be returned instead. See also [method set_project_metadata].

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 [param name]. This is equivalent to using [method Object.get] on the EditorSettings instance.

func (Instance) HasSetting

func (self Instance) HasSetting(name string) bool

Returns [code]true[/code] if the setting specified by [param name] exists, [code]false[/code] otherwise.

func (Instance) MarkSettingChanged

func (self Instance) MarkSettingChanged(setting string)

Marks the passed editor setting as being changed, see [method get_changed_settings]. Only settings which exist (see [method has_setting]) will be accepted.

func (Instance) OnSettingsChanged

func (self Instance) OnSettingsChanged(cb func())

func (Instance) SetBuiltinActionOverride

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

Overrides the built-in editor action [param name] with the input actions defined in [param 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 [param name] to [param value]. This is used to provide a value for the Revert button in the Editor Settings. If [param update_current] is [code]true[/code], the setting is reset to [param value] as well.

func (Instance) SetProjectMetadata

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

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

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 [param value] of the setting specified by [param name]. This is equivalent to using [method Object.set] on the EditorSettings instance.

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

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

type PropertyInfo

type PropertyInfo struct {
	ClassName  string       `gd:"class_name"`
	Name       string       `gd:"name"`
	Hint       int          `gd:"hint"`
	HintString string       `gd:"hint_string"`
	Type       reflect.Type `gd:"type"`
	Usage      int          `gd:"usage"`
}

Jump to

Keyboard shortcuts

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