New Doc Generation
This commit is contained in:
parent
b8fea8ce40
commit
c3d7848d30
|
@ -81,6 +81,11 @@ namespace Rokojori
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void EnsureCachedProjectPath( string cachePath )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void _DisablePlugin()
|
public override void _DisablePlugin()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
uid://mlwd123bf2ba
|
|
@ -79,6 +79,15 @@ namespace Rokojori
|
||||||
a = temp.a;
|
a = temp.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ClampToLimits()
|
||||||
|
{
|
||||||
|
h = MathX.EnsureValidFloat( h );
|
||||||
|
h = MathX.Repeat( h, 360 );
|
||||||
|
s = MathX.Clamp01( s );
|
||||||
|
l = MathX.Clamp01( l );
|
||||||
|
a = MathX.Clamp01( a );
|
||||||
|
}
|
||||||
|
|
||||||
public static HSLColor FromRGBA( Color c )
|
public static HSLColor FromRGBA( Color c )
|
||||||
{
|
{
|
||||||
float h = 0;
|
float h = 0;
|
||||||
|
@ -101,7 +110,8 @@ namespace Rokojori
|
||||||
{
|
{
|
||||||
float delta = cmax - cmin;
|
float delta = cmax - cmin;
|
||||||
|
|
||||||
s = ( l <= .5f ) ? ( delta / ( cmax + cmin ) ) : ( delta / ( 2f - ( cmax + cmin ) ) );
|
s = ( l <= 0.5f ) ? ( delta / ( cmax + cmin ) ) :
|
||||||
|
( delta / ( 2f - ( cmax + cmin ) ) );
|
||||||
|
|
||||||
h = 0;
|
h = 0;
|
||||||
|
|
||||||
|
@ -146,7 +156,12 @@ namespace Rokojori
|
||||||
|
|
||||||
public static float BlendHueInRGB( HSLColor x, HSLColor y, float weight )
|
public static float BlendHueInRGB( HSLColor x, HSLColor y, float weight )
|
||||||
{
|
{
|
||||||
return HSLColor.FromRGBA( ColorX.Lerp( x.ToRGBA(), y.ToRGBA(), weight ) ).h;
|
var rgbLerped = ColorX.Lerp( x.ToRGBA(), y.ToRGBA(), weight );
|
||||||
|
rgbLerped = rgbLerped.Clamp();
|
||||||
|
|
||||||
|
var hsl = HSLColor.FromRGBA( rgbLerped );
|
||||||
|
|
||||||
|
return MathX.EnsureValidFloat( hsl.h );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HSLColor LerpWithHueInRGB( HSLColor x, HSLColor y, Vector4 v )
|
public static HSLColor LerpWithHueInRGB( HSLColor x, HSLColor y, Vector4 v )
|
||||||
|
@ -172,15 +187,17 @@ namespace Rokojori
|
||||||
|
|
||||||
public Color ToRGBA()
|
public Color ToRGBA()
|
||||||
{
|
{
|
||||||
float r, g, b, a;
|
var r = 0f;
|
||||||
a = this.a;
|
var g = 0f;
|
||||||
|
var b = 0f;
|
||||||
|
|
||||||
float m1, m2;
|
var m1 = 0f;
|
||||||
|
var m2 = 0f;
|
||||||
|
|
||||||
m2 = ( l <= .5f ) ? ( l * ( 1f + s ) ) : ( l + s - l * s );
|
m2 = ( l <= 0.5f ) ? ( l * ( 1f + s ) ) : ( l + s - l * s );
|
||||||
m1 = 2f * l - m2;
|
m1 = 2f * l - m2;
|
||||||
|
|
||||||
if ( s == 0f )
|
if ( s <= 0f )
|
||||||
{
|
{
|
||||||
r = g = b = l;
|
r = g = b = l;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +213,6 @@ namespace Rokojori
|
||||||
|
|
||||||
static float Value( float n1, float n2, float hue )
|
static float Value( float n1, float n2, float hue )
|
||||||
{
|
{
|
||||||
|
|
||||||
hue = MathX.Repeat( hue, 360f );
|
hue = MathX.Repeat( hue, 360f );
|
||||||
|
|
||||||
if ( hue < 60f )
|
if ( hue < 60f )
|
||||||
|
|
|
@ -218,8 +218,28 @@ namespace Rokojori
|
||||||
return a - Mathf.Floor( a / n ) * n;
|
return a - Mathf.Floor( a / n ) * n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float Clamp01( float value )
|
public static bool IsInvalidFloat( float value )
|
||||||
{
|
{
|
||||||
|
return float.IsNaN( value ) || float.IsInfinity( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float EnsureValidFloat( float value, float invalidValue = 0f )
|
||||||
|
{
|
||||||
|
if ( float.IsNaN( value ) || float.IsInfinity( value ) )
|
||||||
|
{
|
||||||
|
return invalidValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float Clamp01( float value, float invalidValue = 0f )
|
||||||
|
{
|
||||||
|
if ( float.IsNaN( value ) || float.IsInfinity( value ) )
|
||||||
|
{
|
||||||
|
return invalidValue;
|
||||||
|
}
|
||||||
|
|
||||||
return Mathf.Clamp( value, 0, 1 );
|
return Mathf.Clamp( value, 0, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Rokojori.Tools;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Rokojori
|
namespace Rokojori
|
||||||
{
|
{
|
||||||
|
[Tool]
|
||||||
|
[GlobalClass]
|
||||||
public partial class NetworkNode : Node, INetworkNode
|
public partial class NetworkNode : Node, INetworkNode
|
||||||
{
|
{
|
||||||
[ExportGroup("Network Settings")]
|
[ExportGroup("Network Settings")]
|
||||||
|
@ -20,6 +21,19 @@ namespace Rokojori
|
||||||
protected List<NetworkNodeMember> _networkNodeMembers = null;
|
protected List<NetworkNodeMember> _networkNodeMembers = null;
|
||||||
protected NetworkNodeSlot _networkNodeSlot = new NetworkNodeSlot();
|
protected NetworkNodeSlot _networkNodeSlot = new NetworkNodeSlot();
|
||||||
|
|
||||||
|
#if TOOLS
|
||||||
|
|
||||||
|
[ExportGroup("Help")]
|
||||||
|
[ExportToolButton( "Open Online Docs")]
|
||||||
|
public Callable openOnlineDocsButton => Callable.From(
|
||||||
|
()=>
|
||||||
|
{
|
||||||
|
OnlineDocs.Open( GetType() );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
public virtual List<NetworkNodeMember> GetNetworkNodeMembers()
|
public virtual List<NetworkNodeMember> GetNetworkNodeMembers()
|
||||||
{
|
{
|
||||||
if ( _networkNodeMembers != null )
|
if ( _networkNodeMembers != null )
|
||||||
|
|
|
@ -30,9 +30,19 @@ namespace Rokojori
|
||||||
[Export(PropertyHint.Range, "-100,100 suffix:%")]
|
[Export(PropertyHint.Range, "-100,100 suffix:%")]
|
||||||
public float gamma = 0;
|
public float gamma = 0;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Gradient gradient;
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "0,100 suffix:%")]
|
||||||
|
public float gradientStrength = 50f;
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "-1,1")]
|
||||||
|
public float gradientLumaType = 0f;
|
||||||
|
|
||||||
protected override Color _Modify( Color sourceColor )
|
protected override Color _Modify( Color sourceColor )
|
||||||
{
|
{
|
||||||
var hslColor = HSLColor.FromRGBA( sourceColor );
|
var hslColor = HSLColor.FromRGBA( sourceColor );
|
||||||
|
var luminance = hslColor.l;
|
||||||
|
|
||||||
hslColor.h = MathX.Repeat( hslColor.h + hue, 360 );
|
hslColor.h = MathX.Repeat( hslColor.h + hue, 360 );
|
||||||
hslColor.s = MathX.Clamp01( hslColor.s + saturation/100f );
|
hslColor.s = MathX.Clamp01( hslColor.s + saturation/100f );
|
||||||
|
@ -50,8 +60,33 @@ namespace Rokojori
|
||||||
hslColor.l = ( hslColor.l - 0.5f ) * Mathf.Pow( 2, contrast/100f ) + 0.5f;
|
hslColor.l = ( hslColor.l - 0.5f ) * Mathf.Pow( 2, contrast/100f ) + 0.5f;
|
||||||
hslColor.l = MathX.Clamp01( hslColor.l + brightness/100f );
|
hslColor.l = MathX.Clamp01( hslColor.l + brightness/100f );
|
||||||
|
|
||||||
|
hslColor.ClampToLimits();
|
||||||
var rgb = hslColor.ToRGBA();
|
var rgb = hslColor.ToRGBA();
|
||||||
|
|
||||||
rgb = rgb.Gamma( Mathf.Pow( 2.2f, gamma/100f ) );
|
rgb = rgb.Gamma( Mathf.Pow( 2.2f, gamma/100f ) );
|
||||||
|
rgb = rgb.Clamp();
|
||||||
|
|
||||||
|
|
||||||
|
if ( gradient != null )
|
||||||
|
{
|
||||||
|
var hsl2 = HSLColor.FromRGBA( rgb );
|
||||||
|
var currentLuminance = hsl2.l;
|
||||||
|
|
||||||
|
var lumaLookUp = Mathf.Lerp( currentLuminance, luminance, gradientLumaType * 0.5f + 0.5f );
|
||||||
|
var sampledGradient = gradient.Sample( lumaLookUp );
|
||||||
|
var gradientColorHSL = HSLColor.FromRGBA( sampledGradient );
|
||||||
|
|
||||||
|
var weigths = new Vector4( 1f * gradientColorHSL.s, 0.2f, 0.1f, 1f ) ;
|
||||||
|
weigths = weigths * ( gradientStrength / 100f ) * sampledGradient.A;
|
||||||
|
// weigths.W = 1f;
|
||||||
|
|
||||||
|
var combined = HSLColor.LerpWithHueInRGB( hsl2, gradientColorHSL, weigths );
|
||||||
|
|
||||||
|
combined.ClampToLimits();
|
||||||
|
|
||||||
|
rgb = combined.ToRGBA();
|
||||||
|
rgb = rgb.Clamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return rgb;
|
return rgb;
|
||||||
|
|
|
@ -15,8 +15,16 @@ namespace Rokojori
|
||||||
[Export(PropertyHint.Range, "0,100 suffix:%")]
|
[Export(PropertyHint.Range, "0,100 suffix:%")]
|
||||||
public float amount = 100;
|
public float amount = 100;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public bool enabled = true;
|
||||||
|
|
||||||
public Color Apply( Color color )
|
public Color Apply( Color color )
|
||||||
{
|
{
|
||||||
|
if ( ! enabled )
|
||||||
|
{
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
var modified = _Modify( color );
|
var modified = _Modify( color );
|
||||||
|
|
||||||
return ColorX.Lerp( color, modified, amount / 100f );
|
return ColorX.Lerp( color, modified, amount / 100f );
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cxrrn0fyf3k2d
|
|
@ -0,0 +1 @@
|
||||||
|
uid://clb5lj3q5t5yu
|
|
@ -14,10 +14,6 @@ altHold = 2
|
||||||
shiftHold = 2
|
shiftHold = 2
|
||||||
modifiersMode = 0
|
modifiersMode = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_75e6s"]
|
[sub_resource type="Resource" id="Resource_75e6s"]
|
||||||
script = ExtResource("1_ikub8")
|
script = ExtResource("1_ikub8")
|
||||||
|
@ -27,29 +23,17 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_gmj7t"]
|
[sub_resource type="Resource" id="Resource_gmj7t"]
|
||||||
script = ExtResource("3_1wc0w")
|
script = ExtResource("3_1wc0w")
|
||||||
axis = 1
|
axis = 1
|
||||||
type = 0
|
type = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_687xx"]
|
[sub_resource type="Resource" id="Resource_687xx"]
|
||||||
script = ExtResource("4_wj7li")
|
script = ExtResource("4_wj7li")
|
||||||
button = 12
|
button = 12
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_unhue"]
|
[sub_resource type="Resource" id="Resource_unhue"]
|
||||||
script = ExtResource("1_ikub8")
|
script = ExtResource("1_ikub8")
|
||||||
|
@ -59,10 +43,6 @@ numVisible = 1
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_ikub8")
|
script = ExtResource("1_ikub8")
|
||||||
|
@ -72,7 +52,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -13,10 +13,6 @@ altHold = 2
|
||||||
shiftHold = 2
|
shiftHold = 2
|
||||||
modifiersMode = 0
|
modifiersMode = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_jvxvp"]
|
[sub_resource type="Resource" id="Resource_jvxvp"]
|
||||||
script = ExtResource("1_e8w3r")
|
script = ExtResource("1_e8w3r")
|
||||||
|
@ -26,19 +22,11 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_3ovg5"]
|
[sub_resource type="Resource" id="Resource_3ovg5"]
|
||||||
script = ExtResource("3_pyik4")
|
script = ExtResource("3_pyik4")
|
||||||
button = 10
|
button = 10
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_yhdev"]
|
[sub_resource type="Resource" id="Resource_yhdev"]
|
||||||
script = ExtResource("1_e8w3r")
|
script = ExtResource("1_e8w3r")
|
||||||
|
@ -48,10 +36,6 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_e8w3r")
|
script = ExtResource("1_e8w3r")
|
||||||
|
@ -61,7 +45,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -14,10 +14,6 @@ altHold = 2
|
||||||
shiftHold = 2
|
shiftHold = 2
|
||||||
modifiersMode = 0
|
modifiersMode = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_nj1ud"]
|
[sub_resource type="Resource" id="Resource_nj1ud"]
|
||||||
script = ExtResource("1_r4ul7")
|
script = ExtResource("1_r4ul7")
|
||||||
|
@ -27,29 +23,17 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_mxixb"]
|
[sub_resource type="Resource" id="Resource_mxixb"]
|
||||||
script = ExtResource("3_nh2m3")
|
script = ExtResource("3_nh2m3")
|
||||||
axis = 1
|
axis = 1
|
||||||
type = 1
|
type = 1
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_c1vyq"]
|
[sub_resource type="Resource" id="Resource_c1vyq"]
|
||||||
script = ExtResource("3_dyhbp")
|
script = ExtResource("3_dyhbp")
|
||||||
button = 11
|
button = 11
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_vhtjx"]
|
[sub_resource type="Resource" id="Resource_vhtjx"]
|
||||||
script = ExtResource("1_r4ul7")
|
script = ExtResource("1_r4ul7")
|
||||||
|
@ -59,10 +43,6 @@ numVisible = 1
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_r4ul7")
|
script = ExtResource("1_r4ul7")
|
||||||
|
@ -72,7 +52,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -14,10 +14,6 @@ altHold = 2
|
||||||
shiftHold = 2
|
shiftHold = 2
|
||||||
modifiersMode = 0
|
modifiersMode = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_qts7v"]
|
[sub_resource type="Resource" id="Resource_qts7v"]
|
||||||
script = ExtResource("1_w0cyl")
|
script = ExtResource("1_w0cyl")
|
||||||
|
@ -27,29 +23,17 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_gmj7t"]
|
[sub_resource type="Resource" id="Resource_gmj7t"]
|
||||||
script = ExtResource("3_ushvr")
|
script = ExtResource("3_ushvr")
|
||||||
axis = 0
|
axis = 0
|
||||||
type = 1
|
type = 1
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_687xx"]
|
[sub_resource type="Resource" id="Resource_687xx"]
|
||||||
script = ExtResource("4_53tr6")
|
script = ExtResource("4_53tr6")
|
||||||
button = 13
|
button = 13
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_0hx40"]
|
[sub_resource type="Resource" id="Resource_0hx40"]
|
||||||
script = ExtResource("1_w0cyl")
|
script = ExtResource("1_w0cyl")
|
||||||
|
@ -59,10 +43,6 @@ numVisible = 1
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_w0cyl")
|
script = ExtResource("1_w0cyl")
|
||||||
|
@ -72,7 +52,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -14,10 +14,6 @@ altHold = 2
|
||||||
shiftHold = 2
|
shiftHold = 2
|
||||||
modifiersMode = 0
|
modifiersMode = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_d1suo"]
|
[sub_resource type="Resource" id="Resource_d1suo"]
|
||||||
script = ExtResource("1_vdwin")
|
script = ExtResource("1_vdwin")
|
||||||
|
@ -27,29 +23,17 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_c7ebh"]
|
[sub_resource type="Resource" id="Resource_c7ebh"]
|
||||||
script = ExtResource("3_4antj")
|
script = ExtResource("3_4antj")
|
||||||
axis = 0
|
axis = 0
|
||||||
type = 0
|
type = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_md70b"]
|
[sub_resource type="Resource" id="Resource_md70b"]
|
||||||
script = ExtResource("4_ucs5r")
|
script = ExtResource("4_ucs5r")
|
||||||
button = 14
|
button = 14
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_fhaor"]
|
[sub_resource type="Resource" id="Resource_fhaor"]
|
||||||
script = ExtResource("1_vdwin")
|
script = ExtResource("1_vdwin")
|
||||||
|
@ -59,10 +43,6 @@ numVisible = 1
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_vdwin")
|
script = ExtResource("1_vdwin")
|
||||||
|
@ -72,7 +52,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -13,10 +13,6 @@ altHold = 2
|
||||||
shiftHold = 2
|
shiftHold = 2
|
||||||
modifiersMode = 0
|
modifiersMode = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_pqldp"]
|
[sub_resource type="Resource" id="Resource_pqldp"]
|
||||||
script = ExtResource("1_5263n")
|
script = ExtResource("1_5263n")
|
||||||
|
@ -26,19 +22,11 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_ivi7v"]
|
[sub_resource type="Resource" id="Resource_ivi7v"]
|
||||||
script = ExtResource("3_ejsq1")
|
script = ExtResource("3_ejsq1")
|
||||||
button = 9
|
button = 9
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_0uxqa"]
|
[sub_resource type="Resource" id="Resource_0uxqa"]
|
||||||
script = ExtResource("1_5263n")
|
script = ExtResource("1_5263n")
|
||||||
|
@ -48,10 +36,6 @@ numVisible = 1
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_5263n")
|
script = ExtResource("1_5263n")
|
||||||
|
@ -61,7 +45,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -9,10 +9,6 @@ script = ExtResource("3_5t03r")
|
||||||
axis = 5
|
axis = 5
|
||||||
type = 0
|
type = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_lnrk8")
|
script = ExtResource("1_lnrk8")
|
||||||
|
@ -22,7 +18,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -9,10 +9,6 @@ script = ExtResource("3_pu70j")
|
||||||
axis = 4
|
axis = 4
|
||||||
type = 0
|
type = 0
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_w21si")
|
script = ExtResource("1_w21si")
|
||||||
|
@ -22,7 +18,3 @@ numVisible = 0
|
||||||
inputIcons = []
|
inputIcons = []
|
||||||
useInputIconsFromSensors = true
|
useInputIconsFromSensors = true
|
||||||
continous = false
|
continous = false
|
||||||
_value = 0.0
|
|
||||||
_wasActive = false
|
|
||||||
_active = false
|
|
||||||
_activeTreshold = 0.5
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bhs6rkhfbopbc
|
|
@ -0,0 +1 @@
|
||||||
|
uid://6qukkvril5b8
|
|
@ -0,0 +1,185 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
using Rokojori;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Rokojori.DocGenerator
|
||||||
|
{
|
||||||
|
public class ClassDocGenerator
|
||||||
|
{
|
||||||
|
ClassDocInfo info = new ClassDocInfo();
|
||||||
|
|
||||||
|
public string GetIcon( string classFile, string name, List<string> baseTypes, List<string> icons )
|
||||||
|
{
|
||||||
|
var iconMatcher = new Regex( "Icon\\(\"res://addons/rokojori_action_library/Icons/(\\w+\\.svg)" );
|
||||||
|
|
||||||
|
var result = iconMatcher.Matches( classFile );
|
||||||
|
|
||||||
|
if ( result != null && result.Count == 1 )
|
||||||
|
{
|
||||||
|
return result[ 0 ].Groups[ 1 ].Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( icons.IndexOf( name + ".svg" ) != -1 )
|
||||||
|
{
|
||||||
|
return name + ".svg";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( var bt in baseTypes )
|
||||||
|
{
|
||||||
|
if ( icons.IndexOf( bt + ".svg" ) != -1 )
|
||||||
|
{
|
||||||
|
return bt + ".svg";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "CSharp.svg";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassDocInfo Create( string filePath, Type type, List<string> icons )
|
||||||
|
{
|
||||||
|
var data = filePath == null ? "" : FilesSync.LoadUTF8( filePath );
|
||||||
|
var comments = new DocComments();
|
||||||
|
comments.Grab( data );
|
||||||
|
|
||||||
|
RJLog.Log( type.Name, "Comments:", comments.entries.Count );
|
||||||
|
|
||||||
|
info.name = type.Name;
|
||||||
|
info.csNameSpace = type.Namespace;
|
||||||
|
|
||||||
|
info.doc = comments.FindDoc( "class", type.Name );
|
||||||
|
|
||||||
|
info.generics = Lists.Map( type.GenericTypeArguments, t => t + "" );
|
||||||
|
|
||||||
|
var allBindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
|
||||||
|
var fields = Lists.ToList( type.GetFields( allBindings ) );
|
||||||
|
fields = Lists.Filter( fields, f => ! f.IsPrivate );
|
||||||
|
|
||||||
|
var godotTypes = new List<string>()
|
||||||
|
{
|
||||||
|
"Node", "Resource"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var it = type.BaseType;
|
||||||
|
|
||||||
|
while ( it != null )
|
||||||
|
{
|
||||||
|
if ( godotTypes.IndexOf( it.Name) != -1 )
|
||||||
|
{
|
||||||
|
if ( "Node" == it.Name )
|
||||||
|
{
|
||||||
|
info.extendingClasses.AddRange( new string[]{ "Node", "Object" } );
|
||||||
|
}
|
||||||
|
else if ( "Resource" == it.Name )
|
||||||
|
{
|
||||||
|
info.extendingClasses.AddRange( new string[]{ "Resource", "RefCounted", "Object" } );
|
||||||
|
}
|
||||||
|
|
||||||
|
it = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info.extendingClasses.Add( it.Name );
|
||||||
|
it = it.BaseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
info.icon = GetIcon( data, info.name, info.extendingClasses, icons );
|
||||||
|
|
||||||
|
fields.ForEach(
|
||||||
|
( f )=>
|
||||||
|
{
|
||||||
|
var memberInfo = MemberInfo.CreateField();
|
||||||
|
|
||||||
|
memberInfo.name = f.Name;
|
||||||
|
memberInfo.csNameSpace = f.FieldType.Namespace;
|
||||||
|
memberInfo.dataType = f.FieldType.Name;
|
||||||
|
memberInfo.generics = Lists.Map( f.FieldType.GetGenericArguments(), t => t + "" );
|
||||||
|
memberInfo.doc = comments.FindDoc( "field", f.Name );
|
||||||
|
|
||||||
|
if ( f.IsStatic )
|
||||||
|
{
|
||||||
|
memberInfo.modifiers.Add( "static" );
|
||||||
|
}
|
||||||
|
|
||||||
|
memberInfo.modifiers.Add( f.IsPublic ? "public" : "protected" );
|
||||||
|
|
||||||
|
info.memberInfos.Add( memberInfo );
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
var methods = Lists.ToList( type.GetMethods( allBindings ) );
|
||||||
|
methods = Lists.Filter( methods, m => ! m.IsPrivate );
|
||||||
|
|
||||||
|
var godotInternalMethods = new List<string>()
|
||||||
|
{
|
||||||
|
"GetGodotMethodList",
|
||||||
|
"InvokeGodotClassMethod",
|
||||||
|
"HasGodotClassMethod",
|
||||||
|
"SetGodotClassPropertyValue",
|
||||||
|
"GetGodotClassPropertyValue",
|
||||||
|
"GetGodotPropertyList",
|
||||||
|
"GetGodotPropertyDefaultValues",
|
||||||
|
"SaveGodotObjectData",
|
||||||
|
"RestoreGodotObjectData"
|
||||||
|
};
|
||||||
|
|
||||||
|
methods.ForEach(
|
||||||
|
m =>
|
||||||
|
{
|
||||||
|
if ( godotInternalMethods.IndexOf( m.Name ) != -1 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var memberInfo = MemberInfo.CreateMethod();
|
||||||
|
|
||||||
|
memberInfo.name = m.Name;
|
||||||
|
memberInfo.dataType = m.ReturnType.Name;
|
||||||
|
memberInfo.csNameSpace = m.ReturnType.Namespace;
|
||||||
|
memberInfo.generics = Lists.Map( m.GetGenericArguments(), t => t + "" );
|
||||||
|
memberInfo.doc = comments.FindDoc( "method", m.Name );
|
||||||
|
|
||||||
|
if ( m.IsStatic )
|
||||||
|
{
|
||||||
|
memberInfo.modifiers.Add( "static" );
|
||||||
|
}
|
||||||
|
|
||||||
|
memberInfo.modifiers.Add( m.IsPublic ? "public" : "protected" );
|
||||||
|
|
||||||
|
var parameters = Lists.ToList( m.GetParameters() );
|
||||||
|
parameters.ForEach(
|
||||||
|
( p )=>
|
||||||
|
{
|
||||||
|
var parameterType = new ParameterType();
|
||||||
|
parameterType.name = p.Name;
|
||||||
|
parameterType.type = p.ParameterType.Name;
|
||||||
|
parameterType.csNameSpace = p.ParameterType.Namespace;
|
||||||
|
parameterType.generics = Lists.Map( p.ParameterType.GenericTypeArguments, t => t + "" );
|
||||||
|
|
||||||
|
memberInfo.parameters.Add( parameterType );
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
info.memberInfos.Add( memberInfo );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Rokojori.DocGenerator
|
||||||
|
{
|
||||||
|
public class ParameterType
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public string type;
|
||||||
|
public string csNameSpace;
|
||||||
|
public List<string> generics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MemberInfo
|
||||||
|
{
|
||||||
|
public string doc;
|
||||||
|
public string memberType;
|
||||||
|
public string name;
|
||||||
|
public string dataType;
|
||||||
|
public string csNameSpace;
|
||||||
|
|
||||||
|
public List<string> modifiers = new List<string>();
|
||||||
|
public List<string> generics;
|
||||||
|
public List<ParameterType> parameters = new List<ParameterType>();
|
||||||
|
|
||||||
|
public static readonly string Field = "Field";
|
||||||
|
public static readonly string Method = "Method";
|
||||||
|
|
||||||
|
public static MemberInfo Create( string memberType )
|
||||||
|
{
|
||||||
|
var m = new MemberInfo();
|
||||||
|
m.memberType = memberType;
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MemberInfo CreateField()
|
||||||
|
{
|
||||||
|
return MemberInfo.Create( MemberInfo.Field );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MemberInfo CreateMethod()
|
||||||
|
{
|
||||||
|
return MemberInfo.Create( MemberInfo.Method );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClassDocInfo
|
||||||
|
{
|
||||||
|
public string csNameSpace = "";
|
||||||
|
public string name ="";
|
||||||
|
public string doc;
|
||||||
|
public string icon;
|
||||||
|
public List<string> generics = new List<string>();
|
||||||
|
public List<string> extendingClasses = new List<string>();
|
||||||
|
public List<MemberInfo> memberInfos = new List<MemberInfo>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bx30sgaoxsav5
|
|
@ -0,0 +1,86 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Rokojori.DocGenerator
|
||||||
|
{
|
||||||
|
public class DocCommentEntry
|
||||||
|
{
|
||||||
|
public string type;
|
||||||
|
public string name;
|
||||||
|
public string doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DocComments
|
||||||
|
{
|
||||||
|
public Regex commentStartOld = new Regex( "\\/\\*\\*\\s*<\\s*summary\\s+for\\s*=\\s*\"\\s*(\\w+)\\s+(\\w+)\\s*\"" );
|
||||||
|
public Regex commentStart =
|
||||||
|
|
||||||
|
RegexBuilder.Create()
|
||||||
|
[ "/**" ]._[ "<" ]._[ "summary" ].__[ "for" ]._[ "=" ]._[ "\"" ]._.Word.__.Word._[ "\"" ]
|
||||||
|
.ToRegex();
|
||||||
|
|
||||||
|
|
||||||
|
public string classInfo = "class";
|
||||||
|
public string fieldInfo = "field";
|
||||||
|
public string methodInfo = "method";
|
||||||
|
public List<DocCommentEntry> entries = new List<DocCommentEntry>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void Grab( string data )
|
||||||
|
{
|
||||||
|
var lexEvents = CSharpLexer.Lex( data );
|
||||||
|
|
||||||
|
//RJLog.Log( "Num lex events:", lexEvents.Count );
|
||||||
|
lexEvents.ForEach(
|
||||||
|
( le )=>
|
||||||
|
{
|
||||||
|
if ( ! LexerMatcherLibrary.MultiLineCommentMatcher.Matches( le ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = le.match;
|
||||||
|
|
||||||
|
|
||||||
|
if ( ! commentStart.IsMatch( match ) )
|
||||||
|
{
|
||||||
|
Regex isStartPartially = new Regex( "/\\*\\*\\s*<\\s*summary\\s*" );
|
||||||
|
|
||||||
|
//RJLog.Log( "Not doc Comment:", isStartPartially.IsMatch( match ), match );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = commentStart.Matches( match );
|
||||||
|
|
||||||
|
var type = result[ 0 ].Groups[ 1 ].Value;
|
||||||
|
var name = result[ 0 ].Groups[ 2 ].Value;
|
||||||
|
|
||||||
|
var bodyStart = match.IndexOf( ">" ) + 1;
|
||||||
|
var bodyEnd = match.LastIndexOf( "<" );
|
||||||
|
var body = match.Substring( bodyStart, bodyEnd - bodyStart );
|
||||||
|
|
||||||
|
var entry = new DocCommentEntry();
|
||||||
|
entry.name = name;
|
||||||
|
entry.type = type;
|
||||||
|
entry.doc = body;
|
||||||
|
|
||||||
|
entries.Add( entry );
|
||||||
|
|
||||||
|
RJLog.Log( "Doc Comment:", entry.type, entry.name, ">>\n", entry.doc );
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string FindDoc( string type, string name )
|
||||||
|
{
|
||||||
|
var e= entries.Find( e => e.type == type && e.name == name );
|
||||||
|
|
||||||
|
return e == null ? null : e.doc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
using Rokojori;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Rokojori.DocGenerator
|
||||||
|
{
|
||||||
|
public class ClassTypeEntry
|
||||||
|
{
|
||||||
|
public Type type;
|
||||||
|
public string path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DocGenerator
|
||||||
|
{
|
||||||
|
string path = "";
|
||||||
|
string outputPath = "";
|
||||||
|
List<string> icons = new List<string>();
|
||||||
|
|
||||||
|
public List<FilePath> classFiles = new List<FilePath>();
|
||||||
|
public List<ClassTypeEntry> classTypes = new List<ClassTypeEntry>();
|
||||||
|
|
||||||
|
|
||||||
|
public void Generate( string path, string outputPath, List<string> icons )
|
||||||
|
{
|
||||||
|
this.path = path;
|
||||||
|
this.outputPath = outputPath;
|
||||||
|
this.icons = icons;
|
||||||
|
|
||||||
|
GetFiles();
|
||||||
|
CreateTypesFromFiles();
|
||||||
|
IncludeDefaultTypes();
|
||||||
|
GenerateDocsFromTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetFiles()
|
||||||
|
{
|
||||||
|
classFiles = FilesSync.GetFiles( path, f => f.fileExtension == ".cs", true );
|
||||||
|
}
|
||||||
|
|
||||||
|
void IncludeDefaultTypes()
|
||||||
|
{
|
||||||
|
var defaultTypes = new List<Type>()
|
||||||
|
{
|
||||||
|
typeof( NetworkNode ),
|
||||||
|
typeof( Action ),
|
||||||
|
typeof( Sensor ),
|
||||||
|
typeof( Selector )
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultTypes.ForEach(
|
||||||
|
( dt )=>
|
||||||
|
{
|
||||||
|
var entry = new ClassTypeEntry();
|
||||||
|
entry.type = dt;
|
||||||
|
entry.path = null;
|
||||||
|
|
||||||
|
classTypes.Add( entry);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateTypesFromFiles()
|
||||||
|
{
|
||||||
|
var genericType = new EventSlot<int>().GetType();
|
||||||
|
var namespaceLabel = "Rokojori";
|
||||||
|
var assembly = genericType.Assembly;
|
||||||
|
|
||||||
|
classFiles.ForEach(
|
||||||
|
( cf )=>
|
||||||
|
{
|
||||||
|
var name = cf.fileName;
|
||||||
|
var type = ReflectionHelper.GetTypeByName( namespaceLabel + "." + name );
|
||||||
|
|
||||||
|
if ( type == null )
|
||||||
|
{
|
||||||
|
type = ReflectionHelper.GetTypeByNameFromAssembly( name, assembly );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( type != null )
|
||||||
|
{
|
||||||
|
var entry = new ClassTypeEntry();
|
||||||
|
entry.type = type;
|
||||||
|
entry.path = cf.fullPath;
|
||||||
|
|
||||||
|
classTypes.Add( entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenerateDocsFromTypes()
|
||||||
|
{
|
||||||
|
classTypes.ForEach(
|
||||||
|
( c )=>
|
||||||
|
{
|
||||||
|
var cdg = new ClassDocGenerator();
|
||||||
|
var cinfo = cdg.Create( c.path, c.type, icons );
|
||||||
|
|
||||||
|
var outputPath = FilePath.Join( this.outputPath, cinfo.name + ".json" );
|
||||||
|
FilesSync.SaveJSON( outputPath, cinfo );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#if TOOLS
|
||||||
|
using Godot;
|
||||||
|
using Rokojori;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Rokojori.Tools
|
||||||
|
{
|
||||||
|
public class OnlineDocs
|
||||||
|
{
|
||||||
|
static string docsPath = "https://rokojori.com/en/labs/godot/docs/4.3/";
|
||||||
|
public static void Open( System.Type type )
|
||||||
|
{
|
||||||
|
var name = type.Name + "-class";
|
||||||
|
var path = docsPath + name;
|
||||||
|
OS.ShellOpen( path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bb1yh8iwo8vde
|
|
@ -1,7 +1,7 @@
|
||||||
[plugin]
|
[plugin]
|
||||||
|
|
||||||
name="Rokojori Action Library"
|
name="Rokojori Action Library"
|
||||||
description="Rokojori plugin for the library"
|
description="Library for actions, assets and effects"
|
||||||
author="Rokojori"
|
author="Rokojori"
|
||||||
version="1.0"
|
version="0.1"
|
||||||
script="RokojoriPlugin.cs"
|
script="RokojoriPlugin.cs"
|
||||||
|
|
Loading…
Reference in New Issue