Hello o/

While making an EditorInspectorPlugin for my various custom classes in Godot, I failed to find how to render an EditorProperty in a way that allows it to take the full width of the inspector instead of being pushed next to the property name (like Godot's Vector3 for example)

I tried tinkering with the control's size, anchors etc. with no success (maybe a specific combination of settings ?). Following one of my other personal addons I decided to try moving nodes around within the inspector (bad idea-) but it didn't go as planned. I thought I might have overlooked the documentation for either _ParseProperty, or AddPropertyEditor but documentation isn't specifically detailed for those.

My next step would be to dive into Godot's source code to check how things work under the hood and get a better grasp at what's happening with the two methods I mentioned, but I thought about asking here in case anyone already delved in this.

Alright, I ended up doing the following :

  • Set the Editor Property's first child as a regular "Control" (no special node)
  • Set our actual editing node (a TextEdit in my example) as a child of that regular control
  • Make sure both controls are initiated with a FullRect preset for anchors and offset
  • Move the Left anchor of the editing node to -1 (this appears to only be allowed through scripting ??)

So that's as follow for my example (here in C# but the same can be done in gdscript):

[Tool]
public partial class MultilineTextPropertyEditor: EditorProperty
{

  private TextEdit editor; // My editing node
  private Control control; // A placeholder control to break the default inspector's VBox container's behavior

  public MultilineTextPropertyEditor()
  {
    editor = new();
    control = new();

    control.CustomMinimumSize = new(0, 150); // Setting a minimum size to allow at least a few lines to display.
    
    AddChild(control);
    control.AddChild(editor);
    AddFocusable(editor);

    control.SetAnchorsAndOffsetsPreset(LayoutPreset.FullRect);
    editor.SetAnchorsAndOffsetsPreset(LayoutPreset.FullRect);

    editor.SetAnchor(Side.Left, -1, false, false);
  }
  
}

This result in the editing node covering the full width of the inspector, but at the same time it covers the property name so if you use this you probably want to draw the property name yourself above your EditorProperty, however this trick is simple enough that it should be applicable to most custom properties you would want to use.