Class EditorInspectorPlugin
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
EditorInspectorPlugin allows adding custom property editors to EditorInspector.
When an object is edited, the _CanHandle(GodotObject) function is called and must return true if the object type is supported.
If supported, the function _ParseBegin(GodotObject) will be called, allowing to place custom controls at the beginning of the class.
Subsequently, the _ParseCategory(GodotObject, string) and _ParseProperty(GodotObject, Type, string, PropertyHint, string, PropertyUsageFlags, bool) are called for every category and property. They offer the ability to add custom controls to the inspector too.
Finally, _ParseEnd(GodotObject) will be called.
On each of these calls, the "add" functions can be called.
To use EditorInspectorPlugin, register it using the AddInspectorPlugin(EditorInspectorPlugin) method first.
public class EditorInspectorPlugin : RefCounted, IDisposable
- Inheritance
-
EditorInspectorPlugin
- Implements
- Inherited Members
Constructors
EditorInspectorPlugin()
public EditorInspectorPlugin()
Methods
AddCustomControl(Control)
Adds a custom control, which is not necessarily a property editor.
public void AddCustomControl(Control control)
Parameters
controlControl
AddPropertyEditor(string, Control, bool, 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 addToEnd is true, this newly added editor will be displayed after all the other editors of the property whose addToEnd is false. For example, the editor uses this parameter to add an "Edit Region" button for RegionRect below the regular Rect2 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.
public void AddPropertyEditor(string property, Control editor, bool addToEnd = false, string label = "")
Parameters
AddPropertyEditorForMultipleProperties(string, string[], Control)
Adds an editor that allows modifying multiple properties. The editor control must extend EditorProperty.
public void AddPropertyEditorForMultipleProperties(string label, string[] properties, Control editor)
Parameters
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
methodgodot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signalgodot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
methodgodot_string_nameName of the method to invoke.
argsNativeVariantPtrArgsArguments to use with the invoked method.
retgodot_variantValue returned by the invoked method.
Returns
_CanHandle(GodotObject)
Returns true if this object can be handled by this plugin.
public virtual bool _CanHandle(GodotObject @object)
Parameters
objectGodotObject
Returns
_ParseBegin(GodotObject)
Called to allow adding controls at the beginning of the property list for object.
public virtual void _ParseBegin(GodotObject @object)
Parameters
objectGodotObject
_ParseCategory(GodotObject, string)
Called to allow adding controls at the beginning of a category in the property list for object.
public virtual void _ParseCategory(GodotObject @object, string category)
Parameters
objectGodotObjectcategorystring
_ParseEnd(GodotObject)
Called to allow adding controls at the end of the property list for object.
public virtual void _ParseEnd(GodotObject @object)
Parameters
objectGodotObject
_ParseGroup(GodotObject, string)
Called to allow adding controls at the beginning of a group or a sub-group in the property list for object.
public virtual void _ParseGroup(GodotObject @object, string group)
Parameters
objectGodotObjectgroupstring
_ParseProperty(GodotObject, Type, string, PropertyHint, string, PropertyUsageFlags, bool)
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.
public virtual bool _ParseProperty(GodotObject @object, Variant.Type type, string name, PropertyHint hintType, string hintString, PropertyUsageFlags usageFlags, bool wide)
Parameters
objectGodotObjecttypeVariant.TypenamestringhintTypePropertyHinthintStringstringusageFlagsPropertyUsageFlagswidebool