Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tutorials/plugins/editor/inspector_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,22 @@ specifically add :ref:`class_EditorProperty`-based controls.

public partial class MyInspectorPlugin : EditorInspectorPlugin
{
public override bool _CanHandle(Variant @object)
public override bool _CanHandle(GodotObject @object)
{
// We support all objects in this example.
return true;
}

public override bool _ParseProperty(GodotObject @object, int type, string name, int hintType, string hintString, int usageFlags, bool wide)
public override bool _ParseProperty(GodotObject @object, Variant.Type type,
string name, PropertyHint hintType, string hintString,
PropertyUsageFlags usageFlags, bool wide)
Comment on lines +152 to +154
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we usually split long method signature lines in the documentation, but I think it's fine to start doing it. I'm not sure what should be the maximum character length though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries either way - I was asked to break lines that were causing horizontal scroll (in both C# and GDScript) on an earlier PR, so I assumed that was the preferred approach.

The C# style guide suggests 100 characters, but I had to break this at around 90 to avoid scroll.

{
// We handle properties of type integer.
if (type == (int)Variant.Type.Int)
if (type == Variant.Type.Int)
{
// Create an instance of the custom property editor and register
// it to a specific property path.
AddPropertyEditor(path, new RandomIntEditor());
AddPropertyEditor(name, new RandomIntEditor());
// Inform the editor to remove the default property editor for
// this property type.
return true;
Expand Down Expand Up @@ -283,7 +285,7 @@ followed by ``set_bottom_editor()`` to position it below the name.
EmitChanged(GetEditedProperty(), _currentValue);
}

public override void UpdateProperty()
public override void _UpdateProperty()
{
// Read the current value from the property.
var newValue = (int)GetEditedObject().Get(GetEditedProperty());
Expand Down