readme
This commit is contained in:
@@ -4,10 +4,9 @@ using System;
|
||||
#if TOOLS
|
||||
namespace BITKit;
|
||||
[Tool]
|
||||
public partial class ReferencePlugins : EditorPlugin
|
||||
public partial class BITGodotPlugins : EditorPlugin
|
||||
{
|
||||
private InspectorPlugins _plugin;
|
||||
private PackedScene _containerTemplate = GD.Load<PackedScene>("res://addons/BITPlugins/ReferenceContainer.tscn");
|
||||
public override void _EnterTree()
|
||||
{
|
||||
_plugin = new InspectorPlugins();
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -4,4 +4,4 @@ name="BITPlugins"
|
||||
description="BITKit为Godot支持的插件 "
|
||||
author="军火商小火柴"
|
||||
version=""
|
||||
script="ReferencePlugins.cs"
|
||||
script="BITGodotPlugins.cs"
|
||||
|
Reference in New Issue
Block a user