From a1ebb28b26714e872208d623fa084d44a7712b57 Mon Sep 17 00:00:00 2001 From: Mark Wilson <23439518+wlsnmrk@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:06:46 -0400 Subject: [PATCH 1/4] Fixed C# EditorInspectorPlugin _CanHandle parameter type Updated Inspector Plugin tutorial to reflect that C#'s EditorInspectorPlugin::_CanHandle() takes a GodotObject, not a Variant. --- tutorials/plugins/editor/inspector_plugins.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/plugins/editor/inspector_plugins.rst b/tutorials/plugins/editor/inspector_plugins.rst index f9515001696..dd6f012de7f 100644 --- a/tutorials/plugins/editor/inspector_plugins.rst +++ b/tutorials/plugins/editor/inspector_plugins.rst @@ -143,7 +143,7 @@ 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; From 1552bc3a40214f241ec4921afefd24ea21fb10e9 Mon Sep 17 00:00:00 2001 From: Mark Wilson <23439518+wlsnmrk@users.noreply.github.com> Date: Tue, 25 Apr 2023 14:10:54 -0400 Subject: [PATCH 2/4] Eliminated horizontal scroll in C# for inspector-plugin tutorial Put a line-break and indentation to avoid horizontal scrolling in the displayed code. --- tutorials/plugins/editor/inspector_plugins.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tutorials/plugins/editor/inspector_plugins.rst b/tutorials/plugins/editor/inspector_plugins.rst index dd6f012de7f..7b89d5eb24b 100644 --- a/tutorials/plugins/editor/inspector_plugins.rst +++ b/tutorials/plugins/editor/inspector_plugins.rst @@ -149,7 +149,8 @@ specifically add :ref:`class_EditorProperty`-based controls. 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, int type, string name, + int hintType, string hintString, int usageFlags, bool wide) { // We handle properties of type integer. if (type == (int)Variant.Type.Int) From 10061a541c175751e883f9c73a4f4d49365c64b4 Mon Sep 17 00:00:00 2001 From: Mark Wilson <23439518+wlsnmrk@users.noreply.github.com> Date: Tue, 25 Apr 2023 15:11:09 -0400 Subject: [PATCH 3/4] Fixed _ParseProperty() method signature and undeclared variable Changed example code for EditorInspectorPlugin::_ParseProperty(): * Fixed method signature * Use new enum type of parameter for comparison instead of int. * Use "name" parameter as property-identifying argument to AddPropertyEditor() instead of undeclared variable --- tutorials/plugins/editor/inspector_plugins.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tutorials/plugins/editor/inspector_plugins.rst b/tutorials/plugins/editor/inspector_plugins.rst index 7b89d5eb24b..4998644e56a 100644 --- a/tutorials/plugins/editor/inspector_plugins.rst +++ b/tutorials/plugins/editor/inspector_plugins.rst @@ -149,15 +149,16 @@ specifically add :ref:`class_EditorProperty`-based controls. 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) { // 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; From 6c92c1777f22758a21fe45b3f799d888e6cd2a90 Mon Sep 17 00:00:00 2001 From: Mark Wilson <23439518+wlsnmrk@users.noreply.github.com> Date: Tue, 25 Apr 2023 15:17:29 -0400 Subject: [PATCH 4/4] Fixed override method name in EditorProperty example Updated example to use virtual method _UpdateProperty() instead of non-virtual method UpdateProperty(). --- tutorials/plugins/editor/inspector_plugins.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/plugins/editor/inspector_plugins.rst b/tutorials/plugins/editor/inspector_plugins.rst index 4998644e56a..bcf4bbc5c37 100644 --- a/tutorials/plugins/editor/inspector_plugins.rst +++ b/tutorials/plugins/editor/inspector_plugins.rst @@ -285,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());