rj-action-library/Runtime/Testing/CheckWarnings.cs

55 lines
979 B
C#
Raw Normal View History

2025-06-19 17:22:25 +00:00
using Godot;
using System.Collections.Generic;
using System;
using System.Threading.Tasks;
using System.Reflection;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class CheckWarnings:DebugAction
{
protected new const string name = "Check Warnings";
[Export]
public Node[] roots = [];
int _numProcessed = 0;
protected override void _OnTrigger()
{
ClearMessages();
_numProcessed = 0;
var id = DispatchStart();
roots.ForEach(
( r )=>
{
2025-06-23 11:16:01 +00:00
Nodes.ForEach<Node>( r, n => CheckWarningsOf( n ) );
2025-06-19 17:22:25 +00:00
}
);
UpdateStatus( "Processed: " + _numProcessed );
FinishMessages();
DispatchEnd( id );
}
void CheckWarningsOf( Node n )
{
var warnings = n._GetConfigurationWarnings();
if ( warnings != null && warnings.Length > 0 )
{
Warning( n, "Has " + warnings.Length + " warnings");
}
_numProcessed ++;
}
}
}