readme
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BITKit;
|
||||
#if TOOLS
|
||||
@@ -20,13 +21,18 @@ public partial class InspectorPlugins : EditorInspectorPlugin
|
||||
string hintString,
|
||||
PropertyUsageFlags usageFlags, bool wide)
|
||||
{
|
||||
// We handle properties of type integer.
|
||||
if (type != Variant.Type.Int) return false;
|
||||
// Create an instance of the custom property editor and register
|
||||
// it to a specific property path.
|
||||
AddPropertyEditor(name, new RandomIntEditor());
|
||||
// Inform the editor to remove the default property editor for
|
||||
// this property type.
|
||||
switch (type)
|
||||
{
|
||||
case Variant.Type.String:
|
||||
var field = @object.GetType().GetField(name);
|
||||
var att = field?.GetCustomAttribute<ReadOnlyAttribute>();
|
||||
if (att is null) return false;
|
||||
var label = new Label();
|
||||
AddPropertyEditor(name, label);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user