EditorInspectorPlugin

package
v0.0.0-...-9b8b246 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

EditorInspectorPlugin allows adding custom property editors to EditorInspector.

When an object is edited, the CanHandle function is called and must return true if the object type is supported.

If supported, the function ParseBegin will be called, allowing to place custom controls at the beginning of the class.

Subsequently, the ParseCategory and ParseProperty are called for every category and property. They offer the ability to add custom controls to the inspector too.

Finally, ParseEnd will be called.

On each of these calls, the "add" functions can be called.

To use EditorInspectorPlugin, register it using the EditorPlugin.AddInspectorPlugin method first.

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
	AsEditorInspectorPlugin() Instance
}

type Expanded

type Expanded = MoreArgs

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]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsEditorInspectorPlugin

func (self *Extension[T]) AsEditorInspectorPlugin() 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

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 Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.EditorInspectorPlugin

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

func (self Instance) AddCustomControl(control Control.Instance)

Adds a custom control, which is not necessarily a property editor.

func (Instance) AddPropertyEditor

func (self Instance) AddPropertyEditor(property string, editor Control.Instance)

Adds a property editor for an individual property. The 'editor' control must extend EditorProperty.

There can be multiple property editors for a property. If 'add_to_end' is true, this newly added editor will be displayed after all the other editors of the property whose 'add_to_end' is false. For example, the editor uses this parameter to add an "Edit Region" button for Sprite2D.RegionRect below the regular Rect2.PositionSize editor.

'label' can be used to choose a custom label for the property editor in the inspector. If left empty, the label is computed from the name of the property instead.

func (Instance) AddPropertyEditorForMultipleProperties

func (self Instance) AddPropertyEditorForMultipleProperties(label string, properties []string, editor Control.Instance)

Adds an editor that allows modifying multiple properties. The 'editor' control must extend EditorProperty.

func (Instance) AsEditorInspectorPlugin

func (self Instance) AsEditorInspectorPlugin() Instance

func (Instance) AsObject

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

func (Instance) AsRefCounted

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

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (*Instance) SetObject

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

func (Instance) Virtual

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

type Interface

type Interface interface {
	// Returns true if this object can be handled by this plugin.
	CanHandle(obj Object.Instance) bool
	// Called to allow adding controls at the beginning of the property list for 'object'.
	ParseBegin(obj Object.Instance)
	// Called to allow adding controls at the beginning of a category in the property list for 'object'.
	ParseCategory(obj Object.Instance, category string)
	// Called to allow adding controls at the beginning of a group or a sub-group in the property list for 'object'.
	ParseGroup(obj Object.Instance, group string)
	// Called to allow adding property-specific editors to the property list for 'object'. The added editor control must extend [EditorProperty]. Returning true removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one.
	//
	// [EditorProperty]: https://pkg.go.dev/graphics.gd/classdb/EditorProperty
	ParseProperty(obj Object.Instance, atype variant.Type, name string, hint_type ClassDB.PropertyHint, hint_string string, usage_flags ClassDB.PropertyUsageFlags, wide bool) bool
	// Called to allow adding controls at the end of the property list for 'object'.
	ParseEnd(obj Object.Instance)
}

type MoreArgs

type MoreArgs [1]gdclass.EditorInspectorPlugin

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) AddPropertyEditor

func (self MoreArgs) AddPropertyEditor(property string, editor Control.Instance, add_to_end bool, label string)

Adds a property editor for an individual property. The 'editor' control must extend EditorProperty.

There can be multiple property editors for a property. If 'add_to_end' is true, this newly added editor will be displayed after all the other editors of the property whose 'add_to_end' is false. For example, the editor uses this parameter to add an "Edit Region" button for Sprite2D.RegionRect below the regular Rect2.PositionSize editor.

'label' can be used to choose a custom label for the property editor in the inspector. If left empty, the label is computed from the name of the property instead.

Jump to

Keyboard shortcuts

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