59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
|
|
using Godot;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
namespace Rokojori.DocGenerator
|
|
{
|
|
public class SomeArrayClass
|
|
{
|
|
public int index = 2;
|
|
public string value = "Hello World";
|
|
}
|
|
|
|
public class SomeClass
|
|
{
|
|
public float x = 0;
|
|
public float GetX()
|
|
{
|
|
return x * 2;
|
|
}
|
|
|
|
public List<SomeArrayClass> values = new List<SomeArrayClass>();
|
|
|
|
}
|
|
|
|
[GlobalClass][Tool]
|
|
public partial class CreateDoc : Node
|
|
{
|
|
[Export]
|
|
public string outputPath ="res://addons/rokojori_action_library/Tools/docs/output";
|
|
|
|
[ExportToolButton( "Create")]
|
|
public Callable createButton => Callable.From( ()=>{ Generate(); } );
|
|
|
|
void Test()
|
|
{
|
|
var obj = new SomeClass();
|
|
var sa = new SomeArrayClass();
|
|
var sb = new SomeArrayClass();
|
|
sb.value = "Huhu";
|
|
obj.values.Add( sa );
|
|
obj.values.Add( sb );
|
|
|
|
var testJSON = JSON.StringifyObject( obj );
|
|
RJLog.Log( testJSON );
|
|
}
|
|
|
|
void Generate()
|
|
{
|
|
var absoluteLibraryPath = ProjectSettings.GlobalizePath( "res://addons/rokojori_action_library/Runtime" );
|
|
var absoluteIconPath = ProjectSettings.GlobalizePath( "res://addons/rokojori_action_library/Icons" );
|
|
var absoluteOutputPath = ProjectSettings.GlobalizePath( outputPath );
|
|
|
|
var generator = new DocGenerator();
|
|
var icons = Lists.Map( FilesSync.GetFiles( absoluteIconPath, ( fp => fp.fileExtension == ".svg" ) ), fp => fp.fullFileName );
|
|
generator.Generate( absoluteLibraryPath, absoluteOutputPath, icons );
|
|
}
|
|
}
|
|
} |