Implement Reminder for External Node Types
This commit is contained in:
parent
c3e16cda00
commit
8240e27636
|
@ -0,0 +1,35 @@
|
||||||
|
using Godot;
|
||||||
|
using GodotTools.Internals;
|
||||||
|
|
||||||
|
namespace GodotTools.Inspector;
|
||||||
|
|
||||||
|
public partial class ExternalTypeReminder : HBoxContainer
|
||||||
|
{
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
SetAnchorsPreset(LayoutPreset.TopWide);
|
||||||
|
|
||||||
|
var iconTexture = GetThemeIcon("NodeInfo", "EditorIcons");
|
||||||
|
|
||||||
|
var icon = new TextureRect()
|
||||||
|
{
|
||||||
|
Texture = iconTexture,
|
||||||
|
ExpandMode = TextureRect.ExpandModeEnum.FitWidthProportional,
|
||||||
|
CustomMinimumSize = iconTexture.GetSize(),
|
||||||
|
};
|
||||||
|
|
||||||
|
icon.SizeFlagsVertical = SizeFlags.ShrinkCenter;
|
||||||
|
|
||||||
|
var label = new Label()
|
||||||
|
{
|
||||||
|
Text = "This inspector inherits an external type. Please build the C# project when the external type changes.".TTR(),
|
||||||
|
AutowrapMode = TextServer.AutowrapMode.WordSmart,
|
||||||
|
CustomMinimumSize = new Vector2(100f, 0f),
|
||||||
|
};
|
||||||
|
|
||||||
|
label.SizeFlagsHorizontal = SizeFlags.Fill | SizeFlags.Expand;
|
||||||
|
|
||||||
|
AddChild(icon);
|
||||||
|
AddChild(label);
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,9 +31,9 @@ namespace GodotTools.Inspector
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(scriptPath))
|
if (string.IsNullOrEmpty(scriptPath))
|
||||||
{
|
{
|
||||||
// Generic types used empty paths in older versions of Godot
|
// Types from an external source (PackageReference or ProjectReference)
|
||||||
// so we assume your project is out of sync.
|
// uses empty paths, in such case we do not show out of sync warning.
|
||||||
AddCustomControl(new InspectorOutOfSyncWarning());
|
AddCustomControl(new ExternalTypeReminder());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,6 @@ namespace Godot.Bridge
|
||||||
// not a global class. But if the script is not a global class it must return an empty
|
// not a global class. But if the script is not a global class it must return an empty
|
||||||
// outClassName string since it should not have a name.
|
// outClassName string since it should not have a name.
|
||||||
string scriptPathStr = Marshaling.ConvertStringToManaged(*scriptPath);
|
string scriptPathStr = Marshaling.ConvertStringToManaged(*scriptPath);
|
||||||
Debug.Assert(!string.IsNullOrEmpty(scriptPathStr), "Script path can't be empty.");
|
|
||||||
|
|
||||||
if (!_pathTypeBiMap.TryGetScriptType(scriptPathStr, out Type? scriptType))
|
if (!_pathTypeBiMap.TryGetScriptType(scriptPathStr, out Type? scriptType))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue