Skip to content

febucci-team/godotpackage-editor-utils

Repository files navigation

Editor Utils - Godot Addon

When using Godot (4+), in order to create custom editors (inspectors, property drawers and more), you need to write a new EditorPlugin that handles all of them (or one each), which can be slow and repetitive especially if you manage or create multiple projects.

This package makes it easier to create custom inspectors, drawers and more, by just inheriting from specific classes (inspired from the [CustomEditorOfType(typeof(TClass))] workflow of Unity).


Example Usage

Custom Inspectors

To create a custom inspector, simply have a class in your code inherit from "Febucci.EditorUtils.CustomInspectorBase<TObject>", where TObject is the class you'd like to apply the inspector to.

// example script
[Tool] // required for now
public partial class YourScript : Node { }
    
// you only need this to have a custom inspector on "YourScript" node
#if TOOLS
public partial class YourScriptDrawer : CustomInspectorBase<YourScript>
{
    public override bool _ParseProperty(GodotObject @object, Variant.Type type, string name, PropertyHint hintType, string hintString, PropertyUsageFlags usageFlags, bool wide)
    {
        // do stuff here [...]
        return base._ParseProperty(@object, type, name, hintType, hintString, usageFlags, wide);
    }
}
#endif

Custom Attributes drawer

To create a custom drawer that is applied to attributes (e.g. [ReadOnly]), inherit from "Febucci.EditorUtils.AttributeDrawerBase"

// example attribute
public class ReadOnlyAttribute : Attribute { }

// you only need this
#if TOOLS
public partial class ReadOnlyDrawer : AttributeDrawerBase<ReadOnlyAttribute>
{

    protected override Control GetPropertyEditor(Variant.Type type, string name, PropertyHint hintType, string hintString, PropertyUsageFlags usageFlags, bool wide, object value)
    {
        // create your control node here
        // return ....
    }
}
#endif

& More

...more helpers coming in the future!


How to Install

Requirements

  • This addon requires the 'mono' version of Godot (you need C#)

Install:

  1. Copy the "addons/FebucciEditorUtils" folder in your godot project
  2. Build the project once
  3. Enable the plugin from the "project -> project settings -> plugins" tab.

Support

Created by Febucci Team:

Thanks!

Contribute

If you want to contribute

  1. Fork the project.
  2. Create your own feature branch.
  3. Commit and push your changes to GitHub.
  4. Create a new pull request (with a description that helps us review faster).

More information about contributing here: https://github.com/firstcontributions/first-contributions

About

Editor interface in C# to handle multiple plugin hooks and more, without having to create individual classes for each.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages